iklein99 / homebridge-smartthings

This is a plugin to Homebridge to connect your Smartthings network into Apple Home Kit.
Apache License 2.0
150 stars 52 forks source link

Z-Wave Fan Control - Reports Light Control #220

Closed coryabooth closed 8 months ago

coryabooth commented 9 months ago

Describe The Bug: Two out of eight in wall fan controllers: GE (Enbrighten) Z-Wave ZW4002, show up as "lights" instead of "fans" IMG_9054

They are still controllable, but are not included in "Home" as "Climate" devices and the icon is a "light" fans_before

The fans controllers are all identical.... fan_list

The fans are all using the same edge driver, fans_driver

In my troubleshooting, I have tried switching between two drivers. https://community.smartthings.com/t/st-edge-driver-for-ge-jasco-honeywell-z-wave-switches-dimmers-fans-outlets-and-plug-ins/236733 https://community.smartthings.com/t/st-edge-enhanced-z-wave-fan-controller/249363

I did have initial success moving some fans from "light" to "fan" by changing drivers, but in these two cases - the fans are "locked" to "lights". In one case, a fan moved from "light" to "fan" after turning it on.

To Reproduce: I remove the fans from "Accessories Cache" in HomeBridge.
I change the fan drivers in Smartthings (as listed above) I ensure the fans show correctly in Smartthings - with the "fan" controls showing IMG_9058 IMG_9059

Rebooting HomeBridge, the fans still load as "lights" fan_accessory

Expected behavior: Fan Controllers either load as "fan" or are able to be switched from "light" to "fan" as other similar devices

Logs:

[9/23/2023, 9:52:01 AM] [Smartthings Plug (IK)] Kids Fan command or request is proceeding. [9/23/2023, 9:52:01 AM] [Smartthings Plug (IK)] Kids Fan still waiting... [9/23/2023, 9:52:01 AM] [Smartthings Plug (IK)] getLevel() SUCCESSFUL for Kids Fan. value = 0 [9/23/2023, 9:52:01 AM] [Smartthings Plug (IK)] Office Fan command or request is proceeding. [9/23/2023, 9:52:01 AM] [Smartthings Plug (IK)] Office Fan still waiting... [9/23/2023, 9:52:01 AM] [Smartthings Plug (IK)] getLevel() SUCCESSFUL for Office Fan. value = 0 [9/23/2023, 9:52:01 AM] [Smartthings Plug (IK)] Guest Fan command or request is proceeding. [9/23/2023, 9:52:01 AM] [Smartthings Plug (IK)] Guest Fan still waiting... [9/23/2023, 9:52:01 AM] [Smartthings Plug (IK)] getLevel() SUCCESSFUL for Guest Fan. value = 0 [9/23/2023, 9:52:01 AM] [Smartthings Plug (IK)] Master Fan command or request is proceeding. [9/23/2023, 9:52:01 AM] [Smartthings Plug (IK)] Master Fan still waiting... [9/23/2023, 9:52:01 AM] [Smartthings Plug (IK)] getLevel() SUCCESSFUL for Master Fan. value = 66 [9/23/2023, 9:52:01 AM] [Smartthings Plug (IK)] Basement Fan command or request is proceeding. [9/23/2023, 9:52:01 AM] [Smartthings Plug (IK)] Basement Fan still waiting... [9/23/2023, 9:52:01 AM] [Smartthings Plug (IK)] getLevel() SUCCESSFUL for Basement Fan. value = 0 [9/23/2023, 9:52:01 AM] [Smartthings Plug (IK)] Living Fan command or request is proceeding. [9/23/2023, 9:52:01 AM] [Smartthings Plug (IK)] Living Fan still waiting... [9/23/2023, 9:52:01 AM] [Smartthings Plug (IK)] getLevel() SUCCESSFUL for Living Fan. value = 52

<<<<<<<<<<<<<<THE ISSUE IS HERE "LightService?">>>>>>>>>

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>> This is the log after reloading and AFTER I "remove single cache accessory" in HomeBridge UI <<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Also, I cleared these from the HomeBridge Cache, but the logs still show "restoring from cache"?

Basement Fan: [9/23/2023, 9:51:50 AM] [Smartthings Plug (IK)] DEVICE DATA: {"deviceId":"27db9f2f-9ff0-4acb-bb16-06a74616874c","name":"ge-fan-assoc","label":"Basement Fan","manufacturerName":"SmartThingsEdge","presentationId":"generic-fan-3-speed","deviceManufacturerCode":"0063-4944-3131","locationId":"fdd02356-c8b5-42f0-a6a3-924c828b7bae","ownerId":"1b75fae4-c35c-416b-b214-2a137f24190b","roomId":"40a0ddfc-f1d9-4bd8-9eee-6cdde52aa36e","components":[{"id":"main","label":"main","capabilities":[{"id":"fanSpeed","version":1},{"id":"switch","version":1},{"id":"switchLevel","version":1},{"id":"refresh","version":1}],"categories":[{"name":"Fan","categoryType":"manufacturer"},{"name":"Fan","categoryType":"manufacturer"}]}],"createTime":"2022-12-16T13:57:48.771Z","parentDeviceId":"61de8775-be9e-45dd-a999-20b6d1ff9907","profile":{"id":"d90ed16e-15d7-3a40-840c-9bd6ed7a228b"},"zwave":{"networkId":"A1","driverId":"260eba86-b00d-45b4-a1d9-69e659bbd182","executingLocally":true,"hubId":"61de8775-be9e-45dd-a999-20b6d1ff9907","networkSecurityLevel":"ZWAVE_LEGACY_NON_SECURE","provisioningState":"NONFUNCTIONAL"},"type":"ZWAVE","restrictionTier":0,"allowed":[]} [9/23/2023, 9:51:50 AM] [Smartthings Plug (IK)] Restoring existing accessory from cache: Basement Fan [9/23/2023, 9:51:50 AM] [Smartthings Plug (IK)] Creating instance of LightService for capabilities switch,switchLevel [9/23/2023, 9:51:50 AM] [Smartthings Plug (IK)] Adding LightService to Basement Fan [9/23/2023, 9:51:50 AM] [Smartthings Plug (IK)] Basement Fan supports switchLevel [9/23/2023, 9:51:50 AM] [Smartthings Plug (IK)] Registered LightService for capabilities switch,switchLevel

Living Fan:

[9/23/2023, 9:51:51 AM] [Smartthings Plug (IK)] DEVICE DATA: {"deviceId":"7c22798f-4f4e-43ec-baa6-a43f50540224","name":"ge-fan-assoc","label":"Living Fan","manufacturerName":"SmartThingsEdge","presentationId":"generic-fan-3-speed","deviceManufacturerCode":"0063-4944-3131","locationId":"fdd02356-c8b5-42f0-a6a3-924c828b7bae","ownerId":"1b75fae4-c35c-416b-b214-2a137f24190b","roomId":"06129ef0-cac6-4db2-9a5b-61a4e412e20f","components":[{"id":"main","label":"main","capabilities":[{"id":"fanSpeed","version":1},{"id":"switch","version":1},{"id":"switchLevel","version":1},{"id":"refresh","version":1}],"categories":[{"name":"Fan","categoryType":"manufacturer"}]}],"createTime":"2022-12-16T17:14:16.210Z","parentDeviceId":"61de8775-be9e-45dd-a999-20b6d1ff9907","profile":{"id":"d90ed16e-15d7-3a40-840c-9bd6ed7a228b"},"zwave":{"networkId":"AA","driverId":"260eba86-b00d-45b4-a1d9-69e659bbd182","executingLocally":true,"hubId":"61de8775-be9e-45dd-a999-20b6d1ff9907","networkSecurityLevel":"ZWAVE_LEGACY_NON_SECURE","provisioningState":"NONFUNCTIONAL"},"type":"ZWAVE","restrictionTier":0,"allowed":[]} [9/23/2023, 9:51:51 AM] [Smartthings Plug (IK)] Restoring existing accessory from cache: Living Fan [9/23/2023, 9:51:51 AM] [Smartthings Plug (IK)] Creating instance of LightService for capabilities switch,switchLevel [9/23/2023, 9:51:51 AM] [Smartthings Plug (IK)] Adding LightService to Living Fan [9/23/2023, 9:51:51 AM] [Smartthings Plug (IK)] Living Fan supports switchLevel [9/23/2023, 9:51:51 AM] [Smartthings Plug (IK)] Registered LightService for capabilities switch,switchLevel

Plugin Config:

    {
        "name": "Smartthings Plug (IK)",
        "BaseURL": "https://api.smartthings.com/v1/",
        "AccessToken": "",
        "WebhookToken": "",
        "GarageDoorMaxPoll": 0,
        "PollLocksSeconds": 15,
        "PollDoorsSeconds": 0,
        "PollSensorsSeconds": 5,
        "PollSwitchesAndLightsSeconds": 10,
        "PollWindowShadesSeconds": 0,
        "ExposeHumiditySensorForAirConditioners": false,
        "OptionalModeForAirConditioners": "None",
        "IgnoreDevices": [
            "Garage Opener",
            "Garage Temperature",
            "Guest Temperature",
            "Kids Temperature",
            "Basement Thermostat",
            "Living Thermostat",
            "Master Temperature",
            "Closet Temperature",
            "Office Temperature",
            "Garage Door Opener",
            "MyQ-Controller",
            "Garage Door Tilt",
            "Front Doorbell"
        ],
        "_bridge": {
            "username": "",
            "port": 43258
        },
        "platform": "HomeBridgeSmartThings"
    },

Environment:

coryabooth commented 9 months ago

In HomeBridge under "terminal" Is there a "hb_service" command to remove an accessory from cache?

I am surprised to see the logs show "restored from cache" When I have not only cleared the individual fans - at this point hundreds of times - but I also cleared the entire cache for all accessories as well.

Perhaps this "cache" comment is just an anomaly?

iklein99 commented 9 months ago

Can we close this?

coryabooth commented 9 months ago

It is still a problem for me. I'll keep looking into it today.

coryabooth commented 9 months ago

So I was running HomeBridge (for over a year) on a QNAP.

I decided, for performance reasons - and other odd ball issues - to move the entire install to a Rasberry PI.

I fully wiped all 180+ items from Home, and readded each item, one at a time.

When SmartThings loads the accessories, for some reason or another, some ceiling fans show as "fans" and other - exactly the same fan and exactly the same controller - show as "lights"....

And even after a complete wipe and reload - I am still seeing the same two fan marked as "lights"

Is there something, even if code wise, I could do to trigger the switch from "light" to "fan"

As I mentioned above, they do still work, but the slider for a light dimmer is not preferred over the fan slider. Not to mention the OCD aspect of it...

coryabooth commented 9 months ago

I found the "swagger" page and have noticed the differences. Again these "fans" are exactly the same model and exactly the same driver. They do show as "fans" in SmartThings....

Here is the output from Swagger for a correct one:

{ "aid": 90, "iid": 12, "uuid": "00000040-0000-1000-8000-0026BB765291", "type": "Fan", "humanType": "Fan", "serviceName": "Office Fan", "serviceCharacteristics": [ { "aid": 90, "iid": 13, "uuid": "00000025-0000-1000-8000-0026BB765291", "type": "On", "serviceType": "Fan", "serviceName": "Office Fan", "description": "On", "value": 0, "format": "bool", "perms": [ "ev", "pr", "pw" ], "canRead": true, "canWrite": true, "ev": true }, { "aid": 90, "iid": 15, "uuid": "00000029-0000-1000-8000-0026BB765291", "type": "RotationSpeed", "serviceType": "Fan", "serviceName": "Office Fan", "description": "Rotation Speed", "value": 0, "format": "float", "perms": [ "ev", "pr", "pw" ], "unit": "percentage", "maxValue": 100, "minValue": 0, "minStep": 1, "canRead": true, "canWrite": true, "ev": true }

Here is the output from a "light" { "aid": 39, "iid": 12, "uuid": "00000043-0000-1000-8000-0026BB765291", "type": "Lightbulb", "humanType": "Lightbulb", "serviceName": "Master Fan", "serviceCharacteristics": [ { "aid": 39, "iid": 13, "uuid": "00000025-0000-1000-8000-0026BB765291", "type": "On", "serviceType": "Lightbulb", "serviceName": "Master Fan", "description": "On", "value": 1, "format": "bool", "perms": [ "ev", "pr", "pw" ], "canRead": true, "canWrite": true, "ev": true }, { "aid": 39, "iid": 15, "uuid": "00000008-0000-1000-8000-0026BB765291", "type": "Brightness", "serviceType": "Lightbulb", "serviceName": "Master Fan", "description": "Brightness", "value": 66, "format": "int", "perms": [ "ev", "pr", "pw" ], "unit": "percentage", "maxValue": 100, "minValue": 0, "minStep": 1, "canRead": true, "canWrite": true, "ev": true }

Can this be changed using "Swagger"?

coryabooth commented 9 months ago

One of thought - is there some sort of limit on devices during the load into HomeBridge? Maybe limit on the WebHook?

I'm at a loss as to why these two devices insist on being loaded as "lights" when nothing at all on the SmartThings hub remotely indicates they are lights.

coryabooth commented 9 months ago

So today... At random... (I did a single device cache clear and reboot - which I've been doing all this time) the Living Fan (which you can see in above screenshot) switched to a "Fan" - but... Now my Patio Fan is now a light. Screenshot 2023-10-05 at 1 50 22 PM

It's almost like the plugin just can't handle more than five fans at one time? I can't make any sense of it....

coryabooth commented 8 months ago

@iklein99

Is there any chance your webhook logging could identify something?

iklein99 commented 8 months ago

I was able to reproduce. I'm working on this now.

iklein99 commented 8 months ago

@coryabooth try release 1.5.20 and let me know how it goes.

coryabooth commented 8 months ago

@iklein99

SUPER! This seems to have fixed a lot of things. Another issue was some properly represented fans still had a light dimmer control - even though it did not exist on SmartThings. That was easy to ignore however.

But the bigger problem - fans listed as lights - seems to be fixed!

Thank you!