Let’s assume both devices (xiaomi gateway and f.e. the air purifier) has nothing in common. Do you still want to merge both lines?
syssi/xiaomiplug
Xiaomi Mi Smart WiFi Socket integration for Home Assistant - syssi/xiaomiplug
Let’s assume both devices (xiaomi gateway and f.e. the air purifier) has nothing in common. Do you still want to merge both lines?
Well, I don’t know. I still have no gateway (is on the way), but I supposed it would make sense to have a common platform with maybe optional parameters on the configuration, based on the type of device… It was just a suggestion…
I’m still seeking for good reasons to merge the WiFi components into one platform. I don’t recommend a merge into the xiaomi gateway platform because of the different network protocol (multicast) and the different token/key handling. IMHO the xiaomi gateway and the WiFi devices doesn’t have much in common.
Since @teprrr introduced the “-d info” command it looks like we are able to identify the different devices by a nice model name (f.e. philips.light.bulb, philips.light.ceiling, zhimi.airpurifier.m1). A common component for switches and lights with network discovery and device/feature detection would be awesome.
Did you manage to make it work?
I followed all the steps but when I run the manual to learn a command it gives me a timeout error
File “/config/custom_components/switch/chuangmi_ir.py”, line 67, in _learn_command
Ir_remote.send (“miIO.ir_learn”, {‘key’: str (key)})
File “/config/deps/lib/python3.6/site-packages/miio/miio.py”, line 128, in send
Date, addr = s.recvfrom (1024)
Socket.timeout: timed out
Did you manage to make it work?
I followed all the steps but when I run the manual to learn a command it gives me a timeout error
File “/config/custom_components/switch/chuangmi_ir.py”, line 67, in _learn_command
Ir_remote.send (“miIO.ir_learn”, {‘key’: str (key)})
File “/config/deps/lib/python3.6/site-packages/miio/miio.py”, line 128, in send
Date, addr = s.recvfrom (1024)
Socket.timeout: timed out
Yes, I made it work. All you have to do is specify a “timeout
” parameter, the same you would use with the broadlink RM switch component. It means the time that the device will wait for you to send it a code from your remote.
Once you put that parameter, everything works as indicated.
If anyone is interested, i made a Sensor who gets the Air Quality and the current state from the air Purifier:
sensor:
- platform: command_line
command: sudo miio --control 192.168.1.215 --method get_prop --params '["mode"]' | awk 'NR==5' | cut -d "\"" -f2
- platform: command_line
name: "Xiaomi Airquality"
command: sudo miio --control 192.168.1.215 --method get_prop --params '["aqi"]' | sed -n '5p' | cut -d " " -f3
unit_of_measurement: "PM2.5"
Just change the IP
I’ve updated my xiaomi plug component. It’s called “xiaomi_plug” now as preparation for the future merge into home assistant. Furthermore it uses asyncio now and reacts better on state changes (the switch doesn’t flip back anymore):
Xiaomi Mi Smart WiFi Socket integration for Home Assistant - syssi/xiaomiplug
Could you post a graph showing air quality? Does it have significant effect on air quality (dust) running the purifier? I am considering buying one myself…
Hi syssi. Thank you so much for the good work.
This component is not working yet?
Xiaomi Mi Air Purifier and Xiaomi Mi Air Humidifier integration for Home Assistant - syssi/xiaomi_airpurifier
fan:
This component is not working yet?
It’s just an untested draft. Do you own the device and willing to test the component? I fixed some glitches. Just give it a try and please provide a screenshot if the fan will be shown in the frontend. I’m interested in the provided attributes.
hi
im getting ImportError: No module named ‘zeroconf’`
What can I do? I am running the venv on raspi3
Thanks
Traceback (most recent call last): File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step result = coro.throw(exc) File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 381, in async_process_entity new_entity, self, update_before_add=update_before_add File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 212, in async_add_entity yield from self.hass.async_add_job(entity.update) File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__ yield self # This tells Task to wait for completion. File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup value = future.result() File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result raise self._exception File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run result = self.fn(*self.args, **self.kwargs) File "/home/homeassistant/.homeassistant/custom_components/switch/xiaomiplug.py", line 115, in update from mirobo import DeviceException File "/srv/homeassistant/lib/python3.4/site-packages/mirobo/__init__.py", line 12, in <module> from mirobo.discovery import Discovery File "/srv/homeassistant/lib/python3.4/site-packages/mirobo/discovery.py", line 2, in <module> import zeroconf ImportError: No module named 'zeroconf'
im getting ImportError: No module named ‘zeroconf’`
What can I do? I am running the venv on raspi3
There is a dependency missing unfortunately. Enter your virtualenv and install zeroconf manually
su - homeassistant
source /srv/homeassistant/bin/activate
pip3 install zeroconf
and restart home assistant. If “pip install” fails please post the error message. I assume there will be another dependency missing.
ehi @syssi i’ve the chuangmi_ir remote control and i’ve found a beta custom component to use in homeassistant… this is the url of the component: https://github.com/homeassistantchina/custom_components/tree/master/custom_components/switch
but it doesn’t work… can you please take a look? sorry but i know you are very good
but it doesn’t work… can you please take a look?
Are there any error messages (home-assistant.log)? Could you provide some more details about your issue. What did you try?
it’s working! I still couldnt believe it!
thanks for your help, very much appreciated!
As soon as i add the Config for the Fan(Purifier), i get following error:
2017-08-28 16:55:29 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/remote.py", line 132, in default
return json.JSONEncoder.default(self, o)
File "/usr/lib/python3.5/json/encoder.py", line 179, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <OperationMode.Auto: 'auto'> is not JSON serializable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/remote.py", line 138, in default
for child_obj in o]
TypeError: 'OperationMode' object is not iterable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/aiohttp/web_protocol.py", line 422, in start
resp = yield from self._request_handler(request)
File "/srv/homeassistant/lib/python3.5/site-packages/aiohttp/web.py", line 306, in _handle
resp = yield from handler(request)
File "/usr/lib/python3.5/asyncio/coroutines.py", line 209, in coro
res = yield from res
File "/usr/lib/python3.5/asyncio/coroutines.py", line 209, in coro
res = yield from res
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/http/ban.py", line 58, in ban_middleware_handler
return (yield from handler(request))
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/http/__init__.py", line 424, in handle
result = yield from result
File "/usr/lib/python3.5/asyncio/coroutines.py", line 209, in coro
res = yield from res
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/websocket_api.py", line 388, in handle
yield from self._writer_task
File "/usr/lib/python3.5/asyncio/futures.py", line 363, in __iter__
return self.result() # May raise too.
File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
raise self._exception
File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
result = coro.send(None)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/websocket_api.py", line 238, in _writer
yield from self.wsock.send_json(message, dumps=JSON_DUMP)
File "/srv/homeassistant/lib/python3.5/site-packages/aiohttp/web_ws.py", line 188, in send_json
return self.send_str(dumps(data))
File "/usr/lib/python3.5/json/__init__.py", line 237, in dumps
**kw).encode(obj)
File "/usr/lib/python3.5/json/encoder.py", line 198, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python3.5/json/encoder.py", line 256, in iterencode
return _iterencode(o, 0)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/remote.py", line 141, in default
return json.JSONEncoder.default(self, o)
File "/usr/lib/python3.5/json/encoder.py", line 179, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <OperationMode.Auto: 'auto'> is not JSON serializable
Hi syssi,
I installed the mirobo package and add the Fan to my config.
There is no error in HA log but the frontend keeps just loading like the below.