Nest temperature to trigger notification

I’m trying to get a notification sent to mobiles when the measured temperature on my Nest theromstat reaches a given number.

I’ve used the folowing in a notification automation. Does this only work in an alert?

Shoudl I write the notification differently?

Thanks.

 - id: information3
   alias: TempAlertOver25
   hide_entity: False
   trigger:
    platform: numeric_state
    entity_id: sensor.hallway_thermostat_nest_temperature
    above: '24'
   condition:
    condition: state
    entity_id: group.all_devices
    state: 'not_home'
   action:
    - service: notify.everyone
      data:
       message: 'The house has reached or exceeded 25 degrees'
       title: 'Temperature Alert!'

What does your notify.everyone notification setup look like?

Also are all your devices ever ‘not_home’ this includes anything that is tracked by home assistant. If you have a smart device that HA tracks it will likely always be home and this automation will never fire.

Thanks. I have another automation to turn on our cameras that does trigger when the devices leave home, and also uses notify.everyone do I don’t think it is that.

I think the trigger isn’t triggering but I can’t figure out why.

Does the nest sensor return a string value? If so can anyone show me how to convert the above into a templated automation as I’ve not done that before.

As a bit of a long shot, try taking the quotes off your trigger value. I just looked at the docs and my automatons and they don’t use quotes. HA/YAML/etc. can be very finicky sometimes with this kind of stuff.

https://github.com/SilvrrGIT/HomeAssistant/blob/master/automation/low_battery_adam_phone.yaml#L11

See the below example.

Be sure to put your template in the template editor to test before putting it in your config. If it returns true it will trigger, false it will not.

Thank you! It was the quotes!

I guess it was returning a number but the quotes made it a string.

Many thanks.

I was wrong. The quote removal made this trigger when I set this sensor value manually. Which leads me to believe I need to use climate.nest_hallway.current_temperature but that isn’t an accepted entity. How would I use that in this automation?

Not surprised about the quotes. The code “coerces” the value of above: to be a number, so it shouldn’t matter whether or not you quote it.

You need to use the numeric_state trigger’s value_template parameter:

  - id: information3
    alias: TempAlertOver25
    hide_entity: False
    trigger:
      platform: number_state
      entity_id: climate.nest_hallway
      value_template: "{{ state.attributes.current_temperature }}"
      above: 24
    ...
1 Like

Thanks. Have popped that in and will see if it works next time we are at work. Many thanks for the assistance.

FWIW, I have a Nest thermostat, too, and my understanding is that sensor.xxx_thermostat_temperature is the same as climate.xxx.attributes.current_temperature. So, if you’re now trying to use climate.nest_hallway.attributes.current_temperature, does that mean that in your original post you should have been using sensor.nest_hallway_thermostat_temperature? (You were using sensor.hallway_thermostat_nest_temperature. Is it possible that was just a typo?)

It is very very possible. I was doing it at work when I should have been working :wink: but if this works I think I now understand the attribute and entity link in automations so it was a valuable change to make

Edit: just checked and actually it wasn’t a typo. It was what the sensor shows as in HA. I do wonder if that sensor equals the temp the nest is set to. It sounds like explicitly stating current temperature seems a less ambiguous route to go down.