Skip to content

Commit

Permalink
airhumidifer_(mj)jsq: Add use_time for better API compatibility among…
Browse files Browse the repository at this point in the history
… humidifiers (#1179)
  • Loading branch information
rytilahti authored Nov 5, 2021
1 parent 9b099b5 commit 210e818
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
10 changes: 9 additions & 1 deletion miio/airhumidifier_jsq.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import enum
import logging
from typing import Any, Dict
from typing import Any, Dict, Optional

import click

Expand Down Expand Up @@ -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."""
Expand Down
8 changes: 8 additions & 0 deletions miio/airhumidifier_mjjsq.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down

0 comments on commit 210e818

Please sign in to comment.