Aqara Water sensor automation

Hello all!

I have a HA VM:

Home Assistant 2023.6.3
Supervisor 2023.06.2
Operating System 10.3

I have a ConBee II with firmware 26580700, version 2.22.02. Everything is working fine for my temp sensor, door sensor, but my water sensor are kinda… weird.

like a few months ago, I tested them so if they have water on them, the binary_sensor.namesensor_tampered is triggering normally. I could see off to On, without any problem.

I’m trying to install a new one, but this binary_sensor doesn’t work anymore… Even if I drop the sensor in the water, it’s not changing. I see the Moisture binary sensor going from Wet to Dry (true state is off to on from logs and trace). Ok Fine, I’ll use this to alert me.

The automation is triggering, but no Telegram is sent. Seems to be an issue with the trigger.to_state.name I believe, as when I remvoe it, it works
platform: state
entity_id:

  • binary_sensor.ac_bureau
    from: ‘off’
    to: ‘on’

and this is the action

service: notify.b2_telegram
data:
message: Water leak for {{ trigger.to_state.name }}
title: “ALARM: Water leak”

device_class: moisture
friendly_name: AC_Bureau
on: true
temperature: 30

I tried using trigger.entity_id using a new automation (device instead of state), this works but I want the friendly name. I don’t know why it stopped working for all my sensor.

Any help is appreciate. I’m still testing new stuff, but I’m running out of ideas :smiley:

Thanks!

Edit: here’s the automation:

alias: “ALARME: Fuite d’eau”
description: “”
trigger:

  • platform: state
    entity_id:
    • binary_sensor.ac_bureau
      from: “off”
      to: “on”
      condition: []
      action:
  • service: notify.b2_telegram
    data:
    message: Water leak for {{ trigger.to_state.name }}
    title: “ALARM: Water leak”
    mode: single

Please format your pasted config correctly for the forum. See https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371#oneone-format-it-properly-16

However your problem is that single line templates need to be enclosed in quotes.

message: "Water leak for {{ trigger.to_state.name }}"
1 Like

Thanks and sorry! :slight_smile:

Forgot to put them back on for a test. Even with them on, it’s not working. As soon as I remove the {{ trigger.to_state.name }}, the notification is beeing sent. I can see that it triggers, but no notification.

I have restarted the HA appliance, but nothing fix it. It is very strange.

Any relevant errors in Settings → System → Logs ?

Home assistant core: No issue
All the others, nothing really, only one with network UPS but I removed the addon as I am not using it.

I just tested My Alarm for my door sensor when the alarm system is on, and these one works…

  action:
  - service: telegram_bot.send_message
    data:
      message: 'Le sensor "{{ trigger.to_state.name }}" a été ouvert alors que le
        système d''alarme est actif! '
      title: ALARME

While I tried to copy it:

  action:
  - service: telegram_bot.send_message
    data:
      message: 'Le sensor "{{ trigger.to_state.name }}" a détecté une fuite de liquide'
      title: ALARME
  mode: single

If using the trigger.to_state.name, it doesn’t work. if I use: trigger.to_state.entity_name , I get something.

So I did remove the sensor, and tried again, now it works?

  action:
  - service: telegram_bot.send_message
    data:
      message: 'Fuite pour le sensor "{{ trigger.to_state.name }}" '
      title: ALARME

Now it’s working… Also, I guess the system doesn’t like apostrophe in typing text… weird as it was working before. And also, that the tampered is no longer working