Xiaomi Gateway Integration

Thanks. But no, I already tried that. :slight_smile:

Yes, I’m using flux with my yeelights, it works well.

Also with the Gateway’s light? With the Yeelights I use it as well - works like a charm.

Works really well, I also thought about controlling the color using rotation, but it would require using the HSV color space, and I am not sure if and how to convert rgb to hsv direct into HA.

Yeah I was trying to figure out a way to rotate through colors with the flip180 event but i’m a beginner so i don’t have the slightest how to go about that

protocol version 1.0.7 brings support of curtains. Xiaomi API v.1.0.7

Wireless switch 86 double
Click Left click
Double_click Left double click

Right double-click double_click

Both_click Left and right keys at the same time press

Attribute escalation:
{“Cmd”: “report”, “model”: “86sw2”, “sid”: “112316”, “short_id”: 4343, “data”: “{” channel_0 \ ": " click \ "} }

By sending “write” way “virtual event” (the “virtual event” only work inside the gateway, not reported to the millet cloud), in order to trigger a local linkage (automation) associated with the event can be performed:
{“Cmd”: “write”, “model”: “86sw2”, “sid”: “112316”, “short_id”: 4343, “data”: “{” channel_1 \ ": " double_click \ “}” }


V1.0.7 New: You can “write” on the Rubik’s Cube, 86 wireless switch and wireless switch, in order to create a “virtual event”

Does this mean Aqara switches can support double_click inside HA?

Aqara and Eigenstone are two brands of lumiunited (eigenstone brand is printed inside new aqara sensors).
Why will exist two brands, wild guess, one for selling with xiaomi/mijia, another for lumiunited alone.

eigenstone has a chinese site with some new products not anounced yet. a light relay switch, natural gas alarm and fire alarm without Honeywell branding… a camera (with wrong model id)

Opening page has all the product family

Flooding sensor (finaly :smile: )

Natural Gas Alarm

Fire Alarm

Light Relay switch Zigbee

IP Camera

and github page

1 Like

The “double_click” event arrives the xiaomi component of HA but it’s not implemented so far.

I believe you are wrong. I am using a double click event in an automation with the original xiaomi switch.

Double_click event implemented.

class XiaomiButton(XiaomiDevice, BinarySensorDevice):
    """Representation of a Xiaomi Button."""

    def __init__(self, device, name, data_key, hass, xiaomi_hub):
        """Initialize the XiaomiButton."""
        self._is_down = False
        self._hass = hass
        self._data_key = data_key
        XiaomiDevice.__init__(self, device, name, xiaomi_hub)

    def is_on(self):
        """Return true if sensor is on."""
        return self._is_down

    def parse_data(self, data):
        """Parse data sent by gateway"""
        value = data.get(self._data_key)
        if value is None:
            return False

        if value == 'long_click_press':
            self._is_down = True
            click_type = 'long_click_press'
        elif value == 'long_click_release':
            self._is_down = False
            click_type = 'hold'
        elif value == 'click':
            click_type = 'single'
        elif value == 'double_click':
            click_type = 'double'

        self._hass.bus.fire('click', {
            'entity_id': self.entity_id,
            'click_type': click_type
        if value in ['long_click_press', 'long_click_release']:
            return True
        return False

Both_click is not implemented for 86sw2 (wall double switch).

1 Like

According to new protocol specification Magnet sensor and Motion sensor can report their state as unknown. For example after reboot or power outage until next heart_beat arrive (~60 sec).
How do you think do we need to show this state in UI?
Currently this state is ignored.

The state should be sat to None, then it will show up as Unknown in the frontend.

1 Like

BTW gas and fire sensors got alarm attribute extension

I have a question regarding the Gatewaylight: how do I grab the GW’s light sensor’s data? Earlier this year I used the MiHome-App to create the “night light when motion detected”-automation. Worked very nice: e.g. when I switched the normal (non smart) light on, the GW light switched itself off. So the GW seems to have a light sensor.

Has anyone managed to integrate that capability? Unfortunately I lost track which repo is the most recent and might be able to do so…

You can follow the different forks here: https://github.com/lazcad/homeassistant/network

Thanks. Any chance all those different approaches will ever merge into one main repo and we can concentrate on that? Otherwise I really don’t think it is a very efficient way.

To be honest: Very difficult to keep track and I honestly don’t even know which of those branches I am on and which branch to use for udates. If I read correctly some branches already support the illumination sensor. This might the thing I am looking for.

Hi I have posted on here before about needing to power cycle my gateway in order to get HASS to see it, I have tried to reset my gateway like some one suggested but it didn’t help. I have tried a lot of components on GitHUB none have worked, added the sid with upper case, lower case. with colons and without, I have added " interface: [GATEWAYS IP]" nothing seems to work.

When I do get it connected after a power cycle I can seen all my sensors read the temps, button presses etc, but after about 2 mins they will stop updating I can’t turn on the gateways light it’s as if its not connected.

Can someone help me finally get it working right so I can start automating in HASS. Thanks.

for what its worth

The following errors have been logged this session:

2017-05-31 02:45:23 WARNING (MainThread) [homeassistant.setup] Setup of xiaomi is taking over 10 seconds.
2017-05-31 02:45:28 ERROR (Thread-1) [custom_components.xiaomi] No gateway discovered
2017-05-31 02:45:28 ERROR (MainThread) [homeassistant.setup] Setup failed for xiaomi: Component failed to initiali

Same case here… I’m running firmware 1.4.1_146.0141

Currently running the same firmware probably should have said that, but I had the same problem with the previous firmware and didn’t have any problems adding the gateway or have it drop when I tried it with OpenHAB.