Where is the OWM precipitation probability value?

According to this post, the probability of precipitation has been added to OWM. I have signed up and created an account, and using curl, I can get the daily.pop value just fine.

However, the probability is no longer among the entities provided by the OWM integration, and I’ve even recreated the integration.

Any idea how to get this value back?

You can get it with the weather.get_forecasts service call. You can create a template sensor if you want it provided in an entity.

Oh cool, yes, I could find it there.

But I am now poking blindly at it and not making progress. I tried adding a template sensor (a helper, right?) like it says in the examples, but I cannot figure out how to associate an action with it. The UI doesn’t let me switch to YAML mode, and so I don’t know how/where to define the trigger, and action to populate the response variable, so I have no idea what to use as the template string:

I would greatly appreciate further hand-holding! Thank you! m

The example template in the docs cannot be made in the GUI unfortunately. You’ll have to add it to configuration.yaml.

Ah, that makes more sense. But is there a way to do this via the UI too?

Create a trigger template sensor: no. Use actions to get at the result without using the sensor inbetween, for instance in automation editors: somewhat. It is wise to still have the file editor or Studio Code addon to have access to configuration files. Moving things to the UI happens steadily, but it is a work in progress.

Thank you, I got it working!

1 Like

Can you post your template because I am racking my brain as to why I cannot get my template to work:

template:
  - trigger:
      - platform: time_pattern
        hours: /1
    action:
      - action: weather.get_forecasts
        data:
          type: hourly
        target:
          entity_id: weather.forecast_bennett_ranch
        response_variable: hourly
    sensor:
      - name: Temperature forecast next hour
        unique_id: temperature_forecast_next_hour
        state: "{{ hourly['weather.forecast_bennett_ranch'].forecast[0].precipitation_probability }}"
        unit_of_measurement: %

When use the above code, I receive an error: ‘UndefinedError: ‘hourly’ is undefined’

Sure:

- trigger:
    - platform: time_pattern
      hours: 3
    - platform: mqtt
      topic: debug
      payload: forecast
  action:
    - service: weather.get_forecasts
      data:
        type: daily
      target:
        entity_id: weather.openweathermap
      response_variable: daily
  sensor:
    - name: Precipitation forecast in the next 24h
      unique_id: precipitation_forecast_next_24h
      state: "{{ daily['weather.openweathermap'].forecast[0].precipitation }}"
      unit_of_measurement: mm
    - name: Precipitation probability in the next 24h
      unique_id: precipitation_probability_next_24h
      state: "{{ daily['weather.openweathermap'].forecast[0].precipitation_probability }}"
      unit_of_measurement: '%'

So I must be doing something wrong because I receive the following error:

HA created the sensors, but the result is unknown.

The template editor in developer tools is used for templates only, not yaml code. Just the stuff inside, and including, the curly braces.

Anything outside of the curly braces is just passed to the output as text. Which is why the action isn’t performed and the variable hourly is not defined.

Regarding your sensors showing as unknown: this is expected until they are triggered for the first time. Which, according to your trigger, will be at either 3am every morning or when the message forecast is published to the debug topic on your mqtt server. You could go to developer tools → actions and publish that message with the mqtt.publish action. Then your sensor should update.

1 Like