Xiaomi Gateway Integration

Exceptions in my log and no lights in HASS dev branch. I manually installed the dependency (python-mirobo) from the url in the py file.

2017-08-14 08:40:22 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
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/light/philipslight.py”, line 109, in update
state = self.light.status()
File “/home/homeassistant/.homeassistant/custom_components/light/philipslight.py”, line 83, in light
from mirobo import Ceil
ImportError: cannot import name ‘Ceil’

Please enter the virtualenv of your home assistant installation (if there is one) and install the following dependency:

pip install --upgrade "https://github.com/syssi/python-mirobo/archive/87998cad53ad0c5802dc562497a7606983903c57.zip#python-mirobo"

I hope @teprrr will merge the ceiling lamp in python-mirobo tonight. I will switch back to upstream then.

Didn’t work for me. Still getting the same error. BTW I’m using the ball bulbs and not the ceiling light. Guess I’ll wait for the merge.

Thank you syssi. Is this working with hass.io?

Can you tell me how to get the token using hass.io (on Mac)

The ball has the same feature like the ceiling. The component is for both. Do you use other components which requires python-mirobo? The vacuum for example? I assume home assistant replaces the python-mirobo dependency on startup. The mentioned version contains a ceil.py. Please check out python-packages folder.

I don’t know hass.io. May be somebody else can answer the question how to add custom components at hass.io.

If you have a android phone and mi home installed this is the easiest way to find the token: Xiaomi zigbee smart plug - #12 by syssi

Yes! This must be it. That is a core component now. I checked the package and there is no ceil.py. Is there a way i can edit the core component to comment out the dependency?

Just disable/comment out the other component at your configuration.yaml for testing. If the other component (vacuum, xiaomiplug) is not loaded the dependency won’t be retrieved. Install the patched version again and give it a try! :slight_smile:

Hi Friends,
I have a problem… Window, door, motion and temp sensors automatic offline a few hours later. “Device Offline” I want to device online always. Why they turn off automatically? Is it always possible to keep them online?
Thank you
sensor offline

Either the battery is empty or the device its out of range most of the time. I’m betting on the second one.

IT’S ALIIIIIVE! Brightness and on/off working great.

Edit: @syssi Ok maybe there are some exceptions being thrown around when I’m toggling the lights and changing brightness. Lights become unresponsive sometimes. I have 5 of these bulbs. :grimacing:
https://pastebin.com/M61mqGRT

1 Like

So only missing colour tone changing, right?

If range is an issue, adding some powered (non-battery) xiaomi zigbee devices to the network should help build up the mesh network.

I found my network got more stable once I added a few zigbee power switches. I added them at points in between the hub and the battery powered units as “repeaters”

Hi syssi,

Thank you for your reply.
Distance between gateway and motion sensor is 0.5m, door sensor is 1.5m, window sensor is 5m, temperature sensor is 3m. I guess all the batteries inside sensors are empty. How is that possible?

What value are your sensors reporting for battery?
The sensors ship with batteries connected, so presumably drain to some extent whilst in the warehouse etc.

Right. I’m unsure about the mapping between home assistant and the light. Setting the color temp seems to be easy.

Where can I read and know which value is for which sensor?

Easiest and quickest place is in developer tools states view:

Here you can see battery level against each sensor entity.

I created a group with all the battery levels for my sensors for convenience:

You can probably create automation to alert on low battery level too.

BTW I think its generally regarded that the reported battery level is not well calibrated.
No one know for sure if batteries ever start at 100% for a new battery, or drop to 0% when empty, or whether they report battery level changes in a linear manner.

2 Likes

I have not that program. I don’t know about it. :frowning:
How can I use it?

Ive been working on a ‘notify’ for when each sensor’s battery gets below 5% however doesn’t seem to work. Can you post the code for the above please.