Sprinkler smart automation if not raining tomorrow with Meteorologisk institutt integration

Hello,
I’m trying to configure an automation to turn on garden irrigation if forecast is not rainy and keep automation as simple as possible.

I already found some topic using OpenWeatherMap in the forum but since 2019 I think hassio made lot of improvements that could make the automation more simple using Meteorologisk institutt integration.

I imagine to use a condition like this

condition: state
entity_id: weather.home
state: !rainy
attribute: forecast

But I need to set state as “not” rainy to perform the correct automation.

!rainy is not supposed to work, but would be great :slight_smile:

thanks for any suggestion!

Using the NOT condition. It is also configurable via UI.

condition:
  condition: not
  conditions:
    - condition: state
      entity_id: weather.home
      state:
        - rainy
        - pouring

Edit: If you need to make a list for the state of weather.home.

1 Like

Oh thank you, now I understand better the logic of automations.

What about the attribute? Is it necessary?

condition: not
conditions:
  - condition: state
    entity_id: weather.home
    state: rainy
    attribute: forecast

I don’t think so. Why do you want to include it?

It is prompted by the UI, I have no clue about what is suited for :slight_smile:

You might want to add a list for your condition, such as pouring, lightning-rainy, snowy-rainy.

See my edited post above.

1 Like

Regarding the state list, where can I find all the possible states of weather forecast integration?

Should be this Weather Integration.

But I am not so sure.

Edit: Sorry, I did not realize that you want a state forecast. I think you can enable a setting in the integration to get that sensor.

1 Like

Well today forecast would be enough considering that it will be cicled everyday.

Using openweathermap, does weather.home entity have a state attribute of forecast?

I found these as all possible precipitation states:
state: rainy,pouring,lightning-rainy,snowy-rainy,snowy
:+1:

Okay then you should be able to use that. Because in my Accuweather integration, I do not have it in weather.home entity.

In the Condition UI, you’ll need to pick the attribute from the weather.home.

I’m not using openweathermap, but the native home assistant weather integration, at least in Europe we got:

Meteorologisk institutt (Met.no) Integration as default integration. Unfortunately there’s no documentation.

Maybe in USA you get a different integration.

And Yes, this integration provides a state attribute of forecast but I would expect to find a number value after it (number of days) considering that it is providing 5 days forecast.

Can you give us the complete state attribute of your weather.home?

Maybe you need a template to extract tomorrow’s forecast.

As attribute (optional) the UI provides me this list:

  • temperatue
  • humidity
  • pressure
  • wind bearing
  • wind speed
  • attribution (???)
  • forecast
  • friendly name

Under attribute i have “for” value. Meant to be days?

condition: not
conditions:
  - condition: state
    entity_id: weather.home
    state: rainy,pouring,lightning-rainy,snowy-rainy,snowy
    attribute: forecast
    for: '1'

Unfortnately the UI doesn’t tells me if “for” should be a “1d” value or “01:00:00” hour value and seems to be an offset.

Can you go to Developer Tools —> States (tab) —> Type weather.home?

You’ll find a bunch of state attribute. You can copy and paste it here.

Because as far as I know, the forecast contain not only tomorrow, but also a few days after that.

temperature: 27
humidity: 55
pressure: 908.5
wind_bearing: 178.5
wind_speed: 5.5
attribution: >-
  Weather forecast from met.no, delivered by the Norwegian Meteorological
  Institute.
forecast:
  - condition: sunny
    precipitation: 0
    temperature: 28.2
    templow: 17
    datetime: '2021-07-24T10:00:00+00:00'
    wind_bearing: 188.4
    wind_speed: 12.2
  - condition: partlycloudy
    precipitation: 0
    temperature: 33.2
    templow: 22
    datetime: '2021-07-25T10:00:00+00:00'
    wind_bearing: 230.6
    wind_speed: 8.3
  - condition: partlycloudy
    precipitation: 0
    temperature: 36.1
    templow: 25.2
    datetime: '2021-07-26T10:00:00+00:00'
    wind_bearing: 133.6
    wind_speed: 10.5
  - condition: partlycloudy
    precipitation: 0
    temperature: 35
    templow: 23.4
    datetime: '2021-07-27T10:00:00+00:00'
    wind_bearing: 145.6
    wind_speed: 7.2
  - condition: sunny
    precipitation: 0
    temperature: 31.2
    templow: 20.5
    datetime: '2021-07-28T10:00:00+00:00'
    wind_bearing: 145
    wind_speed: 12.1
friendly_name: Home

Mmmm there’s a numeric precipitation value that could be used instead of text condition value?

:thinking:

condition: state
entity_id: weather.home
state: precipitation =0
attribute: forecast
for: '12:00'

if only would be possible to selet precipitation value from the forecast…

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

Can you try this? The condition will be true if tomorrow’s precipitation is less than 5.

If you go to Developer Tools → Template → Then copy paste {{ state_attr('weather.home', 'forecast')[0].precipitation < 5 }}

What do you see in the result column?

1 Like

Got “true” :sunny: :partying_face: :partying_face::green_heart: :ok_hand: :100: