[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 »

Lars65 wrote: Sunday 17 September 2017 18:35 When I try to install this, I get :

error while loading shared libraries usr/local/bin/python3.5


I don't know how many times I tried this, seems impossible.
I run domoticz beta latest
Raspberry Pi 3
raspbian Jessie
Last time I checked the latest beta still has support for python and python plugins disabled, you need to use the python-enabled branch...

Regards
M
Lars65
Posts: 41
Joined: Thursday 14 July 2016 20:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by Lars65 »

Dumb question I guess but, How do I get the python-enabled branch?

:)
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 »

Lars65 wrote: Sunday 17 September 2017 19:43 Dumb question I guess but, How do I get the python-enabled branch?

:)
There are no dumb questions, just silly answers... :)

You need to compile domoticz yourself, following the instructions on the wiki-page: https://www.domoticz.com/wiki/Installin ... spberry_PI

To get the branch that supports python, one additional command is necessary, just after

Code: Select all

$ git clone https://github.com/domoticz/domoticz.git dev-domoticz
$ cd dev-domoticz
enter

Code: Select all

$ git checkout python-enabled
and follow the rest of the instructions!

Code: Select all

$ git pull
$ cmake -DCMAKE_BUILD_TYPE=Release CMakeLists.txt
$ make -j 3
Regards,
M
ivarka
Posts: 11
Joined: Sunday 17 April 2016 21:00
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by ivarka »

I thought Python support was included in 3.8153 (Stable)?

Ivar
andi216
Posts: 46
Joined: Tuesday 14 March 2017 13:10
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.7243
Contact:

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

Post by andi216 »

@moroen
Hello
I took another step.

Code: Select all

pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ python3 tradfri.tac            
IKEA-tradfri COAP-adaptor version 0.3 started (command line)!
Waiting for connection
Connected from IPv4Address(TCP, '127.0.0.1', 54094)
Data received: b'{"observe": "True", "action": "setConfig", "gateway": "192.168.1.226", "key": "blablablabla"}'


Code: Select all

pi@raspberrypi:~ $ coap-client -k blablabla coaps://192.168.1.226/15004/
v:1 t:CON c:GET i:3515 {} [ ]
decrypt_verify(): found 24 bytes cleartext
decrypt_verify(): found 19 bytes cleartext
[133243]

Code: Select all

pi@raspberrypi:~ $ coap-client -k blablablabla coaps://192.168.1.226/.well-known/core
v:1 t:CON c:GET i:fbcf {} [ ]
decrypt_verify(): found 24 bytes cleartext
decrypt_verify(): found 560 bytes cleartext
<//15001/65536>;ct=0;obs,<//15001/65538>;ct=0;obs,<//15004/133243>;ct=0;obs,<//15005/133243>;ct=0;obs,<//15005/133243/220138>;ct=0;obs,<//15005/133243/214322>;ct=0;obs,<//15005/133243/202541>;ct=0;obs,<//15001>;ct=0;obs,<//15001/reset>;ct=0,<//status>;ct=0;obs,<//15005>;ct=0;obs,<//15004>;ct=0;obs,<//15004/add>;ct=0,<//15004/remove>;ct=0,<//15006>;ct=0;obs,<//15011/15012>;ct=0;obs,<//15011/9034>;ct=0,<//15011/9030>;ct=0,<//15011/9031>;ct=0,<//15011/9063>;ct=0,<//15011/9033>;ct=0,<//15010>;ct=0;obs,<//15010/308046>;ct=0;obs,<//15001/65537>;ct=0;obs
Log

Code: Select all

2017-09-19 19:06:05.552 (IKEA) Calling message handler 'onHeartbeat'.
-------------------------------------------------
Edit | ×
The above values only appear if the command is "python3 tradfri.tac"

After restart Domoticz
Log

2017-09-19 20:05:13.569 (IKEA) Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
2017-09-19 20:05:15.524 (IKEA) Calling message handler 'onHeartbeat'.
2017-09-19 20:05:15.524 (IKEA) Not connected - nextConnect: 3
2017-09-19 20:05:17.529 (IKEA) Calling message handler 'onHeartbeat'.
2017-09-19 20:05:17.529 (IKEA) Not connected - nextConnect: 2
2017-09-19 20:05:19.534 (IKEA) Calling message handler 'onHeartbeat'.
2017-09-19 20:05:19.534 (IKEA) Not connected - nextConnect: 1
2017-09-19 20:05:19.534 (IKEA) Transport set to: 'TCP/IP', 127.0.0.1:1234.
2017-09-19 20:05:19.534 PluginSystem: Starting I/O service thread.
2017-09-19 20:05:19.535 (IKEA) Connect directive received, action initiated successfully.
2017-09-19 20:05:19.585 (IKEA) Calling message handler 'onConnect'.
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 »

ivarka wrote: Tuesday 19 September 2017 8:07 I thought Python support was included in 3.8153 (Stable)?

Ivar
Quite correct, the latest stable includes python, but the latest beta does (at least did) not...

Regards,
M
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 »

andi216 wrote: Tuesday 19 September 2017 18:21 @moroen
Hello
I took another step.

Code: Select all

pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ python3 tradfri.tac            
IKEA-tradfri COAP-adaptor version 0.3 started (command line)!
Waiting for connection
Connected from IPv4Address(TCP, '127.0.0.1', 54094)
Data received: b'{"observe": "True", "action": "setConfig", "gateway": "192.168.1.226", "key": "blablablabla"}'


2017-09-19 20:05:13.569 (IKEA) Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
So, the adapter starts, receives the initial setup command, and then fails?

Could you provide me the rest of the output from tradfri.tac? Or send it to me as a PM?

Regards,
M
sejonr
Posts: 16
Joined: Friday 05 May 2017 12:32
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by sejonr »

Hi i also try to add trådfri plugin. Everything is working exept that i cant find the Trådfri plugin in Domoticz.

(I got help from a person that is very god at Linux and python.) he told me that i need to reinstall domoticz with compile. Do i need that?

Im afraid to loose all my data.

I get this message when i start domoticz.

2017-09-22 09:40:39.391 EventSystem - Python: Failed dynamic library load, install the latest libpython3.x library that is available for your platform.

I using Beta Version 3.8423

I tryed to install libpython3.x but it whas already installed.
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 »

sejonr wrote: Friday 22 September 2017 11:04 Hi i also try to add trådfri plugin. Everything is working exept that i cant find the Trådfri plugin in Domoticz.

(I got help from a person that is very god at Linux and python.) he told me that i need to reinstall domoticz with compile. Do i need that?
You need to compile domoticz from the python-enabled branch yourself if you need to use the latest betas. I wrote some intstructions earlier in the thread. If you don't need any other beta features, the latest stable has python enabled and works with the master-branch of the IKEA-plugin.

Regards,
M
Ravenbankie
Posts: 4
Joined: Tuesday 26 September 2017 22:53
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by Ravenbankie »

Hi,

Moroen , thanxs for this excellent plugin.

I have followed the instructions and everything is working. i hope i can help someone for what's worth my setup:
my setup: Raspberry pi, OSMC , Python 3.4 dev , domoticz beta, IKEA-tradfri git clone development.
it's my first time raspb and linux so it's nice to see everything working now.

i'm curious: Is the async choice better than the syncrounous version within pytradfri of ggravlingen? Is that the future?

I hope to see all the colors for the color lamps supported someday in your plugin Moroen :-)

greetz
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 »

Ravenbankie wrote: Tuesday 26 September 2017 23:27 Hi,

Moroen , thanxs for this excellent plugin.

I have followed the instructions and everything is working. i hope i can help someone for what's worth my setup:
my setup: Raspberry pi, OSMC , Python 3.4 dev , domoticz beta, IKEA-tradfri git clone development.
it's my first time raspb and linux so it's nice to see everything working now.

i'm curious: Is the async choice better than the syncrounous version within pytradfri of ggravlingen? Is that the future?

I hope to see all the colors for the color lamps supported someday in your plugin Moroen :-)

greetz
Thank you for the feedback!

As to async, it's definitely the future, and the current focus of my work on the plugin. If you'd like to monitor progress (slow, but steady), it's in the aiocoap-branch of the repo. The main motivation for switching to async is to get some kind of stable observation going, the way it's done now seems to crash the gateway, especially when monitoring many lights.

As soon as RGB-bulbs are made available here in Norway, I'll get my hands on a couple and start implementing colors.

Regards,
M
sejonr
Posts: 16
Joined: Friday 05 May 2017 12:32
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by sejonr »

Hi All i have one problem i cant find IKEA lamps and i got this fault in Domoticz logg. What can it be?

2017-09-29 08:55:14.104 (IKEA Lampor) Received 76 bytes of data:.

2017-09-29 08:55:14.104 (IKEA Lampor) 7b 22 73 74 61 74 75 73 22 3a 20 22 46 61 69 6c 65 64 22 2c {"status":."Failed",

2017-09-29 08:55:14.104 (IKEA Lampor) 20 22 61 63 74 69 6f 6e 22 3a 20 22 73 65 74 43 6f 6e 66 69 ."action":."setConfi

2017-09-29 08:55:14.105 (IKEA Lampor) 67 22 2c 20 22 65 72 72 6f 72 22 3a 20 22 43 6f 6e 6e 65 63 g",."error":."Connec

2017-09-29 08:55:14.105 (IKEA Lampor) 74 69 6f 6e 20 74 69 6d 65 64 20 6f 75 74 22 7d .. .. .. .. tion.timed.out"}

2017-09-29 08:55:14.105 (IKEA Lampor) Calling message handler 'onMessage'.

2017-09-29 08:55:14.105 (IKEA Lampor) Received: b'{"status": "Failed", "action": "setConfig", "error": "Connection timed out"}'

2017-09-29 08:55:14.105 (IKEA Lampor) Command setConfig failed with error: Connection timed out.

2017-09-29 08:55:14.106 (IKEA Lampor) {'action': 'setConfig', 'error': 'Connection timed out', 'status': 'Failed'}
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 »

sejonr wrote: Friday 29 September 2017 9:01 Hi All i have one problem i cant find IKEA lamps and i got this fault in Domoticz logg. What can it be?

2017-09-29 08:55:14.106 (IKEA Lampor) {'action': 'setConfig', 'error': 'Connection timed out', 'status': 'Failed'}
It appears that the coap-client can't connect to the ikea-gateway. Have you tried testing the coap-client from the command-line?

Code: Select all

$ coap-client -k your_key_goes_here coaps://ip/.well-known/core
Regards,
M
m0rph13
Posts: 18
Joined: Sunday 31 January 2016 1:24
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Contact:

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

Post by m0rph13 »

moroen wrote: Wednesday 27 September 2017 0:25 As soon as RGB-bulbs are made available here in Norway, I'll get my hands on a couple and start implementing colors.
Regards,
M
Have you received your RGB lamp yet?
I've had mine for a couple of weeks now and would love to be able to control colours through your plugin :)

Another thing I would really love to see is a way to detect that a WB has been activated. Currently, all my remotes (WB) shows as being ON all the time.

Thank you for an awesome plugin!
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 »

m0rph13 wrote: Saturday 30 September 2017 11:04 Have you received your RGB lamp yet?
I've had mine for a couple of weeks now and would love to be able to control colours through your plugin :)

Another thing I would really love to see is a way to detect that a WB has been activated. Currently, all my remotes (WB) shows as being ON all the time.

Thank you for an awesome plugin!
Thanks!

Just checked Ikea store-page, and still no RGB-bulbs available here, I'll keep checking! :)

I'm not quite sure what you mean by WB has been activated?

Regards,
M
m0rph13
Posts: 18
Joined: Sunday 31 January 2016 1:24
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Contact:

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

Post by m0rph13 »

moroen wrote: Saturday 30 September 2017 12:47 I'm not quite sure what you mean by WB has been activated?
My bad. I thought the units with WB were the controllers but of course its the white balance :)
sejonr
Posts: 16
Joined: Friday 05 May 2017 12:32
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by sejonr »

moroen wrote: Friday 29 September 2017 12:14
sejonr wrote: Friday 29 September 2017 9:01 Hi All i have one problem i cant find IKEA lamps and i got this fault in Domoticz logg. What can it be?

2017-09-29 08:55:14.106 (IKEA Lampor) {'action': 'setConfig', 'error': 'Connection timed out', 'status': 'Failed'}
It appears that the coap-client can't connect to the ikea-gateway. Have you tried testing the coap-client from the command-line?

Code: Select all

$ coap-client -k your_key_goes_here coaps://ip/.well-known/core
Regards,
M
Hi M

When i putting in my ip and Key i got this. I am new in Linux so i need help :) I run another Coap-script that i find on the web an could find IKEA lamps. (I removed my IKEA Key)
I using Domoticz V3.8153, Python 3.4, Ikea gateway version 1.1.0015.

coap-client -k "MY Key" coaps://192.168.1.45/.well-known/core
v:1 t:CON c:GET i:190c {} [ ]
<//15001/65541>;ct=0;obs,<//15001/65536>;ct=0;obs,<//15001/65542>;ct=0;obs,<//15001/65544>;ct=0;obs,<//15001/65543>;ct=0;obs,<//15001/65550>;ct=0;obs,<//15001/65546>;ct=0;obs,<//15001/65547>;ct=0;obs,<//15001/65548>;ct=0;obs,<//15001/65545>;ct=0;obs,<//150v:1 t:CON c:GET i:190d {} [ ]
01/65537>;ct=0;obs,<//15001/65540>;ct=0;obs,<//15001/65538>;ct=0;obs,<//15001/65549>;ct=0;obs,<//15001/65539>;ct=0;obs,<//15004/179393>;ct=0;obs,<//15004/142833>;ct=0;obs,<//15004/144989>;ct=0;obs,<//15004/170133>;ct=0;obs,<//15004/170529>;ct=0;obs,<//1500v:1 t:CON c:GET i:190e {} [ ]
5/179393/210242>;ct=0;obs,<//15005/179393/221571>;ct=0;obs,<//15005/179393/213378>;ct=0;obs,<//15005/170529/197393>;ct=0;obs,<//15005/179393/227922>;ct=0;obs,<//15005/142833/216337>;ct=0;obs,<//15005/179393>;ct=0;obs,<//15005/142833>;ct=0;obs,<//15005/1449v:1 t:CON c:GET i:190f {} [ ]
89/204536>;ct=0;obs,<//15005/144989/214163>;ct=0;obs,<//15005/144989/200829>;ct=0;obs,<//15005/142833/207015>;ct=0;obs,<//15005/142833/200247>;ct=0;obs,<//15005/142833/219269>;ct=0;obs,<//15005/142833/198771>;ct=0;obs,<//15005/142833/198755>;ct=0;obs,<//15v:1 t:CON c:GET i:1910 {} [ ]
005/170133/204103>;ct=0;obs,<//15005/170133/207258>;ct=0;obs,<//15005/170133/208775>;ct=0;obs,<//15005/170529/210006>;ct=0;obs,<//15005/170529/227710>;ct=0;obs,<//15005/144989>;ct=0;obs,<//15005/170133>;ct=0;obs,<//15005/170529>;ct=0;obs,<//15005/170529/19v:1 t:CON c:GET i:1911 {} [ ]
9134>;ct=0;obs,<//15005/170529/201532>;ct=0;obs,<//15005/170529/219012>;ct=0;obs,<//15005/170133/198681>;ct=0;obs,<//15005/170133/202935>;ct=0;obs,<//15005/170133/213727>;ct=0;obs,<//15001>;ct=0;obs,<//15001/reset>;ct=0,<//status>;ct=0;obs,<//15005>;ct=0;ov:1 t:CON c:GET i:1912 {} [ ]
bs,<//15004>;ct=0;obs,<//15004/add>;ct=0,<//15004/remove>;ct=0,<//15006>;ct=0;obs,<//15011/15012>;ct=0;obs,<//15011/9034>;ct=0,<//15011/9030>;ct=0,<//15011/9031>;ct=0,<//15011/9063>;ct=0,<//15011/9033>;ct=0,<//15010>;ct=0;obs
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 »

sejonr wrote: Sunday 01 October 2017 10:03
moroen wrote: Friday 29 September 2017 12:14
sejonr wrote: Friday 29 September 2017 9:01 Hi All i have one problem i cant find IKEA lamps and i got this fault in Domoticz logg. What can it be?

2017-09-29 08:55:14.106 (IKEA Lampor) {'action': 'setConfig', 'error': 'Connection timed out', 'status': 'Failed'}
It appears that the coap-client can't connect to the ikea-gateway. Have you tried testing the coap-client from the command-line?

Code: Select all

$ coap-client -k your_key_goes_here coaps://ip/.well-known/core
Regards,
M
Hi M

When i putting in my ip and Key i got this. I am new in Linux so i need help :) I run another Coap-script that i find on the web an could find IKEA lamps. (I removed my IKEA Key)
I using Domoticz V3.8153, Python 3.4, Ikea gateway version 1.1.0015.

coap-client -k "MY Key" coaps://192.168.1.45/.well-known/core
v:1 t:CON c:GET i:190c {} [ ]
<//15001/65541>;ct=0;obs,<//15001/65536>;ct=0;obs,<//15001/65542>;ct=0;obs,<//15001/65544>;ct=0;obs,<//15001/65543>;ct=0;obs,
...
So, the coap-client works, the next step is to run tradfri.tac from the command-line and post the output...

Regards,
M
Ravenbankie
Posts: 4
Joined: Tuesday 26 September 2017 22:53
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by Ravenbankie »

Hi moroen,

After a few days (and switching to the aiocoap branch) i get after a few hours an offline domoticz. I can't seem to find the problem. Were can I find the errorlog of domoticz? Domoticz says in systemctl: active(exited). And the tradfri service is running fine. Systemctl doesn't give much feedback for both . Can someone help me?
Last edited by Ravenbankie on Sunday 01 October 2017 20:09, edited 2 times in total.
Lars65
Posts: 41
Joined: Thursday 14 July 2016 20:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by Lars65 »

So I have spent a looooong time, compiling a new domoticz beta, i have installed python 3.6.0, and so on when I get to the point where I should this plugin, I get:
Traceback (most recent call last):
File "tradfri.tac", line 1, in <module>
from twisted.conch.telnet import TelnetTransport, TelnetProtocol
ImportError: No module named 'twisted' and it's installed, tried the opnssl, etc. everything I have got in the documentation on this page.
Any suggestios what do?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest