Can I use weather forecast as a trigger?

I’ve set an automation with weather forecast as condition since I wanted it to start at a specific hour of the day. However, I’m trying to come up with a script to start my AC when temperature is over 35C - no matter the time of the day - as long as I’m at home. I’ve set up the following, but when running it manually I get no traces so I’m not sure if it will check the temperature of the forecast each hour or if it just will never run or what.

Can somebody help with this, please?

alias: Auto AC Salón On
description: Si la temperatura es superior a 35º y hay alguien en casa
triggers:
  - entity_id: weather.forecast_home
    above: 35
    attribute: temperature
    trigger: numeric_state
conditions:
  - condition: state
    entity_id: person.fran
    state: home
actions:
  - type: turn_on
    device_id: b6b57e96790cd569438a2a484e26c48e
    entity_id: b67fa34cab277cd193cb6774d0ea2249
    domain: switch
  - action: persistent_notification.create
    metadata: {}
    data:
      message: Aire de Salón Encendido
      title: Automatización Activada
mode: single

the 35 degree trigger will only fire when the temp goes above 35. it will only fire once, it will not keep triggering while above 35. It will trigger again only when it goes below 35, then back above 35.

1 Like

Numeric state triggers fire when the defined threshold is crossed, they are not checked on a specific time pattern*. So, it will fire whenever the value of your entity’s temperature attribute goes from not above 35 to above 35.

* In this specific case the weather forecast entity may only be updated every hour, so it might appear like it’s checking every hour, but that’s coincidental.

I would use a temperature sensor instead of the forecast. And to mke sure it triggers when needed, you do something like this:

alias: Auto AC Salón On
description: Si la temperatura es superior a 35º y hay alguien en casa
triggers:
  - entity_id: weather.forecast_home
    above: 35
    attribute: temperature
    trigger: numeric_state
  - trigger: state
    entity_id: person.fran
    to: home
conditions:
  - condition: state
    entity_id: person.fran
    state: home
  - entity_id: weather.forecast_home
    above: 35
    attribute: temperature
    condition: numeric_state
actions:
  - type: turn_on
    device_id: b6b57e96790cd569438a2a484e26c48e
    entity_id: b67fa34cab277cd193cb6774d0ea2249
    domain: switch
  - action: persistent_notification.create
    metadata: {}
    data:
      message: Aire de Salón Encendido
      title: Automatización Activada
mode: single

So what is taken into account for triggers is the big 31.9 °C in this screenshot that changes with time, and not the list under “hourly”?


If so I guess it should work as is :thinking:

Thanks!

what does the trigger “to: home” means in this case and how is it different from the condition? (trying to learn)

Edit: sorry, i did not see you read my post. The trigger responds to coming home, to turn it on while it is already hot. IYou need both triggers and both conditions. The triggers to notice either changing, the conditions to make sure both conditions are met, not must one.

A trigger is something happening (changing from not true to true), this is when the automation runs. The conditions test if something is a certain way (can have been true for a while). But they do not cause the automation to run.