Recently installed RainMachine HD-12. I’m using RainMachine to manage irrigation and HA for manual control and situational awareness. Since the integration doesn’t have much in the way of built in sensors, I created a history_stats sensor to indicate how long each zone is on so I don’t need to open the RainMachine app to review.
I found that in HA, the zones that are on second and later are reporting crazy long runtimes - but only when triggered with the program. By all counts, it looks like ALL zones were being triggered simultaneously, as I observed my system start the frontyard program at 0500 and complete at 0545. HA reported one switch was on 15 mins, but the second was on 25 mins. The third was 35 minutes and the 4th was 45 minutes I looked in the rainmachine app and it showed zone 1 ran for 15 mins, zone 2 ran for 10 min, zone 3 ran for 10 min, and zone 4 ran for 10 min.
So I kicked off a manual execution of the scheduled program to make sure things were not running simultaneously (they’re not) and found that RainMachine marks the first zone as running and each subsequent zone as “pending.” Since this is the case, HA is marking all zones as on.
So, from my perspective, there are two solutions that I can do.
- I can create a different program for each zone in RainMachine. I don’t want to do this. I have 6 zones and 6 programs to resolve this issue seems a little silly.
- I can change the math in my template and/or history_stats sensor to properly reflect how long each of these zones is on. I think that if I could take the total time and then divide by the elapsed time of the previous zone, then I may be able make this work.
Now for the problems with the above solutions.
- I don’t think the first option is a proper fix - it’s an improper workaround.
- I have no idea how to change what I have to fix the reporting.
I’m using the baked-in RainMachine integration. My history_stats and template configuration is:
sensor:
- platform: history_stats
name: Front Lawn Runtime Today
entity_id: switch.front_lawn
state: 'on'
type: time
start: '{{ now().replace(hour=0, minute=0, second=0) }}'
end: '{{ now() }}'
- platform: history_stats
name: North Lawn Runtime Today
entity_id: switch.north_lawn
state: 'on'
type: time
start: '{{ now().replace(hour=0, minute=0, second=0) }}'
end: '{{ now() }}'
- platform: history_stats
name: Side Yard Runtime Today
entity_id: switch.side_yard
state: 'on'
type: time
start: '{{ now().replace(hour=0, minute=0, second=0) }}'
end: '{{ now() }}'
- platform: history_stats
name: Front Bushes Runtime Today
entity_id: switch.front_bushes
state: 'on'
type: time
start: '{{ now().replace(hour=0, minute=0, second=0) }}'
end: '{{ now() }}'
- platform: history_stats
name: Bush Sprinklers Runtime Today
entity_id: switch.bush_sprinklers
state: 'on'
type: time
start: '{{ now().replace(hour=0, minute=0, second=0) }}'
end: '{{ now() }}'
- platform: history_stats
name: Tree Sprinklers Runtime Today
entity_id: switch.tree_sprinklers
state: 'on'
type: time
start: '{{ now().replace(hour=0, minute=0, second=0) }}'
end: '{{ now() }}'
- platform: history_stats
rainmachine_convert_side_yard:
friendly_name: "Side Yard Duration"
entity_id: sensor.side_yard_runtime_today
value_template: >
{% set duration_hours = (states('sensor.side_yard_runtime_today'))|float %}
{% set duration = duration_hours * 60 %}
{{ duration|int }}:{{ '{:02}'.format(((duration - duration|int) * 60) |int) }}
rainmachine_convert_front_lawn:
friendly_name: "Front Lawn Duration"
entity_id: sensor.front_lawn_runtime_today
value_template: >
{% set duration_hours = (states('sensor.front_lawn_runtime_today'))|float %}
{% set duration = duration_hours * 60 %}
{{ duration|int }}:{{ '{:02}'.format(((duration - duration|int) * 60) |int) }}
rainmachine_convert_north_lawn:
friendly_name: "North Lawn Duration"
entity_id: sensor.north_lawn_runtime_today
value_template: >
{% set duration_hours = (states('sensor.north_lawn_runtime_today'))|float %}
{% set duration = duration_hours * 60 %}
{{ duration|int }}:{{ '{:02}'.format(((duration - duration|int) * 60) |int) }}
rainmachine_convert_front_bushes:
friendly_name: "Front Bushes Duration"
entity_id: sensor.front_bushes_runtime_today
value_template: >
{% set duration_hours = (states('sensor.front_bushes_runtime_today'))|float %}
{% set duration = duration_hours * 60 %}
{{ duration|int }}:{{ '{:02}'.format(((duration - duration|int) * 60) |int) }}
rainmachine_convert_bush_sprinklers:
friendly_name: "Backyard Bushes Duration"
entity_id: sensor.bush_sprinklers_runtime_today
value_template: >
{% set duration_hours = (states('sensor.bush_sprinklers_runtime_today'))|float %}
{% set duration = duration_hours * 60 %}
{{ duration|int }}:{{ '{:02}'.format(((duration - duration|int) * 60) |int) }}
rainmachine_convert_tree_sprinklers:
friendly_name: "Backyard Trees Duration"
entity_id: sensor.tree_sprinklers_runtime_today
value_template: >
{% set duration_hours = (states('sensor.tree_sprinklers_runtime_today'))|float %}
{% set duration = duration_hours * 60 %}
{{ duration|int }}:{{ '{:02}'.format(((duration - duration|int) * 60) |int) }}