Met.no automation & creating sensor template

Hi,
I’m new here, so be kind :slight_smile:

I need to use the weather condition in met.no (rainy, cloudy, etc.) in order to create an automation to control my window shades.
I understand that I have to create a template sensor, so I paste the code below in my configuration.yaml:

sensor:
  - platform: template
    sensors:
      rain_check:
        friendly_name: "Condizioni meteo"
          value_template: "{{ state_attr('weather.boaria', 'condition') }}"

weather.boaria is the entity name of met.no.

Sure I’m missing something because I can’t see the new sensor, but I’m lost…

Please format your code as explained in the sticky post.

That said, did you run a command line config check, as explained here? The UI misses some common problems.

After that passed, did you restart HA?

Thank you Tinkerer.
I hope I formatted the code in the right mode.

I run a ha core check without problem, now I’ll proceed to restart HA.

EDIT: Ok, now I have an entity called 'sensor.rain_check" but it’s showing “none”…

Test the template in Developer tools -> Templates - see what it returns there.

I certainly don’t see condition as an attribute of the weather entity, the state of the weather entity is the condition.

It returns “none”.

Now I see that the condition=rainy value is present only in the forecast.
For example, if I insert “humidity” the sensor give the correct result.

How can I setup a virtual rain sensor, in order to close the shades if it’s raining?
Thanks!

It is the state of weather.boaria itself

So no virtual rain sensor needed, just use the state of the weather entity

1 Like