Skip to content

v0.5.0 — MASS2 adapter reliability + quality of life

Choose a tag to compare

@mtheli mtheli released this 11 Apr 18:49

Major reliability release for the MASS2 adapter, plus a few quality-of-life features that benefit all users.

BLE fragmentation fix

The coordinator now explicitly negotiates the ATT MTU via _acquire_mtu() on every connect. Without this, BlueZ defaulted to MTU=23 and the 59-byte MASS2 WorkStatus response arrived in 3 fragments, occasionally causing per-port data to drift when the 0x31 resync marker collided with payload bytes. On all modern HA hosts the MTU should now come up at 247 (BlueZ max) and a WorkStatus fits in a single notification.

As a belt-and-suspenders guard, the reassembly buffer is cleared before every adapter request so transports that can't negotiate a larger MTU (some ESP BLE proxies) can't drift between cycles either.

Phantom-load filter (MASS2 ports)

Wireless charging pads like the Apple MagSafe (~0.2 W) and Samsung wireless dock (up to ~0.6 W) periodically probe for devices in standby, polluting history graphs and flipping port_active on and off. The new filter has three paths:

  1. Instant-active — power ≥ phantom_threshold (default 1.0 W) → real charging, snaps to active on the next poll.
  2. Sustained low-power — power between ~0.3 W and phantom_threshold continuously for phantom_sustain seconds (default 5 s). Catches slow chargers (e.g. an electric toothbrush at 0.5 W) without letting phantom pulses through.
  3. Down-hysteresis — once a port is active, it stays active as long as any non-trivial load is present. Only after power stays effectively zero for phantom_debounce seconds (default 2.5 s) does it transition back to off. Bridges brief PD re-negotiation gaps and MCU pulse-charging cycles (e.g. a C4 Air powered via the MASS2) so the state doesn't flap.

The filter overrides ch["status"] while a port is active, which keeps port_status / port_active sensors rock-solid during pulse gaps. All three parameters are configurable per device via the options flow. Set phantom_threshold = 0 to disable the filter entirely and see raw data.

Total Power matches the device display

ISDTMASS2TotalPowerSensor now reads the device-reported total (byte 2 of the WorkStatus response), matching what the MASS2's own display shows as "15W TOTAL". The phantom filter recomputes this value from the filtered per-port values so the total doesn't accumulate masked phantom pulses when nothing is plugged in.

RTC sync on every connect

The coordinator now pushes the current local time to the MASS2 on every successful connect. Without this, the device is stuck with whatever clock it booted with (typically 2000-01-01), and per-port schedules / alarm clocks fire at the wrong time. The sync uses the configured Home Assistant time zone (DST-aware).

Thanks

Thanks to the users who helped track the BLE fragmentation and pulse-charging edge cases by providing detailed history graphs and sensor-state snapshots — that's what turned "it flips sometimes" into a reproducible root cause.