syssi / xiaomi_airpurifier

Xiaomi Mi Air Purifier and Xiaomi Mi Air Humidifier integration for Home Assistant
Apache License 2.0
445 stars 109 forks source link

Add nwt.derh.312en support #56

Open bkchaw opened 4 years ago

bkchaw commented 4 years ago

can you add support for the air dehumidifier. nwt.derh.312en. ??

syssi commented 3 years ago

Same features as nwt.derh.wdh318efw1.

syssi commented 3 years ago

@bkchaw Could you provide the output of the following commands:

apt-get update
apt-get install python3-pip
pip3 install python-miio

miiocli device --ip IP --token TOKEN raw_command get_prop '["on_off"]'
miiocli device --ip IP --token TOKEN raw_command get_prop '["mode"]'
miiocli device --ip IP --token TOKEN raw_command get_prop '["fan_st"]'
miiocli device --ip IP --token TOKEN raw_command get_prop '["buzzer"]'
miiocli device --ip IP --token TOKEN raw_command get_prop '["led"]'
miiocli device --ip IP --token TOKEN raw_command get_prop '["child_lock"]'
miiocli device --ip IP --token TOKEN raw_command get_prop '["humidity"]'
miiocli device --ip IP --token TOKEN raw_command get_prop '["temp"]'
miiocli device --ip IP --token TOKEN raw_command get_prop '["compressor_status"]'
miiocli device --ip IP --token TOKEN raw_command get_prop '["fan_speed"]'
miiocli device --ip IP --token TOKEN raw_command get_prop '["tank_full"]'
miiocli device --ip IP --token TOKEN raw_command get_prop '["defrost_status"]'
miiocli device --ip IP --token TOKEN raw_command get_prop '["alarm"]'
miiocli device --ip IP --token TOKEN raw_command get_prop '["auto"]'

miiocli device --ip IP --token TOKEN raw_command get_prop '["on_off","mode","fan_st","buzzer","led","child_lock","humidity","temp","compressor_status","fan_speed","tank_full","defrost_status","alarm","auto"]'

This will help to implement the device support.

bkchaw commented 3 years ago
root@hoobs:/home/hoobs# miiocli device --ip 192.168.31.42 --token f9a592284c6dceb36fed7ed1cf0fa903 raw_command get_prop '["on_off"]'
Running command raw_command
Error: {'code': -5000, 'message': 'invalid operation'}
root@hoobs:/home/hoobs# miiocli device --ip 192.168.31.42 --token f9a592284c6dceb36fed7ed1cf0fa903 raw_command get_prop '["on_off"]'
Running command raw_command
Error: {'code': -5000, 'message': 'invalid operation'}
root@hoobs:/home/hoobs# miiocli device --ip 192.168.31.42 --token f9a592284c6dceb36fed7ed1cf0fa903 raw_command get_prop '["mode"]'
Running command raw_command
Error: {'code': -5000, 'message': 'invalid operation'}
root@hoobs:/home/hoobs# miiocli device --ip 192.168.31.42 --token f9a592284c6dceb36fed7ed1cf0fa903 raw_command get_prop '["on_off","mode","fan_st","buzzer","led","child_lock","humidity","temp","compressor_status","fan_speed","tank_full","defrost_status","alarm","auto"]'
Running command raw_command
Error: {'code': -5000, 'message': 'invalid operation'}
root@hoobs:/home/hoobs# 
Jerrys-j commented 3 years ago

root@hoobs:/home/hoobs# miiocli device --ip 192.168.31.42 --token f9a592284c6dceb36fed7ed1cf0fa903 raw_command get_prop '["on_off"]' Running command raw_command Error: {'code': -5000, 'message': 'invalid operation'} root@hoobs:/home/hoobs# miiocli device --ip 192.168.31.42 --token f9a592284c6dceb36fed7ed1cf0fa903 raw_command get_prop '["on_off"]' Running command raw_command Error: {'code': -5000, 'message': 'invalid operation'} root@hoobs:/home/hoobs# miiocli device --ip 192.168.31.42 --token f9a592284c6dceb36fed7ed1cf0fa903 raw_command get_prop '["mode"]' Running command raw_command Error: {'code': -5000, 'message': 'invalid operation'} root@hoobs:/home/hoobs# miiocli device --ip 192.168.31.42 --token f9a592284c6dceb36fed7ed1cf0fa903 raw_command get_prop '["on_off","mode","fan_st","buzzer","led","child_lock","humidity","temp","compressor_status","fan_speed","tank_full","defrost_status","alarm","auto"]' Running command raw_command Error: {'code': -5000, 'message': 'invalid operation'} root@hoobs:/home/hoobs#

My device also has this problem and displays an unknown status

gerliczky commented 3 years ago

Dear @syssi, As I see this new Widetech Dehumidifier communicates using mioT API and not miio. As I saw, yous have already started to support some devices with mioT API. Please let me know how can I help you to support the nwt.derh.312en as well.

gerliczky commented 3 years ago

Some additional info:

Result of the following command: miiocli device --ip IPADDRESS --token TOKEN info

Model: nwt.derh.312en
Hardware version: esp32
Firmware version: 2.1.3

miot_spec: https://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:dehumidifier:0000A02D:nwt-312en:1

gerliczky commented 3 years ago

Can someone help me to add the device to this integration?

I managed to get info from the device and I also able to control it with the following commands:

Turn on:
    miiocli device --ip IPADDRESS --token TOKEN raw_command set_properties  '[{"value":True,"siid":2,"piid":1}]'
    Running command raw_command
    [{'did': DID, 'siid': 2, 'piid': 1, 'code': 0}]
Turn off:
    miiocli device --ip IPADDRESS --token TOKEN raw_command set_properties  '[{"value":False,"siid":2,"piid":1}]'
    Running command raw_command
    [{'did': DID, 'siid': 2, 'piid': 1, 'code': 0}]
Get target humidity:
    miiocli device --ip IPADDRESS --token TOKEN raw_command get_properties '[{"piid":5,"siid":2}]'
    Running command raw_command
    [{'did': DID, 'siid': 2, 'piid': 5, 'code': 0, 'value': 50}]