Australia - Electrically Certified Hardware

After spending much more time with the Brilliant Fan Controller, and the Tasmota documentation, I think I now have a working configuration:

Firmware: Tasmota 7.0.0.4-dev

# Configure Power1 (fnId=11) as Fan power (dpId=1)
TuyaMCU 11,1
# Configure Power2 (fnId=12) as Light (dpId=9)
TuyaMCU 12,9
# Configure Dimmer (fnId=21) as Light Dimmer (dpId=10)
TuyaMCU 21,10
# Dimmer is not working with my LED driver. Limit range.
DimmerRange 100,100
# Rule: Publish speed to MQTT when using the remote control.
Rule1 on TuyaReceived#Data=55AA03070005030400010016 DO Publish esp_fan_bedroom/stat/RESULT {"Speed":1} endon on TuyaReceived#Data=55AA03070005030400010117 DO Publish esp_fan_bedroom/stat/RESULT {"Speed":2} endon on TuyaReceived#Data=55AA03070005030400010218 DO Publish esp_fan_bedroom/stat/RESULT {"Speed":3} endon
Rule1 ON
# Rule: Set speed when commands arrive from HA via MQTT.
Rule2 on Event#speed=1 DO Backlog Power1 1; TuyaSend4 3,0 endon on Event#speed=2 DO Backlog Power1 1; TuyaSend4 3,1 endon on Event#speed=3 DO Backlog Power1 1; TuyaSend4 3,2 endon
Rule2 ON
# Set HA auto discover.
SetOption19 1

HA configuration:
The light automatically appears in HA when using auto-discovery. The fan’s speed configuration is anything but straightforward, but I think I’ve covered all use-cases when using the remote control as well as HA. The automation requests the current fan state from the controller at HA startup.

fan:
  - platform: mqtt
    name: "Fan Bedroom"
    availability_topic: "esp_fan_bedroom/tele/LWT"
    payload_available: "Online"
    payload_not_available: "Offline"
    state_topic: "esp_fan_bedroom/stat/POWER1"
    command_topic: "esp_fan_bedroom/cmnd/POWER1"
    payload_on: "ON"
    payload_off: "OFF"
    speed_state_topic: "esp_fan_bedroom/stat/RESULT"
    speed_value_template: "{% if value_json is defined and value_json.Speed is defined %}speed={{ value_json.Speed }}{% endif %}"
    speed_command_topic: "esp_fan_bedroom/cmnd/Event"
    payload_low_speed: "speed=1"
    payload_medium_speed: "speed=2"
    payload_high_speed: "speed=3"
    qos: 1
    speeds:
      - low
      - medium
      - high

automation:
  - alias: "Update fan power state on start-up"
    trigger:
      platform: homeassistant
      event: start
    action:
      - service: mqtt.publish
        data:
          topic: "esp_fan_bedroom/cmnd/POWER1"
          payload: ""
      - service: mqtt.publish
        data:
          topic: "esp_fan_bedroom/cmnd/Event/speed"
          payload: ""

If anyone has a smarter or shorter way to make this all work, please share your configuration.

One piece of work is still missing: I still have to connect the blades to check if the low/medium/high speed settings are actually working with my fan.

3 Likes