Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TOKIT Smart Rice Cooker (tokit.cooker.tk4001) #1961

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ docs/api/
*_BASE_*
*_LOCAL_*
*_REMOTE_*

.DS_Store
.vscode
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ The full documentation is available at [python-miio.readthedocs.io](https://pyth

---

* [Installation](#installation)
* [Getting started](#getting-started)
* [Controlling modern (MIoT) devices](#controlling-modern-miot-devices)
* [Controlling older (miIO) devices](#controlling-older-miio-devices)
* [Troubleshooting](#troubleshooting)
* [API usage](#api-usage)
* [Contributing](#contributing)
* [Simulators](#simulators)
* [Supported devices](#supported-devices)
* [Projects using this library](#projects-using-this-library)
* [Other related projects](#other-related-projects)
- [Installation](#installation)
- [Getting started](#getting-started)
- [Controlling modern (MIoT) devices](#controlling-modern-miot-devices)
- [Controlling older (miIO) devices](#controlling-older-miio-devices)
- [Troubleshooting](#troubleshooting)
- [API usage](#api-usage)
- [Contributing](#contributing)
- [Simulators](#simulators)
- [Supported devices](#supported-devices)
- [Projects using this library](#projects-using-this-library)
- [Other related projects](#other-related-projects)

---

Expand Down Expand Up @@ -295,6 +295,7 @@ integration, this library supports also the following devices:
* Xiaomi Smart Pet Water Dispenser (mmgg.pet_waterer.s1, s4, wi11)
* Xiaomi Mi Smart Humidifer S (jsqs, jsq5)
* Xiaomi Mi Robot Vacuum Mop 2 (Pro+, Ultra)
* Tokit Smart Rice Cooker (tokit.cooker.tk4001)

*Feel free to create a pull request to add support for new devices as
well as additional features for already supported ones.*
Expand Down Expand Up @@ -327,6 +328,7 @@ parentheses) may also support other devices listed above.
* [Xiaomi Raw Sensor](https://github.com/syssi/xiaomi_raw)
* [Xiaomi MIoT Devices](https://github.com/ha0y/xiaomi_miot_raw)
* [Xiaomi Miot Auto](https://github.com/al-one/hass-xiaomi-miot)
* [Tokit Smart Rice Cooker](https://github.com/oooohhoo/tokit_cooker)

## Other related projects

Expand Down
1 change: 1 addition & 0 deletions miio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
from miio.integrations.chuangmi.remote import ChuangmiIr
from miio.integrations.chunmi.cooker import Cooker
from miio.integrations.chunmi.cooker_multi import MultiCooker
from miio.integrations.chunmi.cooker_tokit import TokitCooker
from miio.integrations.deerma.humidifier import AirHumidifierJsqs, AirHumidifierMjjsq
from miio.integrations.dmaker.airfresh import AirFreshA1, AirFreshT2017
from miio.integrations.dmaker.fan import Fan1C, FanMiot, FanP5
Expand Down
5 changes: 1 addition & 4 deletions miio/click_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,7 @@ def wrap(*args, **kwargs):
if msg:
echo(msg.strip())
result = kwargs["result"] = func(*args, **kwargs)
if (
not callable(result_msg_fmt)
and getattr(result, "__cli_output__", None) is not None
):
if not callable(result_msg_fmt) and getattr(result, "__cli_output__", ""):
echo(result.__cli_output__)
elif result_msg_fmt:
if callable(result_msg_fmt):
Expand Down
3 changes: 2 additions & 1 deletion miio/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from .devicestatus import DeviceStatus
from .exceptions import (
DeviceError,
DeviceException,
DeviceInfoUnavailableException,
PayloadDecodeException,
)
Expand Down Expand Up @@ -314,7 +315,7 @@ def supports_miot(self) -> bool:
"""
try:
self.send("get_properties", [{"did": "dummy", "siid": 1, "piid": 1}])
except DeviceError as ex:
except (DeviceError, DeviceException) as ex:
_LOGGER.debug("miot query failed, likely non-miot device: %s", repr(ex))
return False
return True
Expand Down
3 changes: 3 additions & 0 deletions miio/integrations/chunmi/cooker_tokit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .cooker_tokit import TokitCooker

__all__ = ["TokitCooker"]
Loading
Loading