Temperature Sensore Connection lose

Hi,

so with my Automation, I get a notification every time a certain temperature is reached, that part works.

But now and then the Temperature sensor loses its connection for a short period of time, let’s say for 1 minute. After connecting back, the Automation triggers again, which makes sense since there was no Temperature for a short time.

What could I do to prevent these messages?

- id: '1653289621162'
  alias: Tempreture check
  description: ''
  trigger:
  - platform: numeric_state
    id: '1'
    entity_id: sensor.fa_kuehlhaus_ds18b20_temperature
    below: '10'
    above: '0'
    for:
      hours: 0
      minutes: 5
      seconds: 0
  - platform: numeric_state
    id: '2'
    entity_id: sensor.fa_kuehlhaus_ds18b20_temperature
    below: '0'
    for:
      hours: 0
      minutes: 5
      seconds: 0
  - platform: numeric_state
    id: '3'
    entity_id: sensor.fa_kuehlhaus_ds18b20_temperature
    above: '10'
    for:
      hours: 0
      minutes: 5
      seconds: 0
  condition: []
  action:
  - device_id: 2012d5f3253ac
    domain: mobile_app
    type: notify
    message:  {{states("sensor.fa_kuehlhaus_ds18b20_temperature")}}°C.
    title: Kühlhaus Überwachung 
  mode: single

Add a condition that checks the trigger from state:

condition:
  condition: template
  value_template: "{{ trigger.from_state.state not in ['unknown', 'unavailable', 'none'] }}"

Also I’m surprised your message works. Your message template, like all single line templates, should be quoted:

  - device_id: 2012d5f3253ac
    domain: mobile_app
    type: notify
    message:  "{{states('sensor.fa_kuehlhaus_ds18b20_temperature')}}°C."
    title: Kühlhaus Überwachung 

And a rant about using device trigger, actions or conditions: don’t.

They are a lot more difficult to repair if you ever have to replace a device (if faultylost/stolen). Where as changing entity ids are easy (you can do it in one place rather than everywhere you have used a device id). Your message action would look like this if using a service:

  - service: notify.your_mobile_notify_service_here
    data:
      message:  "{{states('sensor.fa_kuehlhaus_ds18b20_temperature')}}°C."
      title: Kühlhaus Überwachung 

You can find your notify service in Developer Tools > Services.

1 Like