Humidity, window sensor with alarm

Hi
I’m very very new to this so I’m not very clued up yet. I’ve not got any equipment yet, I’m just hoping my idea will work.
So, my problem is, the kids keep leaving the bathroom window closed when they have a bath or shower, I’m wanting to setup a system where an alarm goes off when the humidity goes up and the window is closed. My idea was to use a humidity sensor, a window sensor, a ZB mini which says the bathroom light is on and some kind of buzzer/alarm.
Is this possible to do?
Thanks

Yes, that is possible.

1 Like

So Ive got everything setup and it appears to be all working correctly but I cant quite get the automation correct because I’m a noob I guess.
Its doing more or less what I want it to do but the siren (Tuya Neo) Is only sounding for about 9 seconds and i have no idea how to change it.

EDIT
Found it

It’s still not working correctly, the window has to be opened the closed for it to trigger. I’ve tried all sorts of combinations but it’s just not working how I would like it to :tired_face:

This is how someone in the HA Facebook group suggested how to do it


: '1727433561252'
  alias: Bathroom Window/Humidity Window Closed
  description: ''
  triggers:
  - type: humidity
    device_id: 16a86876790ba5f5ee928769108479e0
    entity_id: d3b1c1b89b3476a75361bd4120c7b0b7
    domain: sensor
    trigger: device
    above: 79
  - type: not_opened
    device_id: 4be3590adb65e05cd8405ebd3ee4f415
    entity_id: beb3ab850e7873afde9e72ab6d5cb7c4
    domain: binary_sensor
    trigger: device
  - type: turned_on
    device_id: d6f78d1303e43af1a99bd6313631fe60
    entity_id: 24748285b278fefdc61bb9eb92611f6a
    domain: switch
    trigger: device
  conditions:
  - condition: device
    type: is_on
    device_id: d6f78d1303e43af1a99bd6313631fe60
    entity_id: 24748285b278fefdc61bb9eb92611f6a
    domain: switch
    for:
      hours: 0
      minutes: 1
      seconds: 0
  - type: is_not_open
    condition: device
    device_id: 4be3590adb65e05cd8405ebd3ee4f415
    entity_id: beb3ab850e7873afde9e72ab6d5cb7c4
    domain: binary_sensor
  - type: is_humidity
    condition: device
    device_id: 16a86876790ba5f5ee928769108479e0
    entity_id: d3b1c1b89b3476a75361bd4120c7b0b7
    domain: sensor
    above: 80
  actions:
  - action: script.tuya_siren_zha
    metadata: {}
    data:
      ieee_id: a4:c1:38:75:8b:fa:06:d5
      melody: '7'
      duration: 30
      volume: '2'
      alarm: 'on'
      neo_siren_switch: siren_switch
      neo_melody_text: neo_alarm_melody
  mode: single

Change this part:

  conditions:
  - condition: device
    type: is_on
    device_id: d6f78d1303e43af1a99bd6313631fe60
    entity_id: 24748285b278fefdc61bb9eb92611f6a
    domain: switch
    for:
      hours: 0
      minutes: 1
      seconds: 0
  - type: is_not_open
    condition: device
    device_id: 4be3590adb65e05cd8405ebd3ee4f415
    entity_id: beb3ab850e7873afde9e72ab6d5cb7c4
    domain: binary_sensor
  - type: is_humidity
    condition: device
    device_id: 16a86876790ba5f5ee928769108479e0
    entity_id: d3b1c1b89b3476a75361bd4120c7b0b7
    domain: sensor
    above: 80

to this:

  conditions:
  - condition: device
    type: is_on
    device_id: d6f78d1303e43af1a99bd6313631fe60
    entity_id: 24748285b278fefdc61bb9eb92611f6a
    domain: switch
  - type: is_not_open
    condition: device
    device_id: 4be3590adb65e05cd8405ebd3ee4f415
    entity_id: beb3ab850e7873afde9e72ab6d5cb7c4
    domain: binary_sensor
  - type: is_humidity
    condition: device
    device_id: 16a86876790ba5f5ee928769108479e0
    entity_id: d3b1c1b89b3476a75361bd4120c7b0b7
    domain: sensor
    above: 79

You had two issues there - your switch was being triggered immediately, but the condition checks if it’s been on for 1 minute. Also, your humidity sensor was being triggered above 79 (so 80 would trigger it), but your condition was checking if your humidity is above 80, so it would stop the automation.

Someone in the HA Facebook group needs to learn that using devices for automations is a bad idea. It’s much simpler and more future proof to use entities. Read this for context.

Thank you. I’ll give it a try tomorrow :crossed_fingers:t2:

1 Like