Temperature outside limits Automation Notification

Hi,

I am trying to set up a notification to alert me when the temperature of the house goes outside of set limits.

This is my code, I am a little unsure as the Automation GUI states value template (optional)?

- id: '1576494984622'
  alias: HOUSE TEMPERATURE OUTSIDE LIMITS NOTIFICATION
  description: ''
  trigger:
  - above: '21'
    below: '20'
    entity_id: sensor.indoor_temperature
    platform: numeric_state
    value_template: '{{ value_json.SI7021.Temperature }}'
  condition: []
  action:
  - data:
      message: HEATING CONTROL FAILURE
    service: notify.mobile_app_sm_g960f
  - data:
      message: HEATING CONTROL FAILURE
    service: persistent_notification.create

image

So if the state of your entity “sensor.indoor_temperature” is the temperature you are looking for, you do not need a value_template…
If it is an attribute of your entity than try:

value_template: "{{ state.sensor.indoor_temperature.attributes.temperature }}"

See here for more examples:

Hi, I still cannot get it to trigger

Configuration.yaml

  - platform: mqtt
    name: 'Indoor Temperature'
    unit_of_measurement: '°C'
    state_topic: 'tele/sonoff13/SENSOR'
    qos: 1
    value_template: '{{ value_json.SI7021.Temperature }}'
    force_update: true

Automation.yaml

- id: '1576494984622'
  alias: HOUSE TEMPERATURE OUTSIDE LIMITS NOTIFICATION
  description: ''
  trigger:
  - above: '21'
    below: '20'
    entity_id: sensor.indoor_temperature
    platform: numeric_state
  condition: []
  action:
  - data:
      message: HEATING CONTROL FAILURE
    service: notify.mobile_app_sm_g960f
  - data:
      message: HEATING CONTROL FAILURE
    service: persistent_notification.create

This should trigger automation when value is >21 and <20?

There is also a box “For”, is that optional also?

image

Any ideas what is wrong?

Could it be that it is an MQTT sensor?

Gave up on numeric_state and went with template.

- id: '1576494984622'
  alias: HOUSE TEMPERATURE OUTSIDE LIMITS NOTIFICATION
  description: ''
  trigger:
  - platform: template
    value_template: '{{states.sensor.indoor_temperature.state | float < 18.00 or states.sensor.indoor_temperature.state
      | float > 22.00}}'
  condition: []
  action:
  - data:
      message: HEATING CONTROL FAILURE
    service: notify.mobile_app_sm_g960f
  - data:
      message: HEATING CONTROL FAILURE
    service: persistent_notification.create

This seems to be working fro me.

It seems numeric_state does not work with mqtt sensors?