YAMA - Yet Another Motion Automation (Scenes, Ambient Light and some Conditions )

Because the humidity could change from one day to another, an idea to improve the behavior would be:
First we create a sensor that generates the humidity average over last 30 minutes or last hour.

sensor:
  - platform: statistics
    name: Bath Humidity Average
    entity_id: sensor.sonoff_temp_humidity_sensor_humidity
    sampling_size: 40
    max_age:
      hours: 1
    state_characteristic: average_linear

And then we do a helper binary sensor, to compare realtime humidity and the average. If the difference jumps beyond, say, 5%, we consider it a shower event:

template:
  - binary_sensor:
      - name: "Showering"
        unique_id: showering
        device_class: motion
        state: > 
          {{( states('sensor.sonoff_temp_humidity_sensor_humidity') | float(0) ) > 
            ( states('sensor.bath_humidity_average') | float(0) + 5 )  }}

Anyways, my 2 cents. Feel free to adapt the config to meet your need.

1 Like