Automation trigger and time not working

I did yaml validator and restarted the configurator, but this script didn’t work??
Do I need to add-on a time counter or something?

automation:
trigger:
platform: time
at: “08:18:00”
action:
service: switch.turn_on
entity_id: switch.light_livingroom_couch
data:
#900 seconds = 15 minutes
transition: 90

You need to post your config preserving its format - put 3 single backquotes around it.
From what I see your problem is in calling the service, it should be something like according to examples here:

action:
  service: switch.turn_on
  data:
    entity_id: switch.light_livingroom_couch
    transition: 90

sorry, I did not post the correct format, but I do have the correct format in my yaml file and it still does not work?

I did use an example from here.

automation:
  trigger:
    platform: time
    at: "07:15:00"
  action:
    service: light.turn_on
    entity_id: light.bedroom
    data:
      # 900 seconds = 15 minutes
      transition: 900

I see.
Could you post your automation that doesn’t work and also explain what that “does not work” means with as many relevant details as possible to help you further?

I just changed the code to the code below:
I entered the new time at 10:36 and did my configurator check and restarted HA just in case.
I entered the new time around 10:30 then waited until 10:36 and my light did Not turn on?
Screen shot is part of my yaml file.
image

automation:
  trigger:
    platform: time
    at: "10:36:00"
  action:
    service: homeassistant.turn_on
    entity_id: switch.light_livingroom_couch

This is also in my yaml file

and this works manually
image

and here are setting on this page
image

and this

and…

try adding

initial_state: 'true'

to your automation as per this doc

That was good advice but when my laptop turned 11:15, it did Not turn the switch on.

automation:
  initial_state: 'true'
  trigger:
    platform: time
    at: "11:15:00"
  action:
    service: homeassistant.turn_on
    entity_id: switch.light_livingroom_couch

If you call homeassistant.turn_on from development tools with your entity, does that work?

You have an extra space in front of automation that needs to be removed.

image

I think you should be using light.turn_on instead of homeassistant.turn_on. The second command is for groups, not individual lights.

Well according to this entity_id it would be switch.turn_on, although homeassistant.turn_on should work unless that functionality was removed.

1 Like

I think it’s universal.

1 Like

@AhmadK
I changed spacing but then I got this notification in UI configurator

Then when I move spacing back to original I get an “ok” in the upper right hand corner

@AhmadK
Yes, this works

and this works
image

BUT this does not work??
image

@petro
t’s a switch though, shouldn’t I use switch.light.turn_on?

@anon34565116
@petro

I just realized how does HA determine if its AM or PM. I have been doing this in the evening. Do I need to use UTC time?

could you elaborate?

that does not make sense. it should be switch OR light

I think it’s local time. What exactly did you realise? Can see no bearing with AM/PM and UTC…

You can’t have 2 automation sections. That’s your problem. You need to place your automation inside automations.yaml, which you specified in line 40.

So, your automation is never added to home assistant because of the extra space. Then when you remove the space, it’s never added because you already have an automation section.

Once you rectify that problem, the automation should work. I.E. Copy the automation into automations.yaml. Make sure you omit the word automation inside automations.yaml, otherwise you’ll have more errors. You’ll also need to add an - alias line when inside automations.yaml.

@AhmadK
I realized that in my config.yaml, when I specified the time 11:15:00 that there is no AM/PM. How would HA know if it was AM or PM? Unless I am supposed to use UTC time 23:15:00?

Correct, no bearing on AM/PM