[REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Moderator: leecollings
-
- Posts: 7
- Joined: Friday 17 November 2017 16:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Coap client v.0.4
Gateway Firmware just updated v.1.2.42
I run domoticz v3.8153
BTW, when i do
sudo service Ikea-tradfri statut
i get this error
ikea-tradfri.service - IKEA Tradfri COAP-adapter
Loaded: loaded (/lib/systemd/system/ikea-tradfri.service; enabled; vendor pre
Active: failed (Result: exit-code) since Fri 2017-11-17 18:45:45 CET; 21s ago
Process: 19395 ExecStart=/usr/local/bin/twistd --nodaemon --rundir=${IKEA_HOME
Main PID: 19395 (code=exited, status=217/USER)
nov. 17 18:45:45 raspberrypi systemd[1]: ikea-tradfri.service: Unit entered fail
nov. 17 18:45:45 raspberrypi systemd[1]: ikea-tradfri.service: Failed with resul
nov. 17 18:45:45 raspberrypi systemd[1]: ikea-tradfri.service: Service hold-off
nov. 17 18:45:45 raspberrypi systemd[1]: Stopped IKEA Tradfri COAP-adapter.
nov. 17 18:45:45 raspberrypi systemd[1]: ikea-tradfri.service: Start request rep
nov. 17 18:45:45 raspberrypi systemd[1]: Failed to start IKEA Tradfri COAP-adapt
nov. 17 18:45:45 raspberrypi systemd[1]: ikea-tradfri.service: Unit entered fail
nov. 17 18:45:45 raspberrypi systemd[1]: ikea-tradfri.service: Failed with resul
but when i do
pi@raspberrypi:~ $ cd /home/pi/domoticz/plugins/IKEA-Tradfri
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ /usr/local/bin/twistd -n -y tradfri.tac
I get
Removing stale pidfile /home/pi/domoticz/plugins/IKEA-Tradfri/twistd.pid
2017-11-17T21:26:47+0100 [-] Removing stale pidfile /home/pi/domoticz/plugins/IKEA-Tradfri/twistd.pid
2017-11-17T21:26:47+0100 [-] Loading tradfri.tac...
2017-11-17T21:26:49+0100 [-] Loaded.
2017-11-17T21:26:49+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] twistd 17.9.0 (/usr/bin/python3 3.5.3) starting up.
2017-11-17T21:26:49+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] reactor class: twisted.internet.epollreactor.EPollReactor.
2017-11-17T21:26:49+0100 [-] AdaptorFactory starting on 1234
2017-11-17T21:26:49+0100 [builtins.AdaptorFactory#info] Starting factory <AdaptorFactory object at 0xb6057930>
^C2017-11-17T21:27:05+0100 [-] Received SIGINT, shutting down.
2017-11-17T21:27:05+0100 [-] (TCP Port 1234 Closed)
2017-11-17T21:27:05+0100 [builtins.AdaptorFactory#info] Stopping factory <AdaptorFactory object at 0xb6057930>
2017-11-17T21:27:05+0100 [-] Main loop terminated.
2017-11-17T21:27:05+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] Server Shut Down.
I did change the pathin the ikea-tradfri.serice by changing /opt/... by /home/pi/...
Gateway Firmware just updated v.1.2.42
I run domoticz v3.8153
BTW, when i do
sudo service Ikea-tradfri statut
i get this error
ikea-tradfri.service - IKEA Tradfri COAP-adapter
Loaded: loaded (/lib/systemd/system/ikea-tradfri.service; enabled; vendor pre
Active: failed (Result: exit-code) since Fri 2017-11-17 18:45:45 CET; 21s ago
Process: 19395 ExecStart=/usr/local/bin/twistd --nodaemon --rundir=${IKEA_HOME
Main PID: 19395 (code=exited, status=217/USER)
nov. 17 18:45:45 raspberrypi systemd[1]: ikea-tradfri.service: Unit entered fail
nov. 17 18:45:45 raspberrypi systemd[1]: ikea-tradfri.service: Failed with resul
nov. 17 18:45:45 raspberrypi systemd[1]: ikea-tradfri.service: Service hold-off
nov. 17 18:45:45 raspberrypi systemd[1]: Stopped IKEA Tradfri COAP-adapter.
nov. 17 18:45:45 raspberrypi systemd[1]: ikea-tradfri.service: Start request rep
nov. 17 18:45:45 raspberrypi systemd[1]: Failed to start IKEA Tradfri COAP-adapt
nov. 17 18:45:45 raspberrypi systemd[1]: ikea-tradfri.service: Unit entered fail
nov. 17 18:45:45 raspberrypi systemd[1]: ikea-tradfri.service: Failed with resul
but when i do
pi@raspberrypi:~ $ cd /home/pi/domoticz/plugins/IKEA-Tradfri
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ /usr/local/bin/twistd -n -y tradfri.tac
I get
Removing stale pidfile /home/pi/domoticz/plugins/IKEA-Tradfri/twistd.pid
2017-11-17T21:26:47+0100 [-] Removing stale pidfile /home/pi/domoticz/plugins/IKEA-Tradfri/twistd.pid
2017-11-17T21:26:47+0100 [-] Loading tradfri.tac...
2017-11-17T21:26:49+0100 [-] Loaded.
2017-11-17T21:26:49+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] twistd 17.9.0 (/usr/bin/python3 3.5.3) starting up.
2017-11-17T21:26:49+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] reactor class: twisted.internet.epollreactor.EPollReactor.
2017-11-17T21:26:49+0100 [-] AdaptorFactory starting on 1234
2017-11-17T21:26:49+0100 [builtins.AdaptorFactory#info] Starting factory <AdaptorFactory object at 0xb6057930>
^C2017-11-17T21:27:05+0100 [-] Received SIGINT, shutting down.
2017-11-17T21:27:05+0100 [-] (TCP Port 1234 Closed)
2017-11-17T21:27:05+0100 [builtins.AdaptorFactory#info] Stopping factory <AdaptorFactory object at 0xb6057930>
2017-11-17T21:27:05+0100 [-] Main loop terminated.
2017-11-17T21:27:05+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] Server Shut Down.
I did change the pathin the ikea-tradfri.serice by changing /opt/... by /home/pi/...
-
- Posts: 408
- Joined: Sunday 15 January 2017 11:06
- Target OS: Linux
- Domoticz version: beta
- Location: Norway
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Is there a stale .pid file in the plugin-directory? If so, delete it before trying system again...Yossarian wrote: ↑Friday 17 November 2017 21:29 Coap client v.0.4
Gateway Firmware just updated v.1.2.42
I run domoticz v3.8153
BTW, when i do
sudo service Ikea-tradfri statut
i get this error
ikea-tradfri.service - IKEA Tradfri COAP-adapter
Loaded: loaded (/lib/systemd/system/ikea-tradfri.service; enabled; vendor pre
Active: failed (Result: exit-code) since Fri 2017-11-17 18:45:45 CET; 21s ago
Process: 19395 ExecStart=/usr/local/bin/twistd --nodaemon --rundir=${IKEA_HOME
Main PID: 19395 (code=exited, status=217/USER)
nov. 17 18:45:45 raspberrypi systemd[1]: ikea-tradfri.service: Unit entered fail
nov. 17 18:45:45 raspberrypi systemd[1]: ikea-tradfri.service: Failed with resul
nov. 17 18:45:45 raspberrypi systemd[1]: ikea-tradfri.service: Service hold-off
nov. 17 18:45:45 raspberrypi systemd[1]: Stopped IKEA Tradfri COAP-adapter.
nov. 17 18:45:45 raspberrypi systemd[1]: ikea-tradfri.service: Start request rep
nov. 17 18:45:45 raspberrypi systemd[1]: Failed to start IKEA Tradfri COAP-adapt
nov. 17 18:45:45 raspberrypi systemd[1]: ikea-tradfri.service: Unit entered fail
nov. 17 18:45:45 raspberrypi systemd[1]: ikea-tradfri.service: Failed with resul
but when i do
pi@raspberrypi:~ $ cd /home/pi/domoticz/plugins/IKEA-Tradfri
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ /usr/local/bin/twistd -n -y tradfri.tac
I get
Removing stale pidfile /home/pi/domoticz/plugins/IKEA-Tradfri/twistd.pid
2017-11-17T21:26:47+0100 [-] Removing stale pidfile /home/pi/domoticz/plugins/IKEA-Tradfri/twistd.pid
2017-11-17T21:26:47+0100 [-] Loading tradfri.tac...
2017-11-17T21:26:49+0100 [-] Loaded.
2017-11-17T21:26:49+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] twistd 17.9.0 (/usr/bin/python3 3.5.3) starting up.
2017-11-17T21:26:49+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] reactor class: twisted.internet.epollreactor.EPollReactor.
2017-11-17T21:26:49+0100 [-] AdaptorFactory starting on 1234
2017-11-17T21:26:49+0100 [builtins.AdaptorFactory#info] Starting factory <AdaptorFactory object at 0xb6057930>
^C2017-11-17T21:27:05+0100 [-] Received SIGINT, shutting down.
2017-11-17T21:27:05+0100 [-] (TCP Port 1234 Closed)
2017-11-17T21:27:05+0100 [builtins.AdaptorFactory#info] Stopping factory <AdaptorFactory object at 0xb6057930>
2017-11-17T21:27:05+0100 [-] Main loop terminated.
2017-11-17T21:27:05+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] Server Shut Down.
I did change the pathin the ikea-tradfri.serice by changing /opt/... by /home/pi/...
You might get more information if you run:
Code: Select all
$ sudo journalctl -f -u ikea-tradfri
Regards,
M
-
- Posts: 7
- Joined: Friday 17 November 2017 16:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Hi
I got my PSK while using the three port together instead one by one
coap-client -m post -u "Client_identity" -k "xxxxxxxxxxx" -e '{"9090":"Ikea"}' "coaps://192.168.1.95:5684/15011/9063"
Buuuuut, now i've got in domoticz log
2017-11-19 16:55:34.562 PluginSystem: Starting I/O service thread.
2017-11-19 16:55:34.562 (Ikea) Connect directive received, action initiated successfully.
2017-11-19 16:55:34.613 (Ikea) Calling message handler 'onConnect'.
2017-11-19 16:55:34.613 (Ikea) Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
2017-11-19 16:55:36.520 (Ikea) Calling message handler 'onHeartbeat'.
2017-11-19 16:55:36.520 (Ikea) Not connected - nextConnect: 3
2017-11-19 16:55:38.526 (Ikea) Calling message handler 'onHeartbeat'.
2017-11-19 16:55:38.527 (Ikea) Not connected - nextConnect: 2
2017-11-19 16:55:40.533 (Ikea) Calling message handler 'onHeartbeat'.
2017-11-19 16:55:40.534 (Ikea) Not connected - nextConnect: 1
2017-11-19 16:55:40.534 (Ikea) Transport set to: 'TCP/IP', 127.0.0.1:1234.
No .pid filein IKEA-Tradfri folder
When i type
It returns
sudo journalctl -f -u ikea-tradfri
-- Logs begin at Thu 2016-11-03 18:16:44 CET. --
nov. 19 16:48:14 raspberrypi systemd[31591]: ikea-tradfri.service: Failed at step USER spawning /usr/local/bin/twistd: No such process
nov. 19 16:48:14 raspberrypi systemd[1]: ikea-tradfri.service: Main process exited, code=exited, status=217/USER
nov. 19 16:48:14 raspberrypi systemd[1]: ikea-tradfri.service: Unit entered failed state.
nov. 19 16:48:14 raspberrypi systemd[1]: ikea-tradfri.service: Failed with result 'exit-code'.
nov. 19 16:48:14 raspberrypi systemd[1]: ikea-tradfri.service: Service hold-off time over, scheduling restart.
nov. 19 16:48:14 raspberrypi systemd[1]: Stopped IKEA Tradfri COAP-adapter.
nov. 19 16:48:14 raspberrypi systemd[1]: ikea-tradfri.service: Start request repeated too quickly.
nov. 19 16:48:14 raspberrypi systemd[1]: Failed to start IKEA Tradfri COAP-adapter.
nov. 19 16:48:14 raspberrypi systemd[1]: ikea-tradfri.service: Unit entered failed state.
nov. 19 16:48:14 raspberrypi systemd[1]: ikea-tradfri.service: Failed with result 'exit-code'.
wich is weird as i have twistd already installed
I got my PSK while using the three port together instead one by one
coap-client -m post -u "Client_identity" -k "xxxxxxxxxxx" -e '{"9090":"Ikea"}' "coaps://192.168.1.95:5684/15011/9063"
Buuuuut, now i've got in domoticz log
2017-11-19 16:55:34.562 PluginSystem: Starting I/O service thread.
2017-11-19 16:55:34.562 (Ikea) Connect directive received, action initiated successfully.
2017-11-19 16:55:34.613 (Ikea) Calling message handler 'onConnect'.
2017-11-19 16:55:34.613 (Ikea) Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
2017-11-19 16:55:36.520 (Ikea) Calling message handler 'onHeartbeat'.
2017-11-19 16:55:36.520 (Ikea) Not connected - nextConnect: 3
2017-11-19 16:55:38.526 (Ikea) Calling message handler 'onHeartbeat'.
2017-11-19 16:55:38.527 (Ikea) Not connected - nextConnect: 2
2017-11-19 16:55:40.533 (Ikea) Calling message handler 'onHeartbeat'.
2017-11-19 16:55:40.534 (Ikea) Not connected - nextConnect: 1
2017-11-19 16:55:40.534 (Ikea) Transport set to: 'TCP/IP', 127.0.0.1:1234.
No .pid filein IKEA-Tradfri folder
When i type
Code: Select all
$ sudo journalctl -f -u ikea-tradfri
sudo journalctl -f -u ikea-tradfri
-- Logs begin at Thu 2016-11-03 18:16:44 CET. --
nov. 19 16:48:14 raspberrypi systemd[31591]: ikea-tradfri.service: Failed at step USER spawning /usr/local/bin/twistd: No such process
nov. 19 16:48:14 raspberrypi systemd[1]: ikea-tradfri.service: Main process exited, code=exited, status=217/USER
nov. 19 16:48:14 raspberrypi systemd[1]: ikea-tradfri.service: Unit entered failed state.
nov. 19 16:48:14 raspberrypi systemd[1]: ikea-tradfri.service: Failed with result 'exit-code'.
nov. 19 16:48:14 raspberrypi systemd[1]: ikea-tradfri.service: Service hold-off time over, scheduling restart.
nov. 19 16:48:14 raspberrypi systemd[1]: Stopped IKEA Tradfri COAP-adapter.
nov. 19 16:48:14 raspberrypi systemd[1]: ikea-tradfri.service: Start request repeated too quickly.
nov. 19 16:48:14 raspberrypi systemd[1]: Failed to start IKEA Tradfri COAP-adapter.
nov. 19 16:48:14 raspberrypi systemd[1]: ikea-tradfri.service: Unit entered failed state.
nov. 19 16:48:14 raspberrypi systemd[1]: ikea-tradfri.service: Failed with result 'exit-code'.
wich is weird as i have twistd already installed
-
- Posts: 7
- Joined: Friday 17 November 2017 16:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
After restart
2017-11-19 17:19:01.709 (Ikea) Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
then when i type
it shows
2017-11-19 17:19:07.635 PluginSystem: Starting I/O service thread.
2017-11-19 17:19:07.686 (Ikea) Connected successfully to: 192.168.1.95
2017-11-19 17:19:07.688 (Ikea) Received: b'{"version": "0.4", "status": "Ok", "action": "clientConnect"}'
2017-11-19 17:19:18.087 (Ikea) Received: b'{"error": "Connection timed out", "status": "Failed", "action": "setConfig"}'
2017-11-19 17:19:18.092 (Ikea) Command setConfig failed with error: Connection timed out.
2017-11-19 17:19:18.092 (Ikea) {'action': 'setConfig', 'status': 'Failed', 'error': 'Connection timed out'}
while i see in putty
2017-11-19T17:55:22+0100 [-] Loading tradfri.tac...
2017-11-19T17:55:25+0100 [-] Loaded.
2017-11-19T17:55:25+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] twistd 17.9.0 (/usr/bin/python3 3.5.3) starting up.
2017-11-19T17:55:25+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] reactor class: twisted.internet.epollreactor.EPollReactor.
2017-11-19T17:55:25+0100 [-] AdaptorFactory starting on 1234
2017-11-19T17:55:25+0100 [builtins.AdaptorFactory#info] Starting factory <AdaptorFactory object at 0xb6040910>
2017-11-19T17:56:21+0100 [stdout#info] Connected from IPv4Address(TCP, '127.0.0.1', 41152)
2017-11-19T17:56:57+0100 [-] Received SIGINT, shutting down.
2017-11-19T17:56:57+0100 [-] (TCP Port 1234 Closed)
2017-11-19T17:56:57+0100 [builtins.AdaptorFactory#info] Stopping factory <AdaptorFactory object at 0xb6040910>
2017-11-19T17:56:57+0100 [stdout#info] Disconnected
2017-11-19T17:56:57+0100 [-] Main loop terminated.
2017-11-19T17:56:57+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] Server Shut Down.
So,from what I understand (I don't know python at all ... and maybe I'm totally wrong ), I've got 2 problems :
1: my IKEA-Tradfri.service seems unable to call directly the tradfri.tac --> do I have to change Something in the IKEA-Tradfri.service file? BTW, does the User/group have to match the IKEA-Tradrfi.service folder or the /user/bin/local/twistd folder?
2: when i can call it using /usr/local/bin/twistd -n -y tradfri.tac, it can connect to the Gateway but the connection is lost because TCP port 1234 is closed. I've tried port forwarding but unsuccessfully
2017-11-19 17:19:01.709 (Ikea) Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
then when i type
Code: Select all
pi@raspberrypi:~ $ cd /home/pi/domoticz/plugins/IKEA-Tradfri
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ /usr/local/bin/twistd -n -y tradfri.tac
2017-11-19 17:19:07.635 PluginSystem: Starting I/O service thread.
2017-11-19 17:19:07.686 (Ikea) Connected successfully to: 192.168.1.95
2017-11-19 17:19:07.688 (Ikea) Received: b'{"version": "0.4", "status": "Ok", "action": "clientConnect"}'
2017-11-19 17:19:18.087 (Ikea) Received: b'{"error": "Connection timed out", "status": "Failed", "action": "setConfig"}'
2017-11-19 17:19:18.092 (Ikea) Command setConfig failed with error: Connection timed out.
2017-11-19 17:19:18.092 (Ikea) {'action': 'setConfig', 'status': 'Failed', 'error': 'Connection timed out'}
while i see in putty
2017-11-19T17:55:22+0100 [-] Loading tradfri.tac...
2017-11-19T17:55:25+0100 [-] Loaded.
2017-11-19T17:55:25+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] twistd 17.9.0 (/usr/bin/python3 3.5.3) starting up.
2017-11-19T17:55:25+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] reactor class: twisted.internet.epollreactor.EPollReactor.
2017-11-19T17:55:25+0100 [-] AdaptorFactory starting on 1234
2017-11-19T17:55:25+0100 [builtins.AdaptorFactory#info] Starting factory <AdaptorFactory object at 0xb6040910>
2017-11-19T17:56:21+0100 [stdout#info] Connected from IPv4Address(TCP, '127.0.0.1', 41152)
2017-11-19T17:56:57+0100 [-] Received SIGINT, shutting down.
2017-11-19T17:56:57+0100 [-] (TCP Port 1234 Closed)
2017-11-19T17:56:57+0100 [builtins.AdaptorFactory#info] Stopping factory <AdaptorFactory object at 0xb6040910>
2017-11-19T17:56:57+0100 [stdout#info] Disconnected
2017-11-19T17:56:57+0100 [-] Main loop terminated.
2017-11-19T17:56:57+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] Server Shut Down.
So,from what I understand (I don't know python at all ... and maybe I'm totally wrong ), I've got 2 problems :
1: my IKEA-Tradfri.service seems unable to call directly the tradfri.tac --> do I have to change Something in the IKEA-Tradfri.service file? BTW, does the User/group have to match the IKEA-Tradrfi.service folder or the /user/bin/local/twistd folder?
2: when i can call it using /usr/local/bin/twistd -n -y tradfri.tac, it can connect to the Gateway but the connection is lost because TCP port 1234 is closed. I've tried port forwarding but unsuccessfully
-
- Posts: 408
- Joined: Sunday 15 January 2017 11:06
- Target OS: Linux
- Domoticz version: beta
- Location: Norway
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
The first step is to get the adaptor and domoticz to work while running the adaptor from the command-line, and when you have successfully gotten the plugin to work from the command-line, try using systemd...Yossarian wrote: ↑Sunday 19 November 2017 17:22 So,from what I understand (I don't know python at all ... and maybe I'm totally wrong ), I've got 2 problems :
1: my IKEA-Tradfri.service seems unable to call directly the tradfri.tac --> do I have to change Something in the IKEA-Tradfri.service file? BTW, does the User/group have to match the IKEA-Tradrfi.service folder or the /user/bin/local/twistd folder?
2: when i can call it using /usr/local/bin/twistd -n -y tradfri.tac, it can connect to the Gateway but the connection is lost because TCP port 1234 is closed. I've tried port forwarding but unsuccessfully
I notice a couple of things from your log:
1. 2017-11-19 17:19:07.688 (Ikea) Received: b'{"version": "0.4", "status": "Ok", "action": "clientConnect"}'
2. 2017-11-19 17:19:18.087 (Ikea) Received: b'{"error": "Connection timed out", "status": "Failed", "action": "setConfig"}'
1. indicates that domoticz is able to connect to the adapter, and
2. the adapter is unable to connect to the ikea-gateway (the second line), and is correctly returning this error to domoticz
And this line:
2017-11-19T17:56:57+0100 [-] Received SIGINT, shutting down.
That shouldn't happen unless you close the adapter using ctrl-c?
Regards,
M
-
- Posts: 7
- Joined: Friday 17 November 2017 16:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
I do close the adapter using ctrl+C because nothing happens.should I wait longer?
How can I bring you more precision?
Regards
(BTW : thanks alot for your time and help)
So is the problem comming from my router? my Gateway ?2. the adapter is unable to connect to the ikea-gateway (the second line), and is correctly returning this error to domoticz
How can I bring you more precision?
Regards
(BTW : thanks alot for your time and help)
-
- Posts: 7
- Joined: Friday 17 November 2017 16:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
UPDATE :Finally got it!!!
I didn't have the right user/group set in the Ikea-tradfri.service. I tought it had to match /home/pi/domoticz/plugins/IKEA-Trafri folderbut it had to match the /lib/systemd/system/ folder
When nothing works, start again from the beginning...
I did the setup again and now it works. I guess I must have missed some sudo command ...
So I can switch on/off lights now only if i do :
Note that I have to sudo to make it works
Otherwise i get
When i close putty, nothing works anymore.
My ikea-tradfri.service status shows that it is running fine ans is in the lib/systemcl/system folder
Any suggestions?
I didn't have the right user/group set in the Ikea-tradfri.service. I tought it had to match /home/pi/domoticz/plugins/IKEA-Trafri folderbut it had to match the /lib/systemd/system/ folder
When nothing works, start again from the beginning...
I did the setup again and now it works. I guess I must have missed some sudo command ...
So I can switch on/off lights now only if i do :
Code: Select all
pi@raspberrypi:~ $ cd /home/pi/domoticz/plugins/IKEA-Tradfri
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ sudo python3 tradfri.tac
Otherwise i get
Code: Select all
pi@raspberrypi:~ $ cd /home/pi/domoticz/plugins/IKEA-Tradfri
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ python3 tradfri.tac
Traceback (most recent call last):
File "tradfri.tac", line 14, in <module>
from pytradfri.api.libcoap_api import APIFactory
ImportError: cannot import name 'APIFactory'
My ikea-tradfri.service status shows that it is running fine ans is in the lib/systemcl/system folder
Any suggestions?
-
- Posts: 408
- Joined: Sunday 15 January 2017 11:06
- Target OS: Linux
- Domoticz version: beta
- Location: Norway
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
It appears to be something slightly odd with your python installation. Modules installed with sudo pip3... should (as far as I know) be available to non-root users as well... The error when trying to run pytradfri.tac as a non-root user suggests that the pytradfri-module isn't available to a regular user?Yossarian wrote: ↑Sunday 19 November 2017 22:52 UPDATE :Finally got it!!!
I didn't have the right user/group set in the Ikea-tradfri.service. I tought it had to match /home/pi/domoticz/plugins/IKEA-Trafri folderbut it had to match the /lib/systemd/system/ folder
When nothing works, start again from the beginning...
I did the setup again and now it works. I guess I must have missed some sudo command ...
So I can switch on/off lights now only if i do :
Note that I have to sudo to make it worksCode: Select all
pi@raspberrypi:~ $ cd /home/pi/domoticz/plugins/IKEA-Tradfri pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ sudo python3 tradfri.tac
Otherwise i getWhen i close putty, nothing works anymore.Code: Select all
pi@raspberrypi:~ $ cd /home/pi/domoticz/plugins/IKEA-Tradfri pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ python3 tradfri.tac Traceback (most recent call last): File "tradfri.tac", line 14, in <module> from pytradfri.api.libcoap_api import APIFactory ImportError: cannot import name 'APIFactory'
My ikea-tradfri.service status shows that it is running fine ans is in the lib/systemcl/system folder
Any suggestions?
Anyway, as long as the adapter runs as root, the following ikea-tradfri.service file should work:
Code: Select all
[Unit]
Description=IKEA Tradfri COAP-adapter
[Service]
Type=simple
Environment=IKEA_HOME=/opt/domoticz/plugins/IKEA-Tradfri
ExecStart=/usr/local/bin/twistd --nodaemon \
--rundir=${IKEA_HOME} \
--pidfile=${IKEA_HOME}/twistd.pid \
--python=${IKEA_HOME}/tradfri.tac
User=root
Group=root
Restart=always
[Install]
WantedBy=multi-user.target
Regards,
M
-
- Posts: 7
- Joined: Friday 17 November 2017 16:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
I did. Don't know what's wrong but in the end I can make it work.provided that you substitute IKEA_HOME for the real path to the plugin...
Anyway, thank you for your help and the great job you did with this plugin
Best regards
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Hello,
I've been trying to get the plugin to work, but I was having trouble with the PSK from the Pytradfri at first. I fixed this by manually adding the Gateway Identity and PSK on two places in "libcoap_api.py', but now I'm getting the following error when trying to use tradfri.tac:
Initializing gateway
Unhandled Error
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.5/site-packages/twisted/python/log.py", line 103, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/home/pi/.local/lib/python3.5/site-packages/twisted/python/log.py", line 86, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/home/pi/.local/lib/python3.5/site-packages/twisted/python/context.py", line 122, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/home/pi/.local/lib/python3.5/site-packages/twisted/python/context.py", line 85, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "/home/pi/.local/lib/python3.5/site-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
why = selectable.doRead()
File "/home/pi/.local/lib/python3.5/site-packages/twisted/internet/tcp.py", line 205, in doRead
return self._dataReceived(data)
File "/home/pi/.local/lib/python3.5/site-packages/twisted/internet/tcp.py", line 211, in _dataReceived
rval = self.protocol.dataReceived(data)
File "tradfri.tac", line 76, in dataReceived
self.factory.initGateway(self, command)
File "tradfri.tac", line 275, in initGateway
self.devices = self.api(self.api(self.gateway.get_devices()))
File "/usr/local/lib/python3.5/dist-packages/pytradfri-4.0.3-py3.5.egg/pytradfri/api/libcoap_api.py", line 98, in request
File "/usr/local/lib/python3.5/dist-packages/pytradfri-4.0.3-py3.5.egg/pytradfri/api/libcoap_api.py", line 82, in _execute
Do you know how I could fix the problem?
I've been trying to get the plugin to work, but I was having trouble with the PSK from the Pytradfri at first. I fixed this by manually adding the Gateway Identity and PSK on two places in "libcoap_api.py', but now I'm getting the following error when trying to use tradfri.tac:
Initializing gateway
Unhandled Error
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.5/site-packages/twisted/python/log.py", line 103, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/home/pi/.local/lib/python3.5/site-packages/twisted/python/log.py", line 86, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/home/pi/.local/lib/python3.5/site-packages/twisted/python/context.py", line 122, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/home/pi/.local/lib/python3.5/site-packages/twisted/python/context.py", line 85, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "/home/pi/.local/lib/python3.5/site-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
why = selectable.doRead()
File "/home/pi/.local/lib/python3.5/site-packages/twisted/internet/tcp.py", line 205, in doRead
return self._dataReceived(data)
File "/home/pi/.local/lib/python3.5/site-packages/twisted/internet/tcp.py", line 211, in _dataReceived
rval = self.protocol.dataReceived(data)
File "tradfri.tac", line 76, in dataReceived
self.factory.initGateway(self, command)
File "tradfri.tac", line 275, in initGateway
self.devices = self.api(self.api(self.gateway.get_devices()))
File "/usr/local/lib/python3.5/dist-packages/pytradfri-4.0.3-py3.5.egg/pytradfri/api/libcoap_api.py", line 98, in request
File "/usr/local/lib/python3.5/dist-packages/pytradfri-4.0.3-py3.5.egg/pytradfri/api/libcoap_api.py", line 82, in _execute
Do you know how I could fix the problem?
-
- Posts: 408
- Joined: Sunday 15 January 2017 11:06
- Target OS: Linux
- Domoticz version: beta
- Location: Norway
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
If you have a PSK and identity from pytradfri that works, I would recommend to input them into the plugin. The default IDENT from pytradfri is pytradfri, combined with the PSK from the text file...Siopaos wrote: ↑Wednesday 22 November 2017 0:12 Hello,
I've been trying to get the plugin to work, but I was having trouble with the PSK from the Pytradfri at first. I fixed this by manually adding the Gateway Identity and PSK on two places in "libcoap_api.py', but now I'm getting the following error when trying to use tradfri.tac:
Do you know how I could fix the problem?
Regards,
M
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
I have added the PSK and identity in the plugin in domoticz as well as in the gateway_psk.txt file in the pytradfri folder, but it doesn't seem to work:
IKEA-tradfri COAP-adaptor version 0.5 started (command line)!
Connected from IPv4Address(TCP, '127.0.0.1', 38238)
Data received: b'{"groups": "False", "action": "setConfig", "identity": "MYIDENTITYWASHERE", "pollinterval": "30", "psk": "MYPSKWASHERE", "observe": "False", "gateway": "192.168.1.34"}'
then the error as above
It still seems to be going wrong somehow..
-
- Posts: 408
- Joined: Sunday 15 January 2017 11:06
- Target OS: Linux
- Domoticz version: beta
- Location: Norway
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
just need to ask to be sure: You have reverted the changes you did in "libcoap_api.py'? What's your OS?Siopaos wrote: ↑Wednesday 22 November 2017 9:23I have added the PSK and identity in the plugin in domoticz as well as in the gateway_psk.txt file in the pytradfri folder, but it doesn't seem to work:
IKEA-tradfri COAP-adaptor version 0.5 started (command line)!
Connected from IPv4Address(TCP, '127.0.0.1', 38238)
Data received: b'{"groups": "False", "action": "setConfig", "identity": "MYIDENTITYWASHERE", "pollinterval": "30", "psk": "MYPSKWASHERE", "observe": "False", "gateway": "192.168.1.34"}'
then the error as above
It still seems to be going wrong somehow..
Regards,
M
-
- Posts: 4
- Joined: Wednesday 21 December 2016 9:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
moroen wrote: ↑Monday 20 November 2017 19:30It appears to be something slightly odd with your python installation. Modules installed with sudo pip3... should (as far as I know) be available to non-root users as well... The error when trying to run pytradfri.tac as a non-root user suggests that the pytradfri-module isn't available to a regular user?Yossarian wrote: ↑Sunday 19 November 2017 22:52 UPDATE :Finally got it!!!
I didn't have the right user/group set in the Ikea-tradfri.service. I tought it had to match /home/pi/domoticz/plugins/IKEA-Trafri folderbut it had to match the /lib/systemd/system/ folder
When nothing works, start again from the beginning...
I did the setup again and now it works. I guess I must have missed some sudo command ...
So I can switch on/off lights now only if i do :
Note that I have to sudo to make it worksCode: Select all
pi@raspberrypi:~ $ cd /home/pi/domoticz/plugins/IKEA-Tradfri pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ sudo python3 tradfri.tac
Otherwise i getWhen i close putty, nothing works anymore.Code: Select all
pi@raspberrypi:~ $ cd /home/pi/domoticz/plugins/IKEA-Tradfri pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ python3 tradfri.tac Traceback (most recent call last): File "tradfri.tac", line 14, in <module> from pytradfri.api.libcoap_api import APIFactory ImportError: cannot import name 'APIFactory'
My ikea-tradfri.service status shows that it is running fine ans is in the lib/systemcl/system folder
Any suggestions?
Anyway, as long as the adapter runs as root, the following ikea-tradfri.service file should work:provided that you substitute IKEA_HOME for the real path to the plugin...Code: Select all
[Unit] Description=IKEA Tradfri COAP-adapter [Service] Type=simple Environment=IKEA_HOME=/opt/domoticz/plugins/IKEA-Tradfri ExecStart=/usr/local/bin/twistd --nodaemon \ --rundir=${IKEA_HOME} \ --pidfile=${IKEA_HOME}/twistd.pid \ --python=${IKEA_HOME}/tradfri.tac User=root Group=root Restart=always [Install] WantedBy=multi-user.target
Regards,
M
Fwiw, had the same problem.
Made the installation with sudo while logged in throught putty with pi user.
My plugins folder is /home/pi/domoticz/plugins/.
Had to edit user and group settings in the config file.
- bitjeverkeerd
- Posts: 30
- Joined: Monday 13 April 2015 20:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
I have this very cool (development version) of the ikea tradfri plugin working. Observe changes and add group as devices are both on. Debug is off.
I can switch the lights from Domoticz and I can see that the status of the lights changes when I switch them with the Tradfri remote.
My question is whether it is possible to see the status of the Tradfri remote in Domoticz. Then I could also switch other devices with this remote..
I can switch the lights from Domoticz and I can see that the status of the lights changes when I switch them with the Tradfri remote.
My question is whether it is possible to see the status of the Tradfri remote in Domoticz. Then I could also switch other devices with this remote..
-
- Posts: 28
- Joined: Tuesday 24 October 2017 9:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
How do you get the bulb connected to both GW and remote? When I try to connect the remote the bulb loose connection to the GW?bitjeverkeerd wrote: ↑Monday 11 December 2017 16:32 I have this very cool (development version) of the ikea tradfri plugin working. Observe changes and add group as devices are both on. Debug is off.
I can switch the lights from Domoticz and I can see that the status of the lights changes when I switch them with the Tradfri remote.
My question is whether it is possible to see the status of the Tradfri remote in Domoticz. Then I could also switch other devices with this remote..
Domoticz on Rpi, Z-wave, Hue with Philips and Ikea bulbs
-
- Posts: 408
- Joined: Sunday 15 January 2017 11:06
- Target OS: Linux
- Domoticz version: beta
- Location: Norway
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Sorry for the late reply, I've been occupied elsewhere for a while. At the moment it's not possible to monitor the remotes directly. You could work around this by assigning a bulb to the remote, and then use event-scripts (python, lua or dzVents) for this bulb to trigger a scene or the other devices. Due to the way observations are done at the moment, there will be somewhat of a delay, but it should work.bitjeverkeerd wrote: ↑Monday 11 December 2017 16:32 I have this very cool (development version) of the ikea tradfri plugin working. Observe changes and add group as devices are both on. Debug is off.
I can switch the lights from Domoticz and I can see that the status of the lights changes when I switch them with the Tradfri remote.
My question is whether it is possible to see the status of the Tradfri remote in Domoticz. Then I could also switch other devices with this remote..
Regards,
M
- bitjeverkeerd
- Posts: 30
- Joined: Monday 13 April 2015 20:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Thanks for the reply. For the time being I will use my old zwave switches to switch on the tradfri lighting. Maybe in the future I will completely switch to zigbee/ikea tradfri. Thanks for all the work you have put into this plugin. I keep testing.
-
- Posts: 2
- Joined: Monday 25 December 2017 14:56
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
I'm also trying to get the plugin to work on a raspberry pi running raspbian Jessie, but I am getting stuck at getting a PSK.
after I type in:
>$ coap-client -m post -u "client_identity" -k "MY-GATEWEY-KEY" -e '{"9090":"IKEA"}' "coaps://MY-IP:5684/15011/9063"
I get the following reponse:
> v:1 t:CON c:POST i:1135 {} [ ]
> Dec 25 14:52:13 ALRT 115 invalidate peer
> Dec 25 14:52:13 WARN received alert, peer has been invalidated
I have googled the ALRT 115 error, but could not find any leads. Can anyone help me get past this step?
after I type in:
>$ coap-client -m post -u "client_identity" -k "MY-GATEWEY-KEY" -e '{"9090":"IKEA"}' "coaps://MY-IP:5684/15011/9063"
I get the following reponse:
> v:1 t:CON c:POST i:1135 {} [ ]
> Dec 25 14:52:13 ALRT 115 invalidate peer
> Dec 25 14:52:13 WARN received alert, peer has been invalidated
I have googled the ALRT 115 error, but could not find any leads. Can anyone help me get past this step?
-
- Posts: 408
- Joined: Sunday 15 January 2017 11:06
- Target OS: Linux
- Domoticz version: beta
- Location: Norway
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
It's a subtle fault in your command, Client_identity is with a capital C, so the correct line would be:JCred wrote: ↑Monday 25 December 2017 15:20 I'm also trying to get the plugin to work on a raspberry pi running raspbian Jessie, but I am getting stuck at getting a PSK.
after I type in:
>$ coap-client -m post -u "client_identity" -k "MY-GATEWEY-KEY" -e '{"9090":"IKEA"}' "coaps://MY-IP:5684/15011/9063"
I get the following reponse:
> v:1 t:CON c:POST i:1135 {} [ ]
> Dec 25 14:52:13 ALRT 115 invalidate peer
> Dec 25 14:52:13 WARN received alert, peer has been invalidated
I have googled the ALRT 115 error, but could not find any leads. Can anyone help me get past this step?
Code: Select all
$ coap-client -m post -u "Client_identity" -k "MY-GATEWEY-KEY" -e '{"9090":"IKEA"}' "coaps://MY-IP:5684/15011/9063"
Regards,
M
Who is online
Users browsing this forum: Google [Bot] and 0 guests