Open Ra7t0r opened 3 years ago
I made some modifications to your code in order the fan speed slider to work with Air Purifer 3H
def calFanLevel(speed){
if(speed == 0){
return 0
}else if(speed == 1){
return 33
}else if(speed == 2){
return 66
}else if(speed == 3){
return 100
}else if(speed == 4){ // - - - - - - - - - - - new entry of silent mode
return -1
}
}
// - - - - - - - - - - - modifications to support auto and silent modes
def setFanSpeed(speed){
log.debug "setFanSpeed " + speed
def level = calFanLevel(speed)
if(level > 0){
setLevel(level)
}else if (level == 0) {
setModeAuto()
}else if (level < 0) {
setModeSilent()
}
//sendEvent(name:"fanSpeed", value: level)
}
def setLevel(level){
def speed = Math.round(level/6.25)
// if(model == "MiAirPurifier3"){
// level = Math.round(stf/7.14)
// }
log.debug "setLevel >> " + level + " >> " + speed
// - - - - - - - - - - - modifications to support auto and silent modes
if(level == 33){
speed = "low"
level = 1
}else if(level == 66){
speed = "medium"
level = 2
}else if(level == 100){
speed = "high"
level = 3
}
if(model != "MiAirPurifier"){
def body = [
"id": state.id,
"cmd": "mode",
"data": speed
]
def options = makeCommand(body)
sendEvent(name:"fanSpeed", value: level)
sendCommand(options, null)
}
}
def setModeAuto(){
log.debug "setModeAuto >> ${state.id}"
def body = [
"id": state.id,
"cmd": "mode",
"data": "auto"
]
def options = makeCommand(body)
sendEvent(name:"fanSpeed", value: 0) // - - - - - - - - - - - entry for updating DHT of auto mode
sendCommand(options, null)
}
def setModeSilent(){
log.debug "setModeSilent >> ${state.id}"
def body = [
"id": state.id,
"cmd": "mode",
"data": "silent"
]
def options = makeCommand(body)
sendEvent(name:"fanSpeed", value: 4) // - - - - - - - - - - - entry for updating DHT of silent mode
sendCommand(options, null)
}
I have’t access to custom capabilities, so in silent mode (currently setFanSpeed 4) the label appears as MAX and for auto mode (currently setFanSpeed 0) the label apperas as off.
Can you please integrate this modifications to your repo code? Also the dimmer slider should be updated to off->dimmed->bright, to supported by Air purifier 3H
Hello. I saw that you released a new DTH for air purifier. (devicetypes/streamorange58819) (thanks so much btw..) I test it out and I have faced some issues.
Do you need any feedback on anything?
Hey. I have issues with zhimi.airpurifier.mb3. Some functions on DHT not supported by air purifier 3H, like dimmer. Also I can’t control the device except of turning in On an Off. Other Functions like fan speed, PM10 dust level doesn't seems to work:/
Any plans for supporting this device?