Page 26 of 48
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Posted: Friday 01 February 2019 17:36
by redfirebrooks
Hi
something get wrong again... it is like every week I have a problem with the plugin and I do not know why
Code: Select all
pi@domoticz:~/domoticz/plugins/IKEA-Tradfri $ sudo systemctl status ikea-tradfri.service
● ikea-tradfri.service - IKEA Tradfri COAP-adapter
Loaded: loaded (/lib/systemd/system/ikea-tradfri.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2019-02-01 17:26:53 CET; 5min ago
Main PID: 5259 (code=exited, status=1/FAILURE)
Feb 01 17:26:53 domoticz systemd[1]: ikea-tradfri.service: Failed with result 'exit-code'.
Feb 01 17:26:53 domoticz systemd[1]: ikea-tradfri.service: Service hold-off time over, scheduling restart.
Feb 01 17:26:53 domoticz systemd[1]: Stopped IKEA Tradfri COAP-adapter.
Feb 01 17:26:53 domoticz systemd[1]: ikea-tradfri.service: Start request repeated too quickly.
Feb 01 17:26:53 domoticz systemd[1]: Failed to start IKEA Tradfri COAP-adapter.
Feb 01 17:26:53 domoticz systemd[1]: ikea-tradfri.service: Unit entered failed state.
Feb 01 17:26:53 domoticz systemd[1]: ikea-tradfri.service: Failed with result 'exit-code'.
Starting manually works
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Posted: Friday 01 February 2019 18:59
by moroen
redfirebrooks wrote: ↑Friday 01 February 2019 17:36
Hi
something get wrong again... it is like every week I have a problem with the plugin and I do not know why
Code: Select all
pi@domoticz:~/domoticz/plugins/IKEA-Tradfri $ sudo systemctl status ikea-tradfri.service
● ikea-tradfri.service - IKEA Tradfri COAP-adapter
Loaded: loaded (/lib/systemd/system/ikea-tradfri.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2019-02-01 17:26:53 CET; 5min ago
Main PID: 5259 (code=exited, status=1/FAILURE)
Feb 01 17:26:53 domoticz systemd[1]: ikea-tradfri.service: Failed with result 'exit-code'.
Feb 01 17:26:53 domoticz systemd[1]: ikea-tradfri.service: Service hold-off time over, scheduling restart.
Feb 01 17:26:53 domoticz systemd[1]: Stopped IKEA Tradfri COAP-adapter.
Feb 01 17:26:53 domoticz systemd[1]: ikea-tradfri.service: Start request repeated too quickly.
Feb 01 17:26:53 domoticz systemd[1]: Failed to start IKEA Tradfri COAP-adapter.
Feb 01 17:26:53 domoticz systemd[1]: ikea-tradfri.service: Unit entered failed state.
Feb 01 17:26:53 domoticz systemd[1]: ikea-tradfri.service: Failed with result 'exit-code'.
Starting manually works
I need some more information trying to solve this, python version, running on a PI? What does the log say before "ikea-tradfri.service: Failed with result 'exit-code'"? When it fails, can you still use the app to connect to the gateway and control the lights? Is it possible that the server running the adapter looses the network connection from time to time?
I've been running the plugin for months on a Mac Mini running debian, connected by ethernet cable to the same router as the ikea gateway, and it's rock stable. The achilles heel of the adapter is loosing the connection to the gateway so the connection times out, more often than not, it will not be able to recover without stopping and restarting the adapter. I'm working on a completely new adapter that should be more robust, but it's still some time away...
Regards,
M
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Posted: Tuesday 05 February 2019 1:04
by fotogen
Hi
Kind of desperate since im stuck in one of the first steps
I could read that another user had the same problem but no solution. When running the ./configure.py i get error message that there is no module named "pytradfri". But i can clearly see that it is there when cheching pip3 list. I have been uninstalling/re-installing python and the different scripts. Do any one have any clue? Please make my day
pi@raspberrypi ~/domoticz/plugins/IKEA-Tradfri $ pip3 list
Package Version
-------------- -------
attrs 18.2.0
Automat 0.7.0
constantly 15.1.0
hyperlink 18.0.0
idna 2.8
incremental 17.5.0
pip 19.0.1
PyHamcrest 1.9.0
pytradfri 6.0.1
setuptools 39.0.1
six 1.12.0
tqdm 4.30.0
Twisted 18.9.0
zope.interface 4.6.0
pi@raspberrypi ~/domoticz/plugins/IKEA-Tradfri $ ./configure.py 192.168.1.XXX XXXXXXXXXXXXY
Traceback (most recent call last):
File "./configure.py", line 4, in <module>
from pytradfri import Gateway
ImportError: No module named pytradfri
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./configure.py", line 6, in <module>
except ModuleNotFoundError:
NameError: name 'ModuleNotFoundError' is not defined
pi@raspberrypi ~/domoticz/plugins/IKEA-Tradfri $
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Posted: Thursday 07 February 2019 12:49
by moroen
fotogen wrote: ↑Tuesday 05 February 2019 1:04
Hi
Kind of desperate since im stuck in one of the first steps
I could read that another user had the same problem but no solution. When running the ./configure.py i get error message that there is no module named "pytradfri". But i can clearly see that it is there when cheching pip3 list. I have been uninstalling/re-installing python and the different scripts. Do any one have any clue? Please make my day
Sorry for the late reply!
First of all try:
Code: Select all
$ /usr/bin/env python3 -m pip list
and see if pytradrfri is installed...
It's possible to have mixed python environments, where the python3 interpreter and the pip3 command are from different environments. The above command uses the same interpreter as the plugin and forces pip to display packages that are installed in the env of this interpreter.
If pytradfri isn't installed for this interpreter, you should fix your python setup, but as a stopgap messure:
Code: Select all
$ /usr/bin/env python3 -m pip install pytradfri
$ /usr/bin/env python3 -m pip install twisted
Regards,
M
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Posted: Sunday 17 February 2019 0:32
by bootsieke
Hi,
could anyone tell my why I can't seem to start the tradfri.tac file as a service?
manual execution using "python3 tradfri.tac " works fine and all will be connected in domoticz. But when I start the service domoticz gets disconnected from the lights. When executing the command of the service manually I get following error:
Code: Select all
# /usr/local/bin/twistd --nodaemon --rundir=/home/domoticz/plugins/IKEA-Tradfri --pidfile=/home/domoticz/plugins/IKEA-Tradfri/twistd.pid --python=/home/domoticz/plugins/IKEA-Tradfri/tradfri.tac
Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/twisted/application/app.py", line 674, in run
runApp(config)
File "/usr/local/lib/python3.5/dist-packages/twisted/scripts/twistd.py", line 25, in runApp
runner.run()
File "/usr/local/lib/python3.5/dist-packages/twisted/application/app.py", line 381, in run
self.application = self.createOrGetApplication()
File "/usr/local/lib/python3.5/dist-packages/twisted/application/app.py", line 453, in createOrGetApplication
application = getApplication(self.config, passphrase)
--- <exception caught here> ---
File "/usr/local/lib/python3.5/dist-packages/twisted/application/app.py", line 464, in getApplication
application = service.loadApplication(filename, style, passphrase)
File "/usr/local/lib/python3.5/dist-packages/twisted/application/service.py", line 416, in loadApplication
application = sob.loadValueFromFile(filename, 'application')
File "/usr/local/lib/python3.5/dist-packages/twisted/persisted/sob.py", line 177, in loadValueFromFile
eval(codeObj, d, d)
File "/home/domoticz/plugins/IKEA-Tradfri/tradfri.tac", line 23, in <module>
from ikeatradfri.devices import ikeaBatteryDevice, ikeaSocket, ikeaLight, ikeaGroup
builtins.ImportError: No module named 'ikeatradfri'
Failed to load application: No module named 'ikeatradfri'
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Posted: Sunday 17 February 2019 16:14
by moroen
bootsieke wrote: ↑Sunday 17 February 2019 0:32
Hi,
could anyone tell my why I can't seem to start the tradfri.tac file as a service?
manual execution using "python3 tradfri.tac " works fine and all will be connected in domoticz. But when I start the service domoticz gets disconnected from the lights. When executing the command of the service manually I get following error:
builtins.ImportError: No module named 'ikeatradfri'
Failed to load application: No module named 'ikeatradfri'[/code]
You should use the master branch of the plugin, the development branch is kind of broken at the moment...
[edit]
Even though the development-branch just pushed to GitHub should fix your particular problem...
Regards,
M
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Posted: Monday 18 February 2019 23:08
by bootsieke
moroen wrote: ↑Sunday 17 February 2019 16:14
bootsieke wrote: ↑Sunday 17 February 2019 0:32
Hi,
could anyone tell my why I can't seem to start the tradfri.tac file as a service?
manual execution using "python3 tradfri.tac " works fine and all will be connected in domoticz. But when I start the service domoticz gets disconnected from the lights. When executing the command of the service manually I get following error:
builtins.ImportError: No module named 'ikeatradfri'
Failed to load application: No module named 'ikeatradfri'[/code]
You should use the master branch of the plugin, the development branch is kind of broken at the moment...
[edit]
Even though the development-branch just pushed to GitHub should fix your particular problem...
Regards,
M
That works
I also changed back to the master branch to get the more stable version
Thanks a lot
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Posted: Thursday 21 February 2019 22:35
by Cyroq
A few days in ago, in the middle of the day, Domoticz stopped the connection to IKEA Tradfri. This is the current log file:
Code: Select all
2019-02-21 22:21:05.595 Status: Domoticz V4.10304 (c)2012-2018 GizMoCuz
2019-02-21 22:21:05.603 Status: Build Hash: 30480b21, Date: 2018-12-30 09:37:02
2019-02-21 22:21:05.605 Status: Startup Path: /home/pi/domoticz/
2019-02-21 22:21:05.870 Status: EventSystem: reset all events...
2019-02-21 22:21:06.243 Active notification Subsystems: kodi (1/13)
2019-02-21 22:21:06.561 Starting shared server on: :::6144
2019-02-21 22:21:06.220 Status: PluginSystem: Started, Python version '3.5.3'.
2019-02-21 22:21:06.382 Status: WebServer(HTTP) started on address: :: with port 8080
2019-02-21 22:21:06.555 Status: WebServer(SSL) started on address: :: with port 443
2019-02-21 22:21:06.559 Status: Proxymanager started.
2019-02-21 22:21:06.562 Status: TCPServer: shared server started...
2019-02-21 22:21:06.563 Status: RxQueue: queue worker started...
2019-02-21 22:21:08.702 Kodi: (Kodi) Starting thread.
2019-02-21 22:21:08.803 Kodi: Starting I/O service thread.
2019-02-21 22:21:08.563 Status: (Tradfri) Started.
2019-02-21 22:21:08.601 Status: Kodi: Started
2019-02-21 22:21:08.601 Status: EventSystem: reset all events...
2019-02-21 22:21:08.602 Status: EventSystem: reset all device statuses...
2019-02-21 22:21:08.798 Status: Python EventSystem: Initalizing event module.
2019-02-21 22:21:08.799 Status: EventSystem: Started
2019-02-21 22:21:08.799 Status: EventSystem: Queue thread started...
2019-02-21 22:21:08.933 Status: PluginSystem: Entering work loop.
2019-02-21 22:21:09.282 (Tradfri) Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
2019-02-21 22:21:09.282 (Tradfri) Device has disconnected
2019-02-21 22:21:09.754 Kodi: (Kodi) Event: 'Off'.
2019-02-21 22:21:09.222 Status: (Tradfri) Entering work loop.
2019-02-21 22:21:09.222 Status: (Tradfri) Initialized version 1.1.0, author 'moroen'
2019-02-21 22:21:10.778 Kodi: (Kodi) Connected to '192.168.2.5:9090'.
2019-02-21 22:21:10.779 Kodi: (Kodi) Event: 'On'.
2019-02-21 22:21:29.324 (Tradfri) Connected successfully to: 127.0.0.1
2019-02-21 22:21:59.956 Kodi: Restarting I/O service thread.
2019-02-21 22:22:00.743 (Tradfri) Device has disconnected
2019-02-21 22:22:14.969 (Tradfri) Connected successfully to: 127.0.0.1
2019-02-21 22:22:25.089 (Tradfri) Device has disconnected
2019-02-21 22:22:39.967 (Tradfri) Connected successfully to: 127.0.0.1
2019-02-21 22:22:50.087 (Tradfri) Device has disconnected
2019-02-21 22:23:04.964 (Tradfri) Connected successfully to: 127.0.0.1
2019-02-21 22:23:15.084 (Tradfri) Device has disconnected
2019-02-21 22:23:29.962 (Tradfri) Connected successfully to: 127.0.0.1
2019-02-21 22:23:40.082 (Tradfri) Device has disconnected
2019-02-21 22:23:54.960 (Tradfri) Connected successfully to: 127.0.0.1
2019-02-21 22:24:05.081 (Tradfri) Device has disconnected
So the main error seems to be
Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused. I've tried rebooting both my Raspberry Pi 3 running Domoticz and the IKEA Tradfri bridge, but no luck. Since I have no idea what caused this (no power outage, no change of IP addresses etc) I don't know where to look for a solution.
For what it's worth,
python3 tradfri.tac gives me:
Code: Select all
:0: UserWarning: You do not have a working installation of the service_identity module: 'No module named 'service_identity''. Please install it from <https://pypi.python.org/pypi/service_identity> and make sure all of its dependencies are satisfied. Without the service_identity module, Twisted can perform only rudimentary TLS client hostname verification. Many valid certificate/hostname mappings may be rejected.
IKEA-tradfri COAP-adaptor version 0.8.6 started (command line)!
Couldn't listen on any:1234: [Errno 98] Address already in use.
EDIT:
And just like that I found a working solution. I reconfigured configure.py and the plugin works again.
Code: Select all
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ ./configure.py <IP_ADDRESS> <KEY>
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ sudo cp ikea-tradfri.service /etc/systemd/system
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ sudo systemctl daemon-reload
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ sudo systemctl start ikea-tradfri.service
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ sudo systemctl enable ikea-tradfri.service
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ Sudo reboot
Thanks you for this amazing piece of software that makes my life better!
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Posted: Monday 04 March 2019 22:09
by wvdweerd
I have exact the same situation as Cyroq: after several months of running the Ikea Trafri plugin without any problems, suddenly around half february it did not work anymore. In the logs I also saw these the error messages:
Code: Select all
(IKEA Tradfri) Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
(IKEA Tradfri) Device has disconnected
Note: The IKEA app was still working though, so the Ikea Gateway hub was connected and could be reached from the app.
So I updated the IKEA Tradfri plugin from 1.0.6 to 1.1.1, reconfigured with configure.py (and verified I got a new passkey) and followed the other steps like Cyroq has also listed above.
But still no luck...
With debug set to true in the plugin settings I got the following log info:
Code: Select all
2019-03-04 21:22:58.077 Status: Domoticz V4.9700 (c)2012-2018 GizMoCuz
2019-03-04 21:22:58.078 Status: Build Hash: a3a45906, Date: 2018-06-23 16:24:51
2019-03-04 21:22:58.080 Status: Startup Path: /home/pi/domoticz/
2019-03-04 21:22:58.138 Status: EventSystem: reset all events...
2019-03-04 21:22:58.139 Status: dzVents: Write file: /home/pi/domoticz/scripts/dzVents/generated_scripts/KeukendeurOpenLampAan.lua
2019-03-04 21:22:58.318 Status: PluginSystem: Started, Python version '3.5.3'.
2019-03-04 21:23:00.388 Status: Hardware Monitor: Started
2019-03-04 21:23:00.398 Status: EventSystem: reset all events...
2019-03-04 21:23:00.399 Status: EventSystem: reset all device statuses...
2019-03-04 21:23:00.562 Status: Python EventSystem: Initalizing event module.
2019-03-04 21:23:00.563 Status: EventSystem: Started
2019-03-04 21:23:00.563 Status: EventSystem: Queue thread started...
2019-03-04 21:23:00.642 Status: PluginSystem: Entering work loop.
2019-03-04 21:23:00.892 Status: OpenZWave: Starting...
2019-03-04 21:23:00.892 Status: OpenZWave: Version: 1.4-2888-g54682370-dirty
2019-03-04 21:23:01.121 Status: OpenZWave: Driver Ready
2019-03-04 21:23:18.797 Status: OpenZWave: Awake Nodes queried
2019-03-04 21:31:40.689 Status: (IKEA Tradfri) Started.
2019-03-04 21:31:40.915 Status: (IKEA Tradfri) Initialized version 1.1.1, author 'moroen'
2019-03-04 21:31:40.915 Status: (IKEA Tradfri) Entering work loop.
2019-03-04 21:33:11.268 Status: (IKEA Tradfri) Stop directive received.
2019-03-04 21:33:11.368 Status: (IKEA Tradfri) Stopping threads.
2019-03-04 21:33:11.436 Status: (IKEA Tradfri) Exiting work loop.
2019-03-04 21:33:11.438 Status: (IKEA Tradfri) Stopped.
2019-03-04 21:33:11.438 Status: (IKEA Tradfri) Started.
2019-03-04 21:33:11.665 Status: (IKEA Tradfri) Entering work loop.
2019-03-04 21:33:11.665 Status: (IKEA Tradfri) Initialized version 1.1.1, author 'moroen'
2019-03-04 21:34:56.208 (IKEA Tradfri) Processing 'onHeartbeatCallback' message
2019-03-04 21:34:56.208 (IKEA Tradfri) Calling message handler 'onHeartbeat'.
2019-03-04 21:34:56.208 (IKEA Tradfri) Not connected - nextConnect: 2
2019-03-04 21:35:01.193 (IKEA Tradfri) Pushing 'onHeartbeatCallback' on to queue
2019-03-04 21:35:01.218 (IKEA Tradfri) Processing 'onHeartbeatCallback' message
2019-03-04 21:35:01.218 (IKEA Tradfri) Calling message handler 'onHeartbeat'.
2019-03-04 21:35:01.218 (IKEA Tradfri) Not connected - nextConnect: 1
2019-03-04 21:35:01.219 (IKEA Tradfri) Pushing 'ConnectDirective' on to queue
2019-03-04 21:35:01.219 (IKEA Tradfri) Processing 'ConnectDirective' message
2019-03-04 21:35:01.219 (IKEA Tradfri) Transport set to: 'TCP/IP', 127.0.0.1:1234.
2019-03-04 21:35:01.219 PluginSystem: Starting I/O service thread.
2019-03-04 21:35:01.219 (IKEA Tradfri) Connect directive received, action initiated successfully.
2019-03-04 21:35:01.219 (IKEA Tradfri) Pushing 'onConnectCallback' on to queue
2019-03-04 21:35:01.219 (IKEA Tradfri) Pushing 'DisconnectedEvent' on to queue
2019-03-04 21:35:01.269 (IKEA Tradfri) Processing 'onConnectCallback' message
2019-03-04 21:35:01.269 (IKEA Tradfri) Calling message handler 'onConnect'.
2019-03-04 21:35:01.270 (IKEA Tradfri) Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
2019-03-04 21:35:01.270 (IKEA Tradfri) Processing 'DisconnectedEvent' message
2019-03-04 21:35:01.270 (IKEA Tradfri) Disconnect event received for '127.0.0.1:1234'.
2019-03-04 21:35:01.270 (IKEA Tradfri) Pushing 'onDisconnectCallback' on to queue
2019-03-04 21:35:01.270 (IKEA Tradfri) Processing 'onDisconnectCallback' message
2019-03-04 21:35:01.270 (IKEA Tradfri) Calling message handler 'onDisconnect'.
2019-03-04 21:35:01.270 (IKEA Tradfri) Device has disconnected
@Moroen or anybody else: do you have any suggestions what could be wrong or how I can investigate this further?
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Posted: Tuesday 05 March 2019 10:33
by moroen
wvdweerd wrote: ↑Monday 04 March 2019 22:09
I have exact the same situation as Cyroq: after several months of running the Ikea Trafri plugin without any problems, suddenly around half february it did not work anymore. In the logs I also saw these the error messages:
Code: Select all
(IKEA Tradfri) Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
(IKEA Tradfri) Device has disconnected
Note: The IKEA app was still working though, so the Ikea Gateway hub was connected and could be reached from the app.
So I updated the IKEA Tradfri plugin from 1.0.6 to 1.1.1, reconfigured with configure.py (and verified I got a new passkey) and followed the other steps like Cyroq has also listed above.
But still no luck...
With debug set to true in the plugin settings I got the following log info:
Code: Select all
2019-03-04 21:22:58.077 Status: Domoticz V4.9700 (c)2012-2018 GizMoCuz
2019-03-04 21:22:58.078 Status: Build Hash: a3a45906, Date: 2018-06-23 16:24:51
2019-03-04 21:22:58.080 Status: Startup Path: /home/pi/domoticz/
2019-03-04 21:22:58.138 Status: EventSystem: reset all events...
2019-03-04 21:22:58.139 Status: dzVents: Write file: /home/pi/domoticz/scripts/dzVents/generated_scripts/KeukendeurOpenLampAan.lua
2019-03-04 21:22:58.318 Status: PluginSystem: Started, Python version '3.5.3'.
2019-03-04 21:23:00.388 Status: Hardware Monitor: Started
2019-03-04 21:23:00.398 Status: EventSystem: reset all events...
2019-03-04 21:23:00.399 Status: EventSystem: reset all device statuses...
2019-03-04 21:23:00.562 Status: Python EventSystem: Initalizing event module.
2019-03-04 21:23:00.563 Status: EventSystem: Started
2019-03-04 21:23:00.563 Status: EventSystem: Queue thread started...
2019-03-04 21:23:00.642 Status: PluginSystem: Entering work loop.
2019-03-04 21:23:00.892 Status: OpenZWave: Starting...
2019-03-04 21:23:00.892 Status: OpenZWave: Version: 1.4-2888-g54682370-dirty
2019-03-04 21:23:01.121 Status: OpenZWave: Driver Ready
2019-03-04 21:23:18.797 Status: OpenZWave: Awake Nodes queried
2019-03-04 21:31:40.689 Status: (IKEA Tradfri) Started.
2019-03-04 21:31:40.915 Status: (IKEA Tradfri) Initialized version 1.1.1, author 'moroen'
2019-03-04 21:31:40.915 Status: (IKEA Tradfri) Entering work loop.
2019-03-04 21:33:11.268 Status: (IKEA Tradfri) Stop directive received.
2019-03-04 21:33:11.368 Status: (IKEA Tradfri) Stopping threads.
2019-03-04 21:33:11.436 Status: (IKEA Tradfri) Exiting work loop.
2019-03-04 21:33:11.438 Status: (IKEA Tradfri) Stopped.
2019-03-04 21:33:11.438 Status: (IKEA Tradfri) Started.
2019-03-04 21:33:11.665 Status: (IKEA Tradfri) Entering work loop.
2019-03-04 21:33:11.665 Status: (IKEA Tradfri) Initialized version 1.1.1, author 'moroen'
2019-03-04 21:34:56.208 (IKEA Tradfri) Processing 'onHeartbeatCallback' message
2019-03-04 21:34:56.208 (IKEA Tradfri) Calling message handler 'onHeartbeat'.
2019-03-04 21:34:56.208 (IKEA Tradfri) Not connected - nextConnect: 2
2019-03-04 21:35:01.193 (IKEA Tradfri) Pushing 'onHeartbeatCallback' on to queue
2019-03-04 21:35:01.218 (IKEA Tradfri) Processing 'onHeartbeatCallback' message
2019-03-04 21:35:01.218 (IKEA Tradfri) Calling message handler 'onHeartbeat'.
2019-03-04 21:35:01.218 (IKEA Tradfri) Not connected - nextConnect: 1
2019-03-04 21:35:01.219 (IKEA Tradfri) Pushing 'ConnectDirective' on to queue
2019-03-04 21:35:01.219 (IKEA Tradfri) Processing 'ConnectDirective' message
2019-03-04 21:35:01.219 (IKEA Tradfri) Transport set to: 'TCP/IP', 127.0.0.1:1234.
2019-03-04 21:35:01.219 PluginSystem: Starting I/O service thread.
2019-03-04 21:35:01.219 (IKEA Tradfri) Connect directive received, action initiated successfully.
2019-03-04 21:35:01.219 (IKEA Tradfri) Pushing 'onConnectCallback' on to queue
2019-03-04 21:35:01.219 (IKEA Tradfri) Pushing 'DisconnectedEvent' on to queue
2019-03-04 21:35:01.269 (IKEA Tradfri) Processing 'onConnectCallback' message
2019-03-04 21:35:01.269 (IKEA Tradfri) Calling message handler 'onConnect'.
2019-03-04 21:35:01.270 (IKEA Tradfri) Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
2019-03-04 21:35:01.270 (IKEA Tradfri) Processing 'DisconnectedEvent' message
2019-03-04 21:35:01.270 (IKEA Tradfri) Disconnect event received for '127.0.0.1:1234'.
2019-03-04 21:35:01.270 (IKEA Tradfri) Pushing 'onDisconnectCallback' on to queue
2019-03-04 21:35:01.270 (IKEA Tradfri) Processing 'onDisconnectCallback' message
2019-03-04 21:35:01.270 (IKEA Tradfri) Calling message handler 'onDisconnect'.
2019-03-04 21:35:01.270 (IKEA Tradfri) Device has disconnected
@Moroen or anybody else: do you have any suggestions what could be wrong or how I can investigate this further?
It looks like the adapter isn't running. Try running it from the command-line, to make sure that it starts and that the plugin can connect.
Regards,
M
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Posted: Friday 08 March 2019 16:58
by wvdweerd
moroen wrote: ↑Tuesday 05 March 2019 10:33
It looks like the adapter isn't running. Try running it from the command-line, to make sure that it starts and that the plugin can connect.
Regards,
M
Based on an issue someone else had, I already uninstalled and installed pytradfri.
But still the results from running the command "python3 tradfri.tac --dryrun" is an error:
Code: Select all
:0: UserWarning: You do not have a working installation of the service_identity module: 'No module named 'service_identity''. Please install it from <https://pypi.python.org/pypi/service_identity> and make sure all of its dependencies are satisfied. Without the service_identity module, Twisted can perform only rudimentary TLS client hostname verification. Many valid certificate/hostname mappings may be rejected.
IKEA-tradfri COAP-adaptor version 0.8.7 started (command line)!
Initializing gateway
Transitiontime: 10
Adding light with ID: 65540
Adding light with ID: 65538
Adding light with ID: 65542
Adding light with ID: 65543
Adding light with ID: 65544
Adding light with ID: 65537
{"status": "Ok", "result": [{"Type": "Light", "Dimmable": true, "HasWB": true, "Name": "Lamp Wouter boven", "DeviceID": 65537, "HasRGB": false}, {"Type": "Light", "Dimmable": true, "HasWB": true, "Name": "Lamp Wouter onder", "DeviceID": 65538, "HasRGB": false}, {"Type": "Light", "Dimmable": true, "HasWB": true, "Name": "Lamp Carin", "DeviceID": 65540, "HasRGB": false}, {"Type": "Light", "Dimmable": true, "HasWB": true, "Name": "Slaapkamer lamp1", "DeviceID": 65542, "HasRGB": false}, {"Type": "Light", "Dimmable": true, "HasWB": true, "Name": "Slaapkamer lamp2", "DeviceID": 65543, "HasRGB": false}, {"Type": "Light", "Dimmable": true, "HasWB": true, "Name": "Slaapkamer lamp3", "DeviceID": 65544, "HasRGB": false}], "action": "getLights"}
Announcing changed devices!
Failed to set state
Traceback (most recent call last):
File "tradfri.tac", line 580, in <module>
endpoints.serverFromString(reactor, "tcp:1234").listen(AdaptorFactory()).addErrback(error)
File "tradfri.tac", line 312, in __init__
self.setState(None, "65548", False)
File "tradfri.tac", line 547, in setState
client.transport.write(json.dumps(answer).encode(encoding='utf_8'))
AttributeError: 'NoneType' object has no attribute 'transport'
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Posted: Friday 08 March 2019 19:09
by redfirebrooks
Hi , got an error too
Code: Select all
pi@domoticz:~ $ sudo systemctl status ikea-tradfri.service
● ikea-tradfri.service - IKEA Tradfri COAP-adapter
Loaded: loaded (/etc/systemd/system/ikea-tradfri.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2019-03-08 18:43:55 CET; 20min ago
Process: 1184 ExecStart=/usr/local/bin/twistd --nodaemon --rundir=${IKEA_HOME} --pidfile=${IKEA_HOME}/twistd.p
Main PID: 1184 (code=exited, status=1/FAILURE)
mars 08 18:43:54 domoticz systemd[1]: ikea-tradfri.service: Unit entered failed state.
mars 08 18:43:54 domoticz systemd[1]: ikea-tradfri.service: Failed with result 'exit-code'.
mars 08 18:43:55 domoticz systemd[1]: ikea-tradfri.service: Service hold-off time over, scheduling restart.
mars 08 18:43:55 domoticz systemd[1]: Stopped IKEA Tradfri COAP-adapter.
mars 08 18:43:55 domoticz systemd[1]: ikea-tradfri.service: Start request repeated too quickly.
mars 08 18:43:55 domoticz systemd[1]: Failed to start IKEA Tradfri COAP-adapter.
mars 08 18:43:55 domoticz systemd[1]: ikea-tradfri.service: Unit entered failed state.
mars 08 18:43:55 domoticz systemd[1]: ikea-tradfri.service: Failed with result 'exit-code'.
But it works running manually the tradfri.tac
Again I am lost...
Running Raspberry Pi 3 Model B+
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Posted: Friday 08 March 2019 21:32
by redfirebrooks
redfirebrooks wrote: ↑Friday 08 March 2019 19:09
Hi , got an error too
Code: Select all
pi@domoticz:~ $ sudo systemctl status ikea-tradfri.service
● ikea-tradfri.service - IKEA Tradfri COAP-adapter
Loaded: loaded (/etc/systemd/system/ikea-tradfri.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2019-03-08 18:43:55 CET; 20min ago
Process: 1184 ExecStart=/usr/local/bin/twistd --nodaemon --rundir=${IKEA_HOME} --pidfile=${IKEA_HOME}/twistd.p
Main PID: 1184 (code=exited, status=1/FAILURE)
mars 08 18:43:54 domoticz systemd[1]: ikea-tradfri.service: Unit entered failed state.
mars 08 18:43:54 domoticz systemd[1]: ikea-tradfri.service: Failed with result 'exit-code'.
mars 08 18:43:55 domoticz systemd[1]: ikea-tradfri.service: Service hold-off time over, scheduling restart.
mars 08 18:43:55 domoticz systemd[1]: Stopped IKEA Tradfri COAP-adapter.
mars 08 18:43:55 domoticz systemd[1]: ikea-tradfri.service: Start request repeated too quickly.
mars 08 18:43:55 domoticz systemd[1]: Failed to start IKEA Tradfri COAP-adapter.
mars 08 18:43:55 domoticz systemd[1]: ikea-tradfri.service: Unit entered failed state.
mars 08 18:43:55 domoticz systemd[1]: ikea-tradfri.service: Failed with result 'exit-code'.
But it works running manually the tradfri.tac
Again I am lost...
Running Raspberry Pi 3 Model B+
So I tried stop start from scratch deleting my previous IKEA-Tradfri folder...
And now I am stuck here
Code: Select all
pi@domoticz:~/domoticz/plugins/IKEA-Tradfri $ ./configure.py --debug 192.168.1.250 MYKEY
Config created!
pi@domoticz:~/domoticz/plugins/IKEA-Tradfri $ python3 tradfri.tac
IKEA-tradfri COAP-adaptor version 0.8.7 started (command line)!
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Posted: Friday 08 March 2019 21:36
by redfirebrooks
redfirebrooks wrote: ↑Friday 08 March 2019 21:32
redfirebrooks wrote: ↑Friday 08 March 2019 19:09
Hi , got an error too
Code: Select all
pi@domoticz:~ $ sudo systemctl status ikea-tradfri.service
● ikea-tradfri.service - IKEA Tradfri COAP-adapter
Loaded: loaded (/etc/systemd/system/ikea-tradfri.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2019-03-08 18:43:55 CET; 20min ago
Process: 1184 ExecStart=/usr/local/bin/twistd --nodaemon --rundir=${IKEA_HOME} --pidfile=${IKEA_HOME}/twistd.p
Main PID: 1184 (code=exited, status=1/FAILURE)
mars 08 18:43:54 domoticz systemd[1]: ikea-tradfri.service: Unit entered failed state.
mars 08 18:43:54 domoticz systemd[1]: ikea-tradfri.service: Failed with result 'exit-code'.
mars 08 18:43:55 domoticz systemd[1]: ikea-tradfri.service: Service hold-off time over, scheduling restart.
mars 08 18:43:55 domoticz systemd[1]: Stopped IKEA Tradfri COAP-adapter.
mars 08 18:43:55 domoticz systemd[1]: ikea-tradfri.service: Start request repeated too quickly.
mars 08 18:43:55 domoticz systemd[1]: Failed to start IKEA Tradfri COAP-adapter.
mars 08 18:43:55 domoticz systemd[1]: ikea-tradfri.service: Unit entered failed state.
mars 08 18:43:55 domoticz systemd[1]: ikea-tradfri.service: Failed with result 'exit-code'.
But it works running manually the tradfri.tac
Again I am lost...
Running Raspberry Pi 3 Model B+
So I tried stop start from scratch deleting my previous IKEA-Tradfri folder...
And now I am stuck here
Code: Select all
pi@domoticz:~/domoticz/plugins/IKEA-Tradfri $ ./configure.py --debug 192.168.1.250 MYKEY
Config created!
pi@domoticz:~/domoticz/plugins/IKEA-Tradfri $ python3 tradfri.tac
IKEA-tradfri COAP-adaptor version 0.8.7 started (command line)!
pi@domoticz:~/domoticz/plugins/IKEA-Tradfri $ ./configure.py –-skip-config –-create-service
Error: Failed to generate ID/PSK-pair.
Check that the IP and Master Key is correct.
UPDATE
Trying different solutions found in this topic I messed completely my installation... Lost my samba share, my python scripts... Guess it is the right moment to try another domotic solution.
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Posted: Saturday 09 March 2019 10:55
by moroen
wvdweerd wrote: ↑Friday 08 March 2019 16:58
Code: Select all
:0: UserWarning: You do not have a working installation of the service_identity module: 'No module named 'service_identity''. Please install it from <https://pypi.python.org/pypi/service_identity> and make sure all of its dependencies are satisfied. Without the service_identity module, Twisted can perform only rudimentary TLS client hostname verification. Many valid certificate/hostname mappings may be rejected.
There is something wrong with your twisted-installation, it can't find the required service_identity module. Try:
Regards,
M
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Posted: Saturday 09 March 2019 10:59
by moroen
redfirebrooks wrote: ↑Friday 08 March 2019 21:36
redfirebrooks wrote: ↑Friday 08 March 2019 21:32
redfirebrooks wrote: ↑Friday 08 March 2019 19:09
Hi , got an error too
Code: Select all
pi@domoticz:~ $ sudo systemctl status ikea-tradfri.service
● ikea-tradfri.service - IKEA Tradfri COAP-adapter
Loaded: loaded (/etc/systemd/system/ikea-tradfri.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2019-03-08 18:43:55 CET; 20min ago
Process: 1184 ExecStart=/usr/local/bin/twistd --nodaemon --rundir=${IKEA_HOME} --pidfile=${IKEA_HOME}/twistd.p
Main PID: 1184 (code=exited, status=1/FAILURE)
mars 08 18:43:54 domoticz systemd[1]: ikea-tradfri.service: Unit entered failed state.
mars 08 18:43:54 domoticz systemd[1]: ikea-tradfri.service: Failed with result 'exit-code'.
mars 08 18:43:55 domoticz systemd[1]: ikea-tradfri.service: Service hold-off time over, scheduling restart.
mars 08 18:43:55 domoticz systemd[1]: Stopped IKEA Tradfri COAP-adapter.
mars 08 18:43:55 domoticz systemd[1]: ikea-tradfri.service: Start request repeated too quickly.
mars 08 18:43:55 domoticz systemd[1]: Failed to start IKEA Tradfri COAP-adapter.
mars 08 18:43:55 domoticz systemd[1]: ikea-tradfri.service: Unit entered failed state.
mars 08 18:43:55 domoticz systemd[1]: ikea-tradfri.service: Failed with result 'exit-code'.
But it works running manually the tradfri.tac
Again I am lost...
Running Raspberry Pi 3 Model B+
So I tried stop start from scratch deleting my previous IKEA-Tradfri folder...
And now I am stuck here
Code: Select all
pi@domoticz:~/domoticz/plugins/IKEA-Tradfri $ ./configure.py --debug 192.168.1.250 MYKEY
Config created!
pi@domoticz:~/domoticz/plugins/IKEA-Tradfri $ python3 tradfri.tac
IKEA-tradfri COAP-adaptor version 0.8.7 started (command line)!
pi@domoticz:~/domoticz/plugins/IKEA-Tradfri $ ./configure.py –-skip-config –-create-service
Error: Failed to generate ID/PSK-pair.
Check that the IP and Master Key is correct.
UPDATE
Trying different solutions found in this topic I messed completely my installation... Lost my samba share, my python scripts... Guess it is the right moment to try another domotic solution.
Sorry to hear your troubles. If you decide to give it another go, make sure that python3 is version 3.5.x or higher, and try:
Code: Select all
$ ./configure.py --create-service --debug 192.168.1.250 MYKEY
Regards,
M
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Posted: Sunday 10 March 2019 15:09
by wvdweerd
moroen wrote: ↑Saturday 09 March 2019 10:55
There is something wrong with your twisted-installation, it can't find the required service_identity module. Try:
Regards,
M
Thanks for you reply!
Per your suggestion I installed service_identity, and it indeed solved the error message ('UserWarning: You do not have a working installation of the service_identity module') when running
.
But I stil got the same errors in the Domoticz log ('failed to connect' and 'Device has disconnected').
Finally, after un-installing and installing twisted, learning a lot about the PI file system, trying to understand the source code for your plugin (failing miserably, although I am a developer
) my last attempt to get things working was to generate the "ikea-tradfri.service" file again with the command
Code: Select all
sudo ./configure.py --skip-config --create-service
.
I then compared the content of the new file with the backup I had made of the previously generated file.
And the difference were the "user" and "group" values. In my backup it was "pi", in the new generated file it was "root".
And now it is working again
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Posted: Sunday 10 March 2019 21:52
by moroen
wvdweerd wrote: ↑Sunday 10 March 2019 15:09
moroen wrote: ↑Saturday 09 March 2019 10:55
There is something wrong with your twisted-installation, it can't find the required service_identity module. Try:
Regards,
M
Thanks for you reply!
Per your suggestion I installed service_identity, and it indeed solved the error message ('UserWarning: You do not have a working installation of the service_identity module') when running
.
But I stil got the same errors in the Domoticz log ('failed to connect' and 'Device has disconnected').
Finally, after un-installing and installing twisted, learning a lot about the PI file system, trying to understand the source code for your plugin (failing miserably, although I am a developer
) my last attempt to get things working was to generate the "ikea-tradfri.service" file again with the command
Code: Select all
sudo ./configure.py --skip-config --create-service
.
I then compared the content of the new file with the backup I had made of the previously generated file.
And the difference were the "user" and "group" values. In my backup it was "pi", in the new generated file it was "root".
And now it is working again
Glad it worked out! The challenge you've run up against is, in my opinion, one of the negatives of python, it can quite easily become a jumbled mess of python versions, libraries, dependencies and permission-challenges. And I say that as a developer (albeit only as a hobby) that absolutely loves programming in python. It should be possible to install the plugin and all the dependencies using a non-root user, but I get the impression that this is more difficult on the PI/rasbian than on other distros.
My domoticz system is an old Mac Mini running debian, I gave up on using a PI for domoticz quite a while ago, it was just too high maintenance. When I finally had it working, it was just a matter of time before the SD-card gave out, giving all sorts of strange behaviours and errors. After switching to debian on the mac, the only time my domoticz system fails, is when I manage to f**k it up myself...
But I digress, I'm constantly working to improve the setup and stability of the plugin, so any feedback regarding troubles setting it up is most welcome!
Reagards,
M
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Posted: Monday 11 March 2019 0:42
by moroen
configure.py appears to be somewhat of a sticking point. A new version has been commited to the master branch, with a more sensible command line and hopefully better error handling with somewhat more helpful descriptions when something fails.
Please refer to the readme for updated usage.
Regards,
M
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Posted: Saturday 16 March 2019 17:35
by wvdweerd
moroen wrote: ↑Monday 11 March 2019 0:42
configure.py appears to be somewhat of a sticking point. A new version has been commited to the master branch, with a more sensible command line and hopefully better error handling with somewhat more helpful descriptions when something fails.
Please refer to the readme for updated usage.
Regards,
M
Thanks, seems like a good improvement