Automations turning ALL switches on or off

Hi,

I’m a new user of Hass.io so apologies if this is a numpty issue! I’ve recently setup Hass.io and configured automations, however automations triggered which use switch.turn_on switch all my configured switches on, and triggered which use switch.turn_off switch all my configured switches off regardless of whether there is an automation associated with them. Some of these switches aren’t even the same type - one is a relay and the others use rf, although they are all triggered via gpio.

I’m guessing it’s a syntax issue - my automation.yaml is below:


- id: '1567706223496'
  alias: Lounge Lights On
  trigger:
  - event: sunset
    offset: -01:05:00
    platform: sun
  condition: []
  action:
  - data: 
       entity_id: switch.lounge_lights
    service: switch.turn_on


- id: '1567706494815'
  alias: Lounge Lights Off
  trigger:
  - at: 00:48:00
    platform: time
  condition: []
  action:
  - data:
      entity_id: switch.lounge_lights
    service: switch.turn_off
 
- id: '1567863697301'
  alias: Projector Screen Down
  trigger:
  - at: 00:48:00
  condition: []
  action:
    data:
     entity_id: switch.downrelay
    service: switch.turn_on

Can anyone point me in the right direction of where I’m going wrong please? I’ve tried configuring voia the GUI and by editing automations .yaml

Thanks, nbr_uk

I usually omit the empty conditions. This is what I use for action with a single switch:

action:
  - entity_id: switch.neo_coolcam_plug_3_switch 
    service: switch.turn_off

I also have grouped switches in a group then switch the group like this:

action:
  - entity_id: group.inside_lights
    service: switch.turn_off

Hi pdwonline, thanks for the quick reply.

I’ve just tried updating the format so it’s similar to yours by removing the empy conditions and the data: element but still getting the same result - triggering any of the automations turns all switches on or off respective to the automation used.

My revised code is below:


- id: '1567706223496'
  alias: Lounge Lights On
  trigger:
  - event: sunset
    offset: -01:05:00
    platform: sun
  action:
   entity_id: switch.lounge_lights
   service: switch.turn_on
    
- id: '1567706494815'
  alias: Lounge Lights Off
  trigger:
  - at: 00:48:00
    platform: time
  action:
    entity_id: switch.lounge_lights
    service: switch.turn_off
  
- id: '1567863697301'
  alias: Projector Screen Down
  trigger:
  - at: 00:48:00
  action:
    entity_id: switch.downrelay
    service: switch.turn_on

Anyone got any further ideas please? Thanks.

UPDATE! I had the feeling something wasn’t quite right so took a snapshot, installed the latest Hass.io card image and the restored most elements of my config, just not the base Hass.io install and it’s now working fine :slight_smile:

1 Like