Sensor templating - Add integer (input_select) days to input_datetime date

I’d like to update my irrigation control in HA. I have an input_datetime (only date) which records the date of last run. Let’s call it “input_datetime.lastrun”
I also have an input_select which can be set how many days should elapse until the next operation (between 1 and 7 days)
I’d like to make a sensor which adds the input_select value to the input_datetime.lastrun date, but I can’t find out how to make the value_template.

You didn’t specify what format you wanted the final sensor to be in. For a basic date as the output, one way to do it is as follows:

{% set d = states('input_select.next_run_days') | int(0) %}
{{ (states('input_datetime.lastrun') | as_datetime | as_local 
+ timedelta(days= d )).date() }}

Thanks a lot! works fine. :slight_smile: