Switch Automation Help

Hi

I’m having a problem with an automation not working but I can’t see what’s wrong.

I want a smart plug to turn off at 7:30am but the below doesn’t work. Can anyone please help?


- id: '1599978081786'
  alias: New Automation
  description: ''
  trigger:
  - at: '07:30:00'
    platform: time
  condition: []
  action:
  - data: {}
    entity_id: switch.bfbc4c37057cb3c354huh7
    service: switch.turn_off
  

I don’t think you need data: {}

Does it work when you trigger the automation manually?
Is the automation enabled? Meaning is it turned on when you check under Developer Tools-> States.
And I’d highly recommend changing the name of your switch, how can you work with this obscure name?

1 Like

I didn’t think so either, Nick, so I removed it. I’ve also tried with and without the ‘ in the time. No luck. Tried other switches too and still not working.

Yes it works manually when I select ‘execute’ in the UI and it’s enabled.

The name is just temporary while I test as I deleted previous automations because they weren’t working so when I get this working I’ll rename it.

If you check your logbook, is the time for your events correct?

I was talking about the name of the switch, not the name of the automation.

Yes the time is correct

Then I’m out of ideas, sorry

1 Like

Like Burning and Nick I’m a bit unsure what’s wrong here.
It’s obviously written by the GUI and you obviously need to rename your switch entity to make the automation functionality a little more obvious (switch.bfbc4c37057cb3c354huh7 to say switch.coffee_maker or whatever).
I will rewrite your automation in the traditional way and see if you have any better luck with that : -

- id: '1599978081786'
  alias: new_automation
  trigger:
    - platform: time
      at: '07:30:00'
  action:
    - service: switch.turn_off
      entity_id: switch.bfbc4c37057cb3c354huh7

Report back

1 Like

I just did something drastic to try and resolve this, I did a full clean install of HA.

I’ve added the device and followed your code and added the below but it still doesn’t work, even after a clean install:


- id: 'air_freshener_off'
  alias: Air Freshener Off
  trigger:
    - platform: time
      at: '11:05:00'
  action:
    - service: switch.turn_off
      entity_id: switch.airfresh_kitchen

It’s not just that switch. I have the same problem with other switches so it’s not a faulty switch.

Is your HA time correct ?

2 Likes

:blush: no it was an hour out. That’s sorted it now. When I checked times in the logs earlier I didn’t spot they were an hour out as I assumed that was the time each event occurred.

Something so simple…feel stupid now :blush:

Thank you.

How is HA installed.?
I’m assuming not with hassos ?
If so you need to correct your local time zone in the base OS.
If it IS hassos then you may have skipped a step during on boarding.

With hassos (installed direct to micro sd) and I’ve just changed the time zone in configuration > general configuration.

I knew it! :stuck_out_tongue: Glad that you worked it out

1 Like

Okay, can you please mark @francisp 's post as the solution (helps others searching)

I bet that’s a mistake you won’t make again :smiley: :+1:

1 Like