Hi Robert,
Thanks for sharing your setup, much appreciated!!
I’ve setup my heating in HA based on your automations. I have a total of 6 zones, each zone controls the corresponding TRVs and a main heating valve that controls the hot water flow for the heating in my apartment.
I’m having an issue with the temperature sliders as those automations don’t run because I get following error messages in the logs:
* Template variable error: 'str object' has no attribute 'timestamp' when rendering '{% set t = strptime((now().timestamp() | timestamp_local), "%Y-%m-%d %H:%M:%S").timestamp()-strptime(now().strftime("%Y-%m-%d 00:00:00"),"%Y-%m-%d %H:%M:%S").timestamp() %} {% set time_start = state_attr('input_datetime.heating_weekday_morning_start','timestamp') %} {% set time_end = state_attr('input_datetime.heating_weekday_day_start','timestamp') %} {{ time_start <= t < time_end and is_state('binary_sensor.workday_sensor', 'on')}}'
* Template variable error: 'str object' has no attribute 'timestamp' when rendering '{% set t = strptime((now().timestamp() | timestamp_local), "%Y-%m-%d %H:%M:%S").timestamp()-strptime(now().strftime("%Y-%m-%d 00:00:00"),"%Y-%m-%d %H:%M:%S").timestamp() %}'
The problem seems to be with the template condition in the adjusting temperature automations:
{% set t = strptime((now().timestamp() | timestamp_local), "%Y-%m-%d %H:%M:%S").timestamp()-strptime(now().strftime("%Y-%m-%d 00:00:00"),"%Y-%m-%d %H:%M:%S").timestamp() %}
{% set time_start = state_attr('input_datetime.heating_weekday_morning_start','timestamp') %}
{% set time_end = state_attr('input_datetime.heating_weekday_day_start','timestamp') %}
{{ time_start <= t < time_end and is_state('binary_sensor.workday_sensor', 'on')}}
Sorry but I am no expert these complex conditions so I am not sure how to fix it.
Maybe someone can put me in the right direction.
Thanks!!!
Update:
I found a solution that seems to work for now from an other post. Maybe it is useful for somebody else.
Instead of:
{% set t = strptime((now().timestamp() | timestamp_local), "%Y-%m-%d %H:%M:%S").timestamp()-strptime(now().strftime("%Y-%m-%d 00:00:00"),"%Y-%m-%d %H:%M:%S").timestamp() %}
{% set time_start = state_attr('input_datetime.heating_weekday_morning_start','timestamp') %}
{% set time_end = state_attr('input_datetime.heating_weekday_day_start','timestamp') %}
{{ time_start <= t < time_end and is_state('binary_sensor.workday_sensor', 'on')}}
I use now:
{{ now().fromtimestamp(state_attr('input_datetime.heating_weekday_morning_start', 'timestamp')).time() <= now().time() <= now().fromtimestamp(state_attr('input_datetime.heating_weekday_day_start', 'timestamp')).time() and is_state('binary_sensor.workday_sensor', 'on') }}
Changed all my automations accordingly and so far all working without errors.