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

Support for Zero Fog DWZF(G)-4500Z (shuii.humidifier.jsq002)humidifier #1171

Open
iromeo opened this issue Oct 31, 2021 · 8 comments
Open

Support for Zero Fog DWZF(G)-4500Z (shuii.humidifier.jsq002)humidifier #1171

iromeo opened this issue Oct 31, 2021 · 8 comments

Comments

@iromeo
Copy link
Contributor

iromeo commented Oct 31, 2021

Device information:

  • Name(s) of the device: Zero Fog DWZF(G)-4500Z
  • Link:

Use miiocli device --ip <ip address> --token <token>.

  • Model: shuii.humidifier.jsq002
  • Hardware version: ESP8266
  • Firmware version: 1.4.0

Additional context
Some time ago I added shuii.humidifier.jsq001 support. Now I'm going to make a PR for shuii.humidifier.jsq002 device support. This issue is a first step for supporting it in HomeAssistant, as part of syssi/xiaomi_airpurifier#50

@iromeo iromeo changed the title Support for shuii.humidifier.jsq002 humidifier Support for Zero Fog DWZF(G)-4500Z (shuii.humidifier.jsq002)humidifier Nov 1, 2021
@wxy8866
Copy link

wxy8866 commented Nov 30, 2021

I have this device. Is there any chance to get it work?

@iromeo
Copy link
Contributor Author

iromeo commented Nov 30, 2021

@wxy8866 I'm working on a PR in my spare time, not ready yet.

@MJeka
Copy link

MJeka commented Jan 25, 2022

Hi. I have the same problem.

iromeo added a commit to iromeo/python-miio that referenced this issue Feb 5, 2022
@iromeo
Copy link
Contributor Author

iromeo commented Feb 6, 2022

@MJeka @wxy8866

Hi guys, I implemented code to support this device, so e.g. it could be used for further integration with Home-Assistant (syssi/xiaomi_airpurifier#50) or some other home automation hub. But before opening a pull request and merging it into python-miio we need to test my fix. I have only prev model shuii.humidifier.jsq001, so I cannot test shuii.humidifier.jsq002, they have different commands and response params.

In order to test my integration with device, you need to:

  1. I assume you are familiar with command line and have git and python installed. It is easier to make it using Mac OS or Linux. But windows is also ok.
  2. Also I assume you already have a token for your device, e.g you could use https://github.com/Squachen/micloud project or https://python-miio.readthedocs.io/en/latest/discovery.html
  3. Clone my repo with fix and install miiocli tool from sources (with my changes). Here steps are similar to https://python-miio.readthedocs.io/en/latest/discovery.html#installation but using my repo.
git clone --branch features/1171_jsq002_support https://github.com/iromeo/python-miio.git python-miio-iromeo
cd python-miio-iromeo

poetry install
  1. List of available commands:
$ poetry run miiocli airhumidifierjsq002 --help
Usage: miiocli airhumidifierjsq002 [OPTIONS] COMMAND [ARGS]...

Options:
  --ip TEXT     [required]
  --token TEXT  [required]
  --model TEXT
  --help        Show this message and exit.

Commands:
  info                          Get (and cache) miIO protocol information...
  off                           Power off.
  on                            Power on.
  raw_command                   Send a raw command to the device.
  set_buzzer                    Set buzzer on/off.
  set_child_lock                Set child lock on/off.
  set_heater                    Set water heater on/off.
  set_led                       Turn led on/off.
  set_led_brightness            Set led brightness.
  set_mode                      Set mode.
  set_target_humidity           Set the target humidity %, only 0..99.
  set_target_water_temperature  Set the target water temperature degrees...
  status                        partial(func, *args, **keywords) - new...
  test_properties               Helper to test device properties.
  
  1. Please test commands, check that they changes device settings as expected. Also that in status command results all fields have values as expected.

Some times command could not from the first attempt due to Error: Unable to discover the device ... Just retry in few seconds.

miiocli airhumidifierjsq002 --ip <IP> --token <TOKEN> info

miiocli airhumidifierjsq002 --ip <IP> --token <TOKEN> on
miiocli airhumidifierjsq002 --ip <IP> --token <TOKEN> off

miiocli airhumidifierjsq002 --ip <IP> --token <TOKEN> set_buzzer true
miiocli airhumidifierjsq002 --ip <IP> --token <TOKEN> set_buzzer false

miiocli airhumidifierjsq002 --ip <IP> --token <TOKEN> set_child_lock true
miiocli airhumidifierjsq002 --ip <IP> --token <TOKEN> set_child_lock false

miiocli airhumidifierjsq002 --ip <IP> --token <TOKEN> set_heater true
miiocli airhumidifierjsq002 --ip <IP> --token <TOKEN> set_heater false

miiocli airhumidifierjsq002 --ip <IP> --token <TOKEN> set_led true
miiocli airhumidifierjsq002 --ip <IP> --token <TOKEN> set_led false

miiocli airhumidifierjsq002 --ip <IP> --token <TOKEN> set_led_brightness off
miiocli airhumidifierjsq002 --ip <IP> --token <TOKEN> set_led_brightness low
miiocli airhumidifierjsq002 --ip <IP> --token <TOKEN> set_led_brightness high

miiocli airhumidifierjsq002 --ip <IP> --token <TOKEN> set_mode level1
miiocli airhumidifierjsq002 --ip <IP> --token <TOKEN> set_mode level2
miiocli airhumidifierjsq002 --ip <IP> --token <TOKEN> set_mode level3

miiocli airhumidifierjsq002 --ip <IP> --token <TOKEN> set_target_humidity 30
miiocli airhumidifierjsq002 --ip <IP> --token <TOKEN> set_target_humidity 0
miiocli airhumidifierjsq002 --ip <IP> --token <TOKEN> set_target_humidity 31
miiocli airhumidifierjsq002 --ip <IP> --token <TOKEN> set_target_humidity 99

miiocli airhumidifierjsq002 --ip <IP> --token <TOKEN> set_target_water_temperature 30
miiocli airhumidifierjsq002 --ip <IP> --token <TOKEN> set_target_water_temperature 33
miiocli airhumidifierjsq002 --ip <IP> --token <TOKEN> set_target_water_temperature 60

miiocli airhumidifierjsq002 --ip <IP> --token <TOKEN> status

@AleksandrBoyarshinov
Copy link

AleksandrBoyarshinov commented Feb 6, 2022

Checked all the commands. The commands to turn on and off the water heater do not work. All other commands are working.

miiocli airhumidifierjsq002 --ip <my ip> --token <my token> set_heater true - I get an error

Turning on water heater
Traceback (most recent call last):
File "", line 1, in
File "/home/alex/python-miio-iromeo/miio/cli.py", line 63, in create_cli
return cli(auto_envvar_prefix="MIIO")
File "/home/alex/python-miio-iromeo/miio/click_common.py", line 51, in call
return self.main(*args, **kwargs)
File "/home/alex/.cache/pypoetry/virtualenvs/python-miio-S5EGbLNS-py3.8/lib/python3.8/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/home/alex/.cache/pypoetry/virtualenvs/python-miio-S5EGbLNS-py3.8/lib/python3.8/site-packages/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/alex/.cache/pypoetry/virtualenvs/python-miio-S5EGbLNS-py3.8/lib/python3.8/site-packages/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/alex/.cache/pypoetry/virtualenvs/python-miio-S5EGbLNS-py3.8/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/alex/.cache/pypoetry/virtualenvs/python-miio-S5EGbLNS-py3.8/lib/python3.8/site-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/home/alex/python-miio-iromeo/miio/click_common.py", line 300, in wrap
kwargs["result"] = func(*args, **kwargs)
File "/home/alex/.cache/pypoetry/virtualenvs/python-miio-S5EGbLNS-py3.8/lib/python3.8/site-packages/click/decorators.py", line 84, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/home/alex/.cache/pypoetry/virtualenvs/python-miio-S5EGbLNS-py3.8/lib/python3.8/site-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/home/alex/python-miio-iromeo/miio/click_common.py", line 265, in command_callback
return miio_command.call(miio_device, *args, **kwargs)
File "/home/alex/python-miio-iromeo/miio/click_common.py", line 212, in call
return method(*args, **kwargs)
File "/home/alex/python-miio-iromeo/miio/click_common.py", line 179, in _wrap
return func(self, *args, **kwargs)
TypeError: set_heater() got an unexpected keyword argument 'heater'

miiocli airhumidifierjsq002 --ip <my ip> --token <my token> set_heater false - I get an error

Turning off water heater
Traceback (most recent call last):
File "", line 1, in
File "/home/alex/python-miio-iromeo/miio/cli.py", line 63, in create_cli
return cli(auto_envvar_prefix="MIIO")
File "/home/alex/python-miio-iromeo/miio/click_common.py", line 51, in call
return self.main(*args, **kwargs)
File "/home/alex/.cache/pypoetry/virtualenvs/python-miio-S5EGbLNS-py3.8/lib/python3.8/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/home/alex/.cache/pypoetry/virtualenvs/python-miio-S5EGbLNS-py3.8/lib/python3.8/site-packages/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/alex/.cache/pypoetry/virtualenvs/python-miio-S5EGbLNS-py3.8/lib/python3.8/site-packages/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/alex/.cache/pypoetry/virtualenvs/python-miio-S5EGbLNS-py3.8/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/alex/.cache/pypoetry/virtualenvs/python-miio-S5EGbLNS-py3.8/lib/python3.8/site-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/home/alex/python-miio-iromeo/miio/click_common.py", line 300, in wrap
kwargs["result"] = func(*args, **kwargs)
File "/home/alex/.cache/pypoetry/virtualenvs/python-miio-S5EGbLNS-py3.8/lib/python3.8/site-packages/click/decorators.py", line 84, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/home/alex/.cache/pypoetry/virtualenvs/python-miio-S5EGbLNS-py3.8/lib/python3.8/site-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/home/alex/python-miio-iromeo/miio/click_common.py", line 265, in command_callback
return miio_command.call(miio_device, *args, **kwargs)
File "/home/alex/python-miio-iromeo/miio/click_common.py", line 212, in call
return method(*args, **kwargs)
File "/home/alex/python-miio-iromeo/miio/click_common.py", line 179, in _wrap
return func(self, *args, **kwargs)
TypeError: set_heater() got an unexpected keyword argument 'heater'

@iromeo
Copy link
Contributor Author

iromeo commented Feb 6, 2022

@AleksandrBoyarshinov Thx a lot! I fixed an error in the heater command.

Please check again:

  1. Update project:
cd python-miio-iromeo
git pull
  1. Re-install library:
poetry install
  1. Check heater:
miiocli airhumidifierjsq002 --ip <my ip> --token <my token> set_heater true
miiocli airhumidifierjsq002 --ip <my ip> --token <my token> set_heater false

@AleksandrBoyarshinov
Copy link

@iromeo

I checked, now everything works.

miiocli airhumidifierjsq002 --ip --token set_heater false
Turning off water heater
[0]

miiocli airhumidifierjsq002 --ip --token set_heater true
Turning on water heater
[1]

@MJeka
Copy link

MJeka commented Jun 1, 2022

Hi. Can you merge 1171_jsq002_support https://github.com/iromeo/python-miio.git branch with the master branch which adds support shuii.humidifier.jsq002?

--branch features/1171_jsq002_support https://github.com/iromeo/python-miio.git

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

No branches or pull requests

4 participants