-
-
Notifications
You must be signed in to change notification settings - Fork 563
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
Support for Mi Fresh Air Ventilator dmaker.airfresh.t2017 #502
Comments
Please add Maybe those mode getters should catch the exceptions are report a new mode called "unknown" (and print out a warning) in case this happens, instead of crashing. |
This Air Fresh device has 3 mode ["auto", "sleep", "favourite"]. This payload is from sleep mode. The word "sleep" in payload below will change to "auto", "favourite" following current mode accordingly. Errors from each mode are: off - ValueError: 0 is not a valid OperationMode
|
I found that OperationMode value is fan speed. If I set mode to auto, OperationMode will continuously change following current speed. Range is 60 to 300. |
public static final String PROP_CHILD_LOCK = "child_lock";
public static final String PROP_CO2 = "co2";
public static final String PROP_CONTROL_SPEED = "control_speed";
public static final String PROP_DISPLAY = "display";
public static final String PROP_FILTER_HIGH = "filter_efficient";
public static final String PROP_FILTER_MEDIUM = "filter_intermediate";
public static final String PROP_HIGH_DAY = "filter_effi_day";
public static final String PROP_INCREASE_SPEED = "increase_speed";
public static final String PROP_MEDIUM_DAY = "filter_inter_day";
public static final String PROP_MODE = "mode";
public static final String PROP_PM25 = "pm25";
public static final String PROP_POWER = "power";
public static final String PROP_PTC_LEVEL = "ptc_level";
public static final String PROP_PTC_ON = "ptc_on";
public static final String PROP_PTC_STATUS = "ptc_status";
public static final String PROP_SCREEN_DIRECTION = "screen_direction";
public static final String PROP_SOUND = "sound";
public static final String PROP_SPEED = "favourite_speed";
public static final String PROP_TEMP = "temperature_outside";
public static final String TYPE_ALL = "all";
public static final String TYPE_CO2 = "co2";
public static final String TYPE_DEVICE_OFFLINE = "dev_offline";
public static final String TYPE_EFFICIENT = "efficient";
public static final String TYPE_INTERMEDIATE = "intermediate";
public static final String TYPE_PM25 = "pm25";
static {
HOME_PROPERTIES = new String[]{TYPE_PM25, TYPE_CO2, PROP_TEMP, PROP_SPEED, PROP_FILTER_MEDIUM, PROP_MEDIUM_DAY, PROP_FILTER_HIGH, PROP_HIGH_DAY, PROP_CONTROL_SPEED, PROP_POWER, PROP_MODE, PROP_PTC_ON, PROP_PTC_LEVEL, PROP_PTC_STATUS, PROP_CHILD_LOCK, PROP_SOUND, PROP_DISPLAY, PROP_SCREEN_DIRECTION, PROP_INCREASE_SPEED};
}
public boolean getChildLock() {
return TypeUtil.getDefaultBoolean(TypeUtil.toBoolean(this.mPropertiesMap.get(PROP_CHILD_LOCK)), false);
}
public boolean getSound() {
return TypeUtil.getDefaultBoolean(TypeUtil.toBoolean(this.mPropertiesMap.get(PROP_SOUND)), false);
}
public boolean getDisplay() {
return TypeUtil.getDefaultBoolean(TypeUtil.toBoolean(this.mPropertiesMap.get(PROP_DISPLAY)), false);
}
public String getScreenDirection() {
return TypeUtil.toString(this.mPropertiesMap.get(PROP_SCREEN_DIRECTION));
}
public boolean getIncreaseSpeed() {
return TypeUtil.getDefaultBoolean(TypeUtil.toBoolean(this.mPropertiesMap.get(PROP_INCREASE_SPEED)), false);
}
public Integer getSpeed() {
return TypeUtil.toInteger(this.mPropertiesMap.get(PROP_SPEED));
}
public Integer getHighFilter() {
return TypeUtil.toInteger(this.mPropertiesMap.get(PROP_FILTER_HIGH));
}
public Integer getHighDay() {
return TypeUtil.toInteger(this.mPropertiesMap.get(PROP_HIGH_DAY));
}
public Integer getMediumFilter() {
return TypeUtil.toInteger(this.mPropertiesMap.get(PROP_FILTER_MEDIUM));
}
public Integer getMediumDay() {
return TypeUtil.toInteger(this.mPropertiesMap.get(PROP_MEDIUM_DAY));
}
public String getMode() {
return TypeUtil.toString(this.mPropertiesMap.get(PROP_MODE));
}
public Integer getPm25() {
return TypeUtil.toInteger(this.mPropertiesMap.get(TYPE_PM25));
}
public boolean getPower() {
return TypeUtil.getDefaultBoolean(TypeUtil.toBoolean(this.mPropertiesMap.get(PROP_POWER)), false);
}
public boolean getPtcOn() {
return TypeUtil.getDefaultBoolean(TypeUtil.toBoolean(this.mPropertiesMap.get(PROP_PTC_ON)), false);
}
public String getPtcLevel() {
return TypeUtil.toString(this.mPropertiesMap.get(PROP_PTC_LEVEL));
}
public boolean getPtcStatus() {
return TypeUtil.getDefaultBoolean(TypeUtil.toBoolean(this.mPropertiesMap.get(PROP_PTC_STATUS)), false);
}
public Integer getCo2() {
return TypeUtil.toInteger(this.mPropertiesMap.get(TYPE_CO2));
}
public Float getTemp() {
return TypeUtil.toFloat(this.mPropertiesMap.get(PROP_TEMP));
}
public void getSensor(Callback<JSONArray> callback) {
callMethod("get_sensor", callback, new Object[0]);
}
public void setChildLock(boolean state, Callback<JSONArray> callback) {
callMethod("set_child_lock", callback, Boolean.valueOf(state));
}
public void setSound(boolean sound, Callback<JSONArray> callback) {
callMethod("set_sound", callback, Boolean.valueOf(sound));
}
public void setDisplay(boolean display, Callback<JSONArray> callback) {
callMethod("set_display", callback, Boolean.valueOf(display));
}
public void setScreenDirection(String direction, Callback<JSONArray> callback) {
callMethod("set_screen_direction", callback, direction);
}
public void setIncreaseSpeed(boolean increase, Callback<JSONArray> callback) {
callMethod("set_increase_speed", callback, Boolean.valueOf(increase));
}
public void setSpeed(int speed, Callback<JSONArray> callback) {
callMethod("set_favourite_speed", callback, Integer.valueOf(speed));
}
public void setPtcLevel(String level, Callback<JSONArray> callback) {
callMethod("set_ptc_level", callback, level);
}
public void setRoomArea(int area, Callback<JSONArray> callback) {
callMethod("set_room_area", callback, Integer.valueOf(area));
}
public void setPower(boolean power, Callback<JSONArray> callback) {
callMethod("set_power", callback, Boolean.valueOf(power));
}
public void setPtcOn(boolean ptc, Callback<JSONArray> callback) {
callMethod("set_ptc_on", callback, Boolean.valueOf(ptc));
}
public void setWorkMode(String mode, Callback<JSONArray> callback) {
callMethod("set_mode", callback, mode);
}
public void getTimers(Callback<JSONArray> callback) {
callMethod("get_timer", callback, new Object[0]);
}
public void setTimer(String timer, Callback<JSONArray> callback) {
callMethod("set_timer", callback, timer);
}
public void deleteTimer(int timer, Callback<JSONArray> callback) {
callMethod("delete_timer", callback, Integer.valueOf(timer));
}
public void resetFilter(String type, Callback<JSONArray> callback) {
callMethod("set_filter_reset", callback, type);
}
public void setPtcTimer(String timer, Callback<JSONArray> callback) {
callMethod("set_ptc_timer", callback, timer);
}
public void getPtcTimer(Callback<JSONArray> callback) {
callMethod("get_ptc_timer", callback, new Object[0]);
} |
I'm quite far away from python (javascript) but i would love to help integrating that device to Home Assistant, where can i start with help? As of my tries with modification of original plugin, there is no PM25 sensor in original XiaomiAirfresh, so we should add first to python-miio and then create integration in home assistant plugin? |
One vote more. Do you need any help? |
Got it! |
@lazzzrus, could you please create a PR? I have no idea how to use that data |
Sorry, i don't know how to create PR. The config:
So now i can turn the device on/off. I'm newbie so don't know how to use parameters for dashboard and automation.
|
Someone already put @zxytddd code on github at https://github.com/mypal/mi-airfresh so we can use it in this mean time. Anyway native support from python-miio and Home Assistant is surely preferred. |
Yes. This integration is far too basic. |
|
Could somebody provide the output of:
|
@syssi here is the output grabbed from Mi Home app via tcpdump:
P.S. I've created pull request for openHAB to add support for this device: https://github.com/openhab/openhab2-addons/pull/6558/files |
Please upvote feature request here https://community.home-assistant.io/t/support-for-xiaomi-miio-support-for-dmaker-airfresh-t2017/235798 if you want it integrated in home assistant. |
Product Link:
https://www.xiaomiyoupin.com/detail?gid=104643
The text was updated successfully, but these errors were encountered: