Repository navigation
Conversation
|
Is there any reason this pull request does not get approved? Anything I should change or improve? I have added support for this device to home assistant but this pull request is a prerequisite. |
|
I've been reverse-engineering the same device family (a LIFAair LAM01, the monitor supplied with the LA500/LA350A, firmware 10026, model string 1.
|
| offset | current code | measured |
|---|---|---|
| 37 | pm10 |
PM1.0 |
| 39 | pm2_5 |
PM2.5 (agrees) |
| 41 | pm1 |
PM10 |
Across 315 consecutive frames offset37 <= offset39 <= offset41 always holds. Since PM1.0 is a subset of PM2.5 which is a subset of PM10, the ascending order fixes the labels. Cross-check against the display: it showed PM2.5 = 30 while offset 39 read 30.1 (15-frame mean), and when I heated rosin flux next to the sensor the display read "2000+" while offset 39 peaked at 2022.
2. Formaldehyde is at offset 33 and isn't decoded at all
u16_le(33) / 100 gives mg/m³. I held an alcohol swab near the intake (the manual warns the electrochemical cell cross-reacts strongly with alcohol): the display went 0 → 0.3 → 1.2 mg/m³ while the data went 0 → 30 → 120, then decayed back to 0 over ~60 s in step with the display.
3. temperature / humidity come back as constants, not None
With no purifier paired, offsets 27/29 return 25/45 forever — which the current code decodes as a permanent 2.5 °C / 45 %. The docstring says those keys can be None when the main unit is offline; on this firmware they are stale defaults instead. That is arguably worse than None for a sensor entity, so it may be worth handling explicitly (e.g. treating unchanged 25/45 as "unavailable").
4. Offsets 66..79 look like uninitialised memory
They change on every request — all zeros in the first frame after boot, then random bytes. Nothing meaningful to decode there.
Happy to share the raw frame dumps, captures, or the stimulation methodology if useful.
- Swap PM1/PM10 offsets (verified ascending order vs device display) - Decode formaldehyde at offset 33 (mg/m3) - Treat fan_state 0x01 as offline before anti-allergy flag - Export FanMode from package; update README and test CLI Co-authored-by: Piotr Paczyński <pit3k@users.noreply.github.com>
Placeholder temperature and humidity zeros now return None, including the first poll after the purifier reconnects. On this device, error -5 is no longer reported as a full storage. Fan mode and speed stay as reported. CO2 400 after boot is unchanged: no other byte marks that warm-up. Co-authored-by: Piotr Paczyński <pit3k@users.noreply.github.com>
One sighting during power-cycling and pairing is not enough to call -5 pairing mode. Drop the device-specific mapping and its tests. A short comment records that the cause is unknown. Co-authored-by: Piotr Paczyński <pit3k@users.noreply.github.com>
AUTO at speed 0 and OFF at speed 50 are reported values. Drop standby and any claim about whether the fan was physically spinning. Co-authored-by: Piotr Paczyński <pit3k@users.noreply.github.com>
set_fan_mode and set_fan_speed send one argument and return the decoded SET response. MANUAL has no mode command. Reads expose purifier_online from bit 7 of the fan-state byte and ignore bit 0 when naming the mode. Co-authored-by: Piotr Paczyński <pit3k@users.noreply.github.com>
The station accepts a speed and returns the offline state, and it rejects a mode with error -5. Neither change is applied after reconnect. Co-authored-by: Piotr Paczyński <pit3k@users.noreply.github.com>
Fix LIFAair LM05 readings found on the device
|
Thanks @xain, this matches what I found on my LM05.
Home Assistant now uses broadlink-async instead of this library, so I've moved LM05 support there: DAB-LABS#29. Closing this one in favour of it. |
Context
I have LIFAair air purifier that talks broadlink protocol. I've added support for it.
It supports controlling the fan and reading it's various sensors: temperature, humidity, co2, TVOC, PM2.5.
Product link: https://lifa-air.com/products/lifa-air-la330-air-purifier
Proposed change
Implement support for it and add a simple cli script that can be used to test this device.
Type of change
Additional information
Checklist