Deta Light and Fan Switch (6914HA)
Available from:
Bunnings.com.au
Bunnings.co.nz
Install method:
USB to Serial
GPIO # | Component |
---|---|
GPIO00 | Button2 |
GPIO01 | None |
GPIO02 | None |
GPIO03 | LedLinki |
GPIO04 | Relay3 |
GPIO05 | Button3 |
GPIO09 | None |
GPIO10 | None |
GPIO12 | None |
GPIO13 | Relay2 |
GPIO14 | Relay1 |
GPIO15 | Relay4 |
GPIO16 | Button1 |
FLAG | None |
Configuration (old format, will be converted to new template when applied)
{"NAME":"Deta Fan Speed and Light Controller","GPIO":[18,0,0,158,23,19,0,0,0,22,21,24,17],"FLAG":0,"BASE":18}
Decouple Buttons from Relays
SetOption73 1
Single rule to handle fan speed logic
Rule1
ON SYSTEM#Init DO Backlog var1 3; var2 1 ENDON
ON BUTTON1#State=10 DO power1 Toggle ENDON
ON BUTTON2#State=10 DO event p=%var2% ENDON
ON BUTTON3#State=10 DO event s=%var1% ENDON
ON EVENT#p>0 DO power4 ON ENDON
ON EVENT#p>0 DO power3 ON ENDON
ON EVENT#p>0 DO power2 ON ENDON
ON EVENT#p>0 DO var1 2 ENDON
ON EVENT#p>0 DO var2 0 ENDON
ON EVENT#p=0 DO power3 OFF ENDON
ON EVENT#p=0 DO power4 OFF ENDON
ON EVENT#p=0 DO power2 OFF ENDON
ON EVENT#p=0 DO var1 3 ENDON
ON EVENT#p=0 DO var2 1 ENDON
ON EVENT#s>0 DO var2 0 ENDON
ON EVENT#s=1 DO power3 OFF ENDON
ON EVENT#s=1 DO power4 OFF ENDON
ON EVENT#s=1 DO power2 ON ENDON
ON EVENT#s=1 DO var1 3 ENDON
ON EVENT#s=2 DO power3 OFF ENDON
ON EVENT#s=2 DO power4 ON ENDON
ON EVENT#s=2 DO power2 ON ENDON
ON EVENT#s=2 DO var1 1 ENDON
ON EVENT#s=3 DO power3 ON ENDON
ON EVENT#s=3 DO power4 ON ENDON
ON EVENT#s=3 DO power2 ON ENDON
ON EVENT#s=3 DO var1 2 ENDON
ON POWER2#State=0 DO power4 OFF ENDON
ON POWER2#State=0 DO power3 OFF ENDON
ON POWER2#State=0 DO var1 3 ENDON
ON POWER2#State=0 DO var2 1 ENDON
ON POWER2#State=1 DO power4 ON ENDON
ON POWER2#State=1 DO power3 ON ENDON
ON POWER2#State=1 DO var1 2 ENDON
ON POWER2#State=1 DO var2 0 ENDON
Enable rule with Rule1 1
Description:
SetOption73
Decouples the buttons and relay
The VAR1 can be thought of as “NextSpeed” and VAR2 as “Next Power”, if it makes it easier to read the code
Notes:
- Relay 1 is the main light relay controlled by button1 (the light button)
- Relay 2 is the main fan relay controlled by the button2 (the fan button)
- Relay 3 is the secondary fan relay controlled by the bottom3 (the array buttons)
- Relay 4 is the tertiary fan relay not physically connected to any buttons
Rule Logic
- Relay 3 and 4 will always turn on with Relay 2
- VAR1 is set to 3 at Initialisation and when the fan is powered off to ensure full power to fan to startup
- VAR2 is set to 1 at Initialisation to control the fan “next power state”
- Button 2 will always toggle the power to the fan (and reset state)
- Button 3 will always decrease speed one at a time 3 -> 2 -> 1 -> 3
*** HOME ASSISTANT - 2021.7 new fan layout needs different config. Old config has been deprecated and no longer works.
- Do above steps (SetOption73, Rule1)
- Add Rule: (edit the MQTT publish to suit your setup)
Rule2 ON var1#State DO Publish stat/master-bedroom/%topic%/fanspeed %value% ENDON
- Activate Rule
Rule2 1
- Home Assistant configuration.yaml
Notes on fields to change:
- name (change to your device name)
- unique_id (anything unique)
- mqtt topics: replace ‘master-bedroom/bedroomfanlightswitch’ with whatever your setup uses