I’m displaying the next sunset and sunrise using text_sensor and sun platform in esphome.
It displays in a card “Next Sunset 16:23:45”.
How do I add for example 15min to the value and display “Next Sunset 16:38:45”?
Thank you
I’m displaying the next sunset and sunrise using text_sensor and sun platform in esphome.
It displays in a card “Next Sunset 16:23:45”.
How do I add for example 15min to the value and display “Next Sunset 16:38:45”?
Thank you
Add 900 (seconds) to the time in a template.
Hi Nick,
thanks for the answer but I’m not sure where to do this
see below the snip of the yml file
https://pastebin.com/jvsNKMU9
Once again I missed the fact that we are talking about esphome, not home-assistant!
I would use elevation to approximate a time after sunset.
Do you want to turn on after sunset +15 minutes?
Hello,
Sorry for the delay. First thanks all for your replies. It’s nice to not be ignored
I probably didn’t explain myself correctly.
What I want to see in the card is the sum of the actual time + the offset.
so the sunset time is 16:
my offset is 10min
so I created a sensor in my configuration.yml
sensor:
- platform: template
sensors:
time_blinds_up:
friendly_name: "time_blinds_up"
value_template: "{{((strptime((state_attr('sun.sun', 'next_rising')|replace('T', ' ')).split('.')[0],'%Y-%m-%d %H:%M:%S')) + timedelta( hours = 00, minutes = 00 )).strftime('%a at %H:%M:%S')}}"
time_blinds_down:
friendly_name: "time_blinds_down"
value_template: "{{((strptime((state_attr('sun.sun', 'next_setting')|replace('T', ' ')).split('.')[0],'%Y-%m-%d %H:%M:%S')) + timedelta( hours = 00, minutes = 10 )).strftime('%a at %H:%M:%S')}}"
Thank you