You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ X] I have checked to make sure the plugin is up to date
Describe the bug
When upgrading to the latest release and checking the configured DPs, I noticed that I was not able to ever turn the fan off, it would always revert to speed 1 when switched off.
To Reproduce
Switch fan off in apple home..... slide down the fan control to 0, but fan always stays at speed 1 (or whatever you have defaultFanSpeed set to).
Expected behavior
Fan to go off....
Environment (please complete the following information):
OS: Ubuntu 22.04 LTS
iOS version: 17.5
Node Version: v20.11.0
Plugin Version: 3.1.1
Accessory Type SimpleFanLight Accessory
Additional context
I found the issue... the setMultiStateLegacy breaks my fan device....
After some debugging i discovered that setting multiple DPS in a single call to the device doesn't work , my Fan only processes the last DP sent... so in my case, when the FanActive DP was sent (set to false when swtiching fan off) and the FanRotationSpeed set to the deffault (1 in my case), the fan would only process the last DP, speed 1, so the fan was active with speed 1, which explains why I could never turn it off via homebridge.
I tested this extensively by reading back the DPs from the device and when using setMultiStateLegacy the FanActive DP was never set. If I switched the order of the DPs above, then dpFanOn was set correctly, but dpRotationSpeed not.
By reverting the code to call setMultiState instead (which generates a call per DP to be set), the Fan started to work again.
I just tested the above with the remote control that came with the device and I can contend that when you switch the fan on for example, it sends two commands, one to set dpFanActive and the other dpRotationSpeed, so the remote sends each DP call in a separate message too.
Checklist
Describe the bug
When upgrading to the latest release and checking the configured DPs, I noticed that I was not able to ever turn the fan off, it would always revert to speed 1 when switched off.
To Reproduce
Switch fan off in apple home..... slide down the fan control to 0, but fan always stays at speed 1 (or whatever you have defaultFanSpeed set to).
Expected behavior
Fan to go off....
Environment (please complete the following information):
Additional context
I found the issue... the setMultiStateLegacy breaks my fan device....
After some debugging i discovered that setting multiple DPS in a single call to the device doesn't work , my Fan only processes the last DP sent... so in my case, when the FanActive DP was sent (set to false when swtiching fan off) and the FanRotationSpeed set to the deffault (1 in my case), the fan would only process the last DP, speed 1, so the fan was active with speed 1, which explains why I could never turn it off via homebridge.
return this.setMultiStateLegacy({[this.dpFanOn]: value, [this.dpRotationSpeed]: this.fanDefaultSpeed}, callback);
I tested this extensively by reading back the DPs from the device and when using setMultiStateLegacy the FanActive DP was never set. If I switched the order of the DPs above, then dpFanOn was set correctly, but dpRotationSpeed not.
By reverting the code to call setMultiState instead (which generates a call per DP to be set), the Fan started to work again.
return this.setMultiState({[this.dpFanOn]: value, [this.dpRotationSpeed]: this.fanDefaultSpeed}, callback);
I think we should have an option to use setMultiStateLegacy or setMultiState somewhere so I don't have to edit code with every upgrade etc.
Many thanks,
Adam
The text was updated successfully, but these errors were encountered: