Xiaomi Air Purifier 2
Moderator: leecollings
- remb0
- Posts: 499
- Joined: Thursday 11 July 2013 22:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: The Netherlands
- Contact:
Re: Xiaomi Air Purifier 2
I move this great work to the right forum: python
-
- Posts: 234
- Joined: Sunday 27 August 2017 18:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Spain
- Contact:
Re: Xiaomi Air Purifier 2
Great!!! works fine. thanks a lot!kofec wrote: ↑Thursday 08 March 2018 15:57 If you want you can try the script 'MyAir.py" from https://github.com/kofec/domoticz-AirPurifier
e.g:
pi@raspberrypi:~/domoticz/plugins/domoticz-AirPurifier $ ./MyAir.py 192.168.1.40 933c4c22df26adaec86d6fd788f5af72
<AirPurifierStatus power=on, aqi=9,average_aqi=8,temperature=21.1, humidity=31%,mode=OperationMode.Auto,led=True,led_brightness=LedBrightness.Bright,buzzer=True, child_lock=False,favorite_level=10,filter_life_remaining=53, filter_hours_used=1614, use_time=7632371, purify_volume=77517, motor_speed=355>
-
- Posts: 1
- Joined: Saturday 10 March 2018 17:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Xiaomi Air Purifier 2
Nice plugin, thanks! I'm having a little hiccup though whenkofec wrote: ↑Friday 02 February 2018 14:55 I have created a plugin: https://github.com/kofec/domoticz-AirPurifier
Code: Select all
./MyAir.py 192.168.1.129 7d5474e308cf13f359373fd1c2b0e676 --debug
Namespace(IPaddress='192.168.1.129', debug=True, favoriteLevel=None, mode=None, power=None, token='7d5474e308cf13f359373fd1c2b0e676')
Traceback (most recent call last):
File "./MyAir.py", line 64, in <module>
print(MyAir.status())
File "/home/pi/.local/lib/python3.5/site-packages/miio/airpurifier.py", line 174, in __repr__
self.led_brightness,
File "/home/pi/.local/lib/python3.5/site-packages/miio/airpurifier.py", line 105, in led_brightness
return LedBrightness(self.data["bright"])
File "/usr/lib/python3.5/enum.py", line 241, in __call__
return cls.__new__(cls, value)
File "/usr/lib/python3.5/enum.py", line 476, in __new__
raise ValueError("%r is not a valid %s" % (value, cls.__name__))
ValueError: 9 is not a valid LedBrightness
And the domoticz log shows
2018-03-10 17:09:04.849 Error: (AirPurifier) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/domoticz-AirPurifier/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2018-03-10 17:09:04.849 Error: (Mari Puri) Module Import failed, exception: 'ImportError'
2018-03-10 17:09:04.849 Error: (Mari Puri) Module Import failed: ' Name: miio'
2018-03-10 17:09:04.849 Error: (Mari Puri) Error Line details not available.
2018-03-10 17:10:00.421 Error: Mari Puri hardware (6) thread seems to have ended unexpectedly
-
- Posts: 53
- Joined: Friday 16 September 2016 14:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Xiaomi Air Purifier 2
There was an issue in library python-miio
please install the latest version:
pip3 install -U python-miio
please install the latest version:
pip3 install -U python-miio
-
- Posts: 5
- Joined: Saturday 07 April 2018 8:11
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Xiaomi Air Purifier 2
MyAir.py is working like a charm, so I have python-miio installed, but the plugin is not loading correctly in domoticz:
I think that this could be related to python path used, because pip3 install -U installs package in ~/.local/ but this path is not in the list from log:
EDIT:
I've changed one of the lines to:
And now it seems that the package is recognized, but.... I've got bigger problem. Domoticz crashes with:
Code: Select all
2018-04-07 08:15:46.682 Error: (AirPurifier) failed to load 'plugin.py', Python Path used was '/home/osmc/domoticz/plugins/xiaomi-purifier/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2018-04-07 08:15:46.682 Error: (Purifier) Module Import failed, exception: 'ImportError'
2018-04-07 08:15:46.682 Error: (Purifier) Module Import failed: ' Name: miio'
2018-04-07 08:15:46.682 Error: (Purifier) Error Line details not available.
Can you help me with this?'/home/osmc/domoticz/plugins/xiaomi-purifier/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'
EDIT:
I've changed one of the lines to:
Code: Select all
pathOfPackages = '/home/osmc/.local/lib/python3.5/site-packages'
Code: Select all
2018-04-07 08:56:12.146 Error: Domoticz received fatal signal 11 !...
2018-04-07 08:56:12.148 Error: /home/osmc/domoticz/domoticz() [0x24f04c]
2018-04-07 08:56:12.148 Error: /home/osmc/domoticz/domoticz(_Z14signal_handleri+0x4c) [0x24f104]
2018-04-07 08:56:12.148 Error: /lib/arm-linux-gnueabihf/libc.so.6(+0x24fd0) [0x76c66fd0]
-
- Posts: 5
- Joined: Saturday 07 April 2018 8:11
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Xiaomi Air Purifier 2
Ok, I've finally compiled domoticz from source and it's working
-
- Posts: 784
- Joined: Wednesday 10 December 2014 13:06
- Target OS: Linux
- Domoticz version: beta
- Location: Bordeaux France
- Contact:
Re: Xiaomi Air Purifier 2
I need your help for Xiaomi pm2.5 sensor; The Python Plugin doesn't work @ home.ben53252642 wrote: ↑Wednesday 18 January 2017 18:55 8) For those who want to load the Temperature, Humidity and Aqi (pm2.5 estimate) into Domoticz sensors, below is a updatedomoticz.sh bash script:Code: Select all
#!/bin/bash while true; do # Get the data data=$(node airpurifier.js 192.168.0.240 status) # Sort it temperature=$(echo "$data" | grep "temperature" | sed -e s/[^0-9.]//g) humidity=$(echo "$data" | grep "humidity" | sed -e s/[^0-9.%]//g) aqi=$(echo "$data" | grep "aqi" | sed -e s/[^0-9.]//g) # Load it into Domoticz curl -s "http://USERNAME:[email protected]/json.htm?type=command¶m=udevice&idx=607&nvalue=0&svalue=${temperature};${humidity};0" curl -s "http://USERNAME:[email protected]/json.htm?type=command¶m=udevice&idx=599&svalue=${aqi}" sleep 60 done
I prefere your solution
i have modify your airpurifier.js for the pm2.5 sensor and result is :
Code: Select all
{ power: true, aqi: 14, batteryLevel: 100, charging: true }
using
Code: Select all
aqi=$(echo "$data" | grep "aqi" | sed -e s/[^0-9.]//g)
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
-
- Posts: 234
- Joined: Sunday 27 August 2017 18:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Spain
- Contact:
Re: Xiaomi Air Purifier 2
for aqi i use this:
Code: Select all
aqi=$(echo "$data" | grep -Po ' aqi=\K[^,]+')
-
- Posts: 8
- Joined: Saturday 09 June 2018 3:16
- Target OS: Linux
- Domoticz version:
- Contact:
Re: Xiaomi Air Purifier 2
I have received tons of warnings at step 2) and 3) :
and in the end i was unable to run 4):
I have run all of those commands at root, who is the same user running domoticz.
2) Install miIO Device Library: npm install --save miio
Code: Select all
npm WARN engine [email protected]: wanted: {"node":">=6.6.0"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=6.6.0"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=6.0.0"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=6.0.0"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
3) Install miio command line utility: npm install -g miio
Code: Select all
npm WARN engine [email protected]: wanted: {"node":">=6.6.0"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=6.6.0"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=6.0.0"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=6.0.0"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
4) Run this command to discover and sync the key from your Air Purifier: miio --discover --sync
Code: Select all
miio --discover --sync
-
- Posts: 2
- Joined: Friday 24 August 2018 23:27
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Xiaomi Air Purifier 2
Hi, I have a problem with this plugin:
Code: Select all
2018-08-24 23:40:16.608 Error: (AirPurifier) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/domoticz-AirPurifier/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2018-08-24 23:40:16.609 Error: (Oczyszczacz) Module Import failed, exception: 'ImportError'
2018-08-24 23:40:16.609 Error: (Oczyszczacz) Module Import failed: ' Name: miio'
2018-08-24 23:40:16.609 Error: (Oczyszczacz) Error Line details not available.
Code: Select all
./MyAir.py 192.168.1.4 e8c60b26d83ca76c9b94ee066f4ccf23 --debug
Namespace(IPaddress='192.168.1.4', debug=True, favoriteLevel=None, mode=None, power=None, token='e8c60b26d83ca76c9b94ee066f4ccf23')
<AirPurifierStatus power=on, aqi=10, average_aqi=8, temperature=26.6, humidity=59%, mode=OperationMode.Auto, led=True, led_brightness=LedBrightness.Dim, illuminance=None, buzzer=False, child_lock=False, favorite_level=10, filter_life_remaining=6, filter_hours_used=3274, use_time=11784415, purify_volume=130722, motor_speed=344, motor2_speed=None, volume=None, filter_rfid_product_id=None, filter_rfid_tag=None, filter_type=None, learn_mode=False, sleep_mode=None, sleep_time=None, sleep_mode_learn_count=None, extra_features=0, turbo_mode_supported=False, auto_detect=None, button_pressed=None>
-
- Posts: 53
- Joined: Friday 16 September 2016 14:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Xiaomi Air Purifier 2
As other above you need to correct:
pathOfPackages = '/home/osmc/.local/lib/python3.5/site-packages'
- to your path where miio packages is installed
pathOfPackages = '/home/osmc/.local/lib/python3.5/site-packages'
- to your path where miio packages is installed
-
- Posts: 39
- Joined: Sunday 18 December 2016 13:47
- Target OS: Linux
- Domoticz version: 3.6179
- Contact:
Re: Xiaomi Air Purifier 2
Can you please help the script myAir is not working but airpurifier.js does
nono212@syno:/volume1/@appstore/domoticz/var/plugins/domoticz-AirPurifier$ ./MyAir.py 192.168.1.76 78de1a56c6b7ab88048242e471234683 --debug
Traceback (most recent call last):
File "./MyAir.py", line 11, in <module>
import miio.airpurifier
File "/volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/miio/__init__.py", line 2, in <module>
from miio.airconditioningcompanion import AirConditioningCompanion
File "/volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/miio/airconditioningcompanion.py", line 7, in <module>
from .click_common import command, format_output, EnumType
File "/volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/miio/click_common.py", line 251, in <module>
result_msg_fmt: Union[str, callable]="{result}"):
File "/volume1/@appstore/py3k/usr/local/lib/python3.5/typing.py", line 537, in __getitem__
dict(self.__dict__), parameters, _root=True)
File "/volume1/@appstore/py3k/usr/local/lib/python3.5/typing.py", line 467, in __new__
params.append(_type_check(p, msg))
File "/volume1/@appstore/py3k/usr/local/lib/python3.5/typing.py", line 299, in _type_check
raise TypeError(msg + " Got %.100r." % (arg,))
TypeError: Union[arg, ...]: each arg must be a type. Got <built-in function callable>.
nono212@syno:/volume1/@appstore/domoticz/var/plugins/domoticz-AirPurifier$ node airpurifier.js 192.168.1.76 status
{ power: true,
mode: 'silent',
aqi: 39,
temperature: 23,
humidity: 54 }
nono212@syno:pip3 freeze
android-backup==0.2.0
appdirs==1.4.3
asn1crypto==0.24.0
attrs==18.2.0
cffi==1.11.5
Click==7.0
construct==2.9.41
cryptography==2.3.1
idna==2.7
ifaddr==0.1.4
ipaddress==1.0.22
pretty-cron==1.2.0
pycparser==2.19
python-miio==0.4.1
pytz==2018.5
six==1.11.0
tqdm==4.26.0
zeroconf==0.21.3
nono212@syno:/volume1/@appstore/domoticz/var/plugins/domoticz-AirPurifier$ ./MyAir.py 192.168.1.76 78de1a56c6b7ab88048242e471234683 --debug
Traceback (most recent call last):
File "./MyAir.py", line 11, in <module>
import miio.airpurifier
File "/volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/miio/__init__.py", line 2, in <module>
from miio.airconditioningcompanion import AirConditioningCompanion
File "/volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/miio/airconditioningcompanion.py", line 7, in <module>
from .click_common import command, format_output, EnumType
File "/volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/miio/click_common.py", line 251, in <module>
result_msg_fmt: Union[str, callable]="{result}"):
File "/volume1/@appstore/py3k/usr/local/lib/python3.5/typing.py", line 537, in __getitem__
dict(self.__dict__), parameters, _root=True)
File "/volume1/@appstore/py3k/usr/local/lib/python3.5/typing.py", line 467, in __new__
params.append(_type_check(p, msg))
File "/volume1/@appstore/py3k/usr/local/lib/python3.5/typing.py", line 299, in _type_check
raise TypeError(msg + " Got %.100r." % (arg,))
TypeError: Union[arg, ...]: each arg must be a type. Got <built-in function callable>.
nono212@syno:/volume1/@appstore/domoticz/var/plugins/domoticz-AirPurifier$ node airpurifier.js 192.168.1.76 status
{ power: true,
mode: 'silent',
aqi: 39,
temperature: 23,
humidity: 54 }
nono212@syno:pip3 freeze
android-backup==0.2.0
appdirs==1.4.3
asn1crypto==0.24.0
attrs==18.2.0
cffi==1.11.5
Click==7.0
construct==2.9.41
cryptography==2.3.1
idna==2.7
ifaddr==0.1.4
ipaddress==1.0.22
pretty-cron==1.2.0
pycparser==2.19
python-miio==0.4.1
pytz==2018.5
six==1.11.0
tqdm==4.26.0
zeroconf==0.21.3
-
- Posts: 1
- Joined: Sunday 13 October 2013 2:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Xiaomi Air Purifier 2
Hi,
Just want to say a big thank you to ben53252642 !
Nice Job, nice share
Just want to say a big thank you to ben53252642 !
Nice Job, nice share
-
- Posts: 543
- Joined: Saturday 02 July 2016 5:17
- Target OS: Linux
- Domoticz version: Beta
- Contact:
Re: Xiaomi Air Purifier 2
The original post has been updated to fix a bug with the LED control in the airpurifier.js file.
Please be sure to use the latest version of miio, it can be upgraded with this command:
npm install miio@latest --save
Please be sure to use the latest version of miio, it can be upgraded with this command:
npm install miio@latest --save
Unless otherwise stated, all my code is released under GPL 3 license: https://www.gnu.org/licenses/gpl-3.0.en.html
-
- Posts: 8
- Joined: Saturday 08 September 2018 22:34
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Location: Poland
- Contact:
Re: Xiaomi Air Purifier 2
What can be wrong. Please help.
pi@raspberrypi:~/domoticz/plugins/domoticz-AirPurifier $ sudo ./MyAir.py 192.168.1.107 46749f33f14b42deb79060b8236cf8d0 --debug
Namespace(IPaddress='192.168.1.107', debug=True, favoriteLevel=None, mode=None, power=None, token='46749f33f14b42deb79060b8236cf8d0')
Unable to discover a device at address 192.168.1.107
Traceback (most recent call last):
File "./MyAir.py", line 50, in <module>
print(MyAir.status())
File "/usr/local/lib/python3.5/dist-packages/miio/airpurifier.py", line 416, in status
values.extend(self.send("get_prop", _props[:15]))
File "/usr/local/lib/python3.5/dist-packages/miio/device.py", line 224, in send
self.do_discover()
File "/usr/local/lib/python3.5/dist-packages/miio/device.py", line 162, in do_discover
raise DeviceException("Unable to discover the device %s" % self.ip)
miio.exceptions.DeviceException: Unable to discover the device 192.168.1.107
pi@raspberrypi:~/domoticz/plugins/domoticz-AirPurifier $ sudo ./MyAir.py 192.168.1.107 46749f33f14b42deb79060b8236cf8d0 --debug
Namespace(IPaddress='192.168.1.107', debug=True, favoriteLevel=None, mode=None, power=None, token='46749f33f14b42deb79060b8236cf8d0')
Unable to discover a device at address 192.168.1.107
Traceback (most recent call last):
File "./MyAir.py", line 50, in <module>
print(MyAir.status())
File "/usr/local/lib/python3.5/dist-packages/miio/airpurifier.py", line 416, in status
values.extend(self.send("get_prop", _props[:15]))
File "/usr/local/lib/python3.5/dist-packages/miio/device.py", line 224, in send
self.do_discover()
File "/usr/local/lib/python3.5/dist-packages/miio/device.py", line 162, in do_discover
raise DeviceException("Unable to discover the device %s" % self.ip)
miio.exceptions.DeviceException: Unable to discover the device 192.168.1.107
Re: Xiaomi Air Purifier 2
Hello,
Many thanks for domoticz-AirPurifier @kofec
I successfully added new hardware AirPurifier but have no devices.
In logs everything is ok.
Any idea what to do?
I also followed this instructions https://www.domoticz.com/wiki/Using_Python_plugins and everything looks ok.
Restarted domoticz many times, removed and added yet again plugin but no effects.
MyAir works fine
Many thanks for domoticz-AirPurifier @kofec
I successfully added new hardware AirPurifier but have no devices.
In logs everything is ok.
Code: Select all
2019-01-04 22:53:49.032 Status: (Oczyszczacz) Entering work loop.
2019-01-04 22:53:49.032 Status: (Oczyszczacz) Initialized version 0.1.1, author 'kofec'
I also followed this instructions https://www.domoticz.com/wiki/Using_Python_plugins and everything looks ok.
Restarted domoticz many times, removed and added yet again plugin but no effects.
MyAir works fine
Code: Select all
./MyAir.py 192.168.0.45 39afd28889c854f90e51bd525c0bccbe --power OFF
<AirPurifierStatus power=on, aqi=41, average_aqi=23, temperature=13.9, humidity=49%, mode=OperationMode.Silent, led=True, led_brightness=None, illuminance=200, buzzer=None, child_lock=False, favorite_level=17, filter_life_remaining=87, filter_hours_used=451, use_time=None, purify_volume=None, motor_speed=299, motor2_speed=647, volume=50, filter_rfid_product_id=0:0:30:33, filter_rfid_tag=80:5c:ac:82:b0:ca:4, filter_type=FilterType.Regular, learn_mode=False, sleep_mode=None, sleep_time=None, sleep_mode_learn_count=None, extra_features=0, turbo_mode_supported=False, auto_detect=None, button_pressed=None>
-
- Posts: 2
- Joined: Saturday 30 March 2019 23:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9700
- Contact:
Re: Xiaomi Air Purifier 2
Hi Arcynide,
I had the same issue. It looks like Domoticz has problems with multi-threaded imports described by Dnpwwo in his comment https://www.domoticz.com/forum/viewtopi ... 57#p208487. If you are able to successfully run MyAir.py script, then just open plugin.py file and comment out import line of miio module:
# import miio.airpurifier
The above import causes big issue in my case. It freezes the whole plugin system and none of them is executed any more.. But, after commenting it out, it works like a charm
I hope this helps.
I had the same issue. It looks like Domoticz has problems with multi-threaded imports described by Dnpwwo in his comment https://www.domoticz.com/forum/viewtopi ... 57#p208487. If you are able to successfully run MyAir.py script, then just open plugin.py file and comment out import line of miio module:
# import miio.airpurifier
The above import causes big issue in my case. It freezes the whole plugin system and none of them is executed any more.. But, after commenting it out, it works like a charm
I hope this helps.
-
- Posts: 3
- Joined: Thursday 03 January 2019 4:40
- Target OS: Windows
- Domoticz version: 4.9700
- Contact:
Re: Xiaomi Air Purifier 2
Hi, indeed commenting out "# import miio.airpurifier" helped me to add 3 device (they showed up in the list).
Now, I still cannot control my Purifier Pro and I don't see the temperature/humidity in domoticz. Did you get that to work?
I actually get the following error in the log:
And MyAir.py does not really work. Do I have the wrong token? (I got it via an old Android app version)
C:\Program Files (x86)\Domoticz\plugins\domoticz-AirPurifier-master>MyAir.py 192.168.21.148 8cc275fc96cb3df245853bfa6e49563f
usage: MyAir.py [-h] [--mode {Auto,Favorite,Idle,Silent}]
[--favoriteLevel {0,1,2,3,4,5,6,7,8,9,10}] [--power {ON,OFF}]
[--debug]
IPaddress token
MyAir.py: error: the following arguments are required: IPaddress, token
Now, I still cannot control my Purifier Pro and I don't see the temperature/humidity in domoticz. Did you get that to work?
I actually get the following error in the log:
Code: Select all
2019-04-17 19:14:46.209 Status: User: Admin initiated a switch command (97/XiaomiAir - Power/On)
2019-04-17 19:14:46.248 Error: (XiaomiAir) 'onCommand' failed 'FileNotFoundError'.
2019-04-17 19:14:46.248 Error: (XiaomiAir) ----> Line 581 in C:\Program Files (x86)\Domoticz\plugins\domoticz-AirPurifier-master\plugin.py, function onCommand
2019-04-17 19:14:46.248 Error: (XiaomiAir) ----> Line 329 in C:\Program Files (x86)\Domoticz\plugins\domoticz-AirPurifier-master\plugin.py, function onCommand
2019-04-17 19:14:46.248 Error: (XiaomiAir) ----> Line 626 in C:\Program Files (x86)\Python35-32\Lib\subprocess.py, function check_output
2019-04-17 19:14:46.248 Error: (XiaomiAir) ----> Line 693 in C:\Program Files (x86)\Python35-32\Lib\subprocess.py, function run
2019-04-17 19:14:46.248 Error: (XiaomiAir) ----> Line 972 in C:\Program Files (x86)\Python35-32\Lib\subprocess.py, function __init__
2019-04-17 19:14:46.248 Error: (XiaomiAir) ----> Line 1239 in C:\Program Files (x86)\Python35-32\Lib\subprocess.py, function _execute_child
C:\Program Files (x86)\Domoticz\plugins\domoticz-AirPurifier-master>MyAir.py 192.168.21.148 8cc275fc96cb3df245853bfa6e49563f
usage: MyAir.py [-h] [--mode {Auto,Favorite,Idle,Silent}]
[--favoriteLevel {0,1,2,3,4,5,6,7,8,9,10}] [--power {ON,OFF}]
[--debug]
IPaddress token
MyAir.py: error: the following arguments are required: IPaddress, token
-
- Posts: 3
- Joined: Tuesday 19 June 2018 8:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Xiaomi Air Purifier 2
I'm having trouble getting the switches created, the log in domoticz shows no issues;
Anyone that can point me in the right direction?
Code: Select all
2019-05-05 12:38:11.213 Status: Domoticz V4.10686 (c)2012-2019 GizMoCuz
2019-05-05 12:38:11.213 Status: Build Hash: f7fc1571, Date: 2019-05-04 13:17:04
2019-05-05 12:38:11.213 Status: Startup Path: /home/pi/domoticz/
2019-05-05 12:38:11.359 Status: PluginSystem: Started, Python version '3.5.3'.
2019-05-05 12:38:11.368 Status: WebServer(HTTP) started on address: :: with port 8888
2019-05-05 12:38:11.373 Status: WebServer(SSL) started on address: :: with port 443
2019-05-05 12:38:11.375 Status: Camera: settings (re)loaded
2019-05-05 12:38:11.412 Status: TCPServer: shared server started...
2019-05-05 12:38:11.412 Status: RxQueue: queue worker started...
2019-05-05 12:38:13.413 Status: RFXCOM: Worker started...
2019-05-05 12:38:13.413 Status: XiaomiGateway (ID=3): Delaying worker startup...
2019-05-05 12:38:14.992
2019-05-05 12:38:14.416 Status: RFXCOM: Using serial port: /dev/ttyUSB0
2019-05-05 12:38:15.068 subtype = Interface Response
2019-05-05 12:38:15.068 Sequence nbr = 2
2019-05-05 12:38:15.068 response on cmnd = Get Status
2019-05-05 12:38:15.068 Transceiver type = 433.92MHz
2019-05-05 12:38:15.068 Firmware version = 1025
2019-05-05 12:38:15.068 Firmware type = Ext
2019-05-05 12:38:15.068 Hardware version = 1.3
2019-05-05 12:38:15.068 Undec off
2019-05-05 12:38:15.068 X10 enabled
2019-05-05 12:38:15.068 ARC enabled
2019-05-05 12:38:15.068 AC enabled
2019-05-05 12:38:15.068 HomeEasy EU enabled
2019-05-05 12:38:15.068 Meiantech/Atlantic disabled
2019-05-05 12:38:15.068 Oregon Scientific enabled
2019-05-05 12:38:15.068 ATI/Cartelectronic disabled
2019-05-05 12:38:15.068 Visonic disabled
2019-05-05 12:38:15.068 Mertik disabled
2019-05-05 12:38:15.068 AD disabled
2019-05-05 12:38:15.068 Hideki enabled
2019-05-05 12:38:15.068 La Crosse enabled
2019-05-05 12:38:15.068 Legrand disabled
2019-05-05 12:38:15.068 MSG4Reserved5 disabled
2019-05-05 12:38:15.068 BlindsT0 disabled
2019-05-05 12:38:15.068 BlindsT1 disabled
2019-05-05 12:38:15.068 AE disabled
2019-05-05 12:38:15.068 RUBiCSON disabled
2019-05-05 12:38:15.068 FineOffset disabled
2019-05-05 12:38:15.068 Lighting4 disabled
2019-05-05 12:38:15.068 Conrad RSL disabled
2019-05-05 12:38:15.068 ByronSX disabled
2019-05-05 12:38:15.068 IMAGINTRONIX disabled
2019-05-05 12:38:15.068 KEELOQ disabled
2019-05-05 12:38:15.068 Home Confort disabled
2019-05-05 12:38:18.461 (Xiaomi) Temp + Humidity + Baro (Buiten TempHumBaro)
2019-05-05 12:38:18.465 (Xiaomi) Temp + Humidity + Baro (Jane TempHumBaro)
2019-05-05 12:38:18.467 (Xiaomi) Lux (Aqara Motion Sensor)
2019-05-05 12:38:18.470 (Xiaomi) Temp + Humidity + Baro (Schuur TempHumBaro)
2019-05-05 12:38:18.473 (Xiaomi) Temp + Humidity + Baro (Badkamer TempHumBaro)
2019-05-05 12:38:18.475 (Xiaomi) Temp + Humidity + Baro (Slaapkamer TempHumBaro)
2019-05-05 12:38:18.414 Status: XiaomiGateway (ID=3): Selected as main Gateway
2019-05-05 12:38:18.414 Status: XiaomiGateway (ID=3): Worker started...
2019-05-05 12:38:18.414 Status: (Beneden luchtreiniger) Started.
2019-05-05 12:38:18.414 Status: (Kantoor luchtreiniger) Started.
2019-05-05 12:38:18.414 Status: XiaomiGateway (ID=3): Using 192.168.2.32 for local IP address.
2019-05-05 12:38:18.415 Status: EventSystem: reset all events...
2019-05-05 12:38:18.416 Status: EventSystem: reset all device statuses...
2019-05-05 12:38:18.439 Status: XiaomiGateway: RGB Gateway Detected
2019-05-05 12:38:18.609 Status: Python EventSystem: Initalizing event module.
2019-05-05 12:38:18.609 Status: EventSystem: Started
2019-05-05 12:38:18.610 Status: EventSystem: Queue thread started...
2019-05-05 12:38:18.755 Status: PluginSystem: Entering work loop.
2019-05-05 12:38:18.980 Status: (Beneden luchtreiniger) Entering work loop.
2019-05-05 12:38:18.980 Status: (Beneden luchtreiniger) Initialized version 0.1.1, author 'kofec'
2019-05-05 12:38:19.151 (Beneden luchtreiniger) Debug logging mask set to: NONE
2019-05-05 12:38:19.151 (Beneden luchtreiniger) Device UNIT_MODE_CONTROL with id 10 exist
2019-05-05 12:38:19.151 (Beneden luchtreiniger) Device UNIT_MODE_CONTROL with id 11 exist
2019-05-05 12:38:19.151 (Beneden luchtreiniger) Device UNIT_MOTOR_SPEED_FAVORITE with id 12 exist
2019-05-05 12:38:19.147 Status: (Kantoor luchtreiniger) Entering work loop.
2019-05-05 12:38:19.147 Status: (Kantoor luchtreiniger) Initialized version 0.1.1, author 'kofec'
2019-05-05 12:38:20.600 (Beneden luchtreiniger) Starting device update
2019-05-05 12:38:20.600 (Beneden luchtreiniger) Update unit=1; nValue=0; sValue=37
2019-05-05 12:38:20.604 (Beneden luchtreiniger) Update unit=2; nValue=1; sValue=Great air quality
2019-05-05 12:38:20.605 (Beneden luchtreiniger) Update unit=3; nValue=0; sValue=18.7
2019-05-05 12:38:20.606 (Beneden luchtreiniger) Update unit=4; nValue=51; sValue=0
2019-05-05 12:38:20.606 (Beneden luchtreiniger) Update unit=5; nValue=0; sValue=348
2019-05-05 12:38:20.607 (Beneden luchtreiniger) Update unit=6; nValue=0; sValue=8
2019-05-05 12:38:20.613 (Kantoor luchtreiniger) Debug logging mask set to: NONE
2019-05-05 12:38:20.613 (Kantoor luchtreiniger) Device UNIT_MODE_CONTROL with id 10 exist
2019-05-05 12:38:20.613 (Kantoor luchtreiniger) Device UNIT_MODE_CONTROL with id 11 exist
2019-05-05 12:38:20.613 (Kantoor luchtreiniger) Device UNIT_MOTOR_SPEED_FAVORITE with id 12 exist
2019-05-05 12:38:22.057 (Kantoor luchtreiniger) Starting device update
2019-05-05 12:38:22.058 (Kantoor luchtreiniger) Update unit=1; nValue=0; sValue=48
2019-05-05 12:38:22.061 (Kantoor luchtreiniger) Update unit=2; nValue=1; sValue=Great air quality
2019-05-05 12:38:22.062 (Kantoor luchtreiniger) Update unit=3; nValue=0; sValue=19.3
2019-05-05 12:38:22.063 (Kantoor luchtreiniger) Update unit=4; nValue=44; sValue=0
2019-05-05 12:38:22.063 (Kantoor luchtreiniger) Update unit=5; nValue=0; sValue=346
2019-05-05 12:38:22.066 (Kantoor luchtreiniger) Update unit=6; nValue=0; sValue=8
Re: Xiaomi Air Purifier 2
Hello! Please tell me how to do it on windows ?
Who is online
Users browsing this forum: No registered users and 1 guest