Posting this if someone is doing a similar setup. I can post more if anyone is interested
After I was done I found this by @Blacky. Maby a better way to go.
Here is my take:
Hardware:
Fan with 0-10V control
0-10V controller(ex: Plejd crl-01)
2x temp/humidity sensors. (Aqara zigbee)
Shelly (Shelly Plus 2PM, for physical button)
Software in HA
Node-red Add-on
Node-RED companion Integration.
Thermal comfort (for Abs-humidity) Integration.
ZHA (for the sensors) Integration
HomeKit device (for Plejd) Integration
Shelly Integration
My setup for the bathroom exhaust fan.
It has worked great for a couple years now.
Probably not the smartest way to do this, but it is always nice to figure out stuff yourself.
I think this setup needs to have a strong fan for it to be useful.
I have two Aqara Zigbee sensors for humidity/temp, one outside and one inside of the bathroom(the inside one is close to the fan duct)
with Thermal comfort i make the readings in to Absolute humidity(this feels more useful than percentage over the year)
With a template sensor I calculate the difference between the two Aqara sensors in percentage.
Then I do the rest in Node-RED.
Helper-Template sensor for the Difference:
Unit of measurement: %
Device class: Humidity
State class: Measurement
{{ (states(‘sensor.thermal_comfort_absolute_humidity’)|float / states(‘sensor.thermal_comfort_absolute_humidity_2’)|float * 100 - 100 ) | round(2) }}
In Node-RED:
Since the plejd integration is not great HA thinks my fan is a Light. The command for the fan speed is therefor is “Light.turn_on” with data: {“brightness_pct”: xxx}
With some calibration I could find good values for the switch(sorting) node that works in my bathroom.
Below 10% the fan can be turned off. And over 50% difference it can be 100% speed. Then some stages in between.




