Xiaomi (Aqara) Gateway and NodeRED addon conflict
See original GitHub issueHello,
There seems to be a problem with NodeRED addon and Xiaomi Aqara gateway. They both seem to be in a some sort of conflict. Basically: I had a NodeRED addon up and running for couple for months without an issue. Recently, I bought Xiaomi Gateway and added necessary details in configuration.yaml (indents are there):
xiaomi_aqara:
discovery_retry: 10
gateways:
- key: MyMiHomeKey
but after restart, Hassio returned an error, that “component and platform xiaomi_aqara could not be set up”. Log from Hassio:
Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/homeassistant/setup.py", line 148, in _async_setup_component component.setup, hass, processed_config) # type: ignore
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/xiaomi_aqara.py", line 137, in setup xiaomi.listen()
File "/usr/local/lib/python3.6/site-packages/xiaomi_gateway/__init__.py", line 138, in listen self._mcastsocket = self._create_mcast_socket()
File "/usr/local/lib/python3.6/site-packages/xiaomi_gateway/__init__.py", line 126, in _create_mcast_socket sock.bind((self.MULTICAST_ADDRESS, self.MULTICAST_PORT))
OSError: [Errno 98] Address in use
Eventually, I switched every addon I had off and commented out almost everything from configuartion.yaml. And voila… gateway was discovered and working. So I started turning everything back on, one by one, with restart of Hassio every time. I started with addons. After turning NodeRED addon, Hassio returned “component and platform xiaomi_aqara could not be set up” error again. So I switched NodeRED addon off again and… Xiaomi Gateway up and running again. So I run another test. When Xiaomi Gateway is connected and working, I did press Start to launch NodeRED addon. It seems starting ok at first, but then it throws an error and goes into bootloop with same error every time.
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing...
-----------------------------------------------------------
Hass.io Add-on: Node-RED v1.2.0
Flow-based programming for the Internet of Things
From: Community Hass.io Add-ons
By: Franck Nijhof <frenck@addons.community>
-----------------------------------------------------------
armhf / Resin OS 2.3.0+rev1 / HA 0.83.3 / SU 140 / stable
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing...
Log level is set to INFO
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] 02-updates.sh: executing...
INFO: You are running the latest version of this add-on
[cont-init.d] 02-updates.sh: exited 0.
[cont-init.d] 10-requirements.sh: executing...
[cont-init.d] 10-requirements.sh: exited 0.
[cont-init.d] 20-config.sh: executing...
[cont-init.d] 20-config.sh: exited 0.
[cont-init.d] 50-remove-conflicts.sh: executing...
audited 171 packages in 12.922s
found 9 moderate severity vulnerabilities
run `npm audit fix` to fix them, or `npm audit` for details
[cont-init.d] 50-remove-conflicts.sh: exited 0.
[cont-init.d] 80-system-packages.sh: executing...
[cont-init.d] 80-system-packages.sh: exited 0.
[cont-init.d] 81-npm-packages.sh: executing...
[cont-init.d] 81-npm-packages.sh: exited 0.
[cont-init.d] 82-user-scripts.sh: executing...
[cont-init.d] 82-user-scripts.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
hassio-addon-node-red@ start /opt
node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js"
8 Dec 09:27:04 - [info]
Welcome to Node-RED
===================
8 Dec 09:27:04 - [info] Node-RED version: v0.19.5
8 Dec 09:27:04 - [info] Node.js version: v8.14.0
8 Dec 09:27:04 - [info] Linux 4.4.50 arm LE
8 Dec 09:27:06 - [info] Loading palette nodes
8 Dec 09:27:19 - Error: bind EADDRINUSE 0.0.0.0:9898
at _handle.lookup (dgram.js:266:18)
at _combinedTickCallback (internal/process/next_tick.js:142:11)
at process._tickCallback (internal/process/next_tick.js:181:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hassio-addon-node-red@ start: `node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hassio-addon-node-red@ start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-12-08T09_27_19_779Z-debug.log
hassio-addon-node-red@ start /opt
node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js"
8 Dec 09:27:30 - [info]
Welcome to Node-RED
===================
8 Dec 09:27:30 - [info] Node-RED version: v0.19.5
8 Dec 09:27:30 - [info] Node.js version: v8.14.0
8 Dec 09:27:30 - [info] Linux 4.4.50 arm LE
8 Dec 09:27:32 - [info] Loading palette nodes
8 Dec 09:27:45 - [red] Uncaught Exception:
8 Dec 09:27:45 - Error: bind EADDRINUSE 0.0.0.0:9898
at _handle.lookup (dgram.js:266:18)
at _combinedTickCallback (internal/process/next_tick.js:142:11)
at process._tickCallback (internal/process/next_tick.js:181:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hassio-addon-node-red@ start: `node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hassio-addon-node-red@ start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-12-08T09_27_45_252Z-debug.log
The most important part of this error is (in my opinion) an information about port 9898, which is used also by Xiaomi gateway. I am not completely sure, but I believe this is a listening port (for new devices?), that NodeRED and Xiaomi gateway are using to listen to multicast messages?
So, of course, in this case I can either use Xiaomi gateway OR NodeRed seperetly, but never together.
I don’t know, if it is important, but I have installed NodeRED in PowerShell on windows 10 and this one is working fine (NodeRED starts, I can add Xiaomi “gateway in” and “gateway out” nodes and after initial configuration, they will connect to xiaomi gateway).
Thanks.
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (4 by maintainers)

Top Related StackOverflow Question
We have a deal. 👍
This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.