[REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?

Python and python framework

Moderator: leecollings

moroen
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?

Post by moroen »

dzdm wrote: Tuesday 06 February 2018 15:07 Hi!

Are there any news regarding the motion sensors and the IKEA lightpanels in
the IKEA-Tradfri plugin? What is the current development state? I could not find
anything regarding this in the code base, did anyone already start working on
it?


Thanks :)
I have found no way to monitor sensors using the coap interface. As soon as pytradfri supports sensors (if ever), I'll update the plugin accordingly. The panels should work, but need to be added to the devices.ini... I have no panels, but if you have some, you could run the interactive pytradfri shell, and issue the devices-command and provide the output, and I'll be able to add the panels...

Regards,
M
dzdm
Posts: 12
Joined: Monday 05 February 2018 14:24
Target OS: Linux
Domoticz version:
Contact:

Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?

Post by dzdm »

Hi,

thanks for your reply. I also currently don't have any of the panels, but I'll buy one or two
in the next few days. I'll report the device infos after this, so you can include them.

Thanks!
Arie
Posts: 12
Joined: Saturday 27 January 2018 21:20
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: The Netherlands
Contact:

Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?

Post by Arie »

I am trying to install the IKEA-Tradfri-plugin.
What is meant with IDENT in the command below, the desired identification name of what? The name of the Raspberry Pi on which I am installing the plugin, the name I would like to give to the TRÅDFRI Gateway or something else?
May the identification name contain spaces and letters such as Å for example?
And where will this identification name show up later? That may influence my choice for an identification name.

Code: Select all

coap-client -m post -u "Client_identity" -k "GATEWAY-KEY" -e '{"9090":"IDENT"}' "coaps://IP:5684/15011/9063"
moroen
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?

Post by moroen »

Arie wrote: Thursday 08 February 2018 14:23 I am trying to install the IKEA-Tradfri-plugin.
What is meant with IDENT in the command below, the desired identification name of what? The name of the Raspberry Pi on which I am installing the plugin, the name I would like to give to the TRÅDFRI Gateway or something else?
May the identification name contain spaces and letters such as Å for example?
And where will this identification name show up later? That may influence my choice for an identification name.

Code: Select all

coap-client -m post -u "Client_identity" -k "GATEWAY-KEY" -e '{"9090":"IDENT"}' "coaps://IP:5684/15011/9063"
It's the "username" for the connection with the gateway. Since communication is encrypted using DTLS, and IKEA has requested that the GATEWAY key is not stored anywhere, it's necessary to create a username/password (or IDENT/PSK) pair for communication. You could choose what ever you like, excluding special characters (like Å), spaces etc. It will later need to be entered along with the PSK on the plugin setup-page in Domoticz, and that's the only place it will be shown...

So test, ikea, ikea01, me, you, whatever is ok... :D

Regards,
M
Arie
Posts: 12
Joined: Saturday 27 January 2018 21:20
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: The Netherlands
Contact:

Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?

Post by Arie »

moroen wrote: Thursday 08 February 2018 16:13 It's the "username" for the connection with the gateway. Since communication is encrypted using DTLS, and IKEA has requested that the GATEWAY key is not stored anywhere, it's necessary to create a username/password (or IDENT/PSK) pair for communication. You could choose what ever you like, excluding special characters (like Å), spaces etc. It will later need to be entered along with the PSK on the plugin setup-page in Domoticz, and that's the only place it will be shown...

So test, ikea, ikea01, me, you, whatever is ok... :D

Regards,
M
Thank you for your quick reply. You mention a username and password, but IDENT is only one value, right? Where do I enter the other value of the username and password?

/edit1
I understand now; the PSK is returned after sending the command.

/edit2
I am editing the ikea-tradfri.service-file. I have changed the environment path and user. I did a default installation on my Raspberry Pi, so the user is "pi". Is this group automatically created by Domoticz and can I leave it like this or...? I have installed Twisted using the command "pip3 install twisted", but then it is not installed to the path mentioned at "ExecStart". I assume that I need to change the path, but how can I find out where Twisted has been installed?

Code: Select all

[Unit]
Description=IKEA Tradfri COAP-adapter

[Service]
Type=simple
Environment=IKEA_HOME=/domoticz/plugins/IKEA-Tradfri
ExecStart=/usr/local/bin/twistd --nodaemon \
      --rundir=${IKEA_HOME} \
      --pidfile=${IKEA_HOME}/twistd.pid \
      --python=${IKEA_HOME}/tradfri.tac

User=pi
Group=domoticz

Restart=always

[Install]
WantedBy=multi-user.target
moroen
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?

Post by moroen »

Arie wrote: Thursday 08 February 2018 16:37
moroen wrote: Thursday 08 February 2018 16:13 It's the "username" for the connection with the gateway. Since communication is encrypted using DTLS, and IKEA has requested that the GATEWAY key is not stored anywhere, it's necessary to create a username/password (or IDENT/PSK) pair for communication. You could choose what ever you like, excluding special characters (like Å), spaces etc. It will later need to be entered along with the PSK on the plugin setup-page in Domoticz, and that's the only place it will be shown...

So test, ikea, ikea01, me, you, whatever is ok... :D

Regards,
M
Thank you for your quick reply. You mention a username and password, but IDENT is only one value, right? Where do I enter the other value of the username and password?

/edit1
I understand now; the PSK is returned after sending the command.

/edit2
I am editing the ikea-tradfri.service-file. I have changed the environment path and user. I did a default installation on my Raspberry Pi, so the user is "pi". Is this group automatically created by Domoticz and can I leave it like this or...? I have installed Twisted using the command "pip3 install twisted", but then it is not installed to the path mentioned at "ExecStart". I assume that I need to change the path, but how can I find out where Twisted has been installed?

Code: Select all

[Unit]
Description=IKEA Tradfri COAP-adapter

[Service]
Type=simple
Environment=IKEA_HOME=/domoticz/plugins/IKEA-Tradfri
ExecStart=/usr/local/bin/twistd --nodaemon \
      --rundir=${IKEA_HOME} \
      --pidfile=${IKEA_HOME}/twistd.pid \
      --python=${IKEA_HOME}/tradfri.tac

User=pi
Group=domoticz

Restart=always

[Install]
WantedBy=multi-user.target
I haven't used a PI for a while, so I'm not quite sure about the default group for the pi user, but I would imagine it is 'pi'... You could test it:

Code: Select all

$ touch testing
$ ls -la testing
You'll get something like this as a response:

Code: Select all

-rw-r--r-- 1 mak mak 0 feb.   8 22:53 testing
The first is the user name, in you case pi, the second the default group

To find out where twistd is installed, you could use the which command:

Code: Select all

$ which twistd
/usr/local/bin/twistd
Hope it works out, if not, let me know, and I'll try to help further! :)

Regards,
M
Arie
Posts: 12
Joined: Saturday 27 January 2018 21:20
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: The Netherlands
Contact:

Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?

Post by Arie »

moroen wrote: Thursday 08 February 2018 22:56 I haven't used a PI for a while, so I'm not quite sure about the default group for the pi user, but I would imagine it is 'pi'... You could test it:

Code: Select all

$ touch testing
$ ls -la testing
You'll get something like this as a response:

Code: Select all

-rw-r--r-- 1 mak mak 0 feb.   8 22:53 testing
The first is the user name, in you case pi, the second the default group

To find out where twistd is installed, you could use the which command:

Code: Select all

$ which twistd
/usr/local/bin/twistd
Hope it works out, if not, let me know, and I'll try to help further! :)

Regards,
M
The group is indeed pi. Found out using the command ls -la test. Thank you! :)
The which command does nothing unfortunately. Tried using twisted and twistd. No output whatsoever. Re-ran the command pip3 install twisted in the hope it would show a path, but it did not unfortunately. If you have any other ideas, that would be great. Not much of a Linux user here. :oops:
moroen
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?

Post by moroen »

Arie wrote: Thursday 08 February 2018 23:20 The group is indeed pi. Found out using the command ls -la test. Thank you! :)
The which command does nothing unfortunately. Tried using twisted and twistd. No output whatsoever. Re-ran the command pip3 install twisted in the hope it would show a path, but it did not unfortunately. If you have any other ideas, that would be great. Not much of a Linux user here. :oops:
Ok, have you tried to install twisted using sudo (and force an update, just in case):

Code: Select all

$ sudo pip3 install -U twisted
Regards,
M
Arie
Posts: 12
Joined: Saturday 27 January 2018 21:20
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: The Netherlands
Contact:

Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?

Post by Arie »

moroen wrote: Friday 09 February 2018 0:50 Ok, have you tried to install twisted using sudo (and force an update, just in case):

Code: Select all

$ sudo pip3 install -U twisted
Regards,
M
Brilliant, that did the trick. It is installed in the correct path now. Thank you! :)

I have added the IKEA TRÅDFRI Gateway to Domoticz, but I repeatedly get the error message quoted below in the logging.

Code: Select all

(IKEA TRÅDFRI Gateway) Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
Below a screenshot of my settings. I have disabled the hardware for now as you can see due to this error message.

Image

I ran the following command to get the PSK.

Code: Select all

coap-client -m post -u "Client_identity" -k "zwXXxxXxXXXXCyKE" -e '{"9090":"ikea"}' "coaps://192.168.1.251:5684/15011/9063"
v:1 t:CON c:POST i:e22b {} [ ]
{"9091":"rqNxxx123XXXyEgQ","9029":"1.3.0014"}
I guess I did something wrong...?
Below my ikea-tradfri.service file.

Code: Select all

[Unit]
Description=IKEA Tradfri COAP-adapter

[Service]
Type=simple
Environment=IKEA_HOME=/domoticz/plugins/IKEA-Tradfri
ExecStart=/usr/local/bin/twistd --nodaemon \
      --rundir=${IKEA_HOME} \
      --pidfile=${IKEA_HOME}/twistd.pid \
      --python=${IKEA_HOME}/tradfri.tac

User=pi
Group=pi

Restart=always

[Install]
WantedBy=multi-user.target
Arie
Posts: 12
Joined: Saturday 27 January 2018 21:20
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: The Netherlands
Contact:

Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?

Post by Arie »

I just noticed that the Domoticz path in my ikea-tradfri.service file started with a forward slash (/) instead of a tilde (~) for the home directory. I have changed the path to the full path of /home/pi/domoticz/plugins/IKEA-Tradfri and ran the following commands, followed by a reboot...

Code: Select all

pi@teletraan1:~/domoticz/plugins/IKEA-Tradfri $ sudo systemctl stop ikea-tradfri
pi@teletraan1:~/domoticz/plugins/IKEA-Tradfri $ sudo systemctl disable ikea-tradfri
pi@teletraan1:~/domoticz/plugins/IKEA-Tradfri $ sudo cp ikea-tradfri.service /lib/systemd/system/
pi@teletraan1:~/domoticz/plugins/IKEA-Tradfri $ sudo systemctl daemon-reload
pi@teletraan1:~/domoticz/plugins/IKEA-Tradfri $ sudo systemctl reset-failed
pi@teletraan1:~/domoticz/plugins/IKEA-Tradfri $ sudo systemctl start ikea-tradfri
pi@teletraan1:~/domoticz/plugins/IKEA-Tradfri $ sudo systemctl status ikea-tradfri
● ikea-tradfri.service - IKEA Tradfri COAP-adapter
   Loaded: loaded (/lib/systemd/system/ikea-tradfri.service; disabled; vendor preset: enabled)
   Active: active (running) since Fri 2018-02-09 10:48:00 CET; 6s ago
 Main PID: 10969 (twistd)
   CGroup: /system.slice/ikea-tradfri.service
           └─10969 /usr/bin/python3 /usr/local/bin/twistd --nodaemon --rundir=/home/pi/domoticz/plugins/IKEA-Tradfri --pidfile=/home/pi/domoticz/plugins/IKEA-Tradfri/twistd.pid --python=/home

Feb 09 10:48:00 teletraan1 systemd[1]: Started IKEA Tradfri COAP-adapter.
Feb 09 10:48:01 teletraan1 twistd[10969]: 2018-02-09T10:48:01+0100 [-] Loading /home/pi/domoticz/plugins/IKEA-Tradfri/tradfri.tac...
Feb 09 10:48:01 teletraan1 twistd[10969]: 2018-02-09T10:48:01+0100 [-] Loaded.
Feb 09 10:48:01 teletraan1 twistd[10969]: 2018-02-09T10:48:01+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] twistd 17.9.0 (/usr/bin/python3 3.5.3) starting up.
Feb 09 10:48:01 teletraan1 twistd[10969]: 2018-02-09T10:48:01+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] reactor class: twisted.internet.epollreactor.EPollReactor.
Feb 09 10:48:01 teletraan1 twistd[10969]: 2018-02-09T10:48:01+0100 [-] AdaptorFactory starting on 1234
Feb 09 10:48:01 teletraan1 twistd[10969]: 2018-02-09T10:48:01+0100 [builtins.AdaptorFactory#info] Starting factory <AdaptorFactory object at 0x76041f90>
Feb 09 10:48:04 teletraan1 twistd[10969]: 2018-02-09T10:48:04+0100 [stdout#info] Connected from IPv4Address(TCP, '127.0.0.1', 38690)

pi@teletraan1:~/domoticz/plugins/IKEA-Tradfri $ sudo systemctl enable ikea-tradfri
Created symlink /etc/systemd/system/multi-user.target.wants/ikea-tradfri.service → /lib/systemd/system/ikea-tradfri.service.
Now I only get one error message twice in the logging... Is this an issue or is this expected? How do I get my lights in Domoticz now? They have all been added to the IKEA TRÅDFRI Gateway earlier. Do they show up as unused devices for example?

Code: Select all

2018-02-09 10:56:22.727 (IKEA TRÅDFRI Gateway) Started.
...
2018-02-09 10:56:23.172 (IKEA TRÅDFRI Gateway) Entering work loop.
2018-02-09 10:56:23.172 (IKEA TRÅDFRI Gateway) Initialized version 1.0.6, author 'moroen'
2018-02-09 10:56:23.225 (IKEA TRÅDFRI Gateway) Connected successfully to: 192.168.1.251
2018-02-09 10:56:23.225 Error: (IKEA TRÅDFRI Gateway) 'onMessage' failed 'TypeError':'onMessage() missing 2 required positional arguments: 'Status' and 'Extra''.
...
2018-02-09 10:56:24.277 Error: (IKEA TRÅDFRI Gateway) 'onMessage' failed 'TypeError':'onMessage() missing 2 required positional arguments: 'Status' and 'Extra''.
moroen
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?

Post by moroen »

Arie wrote: Friday 09 February 2018 11:06 Now I only get one error message twice in the logging... Is this an issue or is this expected? How do I get my lights in Domoticz now? They have all been added to the IKEA TRÅDFRI Gateway earlier. Do they show up as unused devices for example?

Code: Select all

2018-02-09 10:56:24.277 Error: (IKEA TRÅDFRI Gateway) 'onMessage' failed 'TypeError':'onMessage() missing 2 required positional arguments: 'Status' and 'Extra''.
You need to match the branch of the plugin to the version of domoticz you're using. It appears that your using the latest beta of domoticz? Then you need to use the developement branch of the plugin:

Code: Select all

$ cd IKEA-Tradfri
$ git checkout development
and restart domoticz... The devices shows up in the Devices tab in domoticz.

Regards,
M

PS: I really should put some more work into the readme/instructions, but writing documentation is not one of my strengths...
Arie
Posts: 12
Joined: Saturday 27 January 2018 21:20
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: The Netherlands
Contact:

Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?

Post by Arie »

moroen wrote: Friday 09 February 2018 13:31 You need to match the branch of the plugin to the version of domoticz you're using. It appears that your using the latest beta of domoticz? Then you need to use the developement branch of the plugin:

Code: Select all

$ cd IKEA-Tradfri
$ git checkout development
and restart domoticz... The devices shows up in the Devices tab in domoticz.

Regards,
M

PS: I really should put some more work into the readme/instructions, but writing documentation is not one of my strengths...
Working like a charm now! Thank you so much for your time and effort! :)
Hann1BaL
Posts: 23
Joined: Sunday 11 March 2018 15:37
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Contact:

Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?

Post by Hann1BaL »

Code: Select all

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 Sun 2018-03-11 15:32:38 CET; 1s ago
  Process: 32183 ExecStart=/usr/bin/twistd --nodaemon --rundir=${IKEA_HOME} --pidfile=${IKEA_HOME}/twistd.pid --python=${IKEA_HOME}/tradfri.ta Main PID: 32183 (code=exited, status=217/USER)

Mar 11 15:32:37 raspberrypi systemd[1]: ikea-tradfri.service: Failed with result 'exit-code'.
Mar 11 15:32:38 raspberrypi systemd[1]: ikea-tradfri.service: Service hold-off time over, scheduling restart.
Mar 11 15:32:38 raspberrypi systemd[1]: Stopped IKEA Tradfri COAP-adapter.
Mar 11 15:32:38 raspberrypi systemd[1]: ikea-tradfri.service: Start request repeated too quickly.
Mar 11 15:32:38 raspberrypi systemd[1]: Failed to start IKEA Tradfri COAP-adapter.
Mar 11 15:32:38 raspberrypi systemd[1]: ikea-tradfri.service: Unit entered failed state.
Mar 11 15:32:38 raspberrypi systemd[1]: ikea-tradfri.service: Failed with result 'exit-code'.
I am trying to install the IKEA tradfri plugin and I believe I managed to get it installed, but every time I run it, it seems to stop itself and I have no real idea how to start troubleshooting this.
Running Domoticz v3.8153 on a rpi2.
phuygens
Posts: 4
Joined: Sunday 11 March 2018 22:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?

Post by phuygens »

Exactly the same issue here (raspberry pi 1)

Are there any 'new' instructions how to install this great plugin?

I'm a complete newbie into Linux/Raspbian
phuygens
Posts: 4
Joined: Sunday 11 March 2018 22:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?

Post by phuygens »

Okay, 4 hours later on troubleshooting :-)
When I run python3 tradfri.tac, I'm able to control the IKEA tradfri from the webinterface of Domoticz!!!
But as soon as I 'type CTRL+C in SSH terminal > I can't control the lights anymore.

This is the IKEA-tradfri.service file:
[Unit]
Description=IKEA Tradfri COAP-adapter

[Service]
Type=simple
Environment=IKEA_HOME=/home/pi/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

What I'm doing wrong? Thanks for all your efforts and keep up this nice project!
moroen
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?

Post by moroen »

phuygens wrote: Sunday 11 March 2018 23:51 Okay, 4 hours later on troubleshooting :-)
When I run python3 tradfri.tac, I'm able to control the IKEA tradfri from the webinterface of Domoticz!!!
But as soon as I 'type CTRL+C in SSH terminal > I can't control the lights anymore.

This is the IKEA-tradfri.service file:
[Unit]
Description=IKEA Tradfri COAP-adapter

[Service]
Type=simple
Environment=IKEA_HOME=/home/pi/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

What I'm doing wrong? Thanks for all your efforts and keep up this nice project!
When you run the adapter from the command line, it will stop as soon as you quit it using ctrl-c. You need to have it running as a service. The services file looks ok, provided that the path is correct.

The ikea-tradfri.service file needs to be copied to a systemd directory, on Debian/raspian this should be a possible location:

Code: Select all

$ sudo cp ikea-tradfri.service /lib/systemd/system/
Then enable and start the service:

Code: Select all

$ sudo systemctl enable ikea-tradfri.service
$ sudo systemctl start ikea-tradfri.service
And finally, check the status:

Code: Select all

$ sudo systemctl status ikea-tradfri.service
If it still fails to control the lights, please post the output of the status-command, and I'll take a look.

Regards,
M
phuygens
Posts: 4
Joined: Sunday 11 March 2018 22:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?

Post by phuygens »

Dear,

Thanks for your help.
I ran the commands you've provided, but still the service does not run as expected. I've rebooted the pi after I've ran your commands.
This is the output:
lines 1-17/17 (END)...skipping...
● ikea-tradfri.service - IKEA Tradfri COAP-adapter
Loaded: loaded (/lib/systemd/system/ikea-tradfri.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2018-03-13 22:53:12 UTC; 8s ago
Main PID: 498 (twistd)
CGroup: /system.slice/ikea-tradfri.service
└─498 /usr/bin/python3 /usr/local/bin/twistd --nodaemon --rundir=/home/pi/domoticz/plugins/IKEA-Tradfri --pidfile=/home/pi/domoticz/plugins/IKEA-Tradfri/twistd.pid --python=/home/pi/domoticz/plugins/IKEA-Tradfri/

Mar 13 22:53:21 raspberrypi twistd[498]: File "/usr/local/lib/python3.5/dist-packages/twisted/application/app.py", line 456, in getApplication
Mar 13 22:53:21 raspberrypi twistd[498]: application = service.loadApplication(filename, style, passphrase)
Mar 13 22:53:21 raspberrypi twistd[498]: File "/usr/local/lib/python3.5/dist-packages/twisted/application/service.py", line 412, in loadApplication
Mar 13 22:53:21 raspberrypi twistd[498]: application = sob.loadValueFromFile(filename, 'application')
Mar 13 22:53:21 raspberrypi twistd[498]: File "/usr/local/lib/python3.5/dist-packages/twisted/persisted/sob.py", line 177, in loadValueFromFile
Mar 13 22:53:21 raspberrypi twistd[498]: eval(codeObj, d, d)
Mar 13 22:53:21 raspberrypi twistd[498]: File "/home/pi/domoticz/plugins/IKEA-Tradfri/tradfri.tac", line 13, in <module>
Mar 13 22:53:21 raspberrypi twistd[498]: from pytradfri import Gateway
Mar 13 22:53:21 raspberrypi twistd[498]: builtins.ImportError: No module named 'pytradfri'
Mar 13 22:53:21 raspberrypi twistd[498]: Failed to load application: No module named 'pytradfri
Thanks for all your support!
moroen
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?

Post by moroen »

phuygens wrote: Tuesday 13 March 2018 23:59 Dear,

Thanks for your help.
I ran the commands you've provided, but still the service does not run as expected. I've rebooted the pi after I've ran your commands.
This is the output:
lines 1-17/17 (END)...skipping...
● ikea-tradfri.service - IKEA Tradfri COAP-adapter
Loaded: loaded (/lib/systemd/system/ikea-tradfri.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2018-03-13 22:53:12 UTC; 8s ago
Main PID: 498 (twistd)
CGroup: /system.slice/ikea-tradfri.service
└─498 /usr/bin/python3 /usr/local/bin/twistd --nodaemon --rundir=/home/pi/domoticz/plugins/IKEA-Tradfri --pidfile=/home/pi/domoticz/plugins/IKEA-Tradfri/twistd.pid --python=/home/pi/domoticz/plugins/IKEA-Tradfri/

Mar 13 22:53:21 raspberrypi twistd[498]: File "/usr/local/lib/python3.5/dist-packages/twisted/application/app.py", line 456, in getApplication
Mar 13 22:53:21 raspberrypi twistd[498]: application = service.loadApplication(filename, style, passphrase)
Mar 13 22:53:21 raspberrypi twistd[498]: File "/usr/local/lib/python3.5/dist-packages/twisted/application/service.py", line 412, in loadApplication
Mar 13 22:53:21 raspberrypi twistd[498]: application = sob.loadValueFromFile(filename, 'application')
Mar 13 22:53:21 raspberrypi twistd[498]: File "/usr/local/lib/python3.5/dist-packages/twisted/persisted/sob.py", line 177, in loadValueFromFile
Mar 13 22:53:21 raspberrypi twistd[498]: eval(codeObj, d, d)
Mar 13 22:53:21 raspberrypi twistd[498]: File "/home/pi/domoticz/plugins/IKEA-Tradfri/tradfri.tac", line 13, in <module>
Mar 13 22:53:21 raspberrypi twistd[498]: from pytradfri import Gateway
Mar 13 22:53:21 raspberrypi twistd[498]: builtins.ImportError: No module named 'pytradfri'
Mar 13 22:53:21 raspberrypi twistd[498]: Failed to load application: No module named 'pytradfri
Thanks for all your support!
So, when running as a service, the pytradfri-module isn't found. Ok, first try, if you already haven't, to install pytradfri using sudo...

Code: Select all

$ sudo pip3 install -U pytradfri
Regards,
M
phuygens
Posts: 4
Joined: Sunday 11 March 2018 22:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?

Post by phuygens »

Dear Moroen,

Thanks, I've ran your command, rebooted my pi without doing anything else (so not starting the service manually) and it now runs like a charm.

Thanks for your efforts and keep up the good work on this project! I read on the internet that IKEA will supply power supplys/power switches in the future, so this is a very nice project. Will keep following this.

Edit: sorry I'm completely a newbie in the Linux world...

Thanks!
moroen
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?

Post by moroen »

phuygens wrote: Wednesday 14 March 2018 23:14 Dear Moroen,

Thanks, I've ran your command, rebooted my pi without doing anything else (so not starting the service manually) and it now runs like a charm.

Thanks for your efforts and keep up the good work on this project! I read on the internet that IKEA will supply power supplys/power switches in the future, so this is a very nice project. Will keep following this.

Edit: sorry I'm completely a newbie in the Linux world...

Thanks!
Glad it worked out! Don't be sorry, learning is the most fun part of using linux! ;)

Regards,
M
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest