Questions About Updating the Z-Wave Fan Component for 4-speed Support

I just installed a HomeSeer HS-FC200+ fan controller along with a 4-speed ceiling fan. From HA, I’m able to configure it to off/low/medium/high, but there’s another speed that I’m currently locked out from unless I go to the wall switch.

It looks like the Z-Wave fan component is hardcoded to just work with three-speed fan controllers:
https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/fan/zwave.py

I’m can put a bit of work in to extend this to 4 speeds, but I’m not super familiar with HA, so I wanted to get some guidance on how to proceed:

  • What should I actually call the speeds for a 4-speed fan? Just “1”, “2”, “3”, and “4”? Split the middle into “Medium-Low” and “Medium-High”?

  • The HomeSeer HS-FC200+ has a Z-Wave node configuration option for switching between 3 speeds and 4 speeds. Should I attempt to read this setting from the device, or is it better to try to drive this from a configuration option?

I’ve made some progress on this, but I’ve also run into a challenge.

I can trivially detect that the current device is an FC200+ during component initialization.

I’ve also managed to read the device-specific configuration option to determine if the device is configured for 3-speed operation or 4-speed operation, but that’s also where my challenge is. For about a minute after I restart HASS, I can’t actually read the config values. Then, after a while, they come in and my fan type is detected.

Here’s the code I’m playing with for reading the fan type configuration option:

def detect_hc200_speeds:
    config_options = self.node.get_values(class_id=const.COMMAND_CLASS_CONFIGURATION)
    for value in config_options.values():
        if value.index == 5:
            if value.data == "4-speed":
                return 4
            elif value.data == "3-speed":
                return 3
    return None

Ideally, I’d like to delay initialization of the fan component until the device configuration values are available (at least, when the device is an FC200+). Does anyone have any advice on how I can accomplish this?

I see that there’s async component initialization in HASS, but I’m not quite sure how to hook that up to the Z-Wave subsystem (which callbacks, if any, are appropriate).