Automation with time as the conditions!

Dear someone.

I have a problem with one of my automations config which I cannot get to work properly. It might be a small thing but I have tried manny things and right now I’m kind of stalled figuring out what’s happening.

What the automations does/should do: It reads an external sensor(thermostat) and controls two radiator values located in a big room and within a time span of 6:00 and 21:30(Or at least it should).
Everything works except when started until the clock passes midnight it simple won’t start again after 6:00 as the preset condition I made.
If I manually activated the automation it will work again until 21:30 as also set in the conditions.

The funny thing is, if let’s say the present time is 9:00, and I set the condition to be activate after 10:00 it will work but the next day it will not again. It’s like something is happening each time the clock passes 24:00!!! So the logic seems to work until the clock passes 24:00.

I also tried making other time based automations at a specific time and they too do not get active after 24:00; it’s simply weird but there properly a good reason why that I just haven’t figured out yet.

There a snipped of my configuration below. The first one is time constrained the other is not.

id: ‘xxxxx006699’
trigger:
alias: XXX1
trigger:

  • platform: template
    value_template: ‘{{ states.climate.XXXX_thermostat.attributes.current_temperature
    < states.climate.XXXX_thermostat.attributes.temperature }}’
    condition:

  • after: ‘6:00:00’
    before: ‘21:30:00’
    condition: time
    action:

  • data:
    entity_id: climate.RadiatorXXXX1
    temperature: 30
    service: climate.set_temperature

  • data:
    entity_id: climate.RadiatorXXXX2
    temperature: 30
    service: climate.set_temperature

  • id: ‘xxxxx1679807’
    alias: XXX2
    trigger:

    • platform: template
      value_template: ‘{{ states.climate.XXXX_thermostat.attributes.temperature
      < states.climate.XXXX_thermostat.current_temperature }}’
      condition: []
      action:
    • data:
      entity_id: climate.RadiatorXXXX1
      temperature: 16
      service: climate.set_temperature
    • data:
      entity_id: climate.RadiatorXXXX2
      temperature: 16
      service: climate.set_temperature

Please put the codeblock in snippets like shown in the blue banner on top of the page.

Ah sorry; I’ll do that(newbee)

`- id: ‘xxxx006699’
alias: XXX1
trigger:

  • platform: template
    value_template: ‘{{ states.climate.XXXX_thermostat.attributes.current_temperature
    < states.climate.states.climate.XXXX_thermostat.attributes.temperature }}’
    condition:

  • after: 06:00:00
    before: ‘21:30:00’
    condition: time
    action:

  • data:
    entity_id: climate.RadiatorXXXX1
    temperature: 30
    service: climate.set_temperature

  • data:
    entity_id: climate.stue_2_28
    temperature: 30
    service: climate.set_temperature

  • id: ‘xxxxx1679807’
    alias: XXX2
    trigger:

    • platform: template
      value_template: ‘{{ states.climate.XXXX_thermostat.attributes.temperature
      < states.climate.XXXX_thermostat.attributes.current_temperature }}’
      condition: []
      action:
    • data:
      entity_id: climate.RadiatorXXXX1
      temperature: 16
      service: climate.set_temperature
    • data:
      entity_id: climate.RadiatorXXXX2
      temperature: 16
      service: climate.set_temperature`

Did it have any effect? I’m not sure

Should I past the snippet in line for line or can I simply just paste it all in? That’s what I tried It dosen’t look correct.

Only start and end

is it like this?

Blockquote

  • id: ‘xxxx006699’
    alias: xxx1
    trigger:
    • platform: template
      value_template: ‘{{ states.climate.thermostat.current_temperature
      < states.climate.thermostat.temperature }}’
      condition:
    • after: 06:00:00
      before: ‘21:30:00’
      condition: time
      action:
    • data:
      entity_id: climate.radiator1
      temperature: 30
      service: climate.set_temperature
    • data:
      entity_id: climate.radiator2
      temperature: 30
      service: climate.set_temperature
  • id: ‘xxxx1679807’
    alias: xxx2
    trigger:
    • platform: template
      value_template: ‘{{ states.climate.thermostat.attributes.temperature
      < states.climate.thermostat.attributes.current_temperature }}’
      condition:
      action:
    • data:
      entity_id: climate.radiator1
      temperature: 16
      service: climate.set_temperature
    • data:
      entity_id: climate.radiator2
      temperature: 16
      service: climate.set_temperature

Blockquote

Blimey, put three of these ` at the start, and drop to a new line.

Then paste your code.

Then drop to a new line and put another three of these `

So

```
Awesome:

  • formatted code

```

Becomes

Awesome:
  - formatted code

Or like this?

Blockquote

- id: 'xxxxx006699'
  alias: xxx1
  trigger:
  - platform: template
    value_template: '{{ states.climate.thermostat.attributes.current_temperature
      < states.climate.thermostat.attributes.temperature }}'
  condition:
  - after: 06:00:00
    before: '21:30:00'
    condition: time
  action:
  - data:
      entity_id: climate.radiator1
      temperature: 30
    service: climate.set_temperature
  - data:
      entity_id: climate.radiator2
      temperature: 30
    service: climate.set_temperature
- id: 'xxxxx1679807'
  alias: xxxx2
  trigger:
  - platform: template
    value_template: '{{ states.climate.thermostat.attributes.temperature
      < states.climate.thermostat.attributes.current_temperature }}'
  condition: []
  action:
  - data:
      entity_id: climate.radiator1
      temperature: 16
    service: climate.set_temperature
  - data:
      entity_id: climate.radiator2
      temperature: 16
    service: climate.set_temperature

Blockquote

Correct now

put quotes around your "after: " condition.

Like this:

condition: time
after: '06:00:00'
before: '21:30:00'

you don’t use blockquotes for any code at all, but your formatting is still wrong if that is copied directly from your automation section in your config.

Thanks, that I didn’t see. I’ll try that out tonight and see what happens after midnight. By the way I used autogenerated code from within the automation GUI but somehow it must do it wrong.
I’ll give you a heads up tomorrow.

Weird it is mostly autogenerate code that is copy pasted in. I will take notice on your input and check it out

Sorry I meant codeblocks ofc. Not good to not sleep