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 LedLink
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,157,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 VAR1 3 ENDON
ON BUTTON1#State=10 DO POWER1 Toggle ENDON
ON BUTTON2#State=10 DO POWER2 Toggle ENDON
ON POWER2#State=1 DO POWER3 ON ENDON
ON POWER2#State=1 DO POWER4 ON ENDON
ON POWER2#State=1 DO VAR1 2 ENDON
ON POWER2#State=0 DO POWER3 OFF ENDON
ON POWER2#State=0 DO POWER4 OFF ENDON
ON POWER2#State=0 DO VAR1 3 ENDON
ON BUTTON3#State=10 DO Event SetSpeed=%VAR1% ENDON
ON EVENT#SetSpeed=1 DO POWER3 OFF ENDON
ON EVENT#SetSpeed=1 DO POWER4 OFF ENDON
ON EVENT#SetSpeed=1 DO POWER2 ON ENDON
ON EVENT#SetSpeed=1 DO VAR1 3 ENDON
ON EVENT#SetSpeed=2 DO POWER3 OFF ENDON
ON EVENT#SetSpeed=2 DO POWER4 ON ENDON
ON EVENT#SetSpeed=2 DO POWER2 ON ENDON
ON EVENT#SetSpeed=2 DO VAR1 1 ENDON
ON EVENT#SetSpeed=3 DO POWER3 ON ENDON
ON EVENT#SetSpeed=3 DO POWER4 ON ENDON
ON EVENT#SetSpeed=3 DO POWER2 ON ENDON
ON EVENT#SetSpeed=3 DO VAR1 2 ENDON

Enable rule with Rule1 1

Description: SetOption73 Decouples the buttons and relay The VAR1 can be thought of as “NextSpeed”, 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 and4 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
  • Button 3 will always decrease speed one at a time 3 -> 2 -> 1 -> 3

Home Assistant

- platform: mqtt
  name: Bedroom Fan
  state_topic: tele/tasmota-7540/STATE
  command_topic: cmnd/tasmota-7540/POWER2
  state_value_template: "{{ value_json.POWER2 }}"
  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 SetSpeed=1
    {% elif value_json.POWER3 == 'OFF' and value_json.POWER4 == 'ON' %}
      Event SetSpeed=2
    {% elif value_json.POWER3 == 'ON' and value_json.POWER4 == 'ON' %}
      Event SetSpeed=3
    {% endif %}
  availability_topic: tele/tasmota-7540/LWT
  payload_available: Online
  payload_not_available: Offline
  payload_low_speed: "Event SetSpeed=1"
  payload_medium_speed: "Event SetSpeed=2"
  payload_high_speed: "Event SetSpeed=3"
  payload_off: 'OFF'
  payload_on: 'ON'
  speeds:
    - low
    - medium
    - high