Build in virtual driver modification

Sorry I'm new here, just moved from ST so maybe its a very stupid question :slight_smile:

I want to use the virtual fan to control my HRV
Something very basic using rule machine (I think)
My HRV is only one speed and its connected to a switch that I can control from Hubitat.
I want to run it in 3 states. Always on, 15 min every hour or 20 min every hour

I was thinking to create a rule to check the status of the virtual fan switch and if its on to use the virtual fan speeds to select to be always on or 15 or 20
But the virtual fan has 5 speeds plus auto while I need only 3

Is there an easy way to modify the code of the virtual fan ? I mean is there a way to see the code of build in devices ?

I'm not sure where the idea that Hubitat's built-in drivers have code publicly available came from, but they don't. :slight_smile: (Perhaps from ex-ST users, as many of us are, assuming that they are like ST and publish most of them.) Hubitat has a few examples on their GitHub, but that is all you'll find officially.

Besides those, there are lots of community drivers you could look at or use as a starting point if open-licensed. Since your driver is virtual, you're at least lucky that those are usually pretty easy to write since they don't usually do anything besides send events (no need to worry about "Z" communication), so even writing one from scratch if need be shouldn't be too difficult if you're otherwise familiar with Hubitat (or ST) driver development.

That being said, it seems to me like the built-in driver might already work for you needs if you just ignore the speeds you don't need (and remember what those are--maybe just "low," "medium," and "high"?), but I understand that it may be less confusing to avoid this. Do understand that the FanControl capability in Hubitat itself expects drivers to have all 5 speeds available (how they're implemented is up to the device), as far as the docs seem to suggest, so apps that expect to be able to use any of them might break if the driver doesn't gracefully accept them anyway. If you're only using this driver for yourself, this is unlikely to matter (since you'll know what you're doing), but it's worth pointing out regardless.

Good luck!


How do you want to select auto time (15 minutes) or always on mode? Dashboard? Physical button?

You could do two virtual switches. One for always on, and the other for timed mode. Place those two separate buttons on dashboard.

Then use a Rule Machine rule or Simple Automations to turn the physical switch on if you press one virtual button on dash, or timed mode if you press the other.

Yes its mostly to avoid confusion. I can use the 5 speeds too.
If the driver code would be available it would be easy to just remove the extra speeds

I was thinking about this more, and I'm still not sure it would help you much: in any app that uses this device, because it implements the FanControl capability, you'd always see all five speeds. This includes RM (e.g., when creating a condition or performing an action to set a speed), Dashboard (when using a fan tile to choose fan speed...I'm assuming this is a thing but honestly have never used it for that), or any app. The five speeds are specified as part of this capability, not a list the device can "generate" (though of course with a custom driver you're free to handle--nor not--setting the device to whatever speed as you see fit).

This is different from, for example, thermostats, where the driver can send an event for the supportedThermostatModes attribute and then any well-behaving app can read that list an only offer options the device actually has.

1 Like