Input_datetime and automation

Hello,

I am trying to set up a visual reminder in lovelace using an input boolean toggled by a button. what i am having difficulty with is showing the “last” time it was changed and then showing the “next” date.

I currently have it somewhat sorted out in that I created two input_datetime “helpers” these being:

  • input_datetime.fish_fed_last — date only

  • input_datetime.next_fish_feed — date only

I am using a couple automations to set the various dates.

to set the “Fish_fed_last” which seems to be working.

alias: fish_last_fed
description: ''
trigger:
  - platform: state
    entity_id: input_boolean.feed_fish
    from: 'on'
    to: 'off'
condition: []
action:
  - service: input_datetime.set_datetime
    data:
      date: '{{ (as_timestamp(now()) | timestamp_custom("%Y-%m-%d", true)) }}'
    entity_id: input_datetime.fish_feed_last
mode: single

however, to set the “next_fish_feed” I cannot seem to get this to work. no mater what I seem to try the date is never updated. I am trying to set “next_fish_feed” to be 3 days in the future. So when the input boolean is togged to off, it would then have “next_fish_feed” show 3 days into the future.

I think I am close I just cannot seem to get this last bit worked out.

If anyone has any suggestions, it would be greatly appreciated.

Thanks - Chris

Maybe the household chores automations I built are exactly what you need.

Take a look here.

After this you’ll get buttons like this in lovelace:

If the button is pressed it will ask for a confirmation that the task has been done and the remaining days till it is due and the days since it was done the last time will be updated. Also the color of the remaining days will change once the task is close to be due or is overdue. Let me know if this is what you need or you want to have more info about this.