Rachio integration: schedule(s) completed time

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.)

Thanks for any help.

Yes! Please add this attribute for all schedules and zones.

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() }}"

image

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.

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() }}"

  - platform: history_stats
    name: Run Counter - Garden
    entity_id: switch.backyard_garden
    state: "on"
    type: count
    start: "{{ today_at() }}"
    end: "{{ now() }}"

  - platform: history_stats
    name: Run Counter - Grass
    entity_id: switch.grass
    state: "on"
    type: count
    start: "{{ today_at() }}"
    end: "{{ now() }}"

  - platform: history_stats
    name: Run Counter - Flowers
    entity_id: switch.flowers
    state: "on"
    type: count
    start: "{{ today_at() }}"
    end: "{{ now() }}"

Update Update: Not helpers… but custom:template-entity-row

type: entities
entities:
  - type: custom:template-entity-row
    name: >-
      Garden ran for {{ states('sensor.run_counter_garden')| float(0) |
      multiply(5) | round(0) }} min
  - type: custom:template-entity-row
    name: >-
      Flowers ran for {{ states('sensor.run_counter_flowers')| float(0) |
      multiply(5) | round(0) }} min
  - type: custom:template-entity-row
    name: >-
      Grass ran for {{ states('sensor.run_counter_grass')| float(0) |
      multiply(5) | round(0) }} min
  - type: custom:template-entity-row
    name: >-
      Total Run time for all stations was {{ (states('sensor.run_counter_grass')
      | float(0) | multiply(5) | round(0)) +
      (states('sensor.run_counter_garden') | float(0) | multiply(5) | round(0))
      + (states('sensor.run_counter_flowers') | float(0) | multiply(5) |
      round(0)) }} min
state_color: true
title: Water Run times