yes, thats what I was trying to say, and what was the benefit over it compared to a binary template sensor I made, which triggers twice a day (and needs the extra to: 'on'
because of that)
no it wasn’t the issue of triggering at daystart…
the challenge was/is to check whether the conditionas are met for the pond pumps to alternate (opposed to both of them being always on)
they need to be alternating either when it is below 6 degrees, or when the sun is down. And survive restarts.
an automation with a ‘while’ construct I made at first doesn’t survive restarts, so now I use these 3 small automations:
1 to set alternating mode, and turn-off 1 switch (so the next automation only needs a toggle service, triggered by the binary sensor checking the temperature and daylight condition
2 to actually toggle, and is triggered by the day change and your noon template (needed in longer periods of cold)
3 to leave alternating mode and turn on both of them again
btw, your suggestion to use
state_attr('sensor.astral_solar_noon', 'today')
works fine, and I am trying to understand why it is better than using states('sensor.astral_solar_noon')
which renders the same result, only without the T.
Having seen several other issues with that resulting in incorrect frontend representation of the timestamp, we had to cure that adding .isoformat()
, making it a true datetime.datetime object
I ask because the states show the attributes With the T…
while the templates show:
and yes, adding that to the {{state_attr('sensor.astral_solar_noon','today')}}
results in the correct time with the T
solar_noon:
value_template: >
{{states('sensor.astral_solar_noon')}}
device_class: timestamp
solar_noon_today:
value_template: >
{{state_attr('sensor.astral_solar_noon','today')}}
device_class: timestamp
solar_noon_today_iso:
value_template: >
{{state_attr('sensor.astral_solar_noon','today').isoformat()}}
device_class: timestamp
in frontend (atop is the astral sensor from your integration):