Replicate Linktap (pause automation if rain is expected)

Hey guys, hope someone can help me out.

I got a Linktap to control my sprinkler system at home. I am trying to replace the functionality of it so i can control everything within home assistant and not have to bounce between the 2 apps.

i was able to schedule the watering. What i am missing is how to check to see if it is raining, then not run the automation if it is. here is a screenshot from Linktap. Any help would be much appreciated.

You’ll need that information in HA. Either via a weather integration or sensors outside your house. If it’s a weather integration with an hourly forecast, I can help you build a template. Otherwise there’s not much you can do.

hey thanks Petro! i am just using AccuWeather and OpenWeather in Home Assistant.

You’d need open weather map in hourly mode. Or you can just trust the daily prediction from accuweather.

that would be a template condition:

- condition: template
  value_template: "{{ state_attr('weather.home', 'forecast')[0].precipitation < 3 }}"

Petro,

thanks for this! so then i would just put this in my sprinkler automation.yaml? Would it check the condition before each time i have in the automation?

alias: GrassSeeding
trigger:
  - platform: time
    at: "05:00:00"
  - platform: time
    at: "08:00:00"
  - platform: time
    at: "11:00:00"
  - platform: time
    at: "14:00:00"
  - platform: time
    at: "17:00:00"
  - platform: time
    at: "20:00:00"
condition:
  - condition: state
    entity_id: input_boolean.seeding_grass_plan
    state: "on"
action:
  - service: switch.turn_on
    entity_id: switch.ad3f9228004b1200_water_switch

You’d put it as a condition in that automation.

The automation will only run if the precipitation is less that 3 whatever units you have set.

in the UI or enter it right into the yaml?

However you want to add it. It’s a template condition. The template is only the {{ .. }} portion.

thanks Petro, will try it now!!! here is the automation. it is raining here and it’s set to fire at 11am, will let you know if it works.

alias: GrassSeeding
trigger:
  - platform: time
    at: "05:00:00"
  - platform: time
    at: "08:00:00"
  - platform: time
    at: "11:00:00"
  - platform: time
    at: "14:00:00"
  - platform: time
    at: "17:00:00"
  - platform: time
    at: "20:00:00"
condition:
  - condition: state
    entity_id: input_boolean.seeding_grass_plan
    state: "on"
  - condition: template
    value_template: "{{ state_attr('weather.home', 'forecast')[0].precipitation < 3 }}"
action:
  - service: switch.turn_on
    entity_id: switch.ad3f9228004b1200_water_switch

Well, accuweather needs to be reporting a precipitation number for today and that number needs to be higher less than 3 for it to start.

You can always test the template in the template editor as well. Also, I’m not sure if your weather entitty is named weather.home.

ok will have a look. would it be able to run the automation unless there was more than 3mm in the last 12 hours or the next 12 hours? or do you think it would be easier to just check condition, and if it comes back as rainy, don’t run?

To check past information, you’d need to jump through hoops. You’d have to make a template sensor that takes predictions and stores them. Then you’d need to make a statistics sensor that sums up the history for the past 12 hours. Then you’d make a condition that looks at the “history” sensor.

ya, no, i don’t need it to be that accurate.

i guess it worked as the sprinkler didn’t turn on. Will report back after testing some more, thanks Petro!!!

I wouldn’t be so sure, make sure to check your logs and verify there aren’t errors.

will do, just on phone right now. i am not sure i re-loaded the automations though. does that template just make sure that there is less than 3mm of rain for the day?