Help with Scenes


#1

I’m trying to get a scene to work that allows me to press “Activate” and it will turn on a switch and turn off two other switches (this is working) and another scene to press activate and it will turn off a switch and turn off the other two, but only if the sun is down (this is not working). I hope someone can help. Thank you all in advance for your kind help. Here is the relevant part of my configuration.yaml file:

scene:
  - name: Patio Lights - On
    entities:
        switch.ge_45605_duplex_receptacle_switch:
            state: on
        switch.ge_unknown_type4952_id3130_switch:
            state: off
        switch.ge_14291_inwall_smart_switch_switch:
            state: off

  - name: Patio Lights - Off
    entities:
        switch.ge_45605_duplex_receptacle_switch:
            state: off
        switch.ge_unknown_type4952_id3130_switch:
            state: on
            condition: state
            entity_id: sun.sun
            state: 'below_horizon'
        switch.ge_14291_inwall_smart_switch_switch:
            state: on
            condition: state
            entity_id: sun.sun
            state: 'below_horizon'

#2

I don’t think you can use conditions in a scene. From the docs, the first line says:

You can create scenes that capture the states you want certain entities to be.

None of the examples use conditions.

I think you need to use a script - which can be used to set the scene and incorporate a condition.


#3

I ended up using automatons to accomplish my goal. Here is the solution:

- id: '1547653566488'
  alias: Patio_Lights_ON
  trigger:
  - platform: state
    entity_id: switch.ge_45605_duplex_receptacle_switch
    from: 'off'
    to: 'on'
  action:
  - service: switch.turn_off
    data:
      entity_id:
      - switch.ge_unknown_type4952_id3130_switch
      - switch.ge_14291_inwall_smart_switch_switch
- id: '1547656830216'
  alias: Patio_Lights_OFF
  trigger:
  - platform: state
    entity_id: switch.ge_45605_duplex_receptacle_switch
    from: 'on'
    to: 'off'
  condition:
  - condition: sun
    after: 'sunset'
  action:
  - service: switch.turn_on
    data:
      entity_id:
      - switch.ge_unknown_type4952_id3130_switch
      - switch.ge_14291_inwall_smart_switch_switch