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 support for dmaker.fan.p9 and dmaker.fan.p10 #819

Merged
merged 6 commits into from
Oct 7, 2020
Merged
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
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Supported devices
- Xiaomi Philips Zhirui Smart LED Bulb E14 Candle Lamp
- Xiaomi Philips Zhirui Bedroom Smart Lamp
- Xiaomi Universal IR Remote Controller (Chuangmi IR)
- Xiaomi Mi Smart Pedestal Fan V2, V3, SA1, ZA1, ZA3, ZA4, P5
- Xiaomi Mi Smart Pedestal Fan V2, V3, SA1, ZA1, ZA3, ZA4, P5, P9, P10
- Xiaomi Mi Air Humidifier V1, CA1, CA4, CB1, MJJSQ, JSQ001
- Xiaomi Mi Water Purifier (Basic support: Turn on & off)
- Xiaomi PM2.5 Air Quality Monitor V1, B1, S1
Expand Down
7 changes: 7 additions & 0 deletions docs/api/miio.airconditioningcompanionMCN.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
miio.airconditioningcompanionMCN module
=======================================

.. automodule:: miio.airconditioningcompanionMCN
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/api/miio.fan_common.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
miio.fan\_common module
=======================

.. automodule:: miio.fan_common
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/api/miio.fan_miot.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
miio.fan\_miot module
=====================

.. automodule:: miio.fan_miot
:members:
:undoc-members:
:show-inheritance:
2 changes: 2 additions & 0 deletions docs/api/miio.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ Submodules
miio.exceptions
miio.extract_tokens
miio.fan
miio.fan_common
miio.fan_miot
miio.gateway
miio.heater
miio.miioprotocol
Expand Down
1 change: 1 addition & 0 deletions miio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from miio.device import Device
from miio.exceptions import DeviceError, DeviceException
from miio.fan import Fan, FanP5, FanSA1, FanV2, FanZA1, FanZA4
from miio.fan_miot import FanMiot, FanP9, FanP10
from miio.gateway import Gateway
from miio.heater import Heater
from miio.philips_bulb import PhilipsBulb, PhilipsWhiteBulb
Expand Down
4 changes: 4 additions & 0 deletions miio/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
Cooker,
Device,
Fan,
FanMiot,
Heater,
PhilipsBulb,
PhilipsEyecare,
Expand Down Expand Up @@ -78,6 +79,7 @@
MODEL_FAN_ZA3,
MODEL_FAN_ZA4,
)
from .fan_miot import MODEL_FAN_P9, MODEL_FAN_P10
from .heater import MODEL_HEATER_MA1, MODEL_HEATER_ZA1
from .powerstrip import MODEL_POWER_STRIP_V1, MODEL_POWER_STRIP_V2
from .toiletlid import MODEL_TOILETLID_V1
Expand Down Expand Up @@ -161,6 +163,8 @@
"zhimi-fan-za3": partial(Fan, model=MODEL_FAN_ZA3),
"zhimi-fan-za4": partial(Fan, model=MODEL_FAN_ZA4),
"dmaker-fan-p5": partial(Fan, model=MODEL_FAN_P5),
"dmaker-fan-p9": partial(FanMiot, model=MODEL_FAN_P9),
"dmaker-fan-p10": partial(FanMiot, model=MODEL_FAN_P10),
"tinymu-toiletlid-v1": partial(Toiletlid, model=MODEL_TOILETLID_V1),
"zhimi-airfresh-va2": partial(AirFresh, model=MODEL_AIRFRESH_VA2),
"zhimi-airfresh-va4": partial(AirFresh, model=MODEL_AIRFRESH_VA4),
Expand Down
23 changes: 1 addition & 22 deletions miio/fan.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import enum
import logging
from typing import Any, Dict, Optional

import click

from .click_common import EnumType, command, format_output
from .device import Device
from .exceptions import DeviceException
from .fan_common import FanException, LedBrightness, MoveDirection, OperationMode

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -64,26 +63,6 @@
}


class FanException(DeviceException):
pass


class OperationMode(enum.Enum):
Normal = "normal"
Nature = "nature"


class LedBrightness(enum.Enum):
Bright = 0
Dim = 1
Off = 2


class MoveDirection(enum.Enum):
Left = "left"
Right = "right"


class FanStatus:
"""Container for status reports from the Xiaomi Mi Smart Pedestal Fan."""

Expand Down
23 changes: 23 additions & 0 deletions miio/fan_common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import enum
swim2sun marked this conversation as resolved.
Show resolved Hide resolved

from .exceptions import DeviceException


class FanException(DeviceException):
pass


class OperationMode(enum.Enum):
Normal = "normal"
Nature = "nature"


class LedBrightness(enum.Enum):
Bright = 0
Dim = 1
Off = 2


class MoveDirection(enum.Enum):
Left = "left"
Right = "right"
Loading