irrigation_unlimited icon indicating copy to clipboard operation
irrigation_unlimited copied to clipboard

Use a better available weather service source in examples

Open tbaumann opened this issue 2 years ago • 8 comments

I love what WeatherUndergrond is doing. But there are alternatives that don't require you to run your own weather station.

May I suggest you change your examples to use OpenWeatherMap or Meteorologisk institutt (Met.no) which are used by default or at least give you easy access to the API.

tbaumann avatar Dec 08 '21 15:12 tbaumann

I second this request!

For OpenWeatherMap, looking at https://github.com/rgc99/irrigation_unlimited/blob/master/packages/irrigation_unlimited_adjustment.yaml example, we should probably be able to replace sensor.wupws_preciptotal with sensor.openweathermap_rain, sensor.wupws_temp with sensor.openweathermap_temperature, but I am not sure how to get sensor.wupws_preciprate equivalent.

dmascord avatar Dec 13 '21 02:12 dmascord

I am not a big fan of WU but it was one of the services that my PWS would feed and could get it back. However, my PWS died a few of weeks ago and it's replacement has a 'custom' weather service it can feed. I have pointed this to my syno NAS and with a little php magic is it now feeding a mysql/mariadb database. From there you can use the built-in HA mysql integration to do all sorts of data mining and best of all, no cloud involved. I am in the process of unwinding the WU integration.

I have installed OWM but waiting for some rain to check the data - due late next week. Temperature should be easy but rainfall could be a challenge.

rgc99 avatar Dec 18 '21 02:12 rgc99

I have exactly the same challenge in Marrakech. 😂

tbaumann avatar Dec 18 '21 10:12 tbaumann

Hi guys,

Any update on this?

Cheers,

Damien

dmascord avatar Jan 27 '22 22:01 dmascord

I setup OWM in the onecall_hourly mode. Temperature should be a straight swap out for the OWM sensors. It looks like you get the rain for the last hour whereas WU gives you a daily cumulative total. Rather than taking a max value for the day it might work as an average, i.e. hourly average value * 24. Could probably also use the last hour rain sensor as the preciprate to check if it is currently raining. Just need to check if it is greater than zero.

rgc99 avatar Jan 29 '22 01:01 rgc99

Struggling to get the daily rainfall from OWM. It gives rainfall for the last hour but very difficult to translate this to the daily accumulated total. For the record OWM has the daily rainfall as a premium paid product so maybe this is by design. Anyone have any luck with rainfall?

rgc99 avatar Feb 10 '22 04:02 rgc99

What I have done at the moment is to use the forecast over the next 4 days, to determine whether or not I should water

sensor:
  - platform: template
    sensors:
        rainy_day:
            friendly_name: "Rain in next 4 Days"
            value_template: >-
                {% set p0 = state_attr('weather.openweathermap', 'forecast')[0].precipitation_probability > 50 %}
                {% set p1 = state_attr('weather.openweathermap', 'forecast')[1].precipitation_probability > 50 %}
                {% set p2 = state_attr('weather.openweathermap', 'forecast')[2].precipitation_probability > 50 %}
                {% set p3 = state_attr('weather.openweathermap', 'forecast')[3].precipitation_probability > 50 %}
                {{ 'Yes' if p0 or p1 or p2 or p3 else 'No' }}

automation:
    - alias: Rainy days in future
      trigger:
        platform: state
        entity_id: sensor.rainy_day
        to: 'Yes'
      action:
        service: irrigation_unlimited.disable
        data: { entity_id: binary_sensor.irrigation_unlimited_c1_m }
    - alias: No rainy days in future
      trigger:
        platform: state
        entity_id: sensor.rainy_day
        to: 'No'
      action:
        service: irrigation_unlimited.enable
        data: { entity_id: binary_sensor.irrigation_unlimited_c1_m }

This isn't the most elegant way of doing it, but it seems to function for me :)

Looking into the cumulative historical rain with OWM, it is probably something that can be achieved using SQL (untested, just an idea):

sensor rainsensor_yesterday:
  platform: sql
  scan_interval: 86400
  queries:
    - name: rainsensor yesterday
      query: "SELECT SUM(state) AS value FROM states WHERE entity_id='sensor.openweathermap_rain' AND state!='unknown' AND datetime(last_changed) BETWEEN datetime(date('now', '-1 days')) AND datetime(date('now'));"
      column: 'value'
      unit_of_measurement: 'mm'

dmascord avatar Feb 24 '22 00:02 dmascord

Hi, I am in the same situation apparently :) I am wondering, what does the "sensor.wupws_preciprate" provide as output? My idea is to try to create a template sensor that return the same result based on available info (if there are any).

Thanks :)

SeLLeRoNe avatar Aug 20 '22 11:08 SeLLeRoNe