Conditional light scenes (hue) depening on the time of day. Is this the way to do it?

Hi Guys,

I’m pretty new to HA as I’m a longtime OH user. I always looked a bit at HA as I’m more familiar with Python than with Java. I am now thinking about making the switch to HA for good for various reasons. Obviously I will need to learn a new syntax for automations, so I started of completely UI based ( BTW the UI automations Editor is great!). I started off with an automation for my Hallway lights:

alias: Lichtsteuerung Flur
description: ''
trigger:
  - platform: state
    entity_id: sensor.flur_motion
    to: 'on'
  - platform: state
    entity_id: sensor.flur_motion
    to: 'off'
    for: '00:00:30'
condition: []
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: sensor.flur_motion
            state: 'on'
          - condition: state
            entity_id: sensor.period_of_day
            state: day
        sequence:
          - service: hue.hue_activate_scene
            data:
              group_name: Flur
              scene_name: Hell
      - conditions:
          - condition: state
            entity_id: sensor.flur_motion
            state: 'on'
          - condition: state
            entity_id: sensor.period_of_day
            state: night
        sequence:
          - service: hue.hue_activate_scene
            data:
              group_name: Flur
              scene_name: Nachtlicht
      - conditions:
          - condition: state
            entity_id: sensor.flur_motion
            state: 'on'
          - condition: state
            entity_id: sensor.period_of_day
            state: dawn
        sequence:
          - service: hue.hue_activate_scene
            data:
              group_name: Flur
              scene_name: Energie tanken
      - conditions:
          - condition: state
            entity_id: sensor.flur_motion
            state: 'on'
          - condition: state
            entity_id: sensor.period_of_day
            state: dusk
        sequence:
          - service: hue.hue_activate_scene
            data:
              group_name: Flur
              scene_name: Entspannen
      - conditions:
          - condition: state
            entity_id: sensor.flur_motion
            state: 'off'
        sequence:
          - service: light.turn_off
            data:
              entity_id: light.flur
    default: []
mode: restart

In short i want the hue light group flur to turn on to different scenes if there is motion and turn them off it there is no motion for 30 sec. I created a sensor.flur_motion template to combine to sensors into one.

Everything seems to be working fine. The real question here is my automation efficient or is there a much better way of achieving this.

2ndly is there a way to determine which member of the template switch actually changed its state? This way I could potentially use one automation for multiple rooms?

Are most people using the automations? Mid therm i definitely want to have a look at the python integration and or at AppDEamon.

So lots of questions thanks in advance.