Skip to content
This repository was archived by the owner on Nov 19, 2026. It is now read-only.

Fix LIFAair LM05 readings found on the device - #1

Merged
pit3k merged 5 commits into
masterfrom
cursor/lm05-reading-fixes-a79c
Nov 18, 2026
Merged

pit3k merged 5 commits into
masterfrom
cursor/lm05-reading-fixes-a79c

Conversation

@pit3k

@pit3k pit3k commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Context

Physical test of 9d46625 on an LM05 (fw 10026) on 2026-11-17. 9d46625 is unchanged.

The library turns device bytes into real state. Placeholder zeros are not forwarded as readings. Setters send one encoded argument and return the decoded response. No read-before-write, retries, or extra heuristics.

Proposed change

  • Temperature and humidity bytes 00 00 00 return None, including the first poll after the purifier reconnects (fan state already online, 4 of 4 cases).
  • purifier_online is bit 7 of fan-state byte 55. When it is false (observed 0x01), fan mode, fan speed, temperature and humidity are None. The offline speed byte is 0, a placeholder. Station readings stay decoded.
  • Fan mode and fan speed are otherwise the values the device reports, including AUTO at speed 0 and OFF with a non-zero speed. Bit 0 of byte 55 is ignored, so 0x80/0x84/0xA4 decode as OFF/MANUAL/AUTO. It is not exposed.
  • set_fan_mode sends one SET_FAN_MODE argument (OFF 1, AUTO 2, NIGHT 6, TURBO 7, ANTI_ALLERGY 11) and returns that response. MANUAL and UNKNOWN raise ValueError and send nothing. There is no MANUAL opcode; use set_fan_speed.
  • set_fan_speed sends one SET_FAN_SPEED argument, 0..121, and returns that response. Values that cannot be encoded raise ValueError.
  • get_state docstring matches those return values.
  • Unit tests decode captured frames and assert each setter sends exactly one packet.

Type of change

  • Bugfix (non-breaking change which fixes an issue)
  • Dependency upgrade
  • New device
  • New product id (the device is already supported with a different id)
  • New feature (which adds functionality to an existing device)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests
  • Documentation

Additional information

Observed on fw 10026, documented on the setters, not enforced by extra packets:

  • Any mode except OFF reports MANUAL after set_fan_speed, including speed 0. In OFF the speed is applied and the fan spins, but the device keeps reporting OFF.
  • In OFF only OFF and AUTO are accepted. NIGHT, TURBO and ANTI_ALLERGY raise device error -5 (StorageError) and nothing changes. AUTO from OFF reports speed 30 and may drop to 0 a few seconds later. NIGHT starts at 10, TURBO at 121, ANTI_ALLERGY at 60.
  • While the purifier main unit is offline (0x01), set_fan_speed succeeds and returns purifier_online False. The speed is not applied, neither then nor after the unit reconnects.
  • While the purifier main unit is offline, set_fan_mode is rejected with device error -5 (StorageError). The mode is not applied after the unit reconnects either.

Left unchanged, with the reason:

  • Error -5 stays the shared StorageError ("The device storage is full"). It is also what the device returns for a rejected mode. No LM05-specific remap.
  • CO2 reads exactly 400 for up to ~10 s after the station starts (5/5) and was also seen once when the main unit dropped out. 400 ppm can be real, so it is kept.
  • Formaldehyde. Still u16 / 100. Always 0.00 on this unit; another user verified the scale. Zero stays 0.0, not None.
  • The other LM05's unpaired climate bytes. PR #807 says offsets 27/29 stay at raw 25 and 45, which this code decodes as 2.5 °C / 45 %, not 25 °C. A single frame cannot tell that apart from a real reading, so it is not special-cased. If that unit also sends fan-state bit 7 clear, those keys are already None.
  • The purifier resetting itself to AUTO after a restart or re-pair. Device behaviour.
  • Mode arguments 9 and 10 only clear or set bit 0 of byte 55. Meaning unknown, so they are not commands.

Checklist

  • The code change is tested and works locally.
  • The code has been formatted using Black.
  • The code follows the Zen of Python.
  • I am creating the Pull Request against the correct branch.
  • Documentation added/updated.
Open in Web Open in Cursor 

cursoragent and others added 5 commits November 17, 2026 14:42
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>
@pit3k
pit3k merged commit 38e1688 into master Nov 18, 2026
@pit3k pit3k mentioned this pull request Nov 18, 2026
5 tasks done
@pit3k
pit3k deleted the cursor/lm05-reading-fixes-a79c branch November 19, 2026 17:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants