Automation not 100% working

hi,
This automation uses 3 inputs:

  • input_boolean.scene_opstaan (when click or activated by scheduler it is morning
  • input_boolean.scene_zonop (i can simulate sun dawn and rise
  • input_select.dagtypen ( i use this for the type of day,)

Scenario 1
Dagtypen = normaal
Scene_zonop= on
Scene_opstaan is pushed , so on

This case works, basic stuff is put on and no light is turned on (scene opstaan_normaal is not executed )

Scenario 2
Dagtypen = normaal
Scene_zonop= off (so it is dark)
Scene_opstaan is pushed , so on

This case partial works, basic stuff is put on and no light is turned on (scene opstaan_normaal is not executed, while the light must be put on… )

alias: auto_scene_opstaan_test
description: ""
trigger:
  - platform: state
    entity_id:
      - input_boolean.scene_opstaan
condition: []
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: input_boolean.scene_opstaan
            state: "on"
          - condition: state
            entity_id: input_boolean.scene_zonop
            state: "on"
        sequence:
          - service: scene.turn_on
            target:
              entity_id: scene.basisvoorziening_{{dagtype}}_aan
            metadata: {}
  - choose:
      - conditions:
          - condition: state
            entity_id: input_boolean.scene_opstaan
            state: "on"
          - condition: state
            entity_id: input_boolean.scene_zonop
            state: "off"
        sequence:
          - service: scene.turn_on
            target:
              entity_id: scene.basisvoorziening_{{dagtype}}_aan
            metadata: {}
          - service: scene.turn_on
            target:
              entity_id: scene.opstaan_{{dagtype}}_aan
            metadata: {}
  - choose:
      - conditions:
          - condition: state
            entity_id: input_boolean.scene_opstaan
            state: "off"
        sequence:
          - service: scene.turn_on
            target:
              entity_id: scene.opstaan_uit
            metadata: {}
variables:
  dagtype: "{{ states('input_select.dagtypen') }}"
mode: single

are you testing this automation by pressing ‘run’? If yes, that will only run actions. It won’t run variables, so that variable will not be populated. You can only test variables when they are in your action section or if the trigger is causing the automation to run.

Hi Petro, i test this by pushing a button off/on for input_boolean.scene_opstaan
the scene responses to this action.
looks like only 1 service is executed, the first… not the second (scene.opstaan_{{dagtype}}_aan).
i can see that in the scene tab, the last activated… basisvoorziening_normaal scene is activated, opstaan_normaal not…

Ahhh, i found it…
the friendly names and id’s where not as i expected…
I used the duplicate function withe scenes sometimes, that seems to be the problem…
and the fact that i did not check the yaml code…

I am new to HA, can somebody look at this script, it works ok now, but i dont now if this workout is as efficient. Thats because i dont now how to adress an if then else within another condition…

See my choose 1 and choose 2, they have the same for the first condiotion so the second condition…

Just to bring something different to the party :partying_face:

Have you thought about using an input_select to solve your problem? I’m using an input_select with five different states, that represent my residences state (morning, lunch, afternoon, evening, night). I combine these with another input_select that represents my light mode.

Just an idea, maybe it makes things easier for you! :slight_smile:

Thanks!
I will think about the pro’s ans cons…

One of them is that i use different states at the same time in different scripts…