Simple time automation doesn't work

Hello,

I’m trying for hours now to get this simple time automation to work. It should start my heating/warm water at specific times. However, it’s not working and I don’t understand why. I made the automations with the automations builder so it should be correct. There are two simple mqtt/tasmota switches.

Problem : As soon as the time reaches the given value nothing happens.

Here’s the automation code:

- id: '1538212292570'
  alias: Heizung_1_ON
  trigger:
  - at: 04:00:00
    platform: time
  condition: []
  action:
  - alias: ''
    data:
      entity_id: switch.heizung
    service: switch.turn_on
- id: '1538212346323'
  alias: HEIZUNG_1_OFF
  trigger:
  - at: '15:59:50'
    platform: time
  condition: []
  action:
  - data:
      entity_id: switch.heizung
    service: switch.turn_off
- id: '1538212394935'
  alias: Warmwasser_ON
  trigger:
  - at: '16:00:00'
    platform: time
  condition: []
  action:
  - data:
      entity_id: switch.warmwasser
    service: switch.turn_on
- id: '1538212431658'
  alias: Warmwasser_OFF
  trigger:
  - at: '18:00:00'
    platform: time
  condition: []
  action:
  - data:
      entity_id: switch.warmwasser
    service: switch.turn_off
- id: '1538212463419'
  alias: Heizung_2_ON
  trigger:
  - at: '18:00:10'
    platform: time
  condition: []
  action:
  - data:
      entity_id: switch.heizung
    service: switch.turn_on
- id: '1538212524606'
  alias: Heizung_2_OFF
  trigger:
  - at: '18:52:00'
    platform: time
  condition: []
  action:
  - data:
      entity_id: switch.heizung
    service: switch.turn_off

and here’s the config for the switches:

switch:
  - platform: mqtt
    name: "Warmwasser"
    icon: mdi:hot-tub
    state_topic: "stat/sonoff/POWER1"
    command_topic: "cmnd/sonoff/POWER1"
    availability_topic: "tele/sonoff/LWT"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"
    retain: false
  - platform: mqtt
    name: "Heizung"
    icon: mdi:radiator
    state_topic: "stat/sonoff/POWER2"
    command_topic: "cmnd/sonoff/POWER2"
    availability_topic: "tele/sonoff/LWT"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"
    retain: false

I have this error in my log but I guess that’s just a problem with darksky

Error doing job: Fatal error on transport TCPTransport (error status in uv_stream_t.read callback)

16:43 /usr/local/lib/python3.6/site-packages/homeassistant/core.py (ERROR)

Thanks for help.

Kind regards

This looks good. Out of curiosity, have you set your latitude, longitude and time_zone attributes in your configuration.yaml file to your location?

The only other note I can think of is that you probably don’t want single quotes around your time entry :

should be:
- at: 15:59:50

That’s wrong, all time needs to be in quotes so the interpreter can differentiate between a number and a string.

@chris1 What you have for:

- at: '15:59:50'

is correct.

If none of your time based items are firing, verify that the time is set correctly in your config and in the operating system.

Interesting. None of mine do and they were generated that way by the automation tool.
Maybe it is a code hardening thing…

I’d verify they actually work. Even going with the automation editor, all it will do is create the yaml for you. It may have added quotes for you knowing that it is a common mistake.

Yes, they work.
They’ve been working for 6 months.

Then it must be adding quotes for you. And by it, i mean the automation editor when saving.

In Chris1’s case I’d say yes.
I just created a new test automation and this time the quotes were placed in the yaml file. However, when I edited the time of one of my existing ones, it left the quotes off.

Odd.

Yeah, that automation helper isn’t the greatest. It’s great for starting out. Once you get the swing of things it’s recommended to learn the yaml way. Maybe one day the editor will be rock solid.

condition: []

You don’t need that line if no conditions then can leave the condition line out.

I think that line is automatically put in there by the automation config editor.

That tool is kind of confusing. But it looks like there is some improvement since the last time I’ve seen the output of someone using it. At least now the trigger, condition, action order is logical in the resulting automation.

1 Like

It works now. Probably because the location wasn’t set. Thought that hassio takes the time information from the host system.

Thanks for all the replies
Chris

What happens to me, using the automation configurator, is that quotes are automatically added for the starting time (after: ) but not for the stopping time (before: ).
Moreover, when you change something in any of your automations, the quotes I’ve manually inserted in the stopping times are removed from every automation in the automations.yaml file!
At the end of the day, if I make any change in any automation using the configurator, I need to manually insert again the quotes in every (before: ) line of each automation.
Any other with the same problem?