MQQT temperature sensor automation

hi,

I want to make a automation from a temperature sensor who send is temperature with MQQT.
I want to get a notification on my phone
the problem i’m not getting the automation to work.
I have no problem with the mqqt and getting the value in home automation.
Here is my automation , what is my problem

alias: temperature
description: ''
trigger:
  - platform: mqtt
    topic: SHT30/room
    payload: '{{trigger.payload_value_json.h > 2}}'
condition: []
action:
  - service: notify.family
    data:
      title: test
      target: {}
      message: test
mode: single

Try

alias: temperature
description: ''
trigger:
  - platform: mqtt
    topic: SHT30/room
condition: 
    condition: template
    value_template: '{{trigger.payload_value_json.h > 2}}'
action:
  - service: notify.family
    data:
      title: test
      target: {}
      message: test
mode: single

to bad that was not the solution

Can you show in MQTT-explorer what exactly you receive on SHT30/room ?

It could be that you need to convert to int, but without knowing the exact message it is difficult to tell.

alias: temperature
description: ''
trigger:
  - platform: mqtt
    topic: SHT30/room
condition: 
    condition: template
    value_template: '{{ (trigger.payload_value_json.h | int ) > 2}}'
action:
  - service: notify.family
    data:
      title: test
      target: {}
      message: test
mode: single


this is my playload

Did you try the last one ? Although with 49.x it will not trigger with test above 2 :slight_smile:
Temperature or humidity ? I think t is temperature, not h

I tried it , no luck 2 was just test nummber .
Maybe the nummber a Float it is a pretty big nummer ?

I

I think what francis is saying is that if the value is already above 2 (it’s currently at 49 in your screenshot) then it won’t trigger. it would need to go below 2 then back above 2 for it to trigger.

automations only trigger when the trigger goes from false to true.

thank you but already used other nummbers

The screenshot you posted shows the MQTT topic’s name is:

SHT30/zolder

However, in the example you posted the MQTT topic’s name is different:

    topic: SHT30/room

Is that intentional because you have more than one topic receiving similar information or it a copy-paste error?

i know i’m Dutch so did a bit of translation,

I suggest you don’t translate anything in the automation for our benefit because it can be misleading when we compare screenshots to what is posted here.

I solved it with a work around.
first i made 3 sensors in the configuration and with that sensor i made the automation.
But i stil searching for a solution.file_editor

alias: temperature
trigger:
  - platform: mqtt
    topic: SHT30/zolder
condition: '{{ trigger.payload_json.h | int > 2 }}'
action:
  - service: notify.family
    data:
      title: test
      message: "Received value is: {{ trigger.payload_json.h }}"

thanks :+1: :+1: 123 Taras that did the trick