Skip to content

Fix Dreo websocket command bursts#117

Open
machina86 wants to merge 1 commit into
zyonse:mainfrom
machina86:main
Open

Fix Dreo websocket command bursts#117
machina86 wants to merge 1 commit into
zyonse:mainfrom
machina86:main

Conversation

@machina86
Copy link
Copy Markdown

Summary

Fixes unreliable Dreo fan scene/automation behavior when multiple fans are controlled at the same time.

HomeKit scenes can send several Dreo control commands in a very short burst, especially when turning fans on or changing speed. I had mlutiple DR-HPF004S fans in a scene that would turn off together but would fail to turn on and I had a DR-HCF003S fan that had unreliable speed updates in automations.

This change serializes outgoing Dreo websocket control commands through a shared queue and adds a short delay between sends.

Changes

  • Added a global control queue in DreoAPI.control().
  • Sends websocket control payloads one at a time instead of all at once.
  • Adds a 250 ms delay between outgoing control commands.
  • Keeps the existing accessory API unchanged, so fan/heater/humidifier callers still use webHelper.control(...).
  • Adds debug logging for outgoing queued control payloads.
  • Adds a startup log showing the plugin version because I was having problems with npm link
  • Bumps version from 4.3.0 to 4.3.1 but you can ignore that depending on if and when you merge this

Testing

Validated on a Raspberry Pi Homebridge image with multiple Dreo fans:

  • DR-HPF004S fans now turn on together from a HomeKit scene.
  • Multi-fan off scenes still work.
  • DR-HCF003S speed changes now work correctly in scenes/automations.
  • Logs confirm outgoing commands are spaced apart instead of sent in one websocket burst.
  • Logs show both control-reply and control-report responses for each fan after scene activation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant