Skip to content

Fix fan speed control, plain JSON datagram parsing, and direct UDP state confirmation - #1

Open
FlashWreck wants to merge 1 commit into
allusv:mainfrom
FlashWreck:fix-speed-control-and-udp-confirmation
Open

FlashWreck wants to merge 1 commit into
allusv:mainfrom
FlashWreck:fix-speed-control-and-udp-confirmation

Conversation

@FlashWreck

Copy link
Copy Markdown

Summary of Changes

  • Fix Speed Control: Changed async_set_percentage to send {"speed": speed} directly rather than bundling power: True. Atomberg BLDC microcontroller firmware evaluates commands using single-key parsing; bundling power caused speed adjustments to be ignored by the motor controller.
  • Support Plaintext & Hex JSON Datagrams: Updated parse_datagram in udp.py to handle both standard JSON and hex-encoded JSON datagrams. Added hexadecimal MAC validation before presence beacon splitting to avoid corrupting plaintext JSON packets into {"device.
  • Direct UDP Response Capture: Updated send_command in udp.py with a non-blocking timeout to capture immediate UDP responses from port 5600, enabling sub-50ms command confirmations.
  • Optimistic State & Transport Sync: Setting speed now reflects power = True in local optimistic state immediately, and direct responses eliminate false-positive 1.5s Wi-Fi timeouts and premature BLE fallbacks.

Testing & Verification

  • Hardware Tested: Verified on physical hardware (Atomberg Renesa Halo Smart R3) with Home Assistant 2026 over LAN UDP. Speed control, power on/off, and state confirmation are working reliably.
  • Script Tests: Validated standalone unit tests across command building, state bitfield decoding (speeds 1–6, power on/off), and datagram parsing.

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