logo elektroda
logo elektroda
X
logo elektroda

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

wolfieeewolf 
Device Name: Deta Grid Connect Smart Fan Speed Controller with Touch Light Switch - 6914HA
Device Type: Fan and Light switch
Device Chip: WB3S - BK7231T
Device Purchased: Bunnings Warehouse - $59.36AUD




Flashing of Main Chip

Manually flashed the chip with BK7231 GUI Flash Tool.

WB3S Module Datasheet


Configuration of Module

PinChTypeDescription
P1Ch4Btn_ScriptOnlyFan Button (Middle)
P6Ch2RelFan MIN speed, turns on 1 of 3 LEDs around the Arrow Button (right led).
Pin active on all fan speeds. Turns on fan button LED
P7Ch3RelFan MIN speed, turns on 1 of 3 LEDs around the Arrow Button (top led)
P8Ch10Btn_ScriptOnlyArrow Button (Right)
P9Ch4RelFan MAX speed, turns on 1 of 3 LEDs around the Arrow Button (bottom led)
P10Ch0WifiLED_nWifiLED_n - White LED on when Wifi is connected or WifiLED - White LED on when Wifi is disconnected
P14Ch1Btn_ScriptOnlyLight Button (Left)
P26Ch1RelLight Relay. Turns on light button LED



Launch Web Application
Go to Filesystem tab
Create file called autoexec.bat (should be default)
Paste follow script
Save and reboot the device.
Test all functions to make sure they are working.

A huge thank you to Drkarl and p.kaczmarek2 for working out the final coding.


// 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 OnClick 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 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 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


So far all the relays/buttons are working the same as the original firmware and I'm able to set all the fan speeds.

To set up the MQTT script in home assistant use the following


mqtt: 
################################################################################
  light:
  ### Bedroom Light #####################
    - unique_id: bedswitch_relay_1
      name: "Bedroom Light"
      state_topic: "bedswitch/1/get"
      command_topic: "bedswitch/1/set"
      qos: 1
      payload_on: 1
      payload_off: 0
      retain: true
      availability:
      - topic: "bedswitch/connected"
################################################################################
  fan:
  ### Bedroom Fan ##########################
    - unique_id: "bedswitch_Channel_10"
      name: "Bedroom Fan"
      state_topic: "bedswitch/5/get"
      command_topic: "bedswitch/5/set"
      percentage_state_topic: "bedswitch/10/get"
      percentage_command_topic: "bedswitch/10/set"
      qos: 1
      payload_on: 1
      payload_off: 0
      speed_range_min: 1
      speed_range_max: 3
      retain: true
      availability:
        - topic: "bedswitch/connected"

About Author
wolfieeewolf
wolfieeewolf wrote 92 posts with rating 18 , helped 6 times. Been with us since 2023 year.

Comments

p.kaczmarek2 01 Mar 2023 11:36

Hello, the first thing to do would be to check if it's really TuyaMCU or not. I doesn't look like TuyaMCU. 1. Does removing the config from autoexec.bat for you changes anything? 2. With TuyaMCU config,... [Read more]

wolfieeewolf 02 Mar 2023 06:13

I think I agree with you that there is no TuyaMCU on board. 1. Does removing the config from autoexec.bat for you changes anything? I added the code to the autoexec.bat to see what it would do... [Read more]

p.kaczmarek2 02 Mar 2023 10:44

Remember that you can use Btn_ScriptOnly role for a button that is fully scriptable and has no automatic channel interactions. I must admit that this part of your description is not clear to me: How... [Read more]

wolfieeewolf 02 Mar 2023 13:01

Hope this helps. Have done some testing with changing pin channels and I feel that what i have below is 99.9% correct. I have been trying to do this via scripting, but I just have no idea where to start. ... [Read more]

p.kaczmarek2 03 Mar 2023 11:48

Well, we can do this step by step. This can be done according to this example: https://github.com/openshwprojects/OpenBK7231T_App/commit/dccb987ff5214e744155d54f30594632e010bb45#diff-d7f6b8d5f1fc099c6e03c7f7fbfecbaff70e911a0e3d059c6aa64c92ff9e0358 Basically,... [Read more]

wolfieeewolf 03 Mar 2023 15:15

I have been working on a script over the last couple of days. The script runs if I use the web GUI but it is all messed up on the device. I'm getting confused about when I should use the PIN or the... [Read more]

p.kaczmarek2 03 Mar 2023 15:38

Do you want to have a "LowMidHigh" (3 options radio button) on GUI or a 4 options one ("OffLowMidHigh") ? [Read more]

wolfieeewolf 04 Mar 2023 02:20

I run everything through Home Assistant and while a nice-looking gui is good, I don't really use it. I only have it that way for testing purposes to make sure the physical buttons are doing what they need... [Read more]

p.kaczmarek2 04 Mar 2023 14:28

Yes, those are for channels Yes, this is OnPress (you can also use OnClick) event for pin index, where pin should also have button role. I will try to update docs to be more clear, but all setButton*... [Read more]

wolfieeewolf 04 Mar 2023 15:26

Finally worked it out!!! After all that effort it ends up that I had some Buttons allocated wrong in the Pin settings. I also was calling the wrong channels and buttons in the script. Still a few... [Read more]

p.kaczmarek2 04 Mar 2023 15:32

Can you please post current version of the script? If you want to toggle multiple channels, do: backlog toggleChannel 10; toggleChannel 12; toggleChannel 14 Let's say you want to do something... [Read more]

wolfieeewolf 04 Mar 2023 15:40

The current script is below. Haven't added your latest reply changes yet. It's about 1:30 AM here so heading to bed. Will have a crack at it tomorrow. // display on gui setChannelType 10 OffLowMidHigh setChannelLabel... [Read more]

p.kaczmarek2 04 Mar 2023 16:43

Maybe replace: alias Do_Cycle_Press addChannel 10 1 0 3 1 with alias Really_Do_Cycle_Press addChannel 10 1 0 3 1 alias Do_Cycle_Press if $CH4 then Really_Do_Cycle_Press because it seems... [Read more]

wolfieeewolf 05 Mar 2023 06:23

I did try the changes you suggested while they did work they didn't work as I hoped. The Fan button now turns on/off relay channels 2,3 and 4 The Fan cycle button cycles for high, mid, low and... [Read more]

wolfieeewolf 13 Apr 2023 16:28

Still trying to sort out this fan-speed drama. I tried to use some Tasmota-type scripting but I don't think OpenBK likes it very much. It needs to follow the logic on this page // Display the... [Read more]

drkarl 22 Jun 2023 13:29

Where you able to get this to function properly? [Read more]

p.kaczmarek2 22 Jun 2023 13:40

Hello, I haven't seen last post in this topic. This line: ON EVENT#p=0 DO power2 OFF ENDON will not work in OBK yet. To toggle channel, you can do: POWER Toggle or toggleChannel 3 ... [Read more]

drkarl 26 Jun 2023 13:01

Updated scripting - seems to work as the device is out of the box with 1 exception, see below. mqtt: ################################################################################ light: ... [Read more]

p.kaczmarek2 26 Jun 2023 20:39

I can add a channel type "MaxMedMin" or something, if you want other speeds order. Your if syntax is not correct. You want something like: alias Do_Cycle_Press_Ext if $CH10!=0 then Do_Cycle_Pr... [Read more]

%}