From 210e818b733bb31544f2844a7719ab501b0b300f Mon Sep 17 00:00:00 2001 From: Teemu R Date: Fri, 5 Nov 2021 15:42:13 +0100 Subject: [PATCH] airhumidifer_(mj)jsq: Add use_time for better API compatibility among humidifiers (#1179) --- miio/airhumidifier_jsq.py | 10 +++++++++- miio/airhumidifier_mjjsq.py | 8 ++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/miio/airhumidifier_jsq.py b/miio/airhumidifier_jsq.py index 98f5326e6..c3dee049d 100644 --- a/miio/airhumidifier_jsq.py +++ b/miio/airhumidifier_jsq.py @@ -1,6 +1,6 @@ import enum import logging -from typing import Any, Dict +from typing import Any, Dict, Optional import click @@ -129,6 +129,14 @@ def lid_opened(self) -> bool: """True if the water tank is detached.""" return self.data["lid_opened"] == 1 + @property + def use_time(self) -> Optional[int]: + """How long the device has been active in seconds. + + Not supported by the device, so we return none here. + """ + return None + class AirHumidifierJsq(Device): """Implementation of Xiaomi Zero Fog Humidifier: shuii.humidifier.jsq001.""" diff --git a/miio/airhumidifier_mjjsq.py b/miio/airhumidifier_mjjsq.py index 454deff07..0e24be59a 100644 --- a/miio/airhumidifier_mjjsq.py +++ b/miio/airhumidifier_mjjsq.py @@ -120,6 +120,14 @@ def wet_protection(self) -> Optional[bool]: return None + @property + def use_time(self) -> Optional[int]: + """How long the device has been active in seconds. + + Not supported by the device, so we return none here. + """ + return None + class AirHumidifierMjjsq(Device): """Support for deerma.humidifier.(mj)jsq."""