I’m trying to make a simple automation that turns on ZWave switch device id 4 when triggered. And I just can’t figure out how! Feel like an idiot, really. I have chosen call_service and switch.turn_on, and in the service data I have:
{
"node_id": 4
}
But that’s not working. So can somebody please take pity in me?
Also I have a bunch of plugs in the house, and I would very much like not to write a separate automation for each of them. So is it possible to use the payload to choose which switch it should control, somewhat like this:
automation:
- alias: Turn on zwave switch 15 before sunrise
trigger:
- platform: sun
event: sunrise
offset: '-00:15:00'
action:
- service: homeassistant.turn_on
entity_id: fibaro_system_fgwpef_wall_plug_switch_1
I’ve used one of my zwave switches as an example.
You don’t trigger the device based on the node_id but instead use the entity_id from Home Assistant.
A list of your devices can be found at http://HAIP:8123/dev-state
I’m a tad confused on what the second part of your question refers to.
My main control scripts in EventGhost and Girder sends MQTT to Hass to turn on and off stuff. They go out with a topic like this:
TurnOnSwitch
And then a payload like this
Switch1
or
Switch11
What I would like to have is one automation with MQTT as the trigger, and the same topic, but which takes that identity from the payload. In otther words what switch is turned on is controlled by the payload. That of course means that I have to use the payload as variable and the have a variable in the action.
action:
- service: homeassistant.turn_on
entity_id: payload as variable
Is that possible, or do I have to make one automation for each switch, with the payload as the difference in the MQTT trigger?