#mqtt automation help

1 messages · Page 1 of 1 (latest)

shrewd wing
#

Hi evebody.
I’m trying to get the value of temperature from ispindel using Mqtt and if this value is around 19 Celsius, trigger a heater in fermentation place to increase the temperature to 20/21 Celsius.

I tried this without success

trigger: mqtt
topic: ispindel/iBigode01/temperature
payload: "{{ 'temperature:' > 20 }}"
encoding: utf-8

action: switch.turn_on
target:
device_id: 5c87152c0f0d783774d827a6b9b0d870
data: {}

Manually works..

Any help will be appreciated.

final ridge
#

You cannot use a template in the trigger like that to make a decision. You can only extract the value in the trigger and then use a condition to check if it's what you want

wraith sentinel
#

I would first create an MQTT sensor for the temperature. Then you can create any number of automation based on the state of that sensor. You also will get history data for the temperature should that be useful.

shrewd wing
#

@final ridge thanks. I can’t predict the exact value of temperature. Each one could have x.99 values and this sensor sends messages every 15 minutes.

#

@wraith sentinel Thanks.
The sensor already created.

final ridge
#

That doesn't matter. You trigger on any change to the topic and use a condition to filter what you want

shrewd wing
#

Could you give me an example ?

final ridge
shrewd wing
#

Thanks, @final ridge I managed how to do it, and now it is working like a charm 🙂

- id: '17334267'
  alias: Turn on Fermenter heater
  description: ''
  triggers:
  - trigger: mqtt
    topic: ispindel/iBigode01/temperature
    encoding: utf-8
  conditions:
  - condition: numeric_state
    entity_id: sensor.ibigode01_temperature
    above: 15
    below: 20.5
  actions:
  - action: switch.turn_on
    target:
      device_id: 5c87152c0f0d783774d827a6b
    data: {}
  mode: single