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

Status cannot be retrieved for AirHumidifier CA1 #606

Closed
lukaszantkowiak opened this issue Dec 27, 2019 · 1 comment
Closed

Status cannot be retrieved for AirHumidifier CA1 #606

lukaszantkowiak opened this issue Dec 27, 2019 · 1 comment

Comments

@lukaszantkowiak
Copy link

Hi,

I have an issue very similiar for #383 however the root cause is different than it was in the #383

pi@raspberrypi:~/domoticz/plugins/domoticz-AirHumidifier $ python3
Python 3.7.3 (default, Apr  3 2019, 05:39:12)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from miio import AirHumidifier
>>> h = AirHumidifier("192.168.1.20", "b3026a0a55390cc375de32c550axxxxx")
>>> h.status()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pi/.local/lib/python3.7/site-packages/miio/airhumidifier.py", line 314, in status
    values.extend(self.send("get_prop", _props[:_props_per_request]))
  File "/home/pi/.local/lib/python3.7/site-packages/miio/device.py", line 291, in send
    raise DeviceError(error)
miio.exceptions.DeviceError: {'code': -9999, 'message': 'UART timeout'}
>>>

h.info() works fine:

I've performed steps from the mentioned ticket:
pi@raspberrypi:~/domoticz/plugins/domoticz-AirHumidifier $ python3
Python 3.7.3 (default, Apr  3 2019, 05:39:12)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from miio import AirHumidifier
>>> h = AirHumidifier("192.168.1.20", "b3026a0a55390cc375de32c550axxxxx")
>>> h.info()
zhimi.humidifier.ca1 v1.6.7 (34:CE:00:87:00:00) @ 192.168.1.20 - token: b3026a0a55390cc375de32c550axxxxx

A request for properties throws an exception:

pi@raspberrypi:~/domoticz/plugins/domoticz-AirHumidifier $ python3                                                                                                                  
Python 3.7.3 (default, Apr  3 2019, 05:39:12)                                                                                                                                       
[GCC 8.2.0] on linux                                                                                                                                                                
Type "help", "copyright", "credits" or "license" for more information.                                                                                                              
>>> from miio import AirHumidifier                                                                                                                                                  
>>> h = AirHumidifier("192.168.1.20", "b3026a0a55390cc375de32c550axxxxx")                                                                                                                                                                                      
>>> properties = ['power', 'mode', 'temp_dec', 'humidity', 'buzzer', 'led_b', 'child_lock', 'limit_hum', 'trans_level', 'speed', 'depth', 'dry', 'use_time', 'button_pressed', 'hw_v
ersion', ]                                                                                                                                                                          
>>> h.send("get_prop", properties)                                                                                                                                                  
Traceback (most recent call last):                                                                                                                                                  
  File "/home/pi/.local/lib/python3.7/site-packages/miio/device.py", line 272, in send                                                                                              
    data, addr = s.recvfrom(1024)                                                                                                                                                   
socket.timeout: timed out                                                                                                                                                           
                                                                                                                                                                                    
During handling of the above exception, another exception occurred:                                                                                                                 
                                                                                                                                                                                    
Traceback (most recent call last):                                                                                                                                                  
  File "<stdin>", line 1, in <module>                                                                                                                                               
  File "/home/pi/.local/lib/python3.7/site-packages/miio/device.py", line 310, in send                                                                                              
    return self.send(command, parameters, retry_count - 1)                                                                                                                          
  File "/home/pi/.local/lib/python3.7/site-packages/miio/device.py", line 291, in send                                                                                              
    raise DeviceError(error)                                                                                                                                                        
miio.exceptions.DeviceError: {'code': -9999, 'message': 'UART timeout'} 

One property is retireved properly:

>>> h.send("get_prop", ['power'])
['off']

info and status cli commands work well:

pi@raspberrypi:~/domoticz/plugins/domoticz-AirHumidifier $ miiocli airhumidifierca1 --ip 192.168.1.20 --token b3026a0a55390cc375de32c550axxxxx info
Model: zhimi.humidifier.ca1
Hardware version: MTK7697
Firmware version: 1.6.7
Network: {'localIp': '192.168.1.20', 'mask': '255.255.255.0', 'gw': '192.168.1.1', 'gw_mac': '78:44:76:DE:00:00'}
AP: {'rssi': -38, 'ssid': 'My WiFi', 'bssid': '78:44:76:DE:00:00'}
pi@raspberrypi:~/domoticz/plugins/domoticz-AirHumidifier $ miiocli airhumidifierca1 --ip 192.168.1.20 --token b3026a0a55390cc375de32c550axxxxx status
Power: off
Mode: OperationMode.Silent
Temperature: 18.4 °C
Humidity: 60 %
LED brightness: LedBrightness.Off
Buzzer: False
Child lock: False
Target humidity: 55 %
Trans level: None
Speed: 0
Depth: 125
Dry: False
Use time: 17826368
Hardware version: 0001
Button pressed: None

Could you please help me with this issue?

@syssi
Copy link
Collaborator

syssi commented Dec 27, 2019

You should use the device specific class:

from miio import AirHumidifierCA1
h = AirHumidifierCA1("192.168.1.20", "b3026a0a55390cc375de32c550axxxxx")
h.status()

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