abhaypawar
(Abhay Pawar)
August 21, 2019, 8:04am
1
Hi,
Need help to trigger a switch on receiving an MQTT message.
- alias: 'Presence TestRoom'
initial_state: true
hide_entity: true
trigger:
platform: mqtt
topic: home/TestRoom/prez
payload: '1'
condition:
condition: time
after: '18:00:00'
before: '23:30:00'
action:
service: switch.turn_on
entity_id: switch.bedroom_light
This automation isn’t working.
Appreciate your help.
Abhay
Not sure you can do it like that.
I have a MQTT sensor that is updated by a MQTT message and I check for the state of that to change as a trigger and then send the notification or whatever you want to do…
abhaypawar
(Abhay Pawar)
August 21, 2019, 9:14am
3
Thanks @DavidFW1960 , used your guidance to write a different automation, and it works like a charm.
Appreciate your help.
1 Like
tom_l
August 21, 2019, 9:21am
4
You should be able to do it like that. See the example here: https://www.home-assistant.io/docs/automation/trigger/#mqtt-trigger
Perhaps it was just that you had quotes around the payload, making it a string instead of a number.