Logo
Deta Fan Speed Controller with Light Switch
AU
Model reference: 6914HA
Deta Fan Speed Controller with Light

Available from:
Bunnings.com.au
Bunnings.co.nz





Flashed with:
Serial port

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
Template
{"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

- platform: mqtt
  name: Bedroom Fan
  command_topic: cmnd/tasmota-7540/Backlog
  state_topic: tele/tasmota-7540/STATE
  state_value_template: >
    {% if value_json.POWER2 == 'ON' %}
      Event p=1
    {% else %}
      Event p=0
    {% endif %}
  speed_command_topic: cmnd/tasmota-7540/Backlog
  speed_state_topic: tele/tasmota-7540/STATE
  speed_value_template: >
    {% if value_json.POWER3 == 'OFF' and value_json.POWER4 == 'OFF' %}
      Event s=1
    {% elif value_json.POWER3 == 'OFF' and value_json.POWER4 == 'ON' %}
      Event s=2
    {% elif value_json.POWER3 == 'ON' and value_json.POWER4 == 'ON' %}
      Event s=3
    {% endif %}
  availability_topic: tele/tasmota-7540/LWT
  payload_available: Online
  payload_not_available: Offline
  payload_low_speed: "Event s=1"
  payload_medium_speed: "Event s=2"
  payload_high_speed: "Event s=3"
  payload_off: "Event p=0"
  payload_on: "Event p=1"
  speeds:
    - low
    - medium
    - high