Pump start
'time-only input_datetime helper called input_datetime.poolpump_start'
Pump stop
I’m using a template sensor to generate a poolpump stop time which is the start time plus a number of hours based on the season. (longer poolpump run time in summer, shorter in winter)
template:
- sensor:
- name: "poolpump_stop"
device_class: timestamp
state: >
{% set hrs = {'Spring': 6, 'Summer': 8, 'Autumn': 6, 'Winter': 4}.get(states('sensor.season'), 6) %}
{{ today_at(states('input_datetime.poolpump_start')) + timedelta(hours=hrs) }}
The automation starts the pool pump at the specified time, but is does not stop the pump, no errors are displayed.
When I plug this into the template editor:
{{ states('sensor.poolpump_stop') | as_datetime | as_local }}
I get an error
AttributeError: 'NoneType' object has no attribute 'tzinfo'
instead of getting the poolpump stop timecorrectly. So the automation starts the pump, but doesn’t stop it.
This used to work, but isn’t now. (i’m resurrecting this, I had some connection issues with the smart socket controlling the pool pump which have finally been resolved)
I tried recreating the template sensor, but there was no device class timestamp available in the gui, and the yaml version isn’t working as expected.
Some of the above is quite advanced, I didn’t write it, I got help from Taras, the original request and thread is marked as having a solution.