This repository was archived by the owner on Nov 19, 2026. It is now read-only.
Repository navigation
Conversation
Adds the lifaair class for the LM05 (0x4EC2). get_state decodes firmware 10026 frames. set_fan_mode and set_fan_speed each send one encoded argument and return the decoded response. Fan mode, speed, temperature and humidity are None when the purifier is offline. Tested on an LM05 with firmware 10026. Co-authored-by: Piotr Paczyński <pit3k@users.noreply.github.com>
Device enums live on the device class and are not re-exported. FanMode is now lifaair.FanMode. The two lookup tables are private, matching the other device classes. Co-authored-by: Piotr Paczyński <pit3k@users.noreply.github.com>
lifaair_state_data assigns each decoded field on its own line. The three canned frames stay the bytes captured on firmware 10026. Co-authored-by: Piotr Paczyński <pit3k@users.noreply.github.com>
One sentence of what the class supports, the CLI script, and who contributed it. Co-authored-by: Piotr Paczyński <pit3k@users.noreply.github.com>
broadlink_cli sets the fan with --fanmode and --fanspeed and prints the decoded state. --sensors prints get_state for an LM05. The per-device script is removed. Co-authored-by: Piotr Paczyński <pit3k@users.noreply.github.com>
Drop the lifaair branch from --sensors. --getstate already prints get_state, and --fanmode and --fanspeed stay. Co-authored-by: Piotr Paczyński <pit3k@users.noreply.github.com>
--fanmode uses FanMode[name] only. The LM05 tests build the device with the shared HOST and MAC and keep their helpers with the others. Co-authored-by: Piotr Paczyński <pit3k@users.noreply.github.com>
Drop the tests that spy on _send or repeat the oracle. ValueError cases only check the raise, and each decode test asserts its point. Co-authored-by: Piotr Paczyński <pit3k@users.noreply.github.com>
The LM05 stops answering a source port after 10 received packets, and a new port works with the same session key. lifaair drops its endpoint after each exchange; other devices keep the one they already hold. Co-authored-by: Piotr Paczyński <pit3k@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
The LIFAair LM05 (devtype 0x4EC2, firmware 10026) is already supported on this repository's synchronous
master, in pit3k/python-broadlink#1, which continued mjg59/python-broadlink#807. Home Assistant pinsbroadlink-async==1.3.0, and a separate fork of DAB-LABS/broadlink-async cannot be created because the two repositories share a fork network. This change hosts that device support onasync-master, which points at DAB-LABS/broadlink-async9c96c75(tag v1.3.0).This pull request is ready to be proposed to DAB-LABS/broadlink-async later. It is opened here, against
async-master, only.Proposed change
Adds a
lifaairclass for the LM05 and registers product id 0x4EC2 as modelLM05, manufacturerLIFAair. Fan modes are the nested enumlifaair.FanMode.get_statereturns the station readings (CO2, TVOC, formaldehyde, PM1, PM2.5, PM10) and the purifier's fan mode, speed, temperature and humidity. Fan mode, speed, temperature and humidity areNonewhen the purifier is offline.purifier_onlineis bit 7 of the fan-state byte. Bytes 27-29 of00 00 00on the first poll after reconnect areNone, which is the placeholder, rather than 0.0 °C / 0 %.set_fan_modeandset_fan_speedeach send one packet carrying the encoded argument and return the decoded SET response. The call does not read before writing, and it does not verify or retry.lifaair.FanMode.MANUAL,lifaair.FanMode.UNKNOWNandNonehave no mode command and raiseValueError. A speed is an int in 0..121; a bool is rejected.StorageError.broadlink_clireads an LM05 with the existing--getstateoption and sets the fan with--fanmodeand--fanspeed, printing the decoded state. The behaviour was checked on an LM05 with firmware 10026 in #1. This port is checked against those captured frames.Type of change
Additional information
Checklist
pytest).ruff check .passes.CHANGELOG.mdhas an entry under Unreleased.