jason0x43 / hacs-hubitat

A Hubitat integration for Home Assistant
MIT License
191 stars 46 forks source link

Set fan set_percentage not working after HA deprecated FanSpeed #166

Closed bmorgenthaler closed 2 years ago

bmorgenthaler commented 2 years ago

HA: 2022.04 Hubitat: 2.3.1.137 Hubitat Integration: 895e5da6 Device: GE Enbrighten Z-Wave Smart Dimmer Device Driver: GE Smart Fan Control HA Developer Tools Device State Info:

preset_modes: null
percentage: 0
percentage_step: 1
preset_mode: null
friendly_name: Ceiling Fan
supported_features: 1

With the recent HA updates (.02 or .03), FanSpeed appears to have been completely removed after deprecation warnings for a while so fan/set_speed doesn't work and needs to be migrated to fan/set_percentage. Unfortunately this doesn't appear to work with the Hubitat Integration and the following error is logged

I have a z-wave usb stick as a secondary controller on my network as backup and using the device exposed from ZwaveJS from this I can control the ceiling fan as expected.

bmorgenthaler commented 2 years ago

Here is a gist of the reported device capabilities from MakerAPI

hoveeman commented 2 years ago

Same issue as @bmorgenthaler. I am unable to control speed, mode, on/off.

nmatt25 commented 2 years ago

I am having the same issue ... the fan entity is being reported to HA as 2 devices ... ex ... in Hubitat the device is "Master Living room fan" (GE Smart Fan Control) in HA the device is fan.master_living_room_fan AND light.master_living_room_fan I can control the ON/OFF of the fan via the fan.master_living_room_fan but not the speeds I can control the SPEED of the fan via the light.master_living_room_fan but not the on/off

I hope that makes sense ... I have updated both HA and Hubitat and removed and reinstalled the integration with no change.

bmorgenthaler commented 2 years ago

@nmatt25 How are you controlling the speed? Even with both light and fan entities enable on the device I can't modify the speed.

jason0x43 commented 2 years ago

An update to support the current fan API is in progress. I should have a beta out in the next day or two.

jason0x43 commented 2 years ago

Please give v0.8.1b1 a try.

hoveeman commented 2 years ago

Thank you! The beta version works correctly. I'm using this frontend theme to control it successfully now.

https://github.com/finity69x2/fan-percent-button-row

    entity: fan.art_room_fan
    type: custom:fan-percent-button-row
    name: Art Room Ceiling Fan
    reverseButtons: true
    customTheme: false
    customSetpoints: true
    lowPercentage: 25
    medPercentage: 66
    hiPercentage: 99
jason0x43 commented 2 years ago

Does your fan only support three levels? If so, could you post the capabilities as reported by Hubitat? The default, and the virtual fan, use 5 levels (low, medium-low, medium, medium-high, high), and I'm curious about what a real world fan reports.

bmorgenthaler commented 2 years ago

@jason0x43 Here you go This is for a GE Enbrighten Z-Wave Ceiling Fan Switch.

bmorgenthaler commented 2 years ago

So I installed v0.8.1b1 and it works with a caveat, you have to have BOTH entities enable from the device, so both the fan and light. If I disable the light entity the fan entity can turn on the fan but not off and the state once turned on doesn't match up with Hubitat though it does change. I can hide the the light but then I still have to explicitly exclude it from some of my cards so only the fan domain is showing.

jason0x43 commented 2 years ago

Interesting. When you say you need both, is it because the fan entity behaves differently when the light entity is enabled, or do you just need the light entity to turn the fan off (because the fan entity can't)?

hoveeman commented 2 years ago

Does your fan only support three levels?

Yes, Only Low (33%), Medium (66%), High (99%. However, the device in hubitat shows 5 different options for low, medium-low, medium, etc... However, if you choose anything above 25% it jumps up to Medium at 66%. If you select medium-low, it jumps up to Medium.

This is the Inovelli combo Light Fan Switch. The Inovelli Drivers create child switches for Light and Fan, and they use the generic hampton bay driver for the child devices. https://inovelli.com/red-series-fan-light-switch-z-wave/

{
    "id": "1053",
    "name": "Hampton Bay Fan Component",
    "label": "Art Room (Fan)",
    "type": "Hampton Bay Fan Component",
    "room": "Art Room",
    "attributes": [
        {
            "name": "speed",
            "currentValue": "medium",
            "dataType": "ENUM",
            "values": [
                "low",
                "medium-low",
                "medium",
                "medium-high",
                "high",
                "on",
                "off",
                "auto"
            ]
        },
        {
            "name": "switch",
            "currentValue": "on",
            "dataType": "ENUM",
            "values": [
                "on",
                "off"
            ]
        },
        {
            "name": "level",
            "currentValue": 66,
            "dataType": "NUMBER"
        },
        {
            "name": "supportedFanSpeeds",
            "currentValue": null,
            "dataType": "JSON_OBJECT"
        }
    ],
    "capabilities": [
        "Actuator",
        "Refresh",
        "FanControl",
        {
            "attributes": [
                {
                    "name": "speed",
                    "dataType": null
                },
                {
                    "name": "supportedFanSpeeds",
                    "dataType": null
                }
            ]
        },
        "SwitchLevel",
        {
            "attributes": [
                {
                    "name": "level",
                    "dataType": null
                }
            ]
        },
        "Switch",
        {
            "attributes": [
                {
                    "name": "switch",
                    "dataType": null
                }
            ]
        }
    ],
    "commands": [
        "cycleSpeed",
        "off",
        "on",
        "refresh",
        "setLevel",
        "setSpeed"
    ]
hoveeman commented 2 years ago

I also have a GE Fan zwave device and my output looks slightly different from @bmorgenthaler

I'm also not experiencing the scenario @bmorgenthaler outlined above. For both my Inovelli and GE, they can both be off and I can select a speed in Homeassistant and they turn on and go to that speed. I can also turn them on and off.

{
    "id": "54",
    "name": "GE Smart Fan Control",
    "label": "Master Bedroom Ceiling Fan",
    "type": "GE Z-Wave Plus Fan Control",
    "room": null,
    "attributes": [
        {
            "name": "supportedFanSpeeds",
            "currentValue": null,
            "dataType": "JSON_OBJECT"
        },
        {
            "name": "pushed",
            "currentValue": 2,
            "dataType": "NUMBER"
        },
        {
            "name": "switch",
            "currentValue": "on",
            "dataType": "ENUM",
            "values": [
                "on",
                "off"
            ]
        },
        {
            "name": "speed",
            "currentValue": "low",
            "dataType": "ENUM",
            "values": [
                "low",
                "medium-low",
                "medium",
                "medium-high",
                "high",
                "on",
                "off",
                "auto"
            ]
        },
        {
            "name": "speed",
            "currentValue": "low",
            "dataType": "ENUM",
            "values": [
                "low",
                "medium-low",
                "medium",
                "medium-high",
                "high",
                "on",
                "off",
                "auto"
            ]
        },
        {
            "name": "level",
            "currentValue": 20,
            "dataType": "NUMBER"
        },
        {
            "name": "numberOfButtons",
            "currentValue": 2,
            "dataType": "NUMBER"
        },
        {
            "name": "doubleTapped",
            "currentValue": 2,
            "dataType": "NUMBER"
        }
    ],
    "capabilities": [
        "Configuration",
        "Actuator",
        "Refresh",
        "FanControl",
        {
            "attributes": [
                {
                    "name": "speed",
                    "dataType": null
                },
                {
                    "name": "supportedFanSpeeds",
                    "dataType": null
                }
            ]
        },
        "SwitchLevel",
        {
            "attributes": [
                {
                    "name": "level",
                    "dataType": null
                }
            ]
        },
        "Switch",
        {
            "attributes": [
                {
                    "name": "switch",
                    "dataType": null
                }
            ]
        },
        "PushableButton",
        {
            "attributes": [
                {
                    "name": "numberOfButtons",
                    "dataType": null
                },
                {
                    "name": "pushed",
                    "dataType": null
                }
            ]
        },
        "DoubleTapableButton",
        {
            "attributes": [
                {
                    "name": "doubleTapped",
                    "dataType": null
                }
            ]
        }
    ],
    "commands": [
        "configure",
        "cycleSpeed",
        "doubleTap",
        "off",
        "on",
        "push",
        "refresh",
        "setLevel",
        "setSpeed"
    ]
}
jason0x43 commented 2 years ago

@hoveeman So are both your Innovelli and GE fans generally working properly, or is the speed setting for one or both of them a bit wonky? Unfortunately neither of them appear to be advertising how many speed levels they actually support (the supportedFanSpeeds attribute is null for both), so there would need to be some way to manually configure them in HA if the speeds they support don't agree with the default set.

hoveeman commented 2 years ago

@hoveeman So are both your Innovelli and GE fans generally working properly, or is the speed setting for one or both of them a bit wonky? Unfortunately neither of them appear to be advertising how many speed levels they actually support (the supportedFanSpeeds attribute is null for both), so there would need to be some way to manually configure them in HA if the speeds they support don't agree with the default set.

They appear to be working properly. I can adjust the speed in home assistant and it adjusts them both properly.

bmorgenthaler commented 2 years ago

So when the light entity is disabled on the device I can it turn on and set the speed to High, Med, Low using the fan entity BUT I cannot turn it off. Also the dashboard doesn't report back the speed setting (using custom:fan-percent-button-row as @hoveeman is) and just stays on off.

My GE Enbright switch is using the GE Smart Fan Control driver built into Hubitat so that is probably why I'm showing different info than @hoveeman, actually @hoveeman I don't even see your driver available to me on my C-5, is that a custom one?

jason0x43 commented 2 years ago

@bmorgenthaler So turning the fan entity off never works, but turning the light entity off does?

hoveeman commented 2 years ago

I don't even see your driver available to me on my C-5, is that a custom one?

Ah, you're right. I didn't remember adding this custom driver, but that is what I'm using. https://raw.githubusercontent.com/Botched1/Hubitat/master/Drivers/GE-Jasco%20Z-Wave%20Plus%20Fan%20Control/GE%20Z-Wave%20Plus%20Fan%20Control.groovy

Also the dashboard doesn't report back the speed setting (using custom:fan-percent-button-row as @hoveeman is) and just stays on off.

Mine update on my homeassistant dashboard if i change the fan speed from hubitat or the switch. hmm.

bmorgenthaler commented 2 years ago

@bmorgenthaler So turning the fan entity off never works, but turning the light entity off does?

Not completely, that is what is weird. Here is the scenario, 1 device, 2 entities - fan, light

bmorgenthaler commented 2 years ago

I know my fan controller is fan only, it doesn't turn on/off the light itself and that is a completely different switch. I wonder if using the reported numberOfButtons: 2 for these types of switch could be used to combine the fan and light entity into a single one that it was previously?

jason0x43 commented 2 years ago

Here is the scenario, 1 device, 2 entities - fan, light

That's super odd. The fan's interaction with the Hubitat device is unrelated to whether a light entity is present or not.

...could be used to combine the fan and light entity into a single one that it was previously

Was it only a single entity at one point? I can see why it ends up as two entities now -- the device supports the SwitchLevel capability, and the integration currently thinks a device with SwitchLevel that isn't a cover must be a light, so it will create a light entity.

I can update that to also ignore SwitchLevel for fans (well, to not create a light entity for a fan with SwitchLevel). That will work so long as fan devices that also have lights provide a light-specific capability, like Light.

bmorgenthaler commented 2 years ago

Was it only a single entity at one point?

Yes previously it was or at least the light entity was disabled in prior versions of HA before they migrated from fan speed support to fan percentage being required, prior to 2021.3 something.

jason0x43 commented 2 years ago

Support for the modern fan API has been added in v0.8.1. The update supports Hubitat's FanController API, which specific devices may deviate from (because no one ever follows the spec 😁). If there are issues with specific fan devices, please open new issues since this one is getting a bit hard to follow.