I have an mqtt fan which I need to control with my HA Scene. I couldn’t find a way to trigger the fan control using HA Scenes, so I thought to build an automation that detects the scene trigger and sends mqtt payload to control the fan off. Below is my automation code so far. When I trigger the scene adios I want the following automation to be run which will then publish mqtt to off my fan. So far this is not working.
- id: '1573695194342'
alias: New Automation
description: ''
trigger:
- entity_id: scene.adios
from: 'off'
platform: state
to: 'on'
condition: []
action:
- data:
data:
payload: '0'
topic: sonoff_fan/cmnd/FanSpeed
service: mqtt.publish
Spaces and indentation is very important in YAML. Here is an example from the online documentation.
automation:
trigger:
platform: state
entity_id: device_tracker.paulus, device_tracker.anne_therese
# Optional
from: "not_home"
# Optional
to: "home"
# If given, will trigger when state has been the to state for X time.
for: "01:10:05"