Just to be clear I didn’t mean you needed to all three. Just one should do it. E.g., you don’t need entity_id
in your solution:
- platform: template
sensors:
days_kw:
value_template: "{{ ((as_timestamp(states('sensor.date') ~ ' 00:00:00') - as_timestamp(state_attr('sensor.power_yearly', 'last_reset')))/(60*60*24))|int }}"
friendly_name: 'bimonthly'
unit_of_measurement: "Days"
It will automatically find sensor.date
and know to update when it changes.