On top of the automations and voice control in the last post, I also want some pre-defined light settings. Home Assistant has scenes for this. Right now I have 3 in mind:

  1. Reading light in the bedroom
    • overhead light off
    • the two lamps on at 25% brightness and turned to a warm light
  2. Night Time
    • turn off all lights in the house
  3. Nap Time
    • turn off all lights in the bedroom

Automation – Light Warmth

Before I make the first scene, I’d like to set up control of the Ikea lights warmth similar to how the brightness is set up. This will almost be a copy and paste from the configuration and automation yaml files, but with a couple tweaks.

Configuration is straight forward:

input_number:
  lamp_brightness:
    name: Bedroom Lamps Brightness
    initial: 0
    min: 0
    max: 100
    step: 5
    icon: mdi:lightbulb

  lamp_warmth:
    name: Bedroom Lamps Warmth
    initial: 450
    min: 250
    max: 450
    step: 5
    icon: mdi:weather-sunny

The min and max values can be found on States tab of the Developer Tools. Scroll down to the entity (light.kyles_lamp) and if it is on will show the following:

I also added icons to the brightness slider and the new warmth slider. There are tons to choose from here.

Now we have two sliders that we can set values for in the GUI.

Scenes

Home Assistant makes senses very simple. Define a name and the entities that you want to control along with what you want them set to, and that’s it:

- name: Reading
  entities:
    light.kyles_lamp:
      state: on
      brightness_pct: 25
      color_temp: 454
    light.mels_lamp:
      state: on
      brightness_pct: 25
      color_temp: 454
    switch.master_bedroom_switch: off

- name: Goodnight
  entities:
    light.bedroom_lamp: off
    switch.master_bedroom_switch: off
    switch.dining_room_switch: off

- name: Nap Time
  entities:
    light.bedroom_lamp: off
    switch.master_bedroom_switch: off

After a reset of HA, we have a new card and can test the scenes out:

Clicking on “Reading” turns both lamps on with dim warm lights. If the main light was at, it would also click off. Now again, reaching for your phone to set the lights when you’re ready for a nap isn’t ideal, so we might as well add Google Assistant back into things. This is as simple as making a new IFTTT Applet. Everything is the exact same as the previous post outlined, except for the URL and the Body:

URL: http://static_IP_or_DNS:8123/api/services/scene/turn_on?api_password=Welcome

Body: {“entity_id”:”scene.reading”}

Repeat for each scene with whatever activation phrase you want.

Note: I’m not a huge fan of how I made the scene for reading. Mainly because the brightness and warmth sliders that we made first do not update with the lights the same way the lights update with the slider. That means if the warmth slider is all the way to the left when the scene is triggered, the lights go from cool to warm, but the slider stays where it is. That is an awful GUI. I was hoping I could adjust the value of the sliders in the scene rather than the lights themselves, but I couldn’t seem to get it working. It is certainly possible with scripts, but not with scenes alone. I’ll save this fix for another post.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.