0.6.0.dev0: introspectable APIs and miot support
Pre-releaseThis is a pre-release for 0.6.0 to make the current state of the library
available via PyPI for testing and development, and is not yet ready for
end users. There are several breaking changes as detailed in the PRs
below, but for most library users, the most visible change being that
the integrations have moved into their own packages under
miio.integrations
instead being available under the main package.
Instead of directly importing the wanted implementation class, you can
now use DeviceFactory
to construct an instance.
This release is a huge with over 200 pull requests with 364 files
changed, including 13748 insertions and 5114 deletions. It is also the
largest release in terms of device support, as it adds support for all
miot/miotspec devices using the genericmiot integration. This is a big
change in how the library was originally designed, as these devices will
require downloading externally hosted specification files to function.
These files are downloaded automatically when the device is used for the
first time and cached for some time for later invocations.
The major highlights of this release include:
- Introspectable interfaces for accessing supported features (status(),
sensors(), settings(), actions()) that will allow downstream users (like
homeassistant) to support devices without hardcoding details in their
codebases. - Generic support for all locally controllable, modern miot devices
(using genericmiot integration,miiocli genericmiot
). - Factory method for creating device instances instead of requiring to
hardcode them (seeDeviceFactory
). - miio and miot simulators to allow development without having access to
devices. This was used to create the miot support and might be useful
for other developers.
There are plenty of more in this release, so huge thanks to everyone who
has contributed to this release and my apologies that it has taken so
long to prepare this. I am hoping that we will get the release blockers
fixed in a timely manner to make these new improvements available for
everyone without having to use the git version.
Help is needed to add the metadata required for the introspectable
interfaces to all existing integrations, see
https://python-miio.readthedocs.io/en/latest/contributing.html#status-containers
and its subsections, if you are looking to contribute. Otherwise, feel
free to test and report any issues, so that we can get those fixed for
the 0.6.0! :-)
Note: the current homeassistant integration requires major refactoring
effort to make use of the new interfaces, so this release will not be
directly useful for most of the users until that work is done. This
release aims to unblock other homeassistant PRs that have been pending
for a long time.
Breaking changes:
- Introduce common interfaces based on device descriptors #1845 (@rytilahti)
- Rename descriptor's 'property' to 'status_attribute' #1759 (@rytilahti)
- Remove {Light,Vacuum}Interfaces #1743 (@rytilahti)
- Rename SettingDescriptor's type to setting_type #1715 (@rytilahti)
- Allow defining device_id for push server #1710 (@rytilahti)
- Reorganize all integrations to vendor-specific dirs #1697 (@rytilahti)
- Remove long-deprecated miio.vacuum module #1607 (@rytilahti)
- Allow passing custom name for miotdevice.set_property_by #1576 (@rytilahti)
- Improve viomi.vacuum.v8 (styj02ym) support #1559 (@rytilahti)
- Clean up raised library exceptions #1558 (@rytilahti)
- Move test-properties to under devtools command #1505 (@rytilahti)
- Implement introspectable settings #1500 (@rytilahti)
- Drop support for python 3.7 #1469 (@rytilahti)
Implemented enhancements:
- Added support for Xiaomi Tower Fan (dmaker.fan.p39) #1877 (@paranerd)
- Raise InvalidTokenException on invalid token #1874 (@rytilahti)
- Added support for Xiaomi Smart Space Heater 1S (zhimi.heater.mc2a) #1868 (@paranerd)
- Add specification for yeelink.light.lamp2 #1859 (@izacus)
- Add support for dmaker.fan.p45 #1853 (@saxel)
- Improve Yeelight by using common facilities #1846 (@rytilahti)
- Mark xiaomi.repeater.v3 as supported for wifirepeater #1812 (@kebianizao)
- Set zhimi.fan.za4 countdown timer to minutes #1787 (@alex3305)
- Add
repeat
param to Roborock segment clean #1771 (@MrBartusek) - Add standard identifiers for fans #1741 (@rytilahti)
- Add standard identifiers for lights #1739 (@rytilahti)
- Make optional deps really optional #1738 (@rytilahti)
- Add roborock mop washing actions #1730 (@starkillerOG)
- Use standard identifiers for roborock #1729 (@starkillerOG)
- Allow defining id for descriptor decorators #1724 (@rytilahti)
- Use normalized property names for genericmiotstatus #1723 (@rytilahti)
- Require name for status embedding #1712 (@rytilahti)
- Add parent reference to embedded containers #1711 (@rytilahti)
- add specs for yeelink.light.colorb #1709 (@Mostalk)
- Cache descriptors on first access #1701 (@starkillerOG)
- Improve cloud interface and cli #1699 (@rytilahti)
- Improve roborock update handling #1685 (@rytilahti)
- Use descriptors for default status command cli output #1684 (@rytilahti)
- Fix access to embedded status containers #1682 (@rytilahti)
- Prettier settings and status for genericmiot #1664 (@rytilahti)
- Implement input parameters for actions #1663 (@rytilahti)
- Handle non-readable miot properties #1662 (@rytilahti)
- Add firmware_features command to roborock #1661 (@rytilahti)
- Improve info output (command to use, miot support) #1660 (@rytilahti)
- Add supports_miot to device class #1659 (@rytilahti)
- Add more status codes for dreamevacuum #1650 (@zoic21)
- roborock: Fix waterflow setting for Q7 Max+ #1646 (@nijel)
- Add support for pet waterer mmgg.pet_waterer.wi11 #1630 (@Alex-ala)
- Add mop dryer add-on of the S7 MaxV Ultra station #1621 (@jpbede)
- Add Roborock S7 MaxV Ultra station sensors #1608 (@jpbede)
- Expose dnd status, add actions for viomivacuum #1603 (@rytilahti)
- Add range_attribute parameter to NumberSettingDescriptor #1602 (@rytilahti)
- Off fan speed for Roborock S7 #1601 (@rogelio-o)
- Add multi map handling to roborock #1596 (@starkillerOG)
- Implement introspectable actions #1588 (@starkillerOG)
- Implement choices_attribute for setting decorator #1587 (@starkillerOG)
- Add additional sensors and settings to Roborock vacuums #1585 (@starkillerOG)
- Add generic miot support #1581 (@rytilahti)
- Add interface to obtain miot schemas #1578 (@rytilahti)
- Add models to parse miotspec files to miio module #1577 (@rytilahti)
- Use rich for logging and cli print outs #1568 (@rytilahti)
- Improve serverprotocol error handling #1564 (@rytilahti)
- Add VacuumDeviceStatus and VacuumState #1560 (@rytilahti)
- Add descriptors for yeelight #1557 (@rytilahti)
- Implement device factory #1556 (@rytilahti)
- Add miot simulator #1539 (@rytilahti)
- Allow custom methods for miio simulator #1538 (@rytilahti)
- Add descriptors for zhimi.fan.{v2,v3,sa1,za1,za3,za4} #1533 (@rytilahti)
- Add basic miIO simulator #1532 (@rytilahti)
- Make pushserver more generic #1531 (@rytilahti)
- Implement embedding DeviceStatus containers #1526 (@rytilahti)
- Use asyncio facilities for push server where possible #1521 (@starkillerOG)
- Make unit optional for @setting, fix type hint for choices #1519 (@Kirmas)
- Add yeelink.light.mono6 specs for yeelight #1509 (@tomechio)
- Expose sensors, switches, and settings for zhimi.airhumidifier #1508 (@Kirmas)
- Add parse-pcap command to devtools #1506 (@rytilahti)
- Add sensor decorators for roborock vacuums #1498 (@rytilahti)
- Implement introspectable switches #1494 (@rytilahti)
- Implement introspectable sensors #1488 (@rytilahti)
- Add smb share feature for Chuangmi Camera #1482 (@0x5e)
Fixed bugs:
- Fix genericmiot status to query all readable properties #1898 (@rytilahti)
- Make Device.sensors() only return read-only descriptors #1871 (@rytilahti)
- Use call_action_from_mapping for existing miot integrations #1855 (@rytilahti)
- add json decode quirk for xiaomi e10 #1837 (@kolos)
- Don't log error message when decoding valid discovery packets #1832 (@gunjambi)
- dreamevacuum: don't crash on missing property values #1831 (@rytilahti)
- genericmiot: skip properties with invalid values #1830 (@rytilahti)
- Fix invalid cache handling for miotcloud schema fetch #1819 (@rytilahti)
- Make sure cache directory exists for miotcloud #1798 (@rytilahti)
- Fix hardcoded lumi.gateway module path #1794 (@rytilahti)
- Fix broken miio-simulator start-up #1792 (@rytilahti)
- roborock: guard current_map_id access #1760 (@rytilahti)
- Fix wrong check in genericmiot for writable properties #1758 (@rytilahti)
- Remove unsupported settings first after initialization is done #1736 (@rytilahti)
- Allow gatt-access for miotproperties #1722 (@rytilahti)
- Add tests to genericmiot's get_descriptor #1716 (@rytilahti)
- Catch UnsupportedFeatureException on unsupported settings #1703 (@starkillerOG)
- Do not crash on extranous urn components #1693 (@rytilahti)
- Fix read-only check for miotsimulator #1690 (@rytilahti)
- Fix broken logging when miotcloud reports multiple available versions #1686 (@rytilahti)
- viomivacuum: Fix incorrect attribute accesses on status output #1677 (@rytilahti)
- Fix incorrect super().__getattr__() use on devicestatus #1676 (@rytilahti)
- Pass package_name to click.version_option() #1675 (@rytilahti)
- Fix json output handling for genericmiot #1674 (@rytilahti)
- Fix logging undecodable responses #1626 (@rytilahti)
- Use piid-siid instead of did for mapping genericmiot responses #1620 (@rytilahti)
- Ensure that cache directory exists #1613 (@rytilahti)
- Fix inconsistent constructor signatures for device classes #1606 (@rytilahti)
- Use __qualname__ to make ids unique for settings and sensors #1589 (@starkillerOG)
- Fix yeelight status for white-only bulbs #1562 (@rytilahti)
- Prefer newest, released release for miottemplate #1540 (@rytilahti)
- Use typing.List for devtools/pcapparser #1530 (@rytilahti)
- Skip write-only properties for miot status requests #1525 (@rytilahti)
- Fix roborock timers' next_schedule on repeated requests #1520 (@phil9909)
- Fix support for airqualitymonitor running firmware v4+ #1510 (@WeslyG)
- Mark zhimi.airp.mb3a as supported for airpurifier_miot #1507 (@rytilahti)
- Suppress deprecated accesses to properties for devicestatus repr #1487 (@rytilahti)
- Fix favorite level for zhimi.airp.rmb1 #1486 (@alexdrl)
- Fix mDNS name for chuangmi.camera.038a2 #1480 (@0x5e)
- Add missing functools.wraps() for @command decorated methods #1478 (@rytilahti)
- fix bright level in set_led_brightness for miot purifiers #1477 (@borky)
- Fix chuangmi_ir supported models for h102a03 #1475 (@rytilahti)
New devices:
- Added support for dreame d10 plus #1827 (@TxMat)
- Support for Xiaomi Baseboard Heater 1S (leshow.heater.bs1s) #1656 (@sayzard)
- Add support for zhimi.airp.mb5a #1527 (@rytilahti)
- Add support for dreame.vacuum.p2029 #1522 (@escoand)
- Add support for dreame trouver finder vacuum #1514 (@Massl123)
- Add support Mi Robot Vacuum-Mop 2 Pro (ijai.vacuum.v3) #1497 (@k402xxxcenxxx)
- Add yeelink.light.strip6 support #1484 (@st7105)
- Add support for the Xiaomi/Viomi Dishwasher (viomi.dishwasher.m02) #877 (@TheDJVG)
Documentation updates:
- Improve docs on token acquisition and cleanup legacy methods #1757 (@rytilahti)
- Simplify install from git instructions #1737 (@rytilahti)
- Miscellaneous janitor work #1691 (@rytilahti)
- Update and restructure the readme #1689 (@rytilahti)
- Use python3 for update firmware docs #1666 (@martin-kokos)
- Add miot-simulator docs #1561 (@rytilahti)
- Enable fail-on-error for doc builds #1473 (@rytilahti)
- Build readthedocs on python3.9 #1472 (@rytilahti)
- Document traffic capture and analysis #1471 (@rytilahti)
Merged pull requests:
- Mark Q Revo as supporting auto-empty #1900 (@SLaks)
- Update pre-commit hooks & dependencies #1899 (@rytilahti)
- Add Roborock S8 Pro Ultra #1891 (@spangenberg)
- Move mocked device and status into conftest #1873 (@rytilahti)
- Update gitignore #1872 (@rytilahti)
- Rename properties to descriptors for devicestatus #1870 (@rytilahti)
- Use trusted publisher setup for CI #1852 (@rytilahti)
- Add python 3.12 to CI #1851 (@rytilahti)
- Suppress 'found an unsupported model' warning #1850 (@rytilahti)
- Update dependencies and pre-commit hooks #1848 (@rytilahti)
- Use __cli_output__ for info() #1847 (@rytilahti)
- Mark roborock q revo (roborock.vacuum.a75) as supported #1841 (@rytilahti)
- Fix doc build for sphinx v7 #1817 (@rytilahti)
- Support pydantic v2 using v1 shims #1816 (@rytilahti)
- Add deprecation warnings for main module imports #1813 (@rytilahti)
- Replace datetime.utcnow + datetime.utcfromtimestamp #1809 (@cdce8p)
- Mark xiaomi.wifispeaker.l05g as supported for ChuangmiIr #1804 (@danielszilagyi)
- Expose DeviceInfoUnavailableException #1799 (@rytilahti)
- Fix flake8 SIM910 errors and add pin pydantic==^1 #1793 (@rytilahti)
- Implement __cli_output__ for descriptors #1762 (@rytilahti)
- Pull 'unit' up to the descriptor base class #1761 (@rytilahti)
- Update dependencies and pre-commit hooks #1755 (@rytilahti)
- Minor pretty-printing changes #1754 (@rytilahti)
- Generalize settings and sensors into properties #1753 (@rytilahti)
- Add deerma.humidifier.jsq2w to jsqs integration #1748 (@mislavbasic)
- Remove fan_common module #1744 (@rytilahti)
- Minor viomi cleanups #1742 (@rytilahti)
- Add enum for standardized vacuum identifier names #1732 (@rytilahti)
- Add missing command for feature request template #1731 (@rytilahti)
- add specs for yeelink.light.colora #1727 (@Mostalk)
- Split genericmiot into parts #1725 (@rytilahti)
- Mark Roborock Q7+ (a40) as supported for roborock #1704 (@andyloree)
- Remove hardcoded model information from mdns discovery #1695 (@rytilahti)
- Set version to 0.6.0.dev #1688 (@rytilahti)
- Remove LICENSE.md #1687 (@rytilahti)
- Move creation of miot descriptors to miot model #1672 (@rytilahti)
- Fix flake8 issues (B028) #1671 (@rytilahti)
- Make simulators return localhost address for info query #1657 (@rytilahti)
- Fix GitHub issue template #1648 (@nijel)
- Enable auto-empty settings for roborock Q7 Max+ #1645 (@nijel)
- Bump codecov-action to @V3 #1643 (@rytilahti)
- Update pre-commit hooks #1642 (@rytilahti)
- Bump dependencies in poetry.lock #1641 (@rytilahti)
- Mark dreame.vacuum.r2228o (L10S ULTRA) as supported #1634 (@zoic21)
- Bump github action versions #1615 (@rytilahti)
- Use micloud for miotspec cloud connectivity #1610 (@rytilahti)
- Mark "chuangmi.camera.021a04" as supported #1599 (@st7105)
- Update pre-commit url for flake8 #1598 (@rytilahti)
- Use type instead of string for SensorDescriptor type #1597 (@rytilahti)
- Mark philips.light.cbulb as supported #1593 (@rytilahti)
- Raise exception on not-implemented @setting(setter) #1591 (@starkillerOG)
- default unit to None in sensor decorator #1590 (@starkillerOG)
- Mark more roborock devices as supported #1582 (@rytilahti)
- Less verbose reprs for descriptors #1579 (@rytilahti)
- Initialize descriptor extras using factory #1575 (@rytilahti)
- Fix setting enum values, report on invalids in miotsimulator #1574 (@rytilahti)
- Use __ as delimiter for embedded statuses #1573 (@rytilahti)
- Rename ButtonDescriptor to ActionDescriptor #1567 (@rytilahti)
- Remove SwitchDescriptor in favor of BooleanSettingDescriptor #1566 (@rytilahti)
- Manually pass the codecov token in CI #1565 (@rytilahti)
- Fix CI by defining attrs constraint properly #1534 (@rytilahti)
- fix some typos #1529 (@phil9909)
- Allow defining callable setters for switches and settings #1504 (@rytilahti)
- Use attr.s instead attrs.define for homeassistant support #1503 (@rytilahti)
- Simplify helper decorators to accept name as non-kwarg #1499 (@rytilahti)
- Fix supported angles for dmaker.fan.{p15,p18) #1496 (@iMicknl)
- Mark Xiaomi Chuangmi Camera (chuangmi.camera.ipc013) as supported #1479 (@0x5e)