Met.no automation

Hi,

is it possible to use the met.no integration? I have not found any examples for it.
In specific I’m trying to configure my covers to go up if wind is over X km/h

Thank you!

Sure, check your sensors it created. Go to dev tools and find the weather sensors.

It probably just has one sensor and a bunch of attributes. One of them is probably wind_speed.

IF there is an attribute wind_speed, make a template sensor that extracts that attribute as its own sensor.

sensor:
  - platform: template
    sensors:
      wind_speed:
        friendly_name: "Wind Speed"
        unit_of_measurement: 'm/s'
        value_template: "{{ state_attr('sensor.weather', 'wind_speed') }}"

Now you have a new sensor called sensor.wind_speed. Use that as your automation trigger

- alias: Save the covers
  trigger: 
    platform: numeric_state
    entity_id: sensor.wind_speed
    # 45 m/s is probably a strong enough wind to take these up
    above: 45
  conditions:
    condition: state
    entity_id: cover.my_cover
    # Make sure to match this state. Or just ignore it and send the up command always. 
    state: 'down'
  action:
    # I assume 'close' is what you want....but who knows.
    - service: cover.close
      data:
        entity_id: cover.my_cover
1 Like

@jocnnor Thank you so much :pray::pray::pray:

The sensor template part I did not get. But now it makes sense :slight_smile:
For reference I am using a shelly to control my covers, so the automation looks like this:

- alias: Wind speed protection for covers (40 m/s)
  trigger: 
    platform: numeric_state
    entity_id: sensor.wind_speed
    above: 40
  action:
    - service: cover.open_cover
      data:
        entity_id: cover.shelly_shsw_25_YOURID

Thank you so much again!

Yep! Often times, if there is a sensor attribute you wish to track, create a template sensor to convert that attribute to its own sensor. Likewise, you can combine multiple different sensors states/attributes into a single sensor.

It’s not 100% needed. You could trigger on ALL state changes on the sensor with the attribute, then parse the attributes in conditions to see if you should trigger something…but that is annoying, and not scale-able should you need to change sensors in the future.

With this, you can now change to any weather sensor you want and simply update the template sensor but leave your automation the same.

1 Like

hy guys, how to make the same thing but when the actual forecast change? Thanks!