Indeed nice, but in my case too big. It’s a parameter that I won’t change every day.
But I found another simpler solution, a custom slider with a specific input_select :
`offset_test:
name: ''
options:
- '- 01:00'
- '- 00:55'
- '- 00:50'
- '- 00:45'
- '- 00:40'
- '- 00:35'
- '- 00:30'
- '- 00:25'
- '- 00:20'
- '- 00:15'
- '- 00:10'
- '- 00:05'
- ' 00:00'
- '+ 00:05'
- '+ 00:10'
- '+ 00:15'
- '+ 00:20'
- '+ 00:25'
- '+ 00:30'
- '+ 00:35'
- '+ 00:40'
- '+ 00:45'
- '+ 00:50'
- '+ 00:55'
- '+ 01:00'
initial: ' 00:00'
`
I created a sensor :
- trigger:
- platform: time
at: '00:00:00'
- platform: event
event_type: event_template_reloaded
- platform: homeassistant
event: start
sensor:
- name: 'Test'
unique_id: 'sensor_test'
state: >
{% set x = states('input_select.offset_test') %}
{% set y = x.split(' ') %}
{% set plusmin = y[0] %}
{% set time = y[1].split(':') %} %}
{% if (plusmin == '+') %}
{{ state_attr('sun.sun', 'next_setting') | as_datetime + timedelta(hours=time[0]|int, minutes=time[1]|int, seconds=0) }}
{% elif (plusmin == '-') %}
{{ state_attr('sun.sun', 'next_setting') | as_datetime - timedelta(hours=time[0]|int, minutes=time[0]|int) }}
{% else %}
{{ state_attr('sun.sun', 'next_setting') | as_datetime }}
{% endif %}
device_class: timestamp
It seems to work :
But after restarting HA / rebuild templates the entity’s state is unknown…
Any idea ?