Trying to do simple group automation switch turn on. Using a group so as not to turn on all switches.
currently have 4 switches only want 3 to turn on. so made a group with only those 3 in it. Yet when calling in automation it turns on all. Soon will be adding a motorized ball valve to control water to a stock tank. This valve will controlled by a switch. Applying power to valve opens water flow , no power no flow. I do not want this to turn on unless specifically called.
here is automation file
id: ‘1555551462981’
alias: Night Lights On
trigger:
event: sunset
offset: -00:15:00
platform: sun
condition:
condition: state
entity_id: group.night_lights
state: home
action:
service: switch.turn_on
id: ‘1555551692314’
alias: Night Lights Out
trigger:
at: ‘22:30:00’
platform: time
condition: []
action:
service: switch.turn_off
here is group file:
night_lights:
name: Night Lights
entities:
- switch.driveway
- switch.ext_house
- switch.barn_exterior
ive messed with this till my head hurts. cant see any reason not working correctly.
First of all, you need to format the code section properly - as you’re new to this you should still have the blue bar at the top explaining how to do that.
In case you switched it off already, try this:
Without it, it’s hard to get to the bottom of it.
Nevertheless, I’m surprised that anything turns on, actually.
The reason is that you seem to call a service (service: switch.turn_on) without defining which entity you actually want to turn on or off.
This would notmally be something like:
id: ‘1555551462981’
alias: Night Lights On
trigger:
event: sunset
offset: -00:15:00
platform: sun
condition:
condition: state
entity_id: group.night_lights
state: home
action:
service: switch.turn_on
id: ‘1555551692314’
alias: Night Lights Out
trigger:
at: ‘22:30:00’
platform: time
condition: []
action:
service: switch.turn_off
Ive have tried following the format of entity_id after service call, but errors.
I have followed many hassio links regarding switches ,groups, automations . scripts. arrgghh. lol.
Yes your suggestion worked. I didnt have condition and state in previous code. But all is working now.
Feel alot more confident now about wiring in water valve.
Thanks