Automation sending notification without sensor value

I have an automation that should send out a notification over Telegram when a an Ikea Air sensor goes below the value 35. I do get notifications for this sensor but the value is always empty. I would like to see the actual value, which in the UI never shows empty.

Here is the YAML of the automation:

alias: Notifications - 005B - PM2.5 level Ikea
description: Sends a notification when the PM2.5 level goes above 85 or below 35
trigger:
  - type: pm25
    platform: device
    device_id: ee08a8f36550c7ab877539bf5be67945
    entity_id: 7c115be9b729e9bdb33bd7f07b00ae61
    domain: sensor
    below: 35
condition:
  - type: is_pm25
    condition: device
    device_id: ee08a8f36550c7ab877539bf5be67945
    entity_id: 7c115be9b729e9bdb33bd7f07b00ae61
    domain: sensor
    above: 0
action:
  - service: telegram_bot.send_message
    metadata: {}
    data:
      target: <target number>
      message: >-
        PM2.5 level should be below 35. Current level {{
        sensor.ikea_air_sensor_vindriktning_pm2_5 }}
      title: 💚 Health
      ttl: 0
      priority: high
mode: single

Thanks for your help!

So what does the message say?

Actually I think the template but should be

{{ states('sensor.ikea_air_sensor_vindriktning_pm2_5')}}

image

I will try your suggestion. Thank you!

Pro tip: it’s advised to avoid device_id’s → Why and how to avoid device_ids in automations and scripts

I will look into that. Test run now shows a value, so I expect a value will show when the trigger happens also.

Thanks again!

I think you need to read the templating docs. Glad you got it fixed, and thanks for the tick.

1 Like