Multiple Humidity Sensors, automation to notify if 1 goes above X% (Newbie)

Hi, relatively new to HA and looking at trying to drive more smarts through notifications (due to my air conditioner not being smart in any way) for humidity control.

I have humidity sensors in each of my rooms, which are measuring fine and working as expected.

I would like to create a notification on my phone, that would alert me to “Room X humidity is at Y%”. which y% would be over a threshold (eg 60%).

Im sure there is a smart way of doing this, rather than creating an automation per humidity sensor. Hoping someone can shed some light on that smart way for me to dig into and learn some more.

Thank you.

For Example Only

alias: Room Humidity Notification
description: ""
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.humidity_01
      - sensor.humidity_02
      - sensor.humidity_03
    above: "60"
    for:
      minutes: "3"
  - platform: numeric_state
    entity_id:
      - sensor.humidity_01
      - sensor.humidity_02
      - sensor.humidity_03
    below: "50"
    for:
      minutes: "3"
condition: []
action:
  - service: notify.my_phone
    data:
      message: >-
        The {{ trigger.to_state.attributes.friendly_name }} is currently {{ trigger.to_state.state }}.
mode: single
1 Like

thanks very much @Coolie1101 for a super quick reply. It looks like I need to do the above in YAML and not through the UI.

I appreciate that this is an example only however due to my newbieness :P, can I confirm that this line IS correct or is it just a verbose way of saying what you mean? The rest of it I can get my head around ta.

The {{ trigger.to_state.attributes.friendly_name }} is currently {{ trigger.to_state.state }}.

Can be done via the UI as well, you will just add multiple entities for the trigger above and below the required value.

This template enables the notification to tell you which sensor triggered the automation and it’s corresponding value.

If you add my example via yaml then switch to visual editor, you will get a little more insight a to what the process / steps are, for me it’s just easier to do in yaml, as we didn’t have the visual editor when i initially started using HA, had to learn yaml the hard way.

1 Like

fantastic thank you so much. i will do it in YAML as I am not afraid of it :stuck_out_tongue: and see how it moves into the UI Editor so I can get my head around it. thanks very much for your clear and prompt responses. #legend.

1 Like

You can always start with 1 sensor, and once it does what you want you can add more sensors to the initial trigger.

Trigger 1

Trigger 2

Hi @Coolie1101, I have added it in to my automations.yaml but the notification isn’t coming through (after I reloaded automations.yaml etc).

I have only added one sensor, just so I can learn to build it out, and note that when I go into the automation UI I cant edit the message (which is fine). However, if I edit the message to just be plain text, the notification works. It doesn’t work with the template details in there. (even if I force run the automation and change the humidity threshold to be lower than current).

Any ideas?

- id: '1669250371390'
  alias: High Humidity Alert
  description: Alert when humidity is over 50%
  trigger:
  - platform: numeric_state
    entity_id:
      - sensor.harper_s_thermostat_humidity
    above: 50
    for:
      hours: 0
      minutes: 3
      seconds: 0
  condition: []
  action:
    - service: notify.mobile_app_dr_iphone_14_pro_max
      data:
        message: The {{ trigger.to_state.attributes.friendly_name }} is currently {{
        trigger.to_state.state }}.
  mode: single

Do you currently receive other notifications via the app?

If so, change the message and test.

action:
    - service: notify.mobile_app_dr_iphone_14_pro_max
      data:
        message: TEST

Also, what’s the current state of the sensor?

yes i do receive them (i have a notification to tell me when my garage door is closed).

Yep, changing it to “TEST” and forcing the run (or changing the threshold, receives that message.

something must have been bugging out mate, all good. i added the rest of the sensors, and now its working. I am not 100% sure what happened and why :slight_smile: but all good mate thanks very much again for your help.

If you could share where I could learn how to craft the message part of the above automation that would be great.

1 Like