I want to broadcast the Dawn and Dusk moments in time to KNX, were I used to control main phases of lighting: Day, Evening and Night.
The KNX Time-DPT is exclusively reserved for the actual time, so I want to express Dawn and Dusk in minutes form 00:00 using DPT time_period_min
I wrote the following configuration:
pack_astro:
knx:
expose:
# Dawn in minutes after 00:00
- type: time_period_min
address: "0/4/0"
entity_id: sun.sun
attribute: sensor.sun_next_dawn
value_template: >-
{% set t = strptime(value, '%a %b %d %H:%M:%S %Z%z %Y') %}
"{{ (t.hour * 60) + t.minute }}"
This runs fine, up to the value part. When I enter a fixed value, this will be broadcasted to KNX on a read request. However I don’t get any value regarding the next_dawn, so I can’t split the time into hours and minutes either. Logs are “Error rendering value template for KNX expose sun.sun__sensor.sun_next_dawn”.
What do I wrong?