I am not getting my head around a solution for this. I need need to change the blades on my lawn mower every four weeks.
I would like to show on my dashboard the last date the blades have been changed and days until the next change. The first one I have managed, but not the second one. Below that I would like to have a button that when being pressed asks me to input the date of change.
Any help is appreciated
I use this methodology for a number of things in my home automation - furnace filter, mower blades, etc. What I have found works best for me is:
A BUTTON helper to indicate when you last did “the thing” (changed blades, changed a filter)
A HISTORY TEMPLATE that uses the date of that button to determine how long it has been since you clicked that button and, thus, did the task
AUTOMATION to read the history template and notify me if the furnace filter has 450 hours on it - which I know because every time my furnace kicks on it fires automation to track how long it ran
It sounds complex but it isn’t. For my furnace filter button, my history template looks like this:
You can use a variation of this system and it will work quite nicely. Just be sure to make your history stats items part of your recorder config so they trap usage over time and across restarts.
Personally, before the robot mower, I was (and am) very persnickety about my mower blades, I have three blades and they get changed every 2 months and then all sharpened at the end of the season. I’m a grass snob :).
OP asked to be able to set the date that the blades were replaced, which is the same reason why I use a date helper instead of just checking the last time the button was pushed. The button can trigger an automation that sets the date helper to today.
To get the “prompt to enter the date” functionality OP mentioned, you could use a conditional card to show the the date helper if it’s be changed less than 60 seconds ago. This way, when the button is pushed it will set the date helper, which will cause it to show on the dashboard for a minute where it can be edited, if needed.
All this, fwiw, is the one use case I bother to use blueprints for. I still have to create the date helper, etc, but then I use the blueprint to configure the reminder period.
I’d add a local calendar event that repeats every 4 weeks. Then trigger a notification automation from that.
Or if you are less regular at actually changing the blades, just enter the event into the calendar when you actually change the blades with a duration of 4 weeks (no repeat). Then trigger the notification automation on the end of the event.
trigger:
- platform: calendar
event: end
entity_id: calendar.blade_change
Don’t ask me why, but after four weeks the blades are blunt as heck.
I haven’t considered the approach by @CO_4X4 which can work for me as well. So I will give it a try.
The code you posted tracks the binary_sensor.furnace_is_running if I understand the docs of history template correct but you state that the history template is tracking that button.
I don’t know if that code would work or not, I always have a sensor to indicate when it’s on or off so I’m tracking actual furnace hours (etc). You might simply point it to any device you have that’s always the same state or what I do is have helper toggles for if it’s “lawn mowing season” for stuff like that, which then drives other automation.