I’ve installed a new home ventilation box which has 3 speeds (lo, normal, high) which I control using a 2-gang Zigbee (DIY) switch. It controls the air in the living-room and toilet. I also have a Zigbee button in the toilet. In the living room I have a Zigbee air quality sensor (VOC / PM2.5). With all of this I like to create logic to control the ventilation speeds:
By default set it to lo;
When VOC/PM2.5 is above a certain threshold (1) set it to normal (and when below again set it to lo);
When VOC/PM2.5 is above a certain threshold (2) set it to high (and when below again set it to normal);
When the toilet button is pressed set it to high for 15 minutes, after that set it to lo again (except when one of the above conditions still applies);
I tried doing this with several automations but that’s rather cumbersome and I don’t seem to be able to accomplish the above. What would be the best approach? Ideally I like to use a single script (Python or Yaml: I can do both) that contains all the logic.
Choose
Trigger ID = button → set to high, wait 15 minutes, choose → create an option to match each of the thresholds and set the speed accordingly
Trigger ID = low → set to low
Trigger ID = normal → set to normal
Trigger ID = high → set to high
I’m afraid it’s not that straightforward. The problem isn’t so much turning on normal/high, but turning them off again with the right conditions. You want them only to turn off when the toilet-timer isn’t active AND VOC-value is low enough AND PM2.5 is low enough. I think using an automation you can only accomplish that by doing something like this (values are arbitrary):
triggers:
voc < 100
pm2.5 < 10
toilet-timer = idle
condition:
voc < 100
pm 2.5 < 10
toilet-timer = idle
action:
fan high = off
Which isn’t really pretty because of the double logic in trigger/condition. Is there a nicer way?
Individual (=2 entities). I’m using 2 zigbee switches to enable speed 2 (normal) and speed 3 (high).
EDIT: And also note that I also like to add logic to enable speed 3 (high) when inside temperature > 24 degrees and outside temperature < inside temperature, so I have to keep that in mind as well…
The ‘high’-selection will have precedence (it will overrule the ‘normal’ selection). This is what I came up with for now. It’s not complete yet, especially the whole inside/outside temperature logic is missing: