Improving Light Automation

I have a hallway in my house that has no natural light, just doors off it. I’ve installed an Everything Presence Lite and a Hue light. I’ve got the automation working correctly, but cannot see how to enhance it. I’ve used the ‘create automation’ in settings/automations. What I’ve got working is light comes on at 22:00 at 4% brightness. At 06:00 and until 22:00 if presence is detected it turns the light on at 60%. Once no presence detected it is turned off.

I have three very simple automations (Hall_Light_Day_Presence, Hall_Light_Day_nopresence and Hall_Night On). They seem to work just fine, however, the way I have done it I can only control the light On, Off and % brightness. I’d really like to be able to change colour as well. I think(?) I might be able to edit the YAML to add the colour but is that the best way? As I went down the route of using the menus I was reluctant to then edit the YAML but very happy to take advice.

Any recommendations would be appreciated.

Can we see the yaml for what you’ve got?

Here are my three automations, there did not seem to be an option for colour using the graphic interface, I’m guessing I could key it into the YAML if there is an option:

alias: Hall_Light_Day_Occupied
description: ""
triggers:
  - type: occupied
    device_id: bebdbb39c75d237c77c2429ed96f7137
    entity_id: 51cc16d7d74eefc7f7c3ff475f93b725
    domain: binary_sensor
    trigger: device
conditions:
  - condition: time
    weekday:
      - sun
      - mon
      - tue
      - wed
      - thu
      - fri
      - sat
    after: "06:00:00"
    before: "22:00:00"
actions:
  - type: turn_on
    device_id: 377a661f8f1a1c50aea667e3e9a178d5
    entity_id: b02bcd0c97b5c723eaf52b030697cc3e
    domain: light
    brightness_pct: 60
mode: single

alias: Hall_Light_Day_Unoccupied
description: ""
triggers:
  - type: not_occupied
    device_id: bebdbb39c75d237c77c2429ed96f7137
    entity_id: 51cc16d7d74eefc7f7c3ff475f93b725
    domain: binary_sensor
    trigger: device
conditions:
  - condition: time
    after: "06:00:00"
    before: "22:00:00"
    weekday:
      - sun
      - mon
      - tue
      - wed
      - thu
      - fri
      - sat
actions:
  - type: turn_off
    device_id: 377a661f8f1a1c50aea667e3e9a178d5
    entity_id: b02bcd0c97b5c723eaf52b030697cc3e
    domain: light
mode: single

alias: Hall_Night_on
description: ""
triggers:
  - trigger: time
    at: "22:00:00"
    weekday:
      - sun
      - mon
      - tue
      - wed
      - thu
      - fri
      - sat
conditions: []
actions:
  - type: turn_on
    device_id: 377a661f8f1a1c50aea667e3e9a178d5
    entity_id: b02bcd0c97b5c723eaf52b030697cc3e
    domain: light
    brightness_pct: 4
mode: single

Ok, you’re using device actions so you’re not gonna see the colour options.
I don’t blame you because it’s described as a “great way to start” in the UI, but doesn’t really mention that it’s very simplified.

Read this to understand why you should be using state actions instead.
When you’re done, have a look at this post of mine showing the difference in options between device & state actions

1 Like

Thanks you for this. I’ve had a look through the two referenced posts and need to work through them some more.

In the meantime I had a look at some other automations I have, mainly turning Hue lights on with Hue switches. They’re all Device related, I have some work to do to ‘correct’ them all. May take a few days to get it clear in my mind and make the changes.

1 Like

I have a hallway and have it set up fairly similar to yours.

Except that I use scenes for each of the conditions daytime, night and off

In the case of the hallway the off scene isn’t that useful since it could only ever be one setting, however it’s a pattern I use for all my rooms, so in those cases I can turn off multiple lights by activating the off scene.

Anyway, using scenes means that I never need to edit the automations just to change how the scene looks - I can open the scene “live edit” mode and setup all the lights how I want them (color / brightness) then just save the scene.

TL;DR - I don’t ever change lights directly, from any of my automations I always activate scenes.


PS I actually go one step further than this and have a input select for each room with all the scenes for that room listed, as that way I know which scene is currently active.

So the actual sequence I use is:

  • Sensor event happens.
  • An automation runs which changes the “room scene” input_select.
  • An automation (on the input_select) runs which activates a scene.
  • The scene actually changes the light.

PPS I also have another text input which remembers the last “not off” scene so that I can toggle lights on/off easily (toggle between the last scene and off).