@vazma wrote:
Hey,
I have a rpi_rf switch setup and I would like to control it via my mqtt topic by sending a message with this format:
{ "data": [ { "service": "switch.bedroom_light", "entity": "switch.bedroom_light", "ingredient": "on" # OR "off" } ] }
In my configuration file I have configured the mqtt and the switch:
switch: - platform: rpi_rf gpio: 17 switches: bedroom_light: protocol: 1 pulselength: 180 code_on: 4273420 code_off: 4273411 mqtt: broker: example.broker.com
And now in the automations.yaml file I would like to add the right configuration but I cant find any example how to handle the message and match it with the right switch state.
- id: '1581790322545' - alias: 'Bedroom lights' trigger: platform: mqtt topic: 'channel/topic' action: service: homeassistant.toggle data: entity_id: switch.bedroom_light
Is there any idea how to switch the state by getting ON or OFF from the mqtt?
Cheers
Posts: 2
Participants: 2