-
Notifications
You must be signed in to change notification settings - Fork 117
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
Added support for Xiaomi Smart Tower Fan #225
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syssi
reviewed
Jul 20, 2023
Could you use |
I don't know the VSCode extension. You could install the pypi package called
And execute the tool at the custom component folder once:
diff --git a/custom_components/xiaomi_miio_fan/fan.py b/custom_components/xiaomi_miio_fan/fan.py
index 559480b..e31b8af 100644
--- a/custom_components/xiaomi_miio_fan/fan.py
+++ b/custom_components/xiaomi_miio_fan/fan.py
@@ -78,7 +78,7 @@ MODEL_FAN_P11 = "dmaker.fan.p11" # Mijia Pedestal Fan
MODEL_FAN_P15 = "dmaker.fan.p15" # Pedestal Fan Fan P15
MODEL_FAN_P18 = "dmaker.fan.p18" # Mi Smart Standing Fan 2
MODEL_FAN_P33 = "dmaker.fan.p33" # Mi Smart Standing Fan Pro 2
-MODEL_FAN_P39 = "dmaker.fan.p39" # Smart Tower Fan
+MODEL_FAN_P39 = "dmaker.fan.p39" # Smart Tower Fan
MODEL_FAN_LESHOW_SS4 = "leshow.fan.ss4"
MODEL_FAN_1C = "dmaker.fan.1c" # Pedestal Fan Fan 1C
@@ -362,9 +362,7 @@ FEATURE_FLAGS_FAN_P33 = (
)
FEATURE_FLAGS_FAN_P39 = (
- FEATURE_SET_CHILD_LOCK
- | FEATURE_SET_OSCILLATION_ANGLE
- | FEATURE_SET_NATURAL_MODE
+ FEATURE_SET_CHILD_LOCK | FEATURE_SET_OSCILLATION_ANGLE | FEATURE_SET_NATURAL_MODE
)
SERVICE_SET_BUZZER_ON = "fan_set_buzzer_on"
@@ -2025,6 +2023,7 @@ class FanStatusP33(DeviceStatus):
def angle(self) -> int:
return self.data["angle"]
+
class FanP33(MiotDevice):
mapping = {
# https://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:fan:0000A005:dmaker-p33:1
@@ -2134,6 +2133,7 @@ class FanP33(MiotDevice):
value = 2
return self.set_property("motor_control", value)
+
class XiaomiFanP39(XiaomiFanMiot):
"""Representation of a Xiaomi Fan P39."""
@@ -2300,7 +2300,8 @@ class FanStatusP39(DeviceStatus):
@property
def angle(self) -> int:
return self.data["angle"]
-
+
+
class FanP39(MiotDevice):
mapping = {
# https://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:fan:0000A005:dmaker-p39:1 |
syssi
approved these changes
Jul 20, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thanks for your contribution! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added support for Xiaomi Smart Tower Fan (dmaker.fan.p39)
For reference:
API overview: https://home.miot-spec.com/spec/dmaker.fan.p39
Spec: https://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:fan:0000A005:dmaker-p39:1
Fixes #213
Fixes #223