I’d like to be able to get the latest “schedule completed time” (i.e. when did this schedule run and finish?") from Rachio for each of my irrigation schedules. Same for each Zone (in HA, a Switch object). I can see in the HA history logs that the zones publish On and Off events; but the state.switch.last_changed and .last_updated properties don’t seem to be updated; or else they get overwritten when HA restarts(?).
Use case: I’d like to display these on my Dashboard, along with the latest rainfall info (already have that via AmbientWeather integration!). I might even create automations to run my irrigation if “last rainfall is > N days” etc.
I know that the Rachio API publishes “schedule started” and “schedule completed” events – I can see them in a google apps script that I wrote, and I’ve captured them in a spreadsheet. I can provide more info if that’s helpful.
(But I don’t know enough about HA code to help produce this in the HA integration.)
The closest I’ve gotten was making these – but i think the time adding is off because the default for the unit_of_measurement is in h not min – i wasn’t able to change that… :
sensor:
########################
# Rachio Watering timers
########################
- platform: history_stats
name: Run Time - Garden
entity_id: switch.backyard_garden
state: "on"
type: time
start: "{{ today_at() }}"
end: "{{ now() }}"
- platform: history_stats
name: Run Time - Grass
entity_id: switch.grass
state: "on"
type: time
start: "{{ today_at() }}"
end: "{{ now() }}"
- platform: history_stats
name: Run Time - Flowers
entity_id: switch.flowers
state: "on"
type: time
start: "{{ today_at() }}"
end: "{{ now() }}"
update: As i re-reviewed the History_stats i see there is a counter, and knowing that the switch value is set on the config, i can just make a helper to math it for me based that value * the counter value in Minutes.