First Automation Help for Complete Newb

Hello everyone, I just started on getting my HA setup on my RPI3. I’ve got everything showing up and can turn on/off my LIFX lights, see my Simplisafe alarm state, and the clients on my network (Unifi). I’m trying to understand how to get the automations to work and have tried a few different things but can’t seem to get it.

For my first automation I was just trying to set the brightness and color of all my LIFX lights at a certain time overnight. This way in the morning when a light gets turned on it will be a “normal” light.

With my current files I’m not getting any errors in my log file, but do get a message “unsupported platform: time” in my automation editor. I’ve added the following code (and commented out the time portion) and I don’t notice any different after a restart.

sensor:
 - platform: cpuspeed
 
 - platform: time_date
   display_options:
     - "date_time"
     - "time"

I tried “at” and “after” in the automation because I read that had been changed, but neither seemed to work. Here is my whole automation file excerpt.

- id: overnight_lifx_reset
  alias: Bright morning light
  #automation:
  trigger:
    platform: time
    # When 'at' is used, you cannot also match on hour, minute, seconds.
    # Military time format.
    at: '20:30:00'
  #trigger:
  #- after: '22:30'
  #  platform: time
  action:
  - data:
      brightness: 80
      color_temp: 200
      transition: 60
    service: light.lifx_set_state
    
- id: lifx_test
  alias: Lifx Dim Test
  trigger:
  - after: '20:40'
    platform: time
  action:
  - data:
      brightness: 60
      kelvin: 3000
      transition: 5
    service: light.lifx_set_state

The automatons show up on my main States screen and my “Bright morning light” automation is turned on, but it never seems to actually do anything.

Can someone point me in the right direction for getting my first automation working?

I don’t own a LIFX light so I cannot test but based on what I found here , this is the structure for the lifx_set_state statement:

  action:
    - service: light.lifx_set_state
      data:
        color_temp: 200
        brightness: 200
        transition: 180

I really don’t know how this works but, maybe, after setting the state you have to turn the light on. Perhaps concatenating services in the action section like this:

  action:
    - service: light.lifx_set_state
      data:
        color_temp: 200
        brightness: 200
        transition: 180
    - service: light.turn_on
      entity_id: light.YOUR-LIFX-ID

Keep us informed if it works. Good luck!

Your automations are fine so I am guessing that you are confused about the time trigger. It should indeed be “at” now and that is because it only triggers at exactly that time. So if you put in 20:40:00 and test at 20:41, nothing will happen until the following day at 20:40. (You can still use “after” but it works exactly like “at”.)

If you click the automation title in the States view you will get a window where you can trigger the automation manually. Does that work?

Incidentally, “brightness: 80” is not particularly bright. Maybe you want “brightness_pct: 80”.

Thanks everyone for the help. I tried to trigger the automation but nothing happened. I then realized that my lights weren’t present in my main screen. I must have done something to my configuration file, but I’m going to work on getting the lights back working and then get the automation working.

Ok I’m really excited I got this working! I think I had a combination of issues, but ultimately a restart of the Raspberry PI helped me to get this working.

I saw this thread as I was getting the same error after restarting via putty and the “systemctl” command. I never made the connection before but would use that method to restart after changing configuration files when the “home assistant restart” through the GUI was unresponsive.

I’m really excited I’ve got my first automation working even though it is very simple. I hope to build more using this as a template. Thanks again everyone for the help and to everyone that’s contributed to HA.

1 Like