@leecher1337 why not just connect external UART to USB converter and capture the the communication data? That way we will know if it's a TuyaMCU or something
Oh, so this may be a TuayMCU, thanks for the hint!
Sorry for stupid question, but is there a way to tell OpenBK that it has to use RXD1/PWM2 as serial protocol interface ports instead of TXD1/RXD1 to even have a chance that the TuyaMCU driver is working or did I miss something?
thank you for this wonderful project, I appreciate the effort behind this. I thought I'll share my setup on this main thread since I have bunch of devices running on this project. they all run solid, connected to HA and works fine.
attaching some pictures. sorry if I am hijacking this thread.
@ p.kaczmarek2 it looks like the GU10 bulbs available in Poland woj14415 are based on WBLC5 + SM2135Eh - I2C communication. After dismantling, it turned out that the CLK line is connected to pin 26, date to pin24. Would you provide information on how to configure this bulb?
Are you still here?
SM2135 driver will be ready tonight.
leecher1337 wrote:
Sorry for stupid question, but is there a way to tell OpenBK that it has to use RXD1/PWM2 as serial protocol interface ports instead of TXD1/RXD1 to even have a chance that the TuyaMCU driver is working or did I miss something?
It's not possible to change the location of hardware UART ports on Beken chips. Are you sure about that PWM2? Maybe it's not a TuyaMCU after all. Please try to sniff the packets with external USB to UART converter.
AcuarioCat wrote:
Did you ever do a W600 port or did you go straight to W800?
Why? Do you know a device with W600?
I haven't looked into W600 yet, but the W600 dev board is on the way and I will do the port as well.
@brijin this is very useful, would you like to provide us more details, the exact product names (and wwhere to buy them) and ready pinout configurations?
Hi @p.kaczmarek2 , sorry been away for work
Just tested the tasmota group feature, i've added openbk 2 gang wall switch into an existing tasmota group (nightlamp -> 4 lights bulbs, + button 3 from a 3gang switch)
By toggling either tasmota bulbs or switch, it would toggle the openbk switch as well. But toggling openbk switch would not control the other tasmota devices so I'm guessing this is where I should use eventhandler script?
For the evenhandler, how do i enable that in the command line and see the ouput? And how could I get single, double, hold clicks working without toggling the openbk switch relay?
For example, wifi bulb is connected the openbk switch relay 1, so I intend to have the relay 1 always on while using button 1 clicks for custom bulb action.
By the way, Is it also possible to separate switch for the group? similar to devgrouptie
EDIT
Ok, i think i almost got it
I changed button 1 for pin 14 to togglechannel
Then I added this in custom cummond
@p.kaczmarek2 Yes the Smart Home WiFi Smart Switch has a TW-02 module whic has a W600 processor - unless they have updated it since the ones I bought.
I did a 'transplant' to an ESP on one device which works fine but much better to use the native device.
I have a 4 gang touch switch with WB3S and CMS8S5880 MCU connected via Serial pins, any idea if this is TuyaMCU supported? I have flash ver 1.7.1 but not sure how to configure this.
By toggling either tasmota bulbs or switch, it would toggle the openbk switch as well. But toggling openbk switch would not control the other tasmota devices so I'm guessing this is where I should use eventhandler script?
WARNING: you MUST use correct channel indexes. I tested it with two power metering plugs. It will work correctly if you use channel 0 (not 1!) for relay on obk, because it expects channel 0 to be the first channel. Here is my test setup:
The only issue is that I don't have any ESP8266 RGB lights, nor any RGBCW. Can you recommend me where can I buy ESP8266 LED bulb?
Otherwise I will try to implement it blindly, would you be able to test that in this case, @ferbulous ?
One of the things I am unsure of currently, is the DGR protocol of Tasmota supposed to send raw RGB color and dimmer separately, and then I shall do finalColor = dimmer * rawColor, or is the color send by Tasmota DGR already a final value?
Pushed button 1, but doesn't seem to do anything, the web request is correct when I tried it on browser
I am confident that "ToggleChannelOnToggle" is not using Button code at all, thus "OnClick" won't work for that, the same goes for "OnHold" and "OnDblClick".
Would you like me to add a special "OnToggle" callback for this specific purpose?
@AcuarioCat ah ok, I will look into it when the dev board arrives.
@p.kaczmarek2 I believe sonoff B05-BL-A60 still has esp
Thanks for the new update, I tried OnToggle for the addevent handler and it works
Is there a different command for double press or long press with ToggleChannelOnToggle since OnHold & OnDblClick is not using button code?
For tasmota group, it doesn't seem to work for me on 1.7.5, neither tasmota lamp/switch or openbk switch are being controlled even after adding to same group. That and I'm unable to access the webpage or ping after 5-6 minutes for the openbkswitch that I'm testing but the switch still functions normally and listed as connected in the router settings. I'll try flashing openbkt on another device and see if this still persists.
Also, is there a proper step for restoring back to original tuya firmware if I need to?
I backed up the cb3s firmware with bk7231tools, dissected rbl and I'm getting bootloader_1.00.bin & app_1.00.bin. But I'm not sure for the next step
@marioalmeida great, if you have some time, could you make some screenshots of product offer page, gather some information from the product description, make some photos, save the OpenBK config and post everything for each product separately as a "Teardown" on our forum?
Here: https://www.elektroda.com/rtvforum/forum507.html put product name in a title
It would be useful for other users so they can also know how to configure.
ferbulous wrote:
Thanks for the new update, I tried OnToggle for the addevent handler and it works
Is there a different command for double press or long press with ToggleChannelOnToggle since OnHold & OnDblClick is not using button code?
There is no "double press" and no "onDblClick" for ToggleChannelOnToggle. Are you sure you know how ToggleChannelOnToggle works? ToggleChannelOnToggle is for case where you have old switch in the wall and still want to reuse it. Normally, you'd use a Button pin.
ferbulous wrote:
For tasmota group, it doesn't seem to work for me on 1.7.5, neither tasmota lamp/switch or openbk switch are being controlled even after adding to same group.
Please post photos of both device configurations. The "Tasmota lamp" is not enough information for me, do by "a lamp" you mean a relay?
Do your OpenBK device has any PWM pins set in the pins config?
What exactly do you need to synchronize, power states, LED state?
I need to know how different your configuration is.
My config is:
- Tasmota device (power metering plug) with single relay on channel 0
- Obk device (power metering plug) with single relay on channel 0
No extra channels, no PWM pins. Both of them have a button.
Tasmota DGR communication is this case works in both ways.
And also, thanks for feedback in general. It's not possible for me myself to test all possible cases and device combinations.
Also, is your device T or N?
ferbulous wrote:
Also, is there a proper step for restoring back to original tuya firmware if I need to?
I have no idea, I have never tried that.
Dodano po 3 [godziny] 18 [minuty]:
UPDATE: Tasmota device groups bugfix and improvement is on the way, should be up in the next 12 hours. Change 1: fixed rare logical error leading to device reverting to old state
Change 2: added correct LED driver gui (1:1 like in Tasmota) for single color LED strip
Change 3: single color LED strips now are also 100% DGR compatible (automatically, just like the relays)
See:
Now I would also like to do:
- support for WarmWhite/ColdWhite strips and DGR
- support for RGB bulbs and DGR
- support for RGBW and RGBCW bulbs
but I lack items for testing, I will try to order some bulbs here in Poland and maybe I will get something with esp.
There is no "double press" and no "onDblClick" for ToggleChannelOnToggle. Are you sure you know how ToggleChannelOnToggle works? ToggleChannelOnToggle is for case where you have old switch in the wall and still want to reuse it. Normally, you'd use a Button pin.
I see, i thought that's the option to pick if I need to enable to multipress action like on tasmota (decouple relay with s073 and obtain multiple button states)
p.kaczmarek2 wrote:
Please post photos of both device configurations. The "Tasmota lamp" is not enough information for me, do by "a lamp" you mean a relay?
Do your OpenBK device has any PWM pins set in the pins config?
What exactly do you need to synchronize, power states, LED state?
I need to know how different your configuration is.
My config is:
- Tasmota device (power metering plug) with single relay on channel 0
- Obk device (power metering plug) with single relay on channel 0
No extra channels, no PWM pins. Both of them have a button.
Tasmota DGR communication is this case works in both ways.
My devices are:
a) 4 tasmota bulbs
b) 1 tasmota wall switch (3 relays - 1 relay assigned to group (devgrouptie)
c) 1 openbkt wall switch (3 relays) - No PWM set in the pins
Just trying to sychronize power states for now
p.kaczmarek2 wrote:
Also, is your device T or N?
It's N (CB3S)
Some updates, I'm trying openbk on 2 gang switch (N device CB3S)
After a few minutes, same issue with web ui unable to access after a few minutes on 1.7.5 (happened on 3 gang switch)
I reverted back to 1.6.9 (previous firmware for the 2 gang switch) and it's more stable now
UPDATE
After upgrading incrementally from 1.6.9
1.70, 1.7.1 is still stable
1.7.2 onwards the web ui/mqtt becomes unresponsive after a few minutes
Not sure why this is happening, any logs i could post here?
Wait, do you mean that MQTT gets unresponsive after few minutes of using Tasmota Device Groups, or in general?
Are you using that option?
I already had reports that there is an issue with MQTT LWIP library and sending too many requests may crash the device.
Are you using those "broadcast" options as well? How many MQTT broadcast options do you have enabled?
Or to put it differently:
1. Does the crash occur if you don't use DGR but use all MQTT publish options?
2. Does the crash occur if you disable all MQTT publish option flags?
3. Does the crash occur if MQTT is disabled at all?
4. Does the crash occur if MQTT is disabled but DGR enabled?
UPDATE: I am trying to replicate your problem with BK7231N lamp RGBCW device:
Dodano po 3 [godziny] 18 [minuty]:
ferbulous wrote:
. That and I'm unable to access the webpage or ping after 5-6 minutes for the openbkswitch that I'm testing but the switch still functions normally and listed as connected in the router settings.
I think that I just managed to recreate the same issue (with all MQTT broadcast flags enabled) on my RGBCW bulb (thanks to your input) and the issue is now fixed. The device now could only disconnect MQTT, but should not crash/lock itself any more, but more testing is needed.
Please try latest updates and report back here. I will also do more tests as the day comes.
Or to put it differently:
1. Does the crash occur if you don't use DGR but use all MQTT publish options?
2. Does the crash occur if you disable all MQTT publish option flags?
3. Does the crash occur if MQTT is disabled at all?
4. Does the crash occur if MQTT is disabled but DGR enabled?
From what I recall, I did not change anything on MQTT publish option & just using the tasmota group.
As for disabling MQTT, might have to wait for further testing since I accidently bricked my 3 gang switch, I noticed sparks when I turned it on because the neutral cable was loose/not connected
1) Is there a way to auto restore the cmds from autoexec.bat file after firmware upgrade?
2) FYI, 3 of the device I upgrade from 1.7.5 to 1.9.0 and now they are disconnected from network, is the normal?
Added after 2 [hours] 43 [minutes]:
"2) FYI, 3 of the device I upgrade from 1.7.5 to 1.9.0 and now they are disconnected from network, is the normal?"
@p.kaczmarek2 , this is due to my stupidity, I installed BK7231N on BK7231T. Is there a way that this can be validated after we drop the firmware and before OTA starts?
I opened one of them and this is the version with WB2S + BL0937. Different than the described by pkaczmarek2 in one of his fantastic how-to.
Following the instructions in that link, I could flash the WB2S with OpenBK7231T_UA_1.9.0. In this case, I could use bk_writer1.60 but I had to desolder TX1 and RX1 to achieve the connection using my USB TTL 3.3V.
The device boots and I can configure the wifi. With this configuration I have the basic functionality:
The button works, I can enable the relay (web and button) and I get Voltage/Current/Power information (uncalibrated) if I execute the "startDriver BL0937" in the log part of the web app. The blue led is fixed blue and it turns to red when the relay is enabled.
If I add "P6 Rel_n 1" I get the red and blue leds mixed when the relay is on. I would like to use the blue led to inform about wifi activity... but I did not find how.
The problem is that I can not see any information about BL0937 in the logs and I can not enable any checkbox in that screen related to BL0937. I can only see continously this BLXXX messages in the logs section:
"Info:BL0942:Consumed 255 unwanted non-header byte in BL0942 buffer"
If I execute the calibration commands, like "VoltageSet [correntVoltageVal], CurrentSet [correntCurrentVal] i PowerSet [correntPowerVal]" nothing is shown in the screen... and then I can not calibrate.
Probably it is my fault, I am "rookie" with this thigs... Can anybody explain to me how to enable the messages?
In the other hand, if you can include a profile for this LSPA9 WB2S+BL0937, It would be great.
Awesome work on the SM2135 LED driver Very cool project, keep up the good work everyone!
I have two devices with a SM2135. I started off with a LSC GU10 RGBCW from Action store with BK7231T. Upgraded to the latest 1.9.0 version. Nice work on the Tasmota alike GUI btw.
At first everything seemed to work nicely. There is one small issue... the colours are mixed up and HA is acting weird, color picker jumps from red to green for example when I try to set red. Tried to re-order RGB to BRG but that made it even worse...
Color temps on the CW leds works flawless. Brightness is also working.
I messed around with the YAML you posted here for the SM2135 but I can't figure out how to correct the issue.
Does anyone has any idea what's wrong?
The button works, I can enable the relay (web and button) and I get Voltage/Current/Power information (uncalibrated) if I execute the "startDriver BL0937" in the log part of the web app. The blue led is fixed blue and it turns to red when the relay is enabled.
This is OK. I will also add a autostart of BL0937 driver when one has pin specified.
xostia wrote:
If I add "P6 Rel_n 1" I get the red and blue leds mixed when the relay is on. I would like to use the blue led to inform about wifi activity... but I did not find how.
Just set WiFi or WiFi_N role for the LED pin
xostia wrote:
The problem is that I can not see any information about BL0937 in the logs
Logs are disabled, I may add a debug flag to enable them only for testing in the future
xostia wrote:
I can not enable any checkbox in that screen related to BL0937.
Which screen are you referring to? Which checkbox? I have no idea.
xostia wrote:
"Info:BL0942:Consumed 255 unwanted non-header byte in BL0942 buffer"
The message prefix "Info:BL0942" may be ignored, because the logging BL0942 prefix is used for BL0937 as well (I will fix that now), but the "buffer" thing is BL0942-only
Now there are two options....
1. I might have made some kind of bug, I will double check
2. maybe you have "startDriver BL0942" command somewhere, maybe in short startup command or in autoexec.bat?
marioalmeida wrote:
1) Is there a way to auto restore the cmds from autoexec.bat file after firmware upgrade?
There was some kind of button, "save fs block" and "restore fsblock", but it was designed by @btsimonh when he contributed to the project and I am not sure how functional is that.
Still, having a copy of single file on your hard drive is relatively easy... and for short configurations, you always have also "short startup command" which is not cleared during OTA.
marioalmeida wrote:
this is due to my stupidity, I installed BK7231N on BK7231T.
Oh no, I can see how that can be a problem! I will check if it's possible to do some kind of simple prevention against that. Maybe at least compare the file name and if it detects N on T (and vice versa) then block update...
@ferbulous MANY, MANY changes were made yesterday to improve stability, but I will still strongly advice NOT TO use "broadcast mqtt every minute" flag.
Tych0 wrote:
At first everything seemed to work nicely. There is one small issue... the colours are mixed up and HA is acting weird, color picker jumps from red to green for example when I try to set red. Tried to re-order RGB to BRG but that made it even worse...
Color temps on the CW leds works flawless. Brightness is also working.
Is the issue on MQTT/HA communication side, or in the wrong channels used for RGB?
Please disable MQTT totally, make sure that your device is disconnected, and then, on OpenBeken gui, set the color to:
1. set to 100% RED (255 0 0) - is the color red?
2. set to 100% GREEN (0 255 0) - is the color green?
3. set to 100% BLUE (0 0 255) - is the color blue?
Tell me the results and I will provide futher instructions. I might add per-channel role setting to the SM2135 driver if needed.
For me, SM2135 driver works great so it's not possible to debug this issue on my side.
[UPDATE] I went and checked my socket, and well, my LSPA9 BL0937 seems to be working.. 60W bulb test, no calibration yet Some of my sockets, with one of them ESP8266, used for testing Tasmota Device Groups device state synchronization:
one of them is older LSPA9 with WB2S+BL0937, second LSPA9 here is newer one with CB2S and BL0942
Is the issue on MQTT/HA communication side, or in the wrong channels used for RGB?
Please disable MQTT totally, make sure that your device is disconnected, and then, on OpenBeken gui, set the color to:
1. set to 100% RED (255 0 0) - is the color red?
2. set to 100% GREEN (0 255 0) - is the color green?
3. set to 100% BLUE (0 0 255) - is the color blue?
Tell me the results and I will provide futher instructions. I might add per-channel role setting to the SM2135 driver if needed.
For me, SM2135 driver works great so it's not possible to debug this issue on my side.
Obviously, I have no clue what's going on... MQTT 'disabled' by changing server IP to non-existing address.
I can't find where to change the colours in the OpenBeken GUI... I would expect to see it on the main page, right?
The only way to get the LED light up using the GUI is to send led_enableAll 1 as command. led_enableAll 0 also turns them off again. But SetChannel 1 100 does nothing. Not sure what I'm doing wrong... sorry.
Debug:CMD:cmd [led_enableAll 1]
Info:CMD: enableAll (led_enableAll) received with args 1
Info:GEN:CHANNEL_Set channel 1 has changed to 100 (flags 2)
Info:GEN:CHANNEL_Set channel 2 has changed to 100 (flags 2)
Info:GEN:CHANNEL_Set channel 3 has changed to 100 (flags 2)
Info:GEN:No change in channel 4 (still set to 0) - ignoring
Info:GEN:No change in channel 5 (still set to 0) - ignoring
Debug:CMD:cmd [SetChannel 1 0]
Info:GEN:CHANNEL_Set channel 1 has changed to 0 (flags 0)
I also noticed that most of the time I have to repeatedly send the commands before the show up in the log.
Oh and de "Status" page in the WebApp say's: 0:0 role
Not sure if this is normal behaviour.
Still, the advanced scripting with "IF" and "WHILE" etc statements is also coming soon, I already have working prototype. It will be very simple to use, with a simple, user-friendly syntax.
Altough I must note that I am not sure how the final configuration system for SM2135 will look like. I don't how which SM2135 use cases should we expect. I will update the system on the fly, I might also add a direct access to SM2135 channels, it should be very easy as well.
For example, is SM2135 used with only Cool White/Warm White lights as well? It wouldn't make sense, would it?
Check. I was on 1.9.0 and updated to 1.10.1. Set the flag, and yes I can now change stuff on the main page. But... same behaviour. When I change the color in the GUI to red, the green LED's turn on. Exactly the same pattern when I use HA and MQTT. I don't know if there are different SM2135 versions. This is a bulb with a SM2135EH.
I have another one, different brand with a SM2135E. Same issue as the other one, mixed-up colours. And the Cold en Warm LED's do not seem to work on this one... which is working perfectly on the bulb I been talking thus far. (side note, I had trouble flashing this one and I might have fried it while doing so...)
There is a checkbox to select "BL0942" messages but no "BL0937". In any case, you say that the logs are disabled, I hope that in future versions we can select both.
I have nothing in my autoexec.bat, the BL0942 boots by itself ... I started BL0937 by hand in a command (If you have time, associate the Enter key of the keyboard with the launch command button... I realised that Enter does not work to execute commands, I must click with the mouse).
When I try to calibrate, I get always a 000.00000 value, ¿do you know why? It seems that the calibration commands only run in BL0942, that is running but it is invalid for this device. How can I stop the BL0942 module?
Thanks for your help
Added after 1 [minutes]:
This is by default in the 1.9 version in the startup:
Now it seems that I can calibrate with VoltageSet XXX en so on...
I replaced the default startup BL0942 with BL0937. There is no log information but the calibration messages answer with regular values... before always 000.0000.
I will update now to 1.10.2 also. Thank you, this is great.
One question... is there any way to connect by console (putty or similar) to enable/disable the relay?. I would like to have a simple access to my devices like this...
this is the default order, you might try SM2135_Map 0 1 2 4 3
Remember that setting is not saved, so add the command call to the "short startup command"
PS: SM2135 is started automatically now if you have set the pins, no need for StartDriver SM2135. If you need multiple commands, use "backlog yyy; zzzz; xxxxx; " etc
From the console of my router (I can access from outside my home) simply with this command:
curl http_the.url.of.the.device/index?tgl=1 | grep ON
I can switch on/off. The grep is to check if on or off. If no html appears after the command, the relay is off. I will prepair something more "elaborated" but this work!
There is a checkbox to select "BL0942" messages but no "BL0937". In any case, you say that the logs are disabled, I hope that in future versions we can select both.
Thank you for reporting this, this was indeed a left over from times where I had only BL0942 driver.
Now I renamed it to "Power Metering". This checkbox is only to show/hide logging.
xostia wrote:
This is by default in the 1.9 version in the startup:
backlog startDriver BL0942; VREF 15987.125000; PREF -683.023987; IREF 272302.687500
It is not. I guess you used LSPA9 template that is for BL0942 version. The template has set the command. I will have to change it's name or something. But now it explains everything.
xostia wrote:
One question... is there any way to connect by console (putty or similar) to enable/disable the relay?. I would like to have a simple access to my devices like this...
What about HTTP cmnd access? By GET command?
Raw TCP access is not present yet, as no one ever before requested it. Still, I might modify the log_server_thread of TCP log server to also accept packets. I will consider that.
Or maybe I will add a command line directly... let me look into it
It is true... @p.kaczmarek2, I was playing with the "easy config" and probably edited later... and that stayed in the startup (LSPA9 but the other model with CB2S).
Respect to the command line. curl is a HTTP client, it works perfect... the problem is that it does not interprete the HTML output.
If you have time to create a url in the web server to enable or disable the relay and, if possible, inform about the Voltage / Power / Current and the status (on/off), in PLAIN TEXT, it will be perfect for simple command line control.
Another 3 questions... and sorry:
1) How can I perform a individual time configuration (I did not see in the web of the device that, set date or NTP config).
2) Is there any way to program on/off periods and leave the configuration in the device itself? (to work even when ther is no connection to wifi or the home-assistant).
3) How can I know that the BL0937CF is in the right GPIO (I understand, reading the datasheet, that is related to the protection when there is a high current). Is the protection took in account in your firmware? (switch off in a certain limit).
... probably I am asking for too much and is is something TBD.
Thank you very much for your sorftware and the corrections performed. You made a fantastic work.
EDIT:
I include here my startup text (that includes the calibration of my device LSPA9 WB2S+BL0937). I performed the calibration using the original firmware in the other unit (it can not be perfect but more or less... it works).