-
-
Notifications
You must be signed in to change notification settings - Fork 566
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 basic support for yunmi.waterpuri.lx9 and lx11 #826
Conversation
This commit introduced basic support for Xiaomi Water Purifier D1 (yunmi.waterpuri.lx9) and C1 (Triple Setting, yunmi.waterpuri.lx11). The only difference is that C1 has a triple-output water tap and a builtin TDS LED while D1 has neither. Tested on my yunmi.waterpuri.lx11 and all properties work. Device Mi Home plugin: https://cdn.cnbj1.fds.api.mi-img.com/rn-plugins/2020-01-16/signed_10032_1000300_63_ANDROID_bundle_248cc8dd48e81c1a6e2563f92d8f3131.zip
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.
Thanks for the PR! Looks pretty straightforward to me, a couple of questions though:
- Is there commands to turn it on/off?
- Could one of the properties be used like
is_on
to see if the device is on, like in the other waterpurifier implementation?
Co-authored-by: Teemu R. <tpr@iki.fi>
This device purify water in a different way. Like the pic above, it comes with a tank (3L capacity) and maybe some cheap filters passing less water flow. Due to its smaller flow, it storages water into internal tank slowly as a "buffer" instead of supplying purified water directly. When water level in the tank is lower than approximately 3/4, it automatically starts purifying until it's full. It seems no way to control the internal water level switch... There is no switch in Mi Home App either. I tried serval keys like |
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.
Okay, that's fine, just wanted to verify if we could have exposed some actions :-)
A couple of more changes before this can be merged: 1) the remaining time values should be returned as timedeltas, and 2) the naming should be consolidated to simplify the API and be more consistent with the waterpurifier one.
miio/waterpurifier_yunmi.py
Outdated
@property | ||
def run_status(self) -> int: | ||
"""Current running status, 0 for no error.""" | ||
return self.data["run_status"] |
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.
Are any other status codes known besides the 0? If yes, maybe this should be an enum?
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.
Found some tips in Mi Home plugin.
function getError(errorCode) {
var errorCode = Number(errorCode).toString(2);
var len = 32;
errorCode = Base.paddingZero(errorCode, len);
var errors = Base.lang.exceptionsArr1;
// ...
var curError = [];
for (var i = len - 1; i >= 0; i--) {
if (errorCode.charAt(i) === '1') {
var index = len - 1 - i;
var target = errors[index];
if (target && target.length > 0) {
curError.push({
index: index,
name: target[0],
detail: target[1] || '',
type: 'error'
});
}
}
}
return curError;
}
Seems the error code is able to represent multiple errors at a time by binary bit.
And the error code description is like
[
['Temperature anomaly', "1. Check if inlet water temperature is among 5~38°C, if not, please adjust the water temperature and try to purify water for several times to check if the problem is solved; \n\n2. If the problem still remains, go to www.mi.com to learn more."],
['Meter damaged', "1. After disassembling the filter for several times, try to purify water again to see if the problem can be solved;\n\n2. If the problem still remains, go to www.mi.com to learn more."],
['Flow sensor anomaly', '1. Disassemble the touch faucet as per manual book and open the water valve to check if the water flow is too small.'],
['Filter life expired', 'Replace filter'],
['Network connection error', '1. The problem may caused by Wi-Fi module damage or abnormal connection to motherboard, go to www.mi.com to learn more.'],
['EEPROM communication error', '1. The problem may caused by EEPROM chip damage or abnormal connection to motherboard, go to www.mi.com to learn more.'],
['RFID communication error', 'RFID communication error'],
['Faucet communication error', '1. Water in faucet internal circuit board can cause failure, please plug device in again to check if indicator lights and keys work normal;'],
['Purified water flow error', '1. Check if all 4 filters are properly installed and replace the filter if it expires;\n\n2. Disassemble the touch faucet as per manual book and open the water valve to check if the water flow is too small; '],
['Water leak', 'Water leak'],
['Floater error', 'Floater error'],
['TDS error', "1. If the RO filter expired, replace it first and try again;\n\n2. Inlet water should be municipal water, if it's not, replace the inlet water and try again;\n\n3. If the problem still remains, go to www.mi.com to learn more."],
['Water temperature too high', "1. Check if inlet water is warm water with temperature ≥40°C. If the temperature ≥40°C, please switch to cooling mode until the temperature < 40°C first, and try to purify the water several times; \n\n2. If the problem still remains, go to www.mi.com to learn more."],
['Recovery rate error', "1. Check if concentrated water's waste pipe works normally, if it's bent, squashed or clogged;\n\n2. If the RO filter expired, replace it first and try again;\n\n3. If the problem still remains, go to www.mi.com to learn more."],
["Water quality anomaly','1. Check if concentrated water's waste pipe works normally, if it's bent, squashed or clogged;\n\n2. If the RO filter expired, replace it first and try again;\n\n3. If the problem still remains, go to www.mi.com to learn more."],
['Thermal protection for pumps', 'Thermal protection for pumps'],
['干烧保护', '1.制常温水。\n2.再次启动制热'],
['出水NTC异常', '1.断电重启。\n2.请联系400售后维修服务'],
['干烧NTC异常', '1.断电重启。\n2.请联系400售后维修服务'],
['加热器异常', '1.断电重启。\n2.请联系400售后维修服务']
]
Should I show both the error name and the operation advice, or just the error name to avoid being too verbose?
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.
The errors are reported as enums, so it should just show the "error name". The name should be informative enough to give a clue how to make it clear that it's error on the device and a pointer towards how to fix it :-) Take a look at how some other compatible devices are reporting their errors.
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.
Do you agree with the current implementation of the errors at the OperationStatus class? I assume an Enum doesn't work here because of a bitmask of errors / multiple errors.
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.
Good job! :-)
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.
Ready to go, thanks again! 🎉
* Add basic support for yunmi.waterpuri.lx9 and lx11 This commit introduced basic support for Xiaomi Water Purifier D1 (yunmi.waterpuri.lx9) and C1 (Triple Setting, yunmi.waterpuri.lx11). The only difference is that C1 has a triple-output water tap and a builtin TDS LED while D1 has neither. Tested on my yunmi.waterpuri.lx11 and all properties work. Device Mi Home plugin: https://cdn.cnbj1.fds.api.mi-img.com/rn-plugins/2020-01-16/signed_10032_1000300_63_ANDROID_bundle_248cc8dd48e81c1a6e2563f92d8f3131.zip * Fix typo, `rising' -> `rinsing' Co-authored-by: Teemu R. <tpr@iki.fi> * Add an example response from yunmi.waterpuri.lx11 * Modify filter name scheme, change filter life from int to timedelta * Use timedelta as hours, add remaining indicator and error code parser * Rename RunStatus to OperationStatus * Fix remaining liters * Rename error property to operation_status too Co-authored-by: Teemu R. <tpr@iki.fi> Co-authored-by: Sebastian Muszynski <basti@linkt.de>
This commit introduced basic support for Xiaomi Water Purifier D1
(yunmi.waterpuri.lx9) and C1 (Triple Setting, yunmi.waterpuri.lx11). The
only difference is that C1 has a triple-output water tap and a builtin
TDS LED while D1 has neither.
Tested on my yunmi.waterpuri.lx11 and all properties work.
Device Mi Home plugin:
https://cdn.cnbj1.fds.api.mi-img.com/rn-plugins/2020-01-16/signed_10032_1000300_63_ANDROID_bundle_248cc8dd48e81c1a6e2563f92d8f3131.zip