Xiaomi gateway not discovered

Do you own/use one of the “broken” devices of firmware 149?

I didn’t upgrade to 149 to avoid problems but I’m stuck at 1.3.1_141.0143.

I know but if you don’t use wall switches there are no problems to fear.

@syssi with the change on

PyXiaomiGateway/init.py

with self.gateways[‘192.168.x.x’] = XiaomiGateway(‘192.168.x.x’, 9898, ‘28fffffffffff’, ‘keykeykey’, self._socket)

my gateway works fine with eth, thanks, is there a release date for the host parameter in Hass release?

1 Like

The change needs some more testing. If it proves as stable I will prepare a pull request.

I know but if you don’t use wall switches there are no problems to fear

I have the wireless round switch and the wireless zigbee double wall switch (Aqara). I think the latter is problematic with the firmware 149.

Sadly, yes.

Hi all,
I need your help. I have been desperately trying to integrate Xiaomi GW in homeassistant (both latest versions).

I cannot see the GW and I cannot debug because my homeassistant.log does not write events. It is a very small file that was last updated many days ago.
Is there smh I can do to enable logging?
Thank you very much in advance.

Just add these lines to your configuration.yaml and restart home assistant:

logger:
  default: warn
  logs:
    homeassistant.components.xiaomi: debug
    homeassistant.components.binary_sensor.xiaomi: debug
    homeassistant.components.sensor.xiaomi: debug
    homeassistant.components.light.xiaomi: debug
    homeassistant.components.switch.xiaomi: debug

Do you use hassio, hassbian or how/where did you install home assistant?

It is running on a RPi 3 with raspbian (already being used for homebridge). I installed in a virtual environment according to the official instructions. I will enable the debugger and get back to you.

Thanks a lot!!

Hey there @syssi,

Just updated the configuration and restarted the server but still nothing new on my log.
Am I checking the correct file?

/home/pi/.homeassistant/home-assistant.log or /home/homeassistant/.homeassistant/home-assistant.log ?

The second one seems to be the correct one according to the timestamp.

homeassistant@rpi3:~/.homeassistant $ whoami
homeassistant
homeassistant@rpi3:~/.homeassistant $ pwd
/home/homeassistant/.homeassistant
homeassistant@rpi3:~/.homeassistant $ cat home-assistant.log
2017-09-16 23:00:01 ERROR (MainThread) [homeassistant.core] Error doing job: Fatal read error on socket transport
Traceback (most recent call last):
File “/usr/lib/python3.4/asyncio/selector_events.py”, line 582, in _read_ready
data = self._sock.recv(self.max_size)
OSError: [Errno 113] No route to host
homeassistant@rpi3:~/.homeassistant $

What do you think?

BTW, home assistant is up and running. My Apple TV and Samsung TV and xiaomi yeeloght are discovered.

It depends. If you have started “bin/hass” as user “pi” the configuration.yaml & home-assistant.log will be located here per default:

/home/pi/.homeassistant/home-assistant.log 

If you are using hass with the user homeassistant (recommended!) your files will be placed here:

/home/homeassistant/.homeassistant/home-assistant.log 

Just check it by ps aux | grep hass and paste the output if you are unsure.

This error doesn’t look like Xiaomi Gateway related because the component isn’t “async”. It should be fixed nevertheless may be it disturb your home assistant instance. Could you post your configuration.yaml? There must be a loaded platform/component with a bogus ip address or URI.

It was bug and it’s fixed now. I installed hassio this morning and was able to test the code.

Pull request: Xiaomi Gateway: Allow static configuration of a gateway without discovery by syssi · Pull Request #9464 · home-assistant/core · GitHub

Hi there,

I feel like a complete total idiot. I was not using the homeassistant user all this time. Therefore I was not editing the proper configuration file.

Now I can see Xiaomi accessories, even though my GW is reported as offline in the MiHome app. The offline state in the official app is irrelevant to what I am doing with home assistant. For some reason it has been online for quite some time.

Can I add signee accessories to the GW without using the Xiaomi app? Can it be done locally through home assistant?

Thanks a lot for your help and support. Really appreciate it.

Yes. Just push the button of the gateway three times in a row. You will hear a chinese notice. Now press the pairing button of your device once. The chinese voice will acknowledge the pairing. Repeat the process for every additional device.

In that case, is the pairing just local? Will I be able to see the devices in MiHome app?
Can I remove a device in a “strictly local” way?

What do you propose I should do? Should I stick to local pairing or not?
I think that both modes of operation can coexist simultaneously.

There is no “local” and “remote” mode. The gateway settings (list of paired devices) will be synced with the chinese cloud as soon as the gateway has internet access the next time. Just block the internet access of the gateway and ignore the existence of the app. As far as I know you cannot remove a paired device from the gateway without an API call. The local API provides a method but it’s not implemented at the home assistant component so far. You can factory reset a device if you push the pairing button for 15 seconds. This does not imply the device will be removed from the “paired devices list” of the gateway.

I see. Thanks for the explanation.
I am not against the Xiaomi cloud per se, but I need the Zigbee connections to be alive and usable at all times.

Right now my GW is shown as offline in MiHome app, but I can see them fine in home assistant.

Is there any way to completely cut off from the cloud? Setup the GW without a mi account, btw?

EDIT: Is there a way to add custom names to the Zigbee components?

I think your idea of your setup is somehow incorrect. The gateway cannot be configured (WiFi setup) without the use of the Mi Home app. As next step you enabled the local network protocol. This protocol is needed for the local communication between Home Assistant and your gateway. The Home Assistant component does not know about the Xiaomi cloud. You can block the internet access of the gateway (at your router for example) now. The gateway will be shown as “offline” at your Mi Home app then. The gateway is no “cut off from the cloud” as long you block the access.

The gateway is limitted to the Xiaomi/Aqara components. New devices are introduced with firmware updates.

Your zigbee devices will be alive and usable. They don’t depend on the xiaomi cloud.