Q; Strange Time Shift in Automation Triggers

Hi !

I have these triggers to turn on and off radiator valves during work days/working hours. Basically they are made to keep the higher temperatures at work time and lower one in evening/night time. Hass installed on Pi3 in docker and display the correct time in all logs. After all, it looks there is a time shift for several hours. Time zone is set in configuration.yaml. During weekends everything works fine since there is the only low-temperature setting, valve opens and close to keep correct temperature range.

Thanks in advance for any help.

- id: radiator_valve_room_001_on_workdays_daytime
  alias: 'Radiator Valve Room 001 on - Wroking Days Daytime'
  trigger:
    - platform: numeric_state
      entity_id: sensor.temperature_eo_temp_sensor_tk_lc_sr04
      below: '21'
  condition:
    condition: time
    after: '07:00:00'
    before: '18:00:00'
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
  action:
   service: switch.turn_on
   entity_id: switch.eo_switch_itrv


- id: radiator_valve_room_001_off_workdays_daytime
  alias: 'Radiator Valve Room 001 off - Working Days Daytime'
  trigger:
    - platform: numeric_state
      entity_id: sensor.temperature_eo_temp_sensor_tk_lc_sr04
      above: '21.5'
  condition:
    condition: time
    after: '07:00:00'
    before: '18:00:00'
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
  action:
   service: switch.turn_off
   entity_id: switch.eo_switch_itrv
   
  
- id: radiator_valve_room_001_on_workdays_nighttime
  alias: 'Radiator Valve Room 001 on - Working Days Night Time'
  trigger:
    - platform: numeric_state
      entity_id: sensor.temperature_eo_temp_sensor_tk_lc_sr04
      below: '18'
  condition:
    condition: time
    after: '18:00:30'
    before: '06:59:30'
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
  action:
   service: switch.turn_on
   entity_id: switch.eo_switch_itrv


- id: radiator_valve_room_001_off_workdays_nighttime
  alias: 'Radiator Valve Room 001 off - Working Days Night Time'
  trigger:
    - platform: numeric_state
      entity_id: sensor.temperature_eo_temp_sensor_tk_lc_sr04
      above: '18.5'
  condition:
    condition: time
    after: '18:00:30'
    before: '06:59:30'
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
  action:
   service: switch.turn_off
   entity_id: switch.eo_switch_itrv

Does the timezone in the configuration.yaml agree with the timezone setting in the UI under Configuration/General?

Yes, both same.
Check configuration returns OK.
Is it possible Automation parser don’t understands time notation?

From logbook:

#### April 21, 2020

12:58:43 AM
[ Radiator Valve Room 001 off - Holidays ](http://***/logbook#) turned off

12:58:43 AM
[ Radiator Valve Room 001 on - Holidays ](http://***/logbook#) turned off

12:58:43 AM
[ Radiator Valve Room 001 off - Working Days Night Time ](***/logbook#) turned off

12:58:43 AM
[ Radiator Valve Room 001 on - Working Days Night Time ](http://***/logbook#) turned off

12:58:43 AM
[ Radiator Valve Room 001 off - Working Days Daytime ](http://***/logbook#) turned off

12:58:43 AM
[ Radiator Valve Room 001 on - Wroking Days Daytime ](http://***/logbook#) turned off

12:58:43 AM
[ Check is working hours ](http://***/logbook#) turned off

You aren’t triggering on time, you are triggering on temperature. Specifically crossing temperature boundaries.

E.g

When a workday starts if the temperature is already below 21 at 7am it will not trigger the switch to turn on.

The trigger is caused by the temperature falling from above 21 to below. If it’s 18 because of the night automation it won’t trigger at 7am.

Solution: don’t use numeric state triggers. Use any state change of the temperature to trigger, then add the temperature desired to your time conditions.

Alternatively add time triggers to your existing triggers and add temperature conditions to your existing conditions.

1 Like

OK, thanks, corrected, now will see if I did it correctly.