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

shuii.humidifier.jsq001 support #642

Closed
iromeo opened this issue Mar 12, 2020 · 4 comments
Closed

shuii.humidifier.jsq001 support #642

iromeo opened this issue Mar 12, 2020 · 4 comments

Comments

@iromeo
Copy link
Contributor

iromeo commented Mar 12, 2020

Please add Xiaomi "The fog free of humidifier" support

I've tried to get info, so it is:

$ miiocli airhumidifier --ip ... --token <....> info
Model: shuii.humidifier.jsq001
Hardware version: ESP8266
Firmware version: 1.3.9
Network: {'localIp': '...', 'mask': '255.255.255.0', 'gw': '...'}
AP: {'rssi': -63, 'ssid': 'wifi', 'bssid': '...'}

Command status doesn't work, I get

ERROR:miio.device:Unable to discover a device at address 192.NN.NN.NN
Error: Unable to discover the device 192.NN.NN.NN

I'm not sure how to check what information this humidifier could return.

@iromeo iromeo changed the title Add shuii.humidifier.jsq001 shuii.humidifier.jsq001 support Mar 12, 2020
@iromeo
Copy link
Contributor Author

iromeo commented Mar 12, 2020

I've tried

from miio import AirHumidifier
dev = AirHumidifier('192.168.1.8', 'c9af1xxxxxxxxxxxxxxxxxx')
dev.status()

and got error miio.exceptions.DeviceException: No response from the device
same error for dev.send("get_prop", ["power"])

Seems device has some other communication protocol, because it ansers on empty command:

>>> dev.send("", [""])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/romeo/anaconda3/envs/xiaomi/lib/python3.7/site-packages/miio/device.py", line 291, in send
    raise DeviceError(error)
miio.exceptions.DeviceError: {'code': -32602, 'message': 'Invalid param.'}

Maybe it is related to #577, seems there slightly different api is used

@rezmus
Copy link

rezmus commented Mar 12, 2020

prop for power state is bstart (if get_prop does not work try get_props).

String[] PROPERTIES = { "temperature", "humidity", "mode", "buzzer", "lock", "brightness", "bstart", "waterYield", "lid" };

On (set_start 1)
Off (set_start 0)
Intelligent (set_mode 1)
Level 1 (set_mode 2)
Level 2 (set_mode 3)
Level 3 (set_mode 4)
Level 4 (set_mode 5)

set_brightness
set_buzzer
set_lock
get_timer
get_timer_count
set_timer

@iromeo
Copy link
Contributor Author

iromeo commented Mar 13, 2020

@rezmus thx, "get_props" works, thx! And you are right about other commands, only timer doesn't work for me

>>> dev.send("get_props","")
[24, 37, 3, 1, 0, 2, 1, 0, 0]

# status[0] : temp
# status[1]: humidity
# status[2]: level ( 0: Intellegent, 1: Level1, ..., 5:Level4)
# status[3]: buzzer (0: off, 1: on)
# status[4]: buttons lock (0: off, 1: on)
# status[5]: indicator (0: off, 1: low, 2: high)
# status[6]: power state (0: off, 1: on)
# status[7]: water level state (0: ok, 1: add water)
# status[8]: list state (0: ok, 1: lid is opened)
  • set_start
     >>> dev.send("set_start", ["1"]);
     ['ok']
    
  • set_mode:
     dev.send("set_mode", ["3"]);
     ['ok']
    
  • set_brightness
    >>> dev.send("set_brightness", ["2"]);
    ['ok']
    
  • set_buzzer
    >>> dev.send("set_buzzer", ["0"]);
    ['ok']
    
  • set_lock
    >>> dev.send("set_lock", ["0"]);
    ['ok']
    
  • get_timer
     >>> dev.send("get_timer","")
     miio.exceptions.DeviceException: No response from the device
    
  • get_timer_count
     >>> dev.send("get_timer_count","")
     miio.exceptions.DeviceException: No response from the device
    
  • set_timer
     >>> dev.send("set_timer")
     miio.exceptions.DeviceException: No response from the device
    

P.S: I could make a pull request with this humidifier support

iromeo added a commit to iromeo/python-miio that referenced this issue Mar 28, 2020
iromeo added a commit to iromeo/python-miio that referenced this issue Mar 28, 2020
iromeo added a commit to iromeo/python-miio that referenced this issue Mar 28, 2020
rytilahti added a commit that referenced this issue Mar 28, 2020
… (#654)

* Add Xiaomi Zero Fog Humidifier (shuii.humidifier.jsq001) support (#642)

* Code clean-up based on part of PR feedback (#642)

* Add brightness on/off boolean state for convenience and consistency

* Code cleanup, removed hardware/firmware properties from status, use device.info() for them (#642)

* Removed according to PR feedback (#642)

* remove newline

Co-authored-by: Teemu R <tpr@iki.fi>
@rytilahti
Copy link
Owner

This can be closed now, #654 is merged and will be a part of the next release 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants