How to get from Fan to Fancy

Greetings awesome people!

My house has a ventilation system which I’m trying to automate. The ventilation has 3 speeds:

  • High
  • Medium
  • Low

I installed a Shelly double switch to turn on either medium or high. The ventilation is low with both are off.

I have a bunch of sensors setup and I want to have some manual control as well. I used helpers to calculate the desired ventilation speed for each of the following criteria:

  • Temperature
  • Humidity
  • Moisture
  • Air quality
  • Manual (Countdown timer)

I’m currently writing an automation to control all of this and it was getting kind of big, so I though to myself: can’t I do this easier. The current automation looks like this:

Trigger: 
  A, B, C, D, E
Action:
  Choice: A, B, C, D, E = high
    turn on:  ventilation-high
    turn off: ventilation-medium
  Choice: A, B, C, D, E = medium
    turn off: ventilation-high
    turn on:  ventilation-medium
Default:
    turn off: ventilation-high
    turn off: ventilation-medium

The thing that came to mind was to to create 5 fan helper entities and put them in a group. Than, all i needed to do wat to set the ventilation to match the state of the group.
Of course I have no idea if this is even possible, let alone how to do this. The best thing I can find is to use the “number” helper (0=low, 1=medium, 2=high) and the “max” helper as a group. I guess it works, but it’s not pretty.

My question is: What is are the possible ways to do this?

I’m interested in multiple options so I can learn the differences and apply the best strategy for future automations which are slightly different.

I will assume;… because you mentioned temperature and humidity, it’s for fresh air ventilation?

If so, is this just a basic fresh-air intake system, or are you using an HRV or ERV?

If it’s just a standard fresh-air intake system, you may want to consider using Inside and Out Dew Point as your limits. The indoor ‘sweet spot’ is between 50-60F.

The ventilation system has a heat exchanger between in and out with a bypass.
I have done all the calculations (like dew-point) to determine when ventilation is needed for each individual parameter.

My question is not specific to ventilation or fans. It’s about the best way to control a device based on multiple input parameters.

Have you looked at creating a fan template

This would allow you to encapsulate as scripts all the special logic related to manipulating / reading the binary switches and then you just interface to the fan using from automation/Lovelace the standard fan methods,

Fantastic!
This is definitely a big step in the right direction. I have not created templates or scripts myself yet, so this is an excellent opportunity to try it out.