logo elektroda
logo elektroda
X
logo elektroda

Deta Grid Connect Smart Fan Speed Controller with Touch Light Switch - 6914HA - Teardown

wolfieeewolf 4752 51
ADVERTISEMENT
  • #31 20695136
    wolfieeewolf
    Level 11  
    So I have been testing the latest code over the last few months and have found a few little idiosyncrasies that are causing issues.

    1. Fans turn on randomly. I have done some testing and I believe it is happening when the wifi is reset or home assistant is rebooted. Not sure if it's a MQTT thing or not. Only happen with new code old code works fine. possible that it doesn't like the extra fan channel. also only happens on two of my switches. Have completely reset them but still happens.

    2. Light button will not turn on light power unless I hold it down for a few seconds. same when you go to turn it off. If you just click the button once it does a quick flick from off to on and visa versa. Does not happen with old code. Again could be the extra fan channel as it doesn't do it when I delete the Fan ON/OFF part of the script.

    3. Extra fan channel. When using Tasmoadmin the switch now has an extra channel that needs to be manually named for it to work.

    4. When using Google to control the fan always goes to max speed first no matter what speed I ask it to do. be it Low, Med, 33% 66%. When you ask Google again it will then adjust speed. I'm thinking this has something to do with the extra fan channel or the way the fan speed is set to always be Max on startup. I think this could be avoided if the Fan ON/OFF button was not a thing but then it would not be like the OEM firmware.

    To combat these issues I think getting rid of the Fan ON/OFF button and just using the fan speed button to control the fan speeds from off, low, med, and high would be the way. This would leave the Fan button as a non-functioning button. Not ideal but should fix the problems I'm having.

    My thoughts would be to utilise the fan button as a scene button for dimming lights or running some kind of automation. Would be good for bedtime routines to set lights to low and turn off house.

    Is anyone else experiencing these issues? I have tried to re-write the code again to see if I can stop it from happening but no matter what I do I can't get it working like the OEM firmware.
  • ADVERTISEMENT
  • #32 20695189
    p.kaczmarek2
    Moderator Smart Home
    Maybe we could approach it from a different angle. I don't have this device at hand, so it's problematic for me to imagine the whole functionality, but maybe with your help I could try to write a dedicated C driver for that? I would need to know again what exactly should be on UI and what are the inputs/outputss, but it should be possible... what do you think?

    I often do drivers to help users, as you can see here:
    https://github.com/openshwprojects/OpenBK7231T_App/issues/892
    The only issue that your one use case is a bit more complicated.
    Helpful post? Buy me a coffee.
  • #33 20695339
    drkarl
    Level 4  
    wolfieeewolf wrote:
    So I have been testing the latest code over the last few months and have found a few little idiosyncrasies that are causing issues.

    1. Fans turn on randomly. I have done some testing and I believe it is happening when the wifi is reset or home assistant is rebooted. Not sure if it's a MQTT thing or not. Only happen with new code old code works fine. possible that it doesn't like the extra fan channel. also only happens on two of my switches. Have completely reset them but still happens.


    I have not experienced any of this behavior on the 4 fans I have so don't think it would be related to the script. It may be happening if you are still using both the HASS Discovery function AND manual MQTT yaml configuration at the same time.
    Turn off HASS Discovery and ONLY use the manual MQTT yaml config.
    You may need to manually remove/delete the devices HASS Discovery added Home Assistant?

    This could also be an issue with your MQTT RETAIN settings but again I have not experienced any of this behavior.
    Watch this video from THE HOOKUP https://www.youtube.com/watch?v=31IyfM1gygo


    wolfieeewolf wrote:
    2. Light button will not turn on light power unless I hold it down for a few seconds. same when you go to turn it off. If you just click the button once it does a quick flick from off to on and visa versa. Does not happen with old code. Again could be the extra fan channel as it doesn't do it when I delete the Fan ON/OFF part of the script.


    I have this behavior also and would LOVE to fix it
    I tried using FLAG 6 expecting the switch to become instant but still have to hold for 0.5-1 sec to toggle state
    FLAG 6 [BTN] Instant touch reaction instead of waiting for release (aka setoption13 in tasmota)

    wolfieeewolf wrote:
    3. Extra fan channel. When using Tasmoadmin the switch now has an extra channel that needs to be manually named for it to work.


    I do not use Tasmoadmin to manage/use the device so has been a non issue for my use case.
    All interaction is done physically at the switch or through Home Assistant manual MQTT setup, exposing ONLY Light On/OFF (Switch1), Fan On/OFF (Switch 5) and Fan Speed (Switch 10)

    wolfieeewolf wrote:
    4. When using Google to control the fan always goes to max speed first no matter what speed I ask it to do. be it Low, Med, 33% 66%. When you ask Google again it will then adjust speed. I'm thinking this has something to do with the extra fan channel or the way the fan speed is set to always be Max on startup. I think this could be avoided if the Fan ON/OFF button was not a thing but then it would not be like the OEM firmware.


    This was by design and expected behavior consistent with the OEM firmware.
    I felt the OEM firmware was written this way to ensure the fans startup current load is spread across all 3 fan relays/capacitors to not overload any one individual.
    I mimicked this behavior in the script. The fan must be turned on first, always at full speed. Speed cycle is then DECREASED cascade from Max -> Med -> Min.
    If you feel this is over cautious and not necessary you could change it, but doing so will deviate from the OEM operation of the device.

    wolfieeewolf wrote:
    To combat these issues I think getting rid of the Fan ON/OFF button and just using the fan speed button to control the fan speeds from off, low, med, and high would be the way. This would leave the Fan button as a non-functioning button. Not ideal but should fix the problems I'm having.

    My thoughts would be to utilise the fan button as a scene button for dimming lights or running some kind of automation. Would be good for bedtime routines to set lights to low and turn off house.


    This would deviate from the OEM firmware but may work better for your use case. Test it out and report back how you feel it functions.

    TLDR
    If the press delay (problem 2 above) can be fixed the device would be PERFECT as per OEM supplied.

    The GHOST SWITCHING are likely due to using BOTH HASS discovery and MANUAL MQTT yaml config at the same time.
    This would also explain the additional device entities in Home Assistant. I suggest turn OFF HASS discovery and use MANUAL MQTT yaml config ONLY exposing switch 1 (Light on/off), 5 (Fan on/off), 10 (Fan speed %)

    Ghost switching may possibly but unlikely be due to incorrect MQTT RETAIN settings.
  • #34 20695360
    p.kaczmarek2
    Moderator Smart Home
    drkarl wrote:

    I have this behavior also and would LOVE to fix it
    I tried using FLAG 6 expecting the switch to become instant but still have to hold for 0.5-1 sec to toggle state
    FLAG 6 [BTN] Instant touch reaction instead of waiting for release (aka setoption13 in tasmota)

    Please post your code.

    If you have scripted:
    
    addEventHandler OnClick 1 Do_Power_Press
    

    and you want it to be instant press, then flag 6 won't work, because you have specified yourself that it must be "OnClick".

    If you want to use OnPress event, do:
    
    addEventHandler OnPress 1 Do_Power_Press
    
    Helpful post? Buy me a coffee.
  • #35 20695671
    drkarl
    Level 4  
    Outstanding! Thank you this now works exactly as OEM firmware
    I have changed both the Light and Fan Speed selector to OnPress and they both act instantly when FLAG 6 is selected.

    I have chosen to leave Fan ON/OFF as OnClick as the LIGHT and FAN buttons are very close together so having the Light instant but Fan slightly delayed might help to stop accidentally turning the fan on.

    // Display the labels for each channel on the GUI
    setChannelLabel 1 "Light Relay"
    setChannelLabel 2 "Min Fan 1 Relay"
    setChannelLabel 3 "Mid Fan 2 Relay"
    setChannelLabel 4 "Max Fan Relay"
    setChannelType 5 Toggle
    setChannelLabel 5 "Fan ON/OFF"
    setChannelType 10 OffLowMidHigh
    
    // Hide the raw relay channel buttons from the GUI
    setChannelVisible 1 0
    setChannelVisible 2 0
    setChannelVisible 3 0
    setChannelVisible 4 0
    setChannelVisible 5 0
    
    // Start the HTTP button driver
    startDriver httpButtons
    
    // Set up the Light button on the GUI
    setButtonLabel 1 "Light ON/OFF"
    setButtonCommand 1 Do_Light_Press
    setButtonEnabled 1 1
    setButtonColor 1 red
    addChangeHandler Channel1 == 0 setButtonColor 1 red
    addChangeHandler Channel1 != 0 setButtonColor 1 green
    addEventHandler OnPress 14 Do_Light_Press
    alias Do_Light_Press toggleChannel 1
    
    // Set up the Fan ON/OFF button on the GUI
    setButtonLabel 2 "Fan ON/OFF"
    setButtonCommand 2 Do_Power_Press
    setButtonEnabled 2 1
    setButtonColor 2 red
    addChangeHandler Channel2 == 0 setButtonColor 2 red
    addChangeHandler Channel2 != 0 setButtonColor 2 green
    addEventHandler OnClick 1 Do_Power_Press
    alias Do_Power_Press toggleChannel 5
    
    // Set up the Fan speed cycle button on the GUI
    setButtonLabel 10 "Next Fan Speed"
    setButtonCommand 10 Do_Cycle_Press_Ext
    setButtonEnabled 10 1
    addEventHandler OnPress 8 Do_Cycle_Press_Ext
    alias Do_Cycle_Press addChannel 10 -1 1 3 1 
    alias Do_Cycle_Press_Ext if $CH10!=0 then Do_Cycle_Press 
    
    
    // Set up change handlers for the fan speed options
    addChangeHandler Channel10 == 0 backlog SetChannel 2 0; SetChannel 3 0; SetChannel 4 0; SetChannel 5 0
    addChangeHandler Channel10 == 1 backlog SetChannel 2 1; SetChannel 3 0; SetChannel 4 0; SetChannel 5 1
    addChangeHandler Channel10 == 2 backlog SetChannel 2 1; SetChannel 3 1; SetChannel 4 0; SetChannel 5 1
    addChangeHandler Channel10 == 3 backlog SetChannel 2 1; SetChannel 3 1; SetChannel 4 1; SetChannel 5 1
    addChangeHandler Channel5 == 0 backlog SetChannel 10 0
    addChangeHandler Channel5 == 1 backlog SetChannel 10 3
  • #36 20695685
    p.kaczmarek2
    Moderator Smart Home
    To be clear, FLAG 6 "instant touch reactions" is not related to scripted button events. Flag 6 only related to "automatic" button events, like a button and relay on a single channel. This is why flag 6 doesn't do anything for you. Still, it's good to hear it's working! Is there anything else I may help you with?
    Helpful post? Buy me a coffee.
  • #37 20696579
    wolfieeewolf
    Level 11  
    >>20695671

    Can you share your channel template with me? I'm thinking yours might differ slightly from mine. I'm still experiencing issues, but it seems to be related to some sort of configuration error. This problem only arises when MQTT is configured and occurs after the device is rebooted or the internet connection drops. It's strange because I've removed all MQTT configurations from Home Assistant and cleared all the flags. I even reset the device to its factory OBK settings. The only MQTT-related thing I have active is Home Assistant's auto-discovery feature, but even with auto-discovery turned off, the issue is still there. Strangely, when I remove all MQTT data from the OBK, it functions as intended.

    I prefer to keep auto-discovery enabled, as manually writing custom MQTT config YAML for all my devices seems unnecessary when it's only this specific device causing problems. While having the ability to send custom MQTT config from the OBK itself could potentially help ensure only the desired information is exposed to Home Assistant, this function doesn't currently exist, so it's hard to determine if this could work or not.

    I'm currently using the latest version of Home Assistant:

    Home Assistant 2023.8.2
    Supervisor 2023.08.1
    Operating System 10.4
    Frontend 20230802.0 (latest)

    This issue has only been happening in the past month or so, so there's a chance it's related to a Home Assistant update. However, this doesn't explain why it's only happening to 2 out of 4 devices. It's also possible that there are hardware differences between what you have and what I have. My switches are black and are series 2. I belive the white series 2 switches might have been released before the black ones, so there could be internal hardware variations.

    The issue is occurring on only 2 of the 4 switches I own, which makes it even more puzzling. I've even copied the data from the non-working switches to the working ones, and those devices continue to function correctly. It's very bizarre.

    Interestingly, when I delete the fan on/off channel 5 from the script, the issue seems to be resolved. This is why I think it could be something related to my channel setup causing the problem. It's the only thing I can think of.

    drkarl wrote:
    I felt the OEM firmware was written this way to ensure the fans startup current load is spread across all 3 fan relays/capacitors to not overload any one individual.


    This is interesting to me. I wonder what the power draw across the different relays is? Not sure how I would go about testing the current load in all the different scenarios. I haven't pulled one of these apart to see just how many relays are in or how there are running them. I do have a spare laying around somewhere maybe I'll post some pictures to see if starting on low or medium speeds first will cause an issue.

    p.kaczmarek2 wrote:
    Maybe we could approach it from a different angle. I don't have this device at hand, so it's problematic for me to imagine the whole functionality, but maybe with your help I could try to write a dedicated C driver for that? I would need to know again what exactly should be on UI and what are the inputs/outputss, but it should be possible... what do you think?


    This could be something worth exploring if the above solutions don't work. I like having the freedom of modifying the btn_script to perform basically any function I wish, a driver might offer a simpler solution for users who prefer the device's original functions. If I can't resolve the issue by trying all available options, we can consider developing a dedicated driver for this purpose.

    Just to note this device does not have a TuyaMCU on board it works via switching relays on and off so I'm not sure if that would effect how you build a driver for this device.
  • ADVERTISEMENT
  • #38 20697900
    wolfieeewolf
    Level 11  
    drkarl wrote:
    This could also be an issue with your MQTT RETAIN settings but again I have not experienced any of this behavior.
    Watch this video from THE HOOKUP https://www.youtube.com/watch?v=31IyfM1gygo


    I believe this is most likely the case.

    My logs from a startup.

    Info:MAIN:Module reboot in 2...
    Info:MAIN:Time 98, idle 55956/s, free 74752, MQTT 1(1), bWifi 1, secondsWithNoPing 24, socks 2/38 POWERSAVE
    Info:MAIN:Module reboot in 1...
    ndler: added OnClick with cmd Do_Cycle_Press_Ext
    Info:CMD:New alias has been set: Do_Cycle_Press runs addChannel 10 -1 1 3 1
    Info:CMD:New alias has been set: Do_Cycle_Press_Ext runs if $CH10!=0 then Do_Cycle_Press
    Info:EVENT:CMD_AddChangeHandler: added Channel10 with cmd backlog SetChannel 2 0; SetChannel 3 0; SetChannel 4 0; SetChannel 5 0
    Info:EVENT:CMD_AddChangeHandler: added Channel10 with cmd backlog SetChannel 2 1; SetChannel 3 0; SetChannel 4 0; SetChannel 5 1
    Info:EVENT:CMD_AddChangeHandler: added Channel10 with cmd backlog SetChannel 2 1; SetChannel 3 1; SetChannel 4 0; SetChannel 5 1
    Info:EVENT:CMD_AddChangeHandler: added Channel10 with cmd backlog SetChannel 2 1; SetChannel 3 1; SetChannel 4 1; SetChannel 5 1
    Info:EVENT:CMD_AddChangeHandler: added Channel5 with cmd backlog SetChannel 10 0
    Info:EVENT:CMD_AddChangeHandler: added Channel5 with cmd backlog SetChannel 10 3
    Info:MAIN:Time 1, idle 32223/s, free 86344, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MAIN:Time 2, idle 37910/s, free 86344, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MAIN:Time 3, idle 37662/s, free 86344, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MAIN:Time 4, idle 35544/s, free 86344, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MAIN:Time 5, idle 37995/s, free 86344, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MAIN:ssid:TelstraC3E92F key:paecawv8q5rr2ghf
    Info:MAIN:Time 6, idle 75273/s, free 81064, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MAIN:Boot complete time reached (5 seconds)
    Info:CFG:####### Set Boot Complete #######


    This boot-up section seems ok and is doing what it should

    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MAIN:Time 7, idle 91569/s, free 80520, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MAIN:Time 8, idle 40159/s, free 79760, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MAIN:Time 9, idle 0/s, free 79760, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MAIN:Time 10, idle 0/s, free 79760, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:GEN:dhcp=0 ip=0.0.0.0 gate=0.0.0.0 mask=0.0.0.0 mac=10:d5:61:27:b9:c5
    Info:GEN:sta: 0, softap: 0, b/g/n
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MAIN:Time 11, idle 0/s, free 79760, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MAIN:Time 12, idle 0/s, free 79760, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MAIN:Time 13, idle 0/s, free 79760, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MAIN:Time 14, idle 0/s, free 79760, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTING - 1
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTED - 4
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTED - 4
    Info:MAIN:Time 15, idle 25868/s, free 80168, MQTT 0(0), bWifi 1, secondsWithNoPing -1, socks 3/38 POWERSAVE
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    C5/+/get
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic obk6127B9C5/5/set
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic obk6127B9C5/10/set
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic obk6127B9C5/1/get
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic obk6127B9C5/2/get
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic obk6127B9C5/3/get
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic obk6127B9C5/4/get
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic obk6127B9C5/5/get
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic obk6127B9C5/10/get
    Info:MQTT:MQTT client in mqtt_incoming_data_cb data is 0 for ch 5
    Info:GEN:No change in channel 5 (still set to 0) - ignoring
    
    Info:MQTT:MQTT client in mqtt_incoming_data_cb data is 2 for ch 10
    Info:GEN:CHANNEL_Set channel 10 has changed to 2 (flags 0)
    
    Info:MQTT:Channel has changed! Publishing 2 to channel 10 
    Info:MQTT:Publishing val 2 to obk6127B9C5/10/get retain=0
    Info:EVENT:EventHandlers_ProcessVariableChange_Integer: executing command backlog SetChannel 2 1; SetChannel 3 1; SetChannel 4 0; SetChannel 5 1
    Info:GEN:CHANNEL_Set channel 2 has changed to 1 (flags 0)
    
    Info:MQTT:Channel has changed! Publishing 1 to channel 2 
    Info:MQTT:Publishing val 1 to obk6127B9C5/2/get retain=0
    Info:EVENT:EventHandlers_ProcessVariableChange_Integer: executing command setButtonColor 2 green
    Info:GEN:CHANNEL_Set channel 3 has changed to 1 (flags 0)
    
    Info:MQTT:Channel has changed! Publishing 1 to channel 3 
    Info:MQTT:Publishing val 1 to obk6127B9C5/3/get retain=0
    Info:GEN:No change in channel 4 (still set to 0) - ignoring
    
    Info:GEN:CHANNEL_Set channel 5 has changed to 1 (flags 0)
    
    Info:MQTT:Channel has changed! Publishing 1 to channel 5 
    Info:MQTT:Publishing val 1 to obk6127B9C5/5/get retain=0
    Info:EVENT:EventHandlers_ProcessVariableChange_Integer: executing command backlog SetChannel 10 3
    Info:GEN:CHANNEL_Set channel 10 has changed to 3 (flags 0)
    
    Info:MQTT:Channel has changed! Publishing 3 to channel 10 
    Info:MQTT:Publishing val 3 to obk6127B9C5/10/get retain=0
    Info:EVENT:EventHandlers_ProcessVariableChange_Integer: executing command backlog SetChannel 2 1; SetChannel 3 1; SetChannel 4 1; SetChannel 5 1
    Info:GEN:No change in channel 2 (still set to 1) - ignoring
    
    Info:GEN:No change in channel 3 (still set to 1) - ignoring
    
    Info:GEN:CHANNEL_Set channel 4 has changed to 1 (flags 0)
    
    Info:MQTT:Channel has changed! Publishing 1 to channel 4 
    Info:MQTT:Publishing val 1 to obk6127B9C5/4/get retain=0
    Info:GEN:No change in channel 5 (still set to 1) - ignoring
    
    Info:MAIN:Time 18, idle 5993/s, free 80504, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MAIN:Will do request HA discovery now.
    Info:MQTT:Queued topic=homeassistant/switch/Bedroom_Switch_relay_1/config, 1 items in queue
    Info:MQTT:Queued topic=homeassistant/switch/Bedroom_Switch_relay_2/config, 2 items in queue
    Info:MQTT:Queued topic=homeassistant/switch/Bedroom_Switch_relay_3/config, 3 items in queue
    Info:MQTT:Queued topic=homeassistant/switch/Bedroom_Switch_relay_4/config, 4 items in queue
    Info:MQTT:Queued topic=homeassistant/switch/Bedroom_Switch_relay_5/config, 5 items in queue
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic obk6127B9C5/10/get
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic obk6127B9C5/2/get
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic obk6127B9C5/3/get
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic obk6127B9C5/5/get
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic obk6127B9C5/10/get
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic obk6127B9C5/4/get
    Info:MQTT:Publishing val (315 bytes) to homeassistant/switch/Bedroom_Switch_relay_1/config retain=1
    Info:MQTT:Publishing val (319 bytes) to homeassistant/switch/Bedroom_Switch_relay_2/config retain=1
    Info:MQTT:Publishing val (319 bytes) to homeassistant/switch/Bedroom_Switch_relay_3/config retain=1
    Info:MAIN:Time 19, idle 5447/s, free 74624, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MQTT:Publishing val (317 bytes) to homeassistant/switch/Bedroom_Switch_relay_4/config retain=1
    Info:MQTT:Publishing val (314 bytes) to homeassistant/switch/Bedroom_Switch_relay_5/config retain=1
    Info:MAIN:Time 20, idle 18302/s, free 74624, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:GEN:dhcp=0 ip=192.168.0.11 gate=192.168.0.1 mask=255.255.255.0 mac=10:d5:61:27:b9:c5
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-54,ssid=TelstraC3E92F,bssid=a2:b5:3c:c3:e9:37,channel=11,cipher_type:CCMP
    Info:MQTT:Channel has changed! Publishing 1 to channel 1 
    Info:MQTT:Publishing val 1 to obk6127B9C5/1/get retain=0
    Info:MAIN:Time 21, idle 25986/s, free 74624, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic obk6127B9C5/1/get
    Info:MQTT:Channel has changed! Publishing 1 to channel 2 
    Info:MQTT:Publishing val 1 to obk6127B9C5/2/get retain=0
    Info:MAIN:Time 22, idle 11256/s, free 74176, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 3/38 POWERSAVE
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic obk6127B9C5/2/get
    Info:MQTT:Channel has changed! Publishing 1 to channel 3 
    Info:MQTT:Publishing val 1 to obk6127B9C5/3/get retain=0
    Info:MAIN:Time 23, idle 52338/s, free 74624, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic obk6127B9C5/3/get
    Info:MQTT:Channel has changed! Publishing 1 to channel 4 
    Info:MQTT:Publishing val 1 to obk6127B9C5/4/get retain=0
    Info:MAIN:Time 24, idle 55164/s, free 74624, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic obk6127B9C5/4/get
    Info:MQTT:Channel has changed! Publishing 1 to channel 5 
    Info:MQTT:Publishing val 1 to obk6127B9C5/5/get retain=0
    Info:MAIN:Time 25, idle 50575/s, free 74624, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic obk6127B9C5/5/get
    Info:MQTT:Channel has changed! Publishing 3 to channel 10 
    Info:MQTT:Publishing val 3 to obk6127B9C5/10/get retain=0
    Info:MAIN:Time 26, idle 46237/s, free 74392, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic obk6127B9C5/10/get
    Info:MAIN:Time 27, idle 40869/s, free 66016, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 3/38 POWERSAVE
    Info:MAIN:Time 28, idle 94650/s, free 74624, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MAIN:Time 29, idle 54483/s, free 74624, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MAIN:Time 30, idle 53936/s, free 74624, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:GEN:dhcp=0 ip=192.168.0.11 gate=192.168.0.1 mask=255.255.255.0 mac=10:d5:61:27:b9:c5
    Info:GEN:sta: 1, softap: 0, b/g/n


    I'm thinking that somehow a retained value is stuck in the flash memory and will not release. I have done a complete reset of the device but it appears that this is not wiping out everything. As I can't use the Tasmota ButtonRetain On and Off commands I am not sure how I would wipe the retain memory out.

    I have done some testing by deleting parts of the autoexec.bat script and with everything else deleted but this code, it still turns the fan on.

    // Set up change handlers for the fan speed options
    addChangeHandler Channel10 == 0 backlog SetChannel 2 0; SetChannel 3 0; SetChannel 4 0; SetChannel 5 0
    addChangeHandler Channel10 == 1 backlog SetChannel 2 1; SetChannel 3 0; SetChannel 4 0; SetChannel 5 1
    addChangeHandler Channel10 == 2 backlog SetChannel 2 1; SetChannel 3 1; SetChannel 4 0; SetChannel 5 1
    addChangeHandler Channel10 == 3 backlog SetChannel 2 1; SetChannel 3 1; SetChannel 4 1; SetChannel 5 1
    addChangeHandler Channel5 == 0 backlog SetChannel 10 0
    addChangeHandler Channel5 == 1 backlog SetChannel 10 3
    


    I have even deleted the script down to one line of code

    addChangeHandler Channel10 == 2 backlog SetChannel 2 1; SetChannel 3 1; SetChannel 4 0; SetChannel 5 1


    I have turned off all flags and reset. I've deleted scripts, configs and basically everything I can think of then reset again. I also have auto-discovery turned off and all entities deleted in-home assistant. With the MQTT broker turned off it doesn't do it but as soon as the MQTT broker is turned on and it connects it turns the fan on. It has to be something stuck somewhere when the MQTT connection is made and it's sending some kind of trigger that turns on the fan.

    I have even gone as far as reflashing the device manually but the problem still is there. @p.kaczmarek2 Not sure if you can assist on this one but I'm at a complete loss on where to go next.
  • #39 20697907
    MnM1
    Level 10  
    Have you tried MQTT Explorer to connect to your mqtt and delete all traces of that device manually? (after you remove it from you HA config, etc)
  • ADVERTISEMENT
  • #40 20697921
    wolfieeewolf
    Level 11  
    MnM1 wrote:
    Have you tried MQTT Explorer to connect to your mqtt and delete all traces of that device manually? (after you remove it from you HA config, etc)


    This has worked. There was a few retained entries that I have cleared out and now it's all functioning how it should. Thanks for your help on this. It was driving me insane trying to work it out.
  • #41 20857911
    wolfieeewolf
    Level 11  
    @p.kaczmarek2

    I hope you can help me with this.

    I have this snippet of code in my autoexec.bat to turn on my light

    // Set up the Light button on the GUI
    setButtonLabel 1 "Light ON/OFF"
    setButtonCommand 1 Do_Light_Press
    setButtonEnabled 1 1
    setButtonColor 1 red
    addChangeHandler Channel1 == 0 setButtonColor 1 red
    addChangeHandler Channel1 != 0 setButtonColor 1 green
    addEventHandler OnClick 14 Do_Light_Press
    addEventHandler OnHold 14 toggleChannel 1
    alias Do_Light_Press publish zigbee2mqtt/Media/set Toggle -1


    The problem is that the webGUI is not working how I would like and I don't know how to fix it.

    What happens with the code right now is that when I push the "Light ON/OFF" Button the bulb turns off and the GUI button is red. When pushed again it turns the bulb on but the GUI button stays red.

    I can see the error and it has to do with the OnClick and OnHold event handlers. I would like to split these somehow as they both do different things.

    I need to create a dummy button on the GUI that I can link "OnClick 14 Do_Light_Press" or "OnHold 14 toggleChannel 1" to so I can then change the button colour depending on what has been pressed.

    I have looked over the docs and can't find anything that might work so hoping you can help
  • #42 20858744
    p.kaczmarek2
    Moderator Smart Home
    I am not sure what are you trying to do. The Do_Light_Press call just does a Zigbee publish. It does not invert the channel 1. It's work as it's scripted. Hmm.

    Maybe you'd rather want to do this:

    
    alias Do_Light_Press backlog toggleChannel 1; publish zigbee2mqtt/Media/set Toggle -1
    

    but that does not solve a potential desync between Zigbee device state and button color.

    Also, just to be sure, are you aware that OnClick and OnHold handlers are only for physical button? HTTP panel button will not trigger them.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #43 20858878
    wolfieeewolf
    Level 11  
    Unfortunately, the provided code won't achieve the desired outcome.

    I understand that the OnClick and OnHold handlers are specifically designed for physical buttons. Interestingly, the HTTP panel button triggers the bulb when clicked, possibly defaulting to that action as it's the first function in the script.

    Here's how it operates in my script:

    Pressing the physical button toggles the bulb on/off through MQTT with the command zigbee2mqtt/Media/set Toggle -1. Importantly, this doesn't affect the relay.

    Holding the button turns off the relay, cutting power to the bulb.

    I've set it up this way to prevent accidental power cuts by family members, ensuring the bulb remains functional in Home Assistant.

    The physical button works as expected; however, the HTTP panel button causes confusion, as it shares the same channel for activating both the bulb and the relay.

    something like the following might work:

    OnClick addChangeHandler Channel1 == 0 setButtonColor 1 red
    OnClick addChangeHandler Channel1 != 0 setButtonColor 1 green
    
    OnHold addChangeHandler Channel1 == 0 setButtonColor 1 red
    OnHold addChangeHandler Channel1 != 0 setButtonColor 1 green


    However, this poses a challenge because the OnClick and OnHold HTTP panel buttons are the same. Consequently, I can't discern whether the bulb or relay is on/off.

    Ideally, I'd need two HTTP panel buttons: one labelled "Bulb ON/OFF" and another labelled "Relay ON/OFF." My predicament lies in implementing this, given that both OnClick and OnHold use pin 14 to run the script.

    I'm in search of an "If this, then that" command and a method to create a dummy button on the HTTP panel. I hope this clarifies my situation.
  • #44 20859011
    p.kaczmarek2
    Moderator Smart Home
    Let's try to solve it step by step.
    wolfieeewolf wrote:
    Interestingly, the HTTP panel button triggers the bulb when clicked, possibly defaulting to that action as it's the first function in the script.

    Why do you think it's defaulting to anything? I can see that you have clearly scripted it to call bulb toggle:
    Screenshot of script code for toggling a light bulb.
    Helpful post? Buy me a coffee.
  • #45 20859017
    wolfieeewolf
    Level 11  
    I have been messing about and have worked out how to make a dummy button that works the way I need it to. I split the code so the buttons are now independent of each other but still having the issue with the colours not working how they should.

    The "Light ON/OFF" turns the bulb on/off - It also turns the HTTP button red/green when clicked. It also turns red/green when pressing the button on the physical device as well. So thumbs up for that.

    The "Relay ON/OFF" works and turns on/off the relay - Unfortunately, it turns the "Light ON/OFF" HTTP button red/green. It's the same when holding the button on the physical device.

    I'm sure it's just a coding error but I'm not seeing it.

    Here's the code.

    // Set up the Light button on the GUI
    setButtonLabel 1 "Light ON/OFF"
    setButtonCommand 1 Do_Light_Press
    setButtonEnabled 1 1
    setButtonColor 1 red
    addChangeHandler Channel1 == 0 setButtonColor 1 red
    addChangeHandler Channel1 != 0 setButtonColor 1 green
    addEventHandler OnClick 14 Do_Light_Press
    alias Do_Light_Press publish zigbee2mqtt/Bedroom/set Toggle -1
    
    setButtonLabel 30 "Relay ON/OFF"
    setButtonCommand 30 Do_Relay_Hold
    setButtonEnabled 30 1
    setButtonColor 30 red
    addChangeHandler Channel30 == 0 setButtonColor 30 red
    addChangeHandler Channel30 != 0 setButtonColor 30 green
    addEventHandler OnHold 14 Do_Relay_Hold
    alias Do_Relay_Hold toggleChannel 1


    I think the issue is still that Channel30 is not tied to the right channel to pick up the change. I did change it to Channel1 but it still changes the colours to the wrong buttons.

    I'm not sure there is a fix for this as you can't have two different buttons using the same channel doing two different things.
  • #46 20859023
    p.kaczmarek2
    Moderator Smart Home
    Maybe something like:
    
    // There is a Relay pin on channel 1
    setChannelType 1 Toggle
    // Channel 2 has no physical relays
    setChannelType 2 Toggle
    
    // P14 is Btn_ScriptOnly
    addEventHandler OnHold 14 toggleChannel 1
    addEventHandler OnClick 14 toggleChannel 2
    
    addEventHandler OnChannelChange 2 Do_Light_Press 
    
    alias Do_Light_Press publish zigbee2mqtt/Media/set Toggle -1
    
    Helpful post? Buy me a coffee.
  • #47 20862047
    wolfieeewolf
    Level 11  
    I've done it!!

    I tidied up some code and it works great.

    The only issue is that when turning off the light the button gets confused with being ON/OFF. I need to work out how to get the state of the light with MQTT and relay that back to the autoexec.bat. I think that will be a job for another day. For now, it works how I need it to.

    
    -- Start NTP driver and set time zone offset
    startDriver NTP
    ntp_timeZoneOfs +10:00
    powerSave 1
    
    -- Display labels for each channel on the GUI
    setChannelLabel 1 "Light Relay"
    setChannelLabel 2 "Min Fan 1 Relay"
    setChannelLabel 3 "Mid Fan 2 Relay"
    setChannelLabel 4 "Max Fan Relay"
    
    -- Hide raw relay channel buttons from the GUI
    setChannelVisible 2 0
    setChannelVisible 3 0
    setChannelVisible 4 0
    
    -- Start HTTP button driver
    startDriver httpButtons
    
    -- Set up Light button on the GUI
    setChannelLabel 5 "Light"
    setChannelType 5 Toggle
    addEventHandler OnClick 14 toggleChannel 5
    addEventHandler OnChannelChange 5 Do_Light_Press 
    alias Do_Light_Press publish zigbee2mqtt/Media/set Toggle -1
    
    -- Set up Relay ON/OFF button on the GUI
    setChannelLabel 1 "Relay"
    setChannelType 1 Toggle
    addEventHandler OnHold 14 toggleChannel 1
    
    -- Set up Fan ON/OFF button on the GUI
    setChannelLabel 6 "Fan"
    setChannelType 6 Toggle
    addEventHandler OnClick 1 toggleChannel 6
    
    -- Set up Fan speed cycle on the GUI
    setChannelType 10 OffLowMidHigh
    addEventHandler OnClick 8 Do_Cycle_Press_Ext
    alias Do_Cycle_Press addChannel 10 -1 1 3 1 
    alias Do_Cycle_Press_Ext if $CH10!=0 then Do_Cycle_Press 
    
    -- Set up change handlers for fan speed options
    addChangeHandler Channel10 == 0 backlog SetChannel 2 0; SetChannel 3 0; SetChannel 4 0; SetChannel 6 0
    addChangeHandler Channel10 == 1 backlog SetChannel 2 1; SetChannel 3 0; SetChannel 4 0; SetChannel 6 1
    addChangeHandler Channel10 == 2 backlog SetChannel 2 1; SetChannel 3 1; SetChannel 4 0; SetChannel 6 1
    addChangeHandler Channel10 == 3 backlog SetChannel 2 1; SetChannel 3 1; SetChannel 4 1; SetChannel 6 1
    addChangeHandler Channel6 == 0 backlog SetChannel 10 0
    addChangeHandler Channel6 == 1 backlog SetChannel 10 3
    
    
  • #48 21256025
    wolfieeewolf
    Level 11  
    Any chance anyone has the stock firmware for this device? I lost my backup.
  • #50 21407829
    wolfieeewolf
    Level 11  
    Has anyone had any issues with these devices becoming non-functional after an update? I have had 4 of these in the last few months and are now completely unusable. I tried uploading the firmware manually with BK Writer, but that made things worse. Now I can't even get the device to boot. It won't even load into safe mode. I'm wondering if the bootloader got screwed up somehow. If I can work out how to redo the bootloader using the SPI writer I'll see if that brings it back to life. I just wanted to see if anyone else has had any issues in the last few months of updates. It seem to just be this device. all my other Deta switches work fine.
  • #52 21408990
    wolfieeewolf
    Level 11  
    The problem is it's not just one update and the device stops working. I don't know what firmware it was as I try to update every 2 weeks or so. I would say the problems started about 3 or 4 months ago. I have updated the firmware on them and it works fine for a few weeks then out of the blue it just decides to do something weird and die.

    I updated a device then a few weeks later after it had been working fine it just stopped working. Another one you go to turn on the light switch and it reboots itself and stops working or I had one start going crazy just turning itself on and off until it stopped working. Then another one that just decided to reset itself back to defaults when I tried to get the AP working by rebooting it. It just never rebooted and died.

    I can access the Tuya chip fine and there doesn't seem to be an issue with writing the firmware it all goes ok but when you go to boot the device it doesn't work. I had a brand new device and flashed the firmware on it and it then wouldn't work. I used the latest BK Writer with default settings. When it didn't work I guessed there may be an issue with the BK Writer so went back to the one I knew worked before but still nothing. Unfortunately, I can't remember the firmware version but it would have been a recent one in December some time. It's probably about the same time I started to have issues with my downlights going crazy with temperature spiking so maybe version 1.17.698.

    Seems weird though that most of my other devices work perfectly fine with the latest version just seems to be this switch that is having issues.

    Anyway we are moving house in a few weeks so I'm ripping them out and just replacing them with standard non-smart switches. I don't think I'd ever use these again.

Topic summary

The discussion revolves around the Deta Grid Connect Smart Fan Speed Controller with Touch Light Switch (model 6914HA) and its configuration, particularly focusing on the WB3S chip and its compatibility with TuyaMCU. Users explore the flashing of the main chip using the BK7231 GUI Flash Tool, troubleshooting GPIO configurations, and scripting for fan speed control and light toggling. Key issues include the absence of TuyaMCU functionality, challenges in scripting for button interactions, and the need for precise channel and pin management. Solutions involve using specific event handlers and aliases to achieve desired functionality, as well as addressing MQTT integration with Home Assistant for better control and automation.
Summary generated by the language model.
ADVERTISEMENT