Using template to trigger automation not working

I’m probably getting confused between triggers and conditions, however I’m stuck

I have a centralised ventilation system with built in humidity sensor and I have a humidity sensor directly in my bathroom. I want the ventilation system to increase to abot 90% of the power when the humidity is above ‘normal’
What I define as normal is when the humidity of the ventilation system (itho) is bigger or equal to the humidity sensor in bathroom - x%
For the test I have made this value in the formula bigger so the evualtion of the template always comes out as true. I have validated the template in the developper and it comes out a boolean True

The automation has never actually triggered the actions though, so not sure what I’m missing

alias: "Test humidity "
description: ""
trigger:
  - platform: template
    value_template: >-
      {{states('sensor.itho_wifi_nrg_itho_ac88_nrg_itho_ac88_humidity')| float
      >= states('sensor.badkamer_humidity')| float - 15 }}
    for:
      hours: 0
      minutes: 2
      seconds: 0
    id: Test sensor true
    enabled: false
condition:

action:
  - alias: Notification to a54 for fan to 90
    service: notify.mobile_app_sm_a546b
    data:
      message: test humidity above value
      title: "test humidity "
  - wait_template: ""
    continue_on_timeout: true
    timeout: "00:01"
  - alias: notification to a54 for fan back to 33
    service: notify.mobile_app_sm_a546b
    data:
      message: fan back to value
      title: "fan back to value "
mode: single

In order for it to fire, the template’s evaluation must change from false to true. If the template is already true when the automation is saved or loaded it will not fire until the evaluation changes to false then back to true.

in a centralized system does this not seems to be a good idea, as the humidity in a bathroom often is higher than in the rest of the rooms, so
The humidity in the bathroom, will most of the time exceed(be higher) than the rest of the house, including in the ventilation-system

It Wont start because when you take a hot shower the humid in the bathroom is way higher, than in the ventilation-system, thats what its there fore, to evacuate humid from rooms where it’s higher
or , how does your equation look like ?

Sorry , i’ve just never seen a “logic” like this, normally a ventilation should start when i.e humid raise above a certain value, NOT compared to any other places, if 80% in the bathroom evacuate, don’t wait until the humid in the ventilation system increases, it’s the humid in the bathroom you want to keep on a steady level, not pending alot, The Pending raise/falls is the most damaging

You also disabled the only trigger you have?

I understand why my explanation sounds confusing, let me try and explain a bit more.

The humidity in the house varies between summer, autumn, winter, hence an absolute value doesnt work. e.g. 3 weeks ago it was dry here and humidity was around 50% in the house, right now the humidity is around 60%

The positioning of the sensors themselves are important to understand in the reason why I choose this solution, however I’m open for other ideas as well. The bathroom sensor where I deduct 15% of is located close to the floor and is one of my tado switches on my radiator. The sensor in the itho is connected to a ventilation hole right above my shower in a close showercabin almost closed till the ceiling. this means that when the itho is strongly increasing in humidity in a short period of time the fan should increase in speed. I would then use a 15 minute wait_template timer to lower the fan back to normal speed.

Does this make more sense?

good catch, however this was merely because I was fiddeling around and I have tested with an activated trigger to no avail

Yes, it does even here, and i guess everywhere, and (atleast my intentions" is to keep it fairly steady, in specific in the bathroom, laundryroom)( so it doesn’t spread to the rest of the house, before the ventilation kicks in)
So lets say

When you start your shower, the humid will increase rapidly, And this is the only sensor you have to rely upon, if you want to evacuate the humid from the shower, regardless whether it’s 50-60% or whatever in the rest of the house, this sensor above your shower will instantly, pop-up to i.e 80+ … Meaning when it does, then evacuate( increase speed of your ventilation at starting at i.e 70-75% humid.
( But ofcause you know your house better than any )

I only increase speed, or start a specific ventilator(in i.e laundry-room), when humid increases there, no matter if it’s because of “states” i causes(shower/laundry), or other “out-side” circumstances.
Bathroom/Laundry starts at 70, regardless what the humid is in rest of the house, ventilation-system or outside.

If your “floor-humid-sensor” ( which actually will be affect by your hot shower ) is say 55% ( i live in a wooden house, so that’s current value, this rainy season, 65% at mid-level )
So your “floor-sensor” is 55%, fairly low in my opinion(i like a relative higher level of humid, better for my health )
55-15=40, the rest of the house(and at your itho raises to lets say 55-60% ( 60 IS >= 40 THEN Increase speed to 90 ) ?, for what reason ?
PS: even 45% humid(at your itho) is higher than 40

Valid point to focus on humidity increasing instead of offset against another sensor.

How would a formula look like to measure substantial change in humidity, than that can be used as a trigger?

Create a derivative sensor that uses the humidity sensor as the source sensor. The derivative of that is the “rate of change”. So the sensor will be “rate of change of the humidity”. Then simply set a threshold on that. I.e. if the rate of change is higher than 10, do xyz.

excuse my newness, would you have a reference how to setup a derivative sensor?

Go to the integrations section of the documents and search for derivative (top of the topic has a “docs” link). IIRC it’s a yaml only integration. Once you find it, the docs will spell out what to do. If/When you run into issues, come back here and post your progress.

1 Like

@petro Thanks derivative sensor was exactly what I needed! I have now a trigger when humidity rapidly changes to start the fan