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

Python and python framework
sejonr
Posts: 16
Joined: Friday 05 May 2017 12:32
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by sejonr » Sunday 01 October 2017 21:23

moroen wrote:
Sunday 01 October 2017 17:15
sejonr wrote:
Sunday 01 October 2017 10:03
moroen wrote:
Friday 29 September 2017 12:14


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
Hi M

I got this...When i have stopped the service ikea-tradfri.service

Waiting for connection
Connected from IPv4Address(TCP, '127.0.0.1', 36926)
Data received: b'{"action": "setConfig", "key": "My Key", "gateway": "192.168.1.45", "observe": "True"}'

But when i start the service and restart domoticz i got this!

IKEA-tradfri COAP-adaptor version 0.3 started (command line)!
Waiting for connection
Unhandled error in Deferred:

Here is the ikea-tradfri.service file. I got the same problem when i dont have "/home/pi" and when i have other than user/groop =root i got COAP-adaptor connection fault.

[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

Very mutch thanks for your help! I realy want this to work :)

Brgd

R

Ravenbankie
Posts: 4
Joined: Tuesday 26 September 2017 22:53
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by Ravenbankie » Sunday 01 October 2017 21:30

sejonr wrote:
Sunday 01 October 2017 21:23
moroen wrote:
Sunday 01 October 2017 17:15
sejonr wrote:
Sunday 01 October 2017 10:03

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
Hi M

I got this...When i have stopped the service ikea-tradfri.service

Waiting for connection
Connected from IPv4Address(TCP, '127.0.0.1', 36926)
Data received: b'{"action": "setConfig", "key": "My Key", "gateway": "192.168.1.45", "observe": "True"}'

But when i start the service and restart domoticz i got this!

IKEA-tradfri COAP-adaptor version 0.3 started (command line)!
Waiting for connection
Unhandled error in Deferred:

Here is the ikea-tradfri.service file. I got the same problem when i dont have "/home/pi" and when i have other than user/groop =root i got COAP-adaptor connection fault.

[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

Very mutch thanks for your help! I realy want this to work :)

Brgd

R
You need to change the environment path to the path of your specific situation. In my situation it was /home/osmc/domoticz/plugins ..
The user and group needs to be the user and group that have root rights. In my case it is osmc:osmc

sejonr
Posts: 16
Joined: Friday 05 May 2017 12:32
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by sejonr » Sunday 01 October 2017 21:35

sejonr wrote:
Sunday 01 October 2017 21:23
moroen wrote:
Sunday 01 October 2017 17:15
sejonr wrote:
Sunday 01 October 2017 10:03

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
Hi M

I got this...When i have stopped the service ikea-tradfri.service

Waiting for connection
Connected from IPv4Address(TCP, '127.0.0.1', 36926)
Data received: b'{"action": "setConfig", "key": "My Key", "gateway": "192.168.1.45", "observe": "True"}'

But when i start the service and restart domoticz i got this!

IKEA-tradfri COAP-adaptor version 0.3 started (command line)!
Waiting for connection
Unhandled error in Deferred:

Here is the ikea-tradfri.service file. I got the same problem when i dont have "/home/pi" and when i have other than user/groop =root i got COAP-adaptor connection fault.

[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

Very mutch thanks for your help! I realy want this to work :)

Brgd

R
A little more information when i run: python3 -i -m pytradfri IP KEY with my IP and KEY
I got this message..............

DEBUG:pytradfri.api.libcoap_api:Executing 192.168.1.45 get ['status']
DEBUG:pytradfri.api.libcoap_api:Received: v:1 t:CON c:GET i:9809 {} [ ]
{}
Traceback (most recent call last):
File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.4/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/pi/pytradfri/pytradfri/__main__.py", line 19, in <module>
api = api_factory(sys.argv[1], sys.argv[2])
File "/home/pi/pytradfri/pytradfri/api/libcoap_api.py", line 131, in api_facto ry
request(Command('get', ['status']))
File "/home/pi/pytradfri/pytradfri/api/libcoap_api.py", line 78, in request
return _execute(api_commands[0])
File "/home/pi/pytradfri/pytradfri/api/libcoap_api.py", line 72, in _execute
api_command.result = _process_output(return_value, parse_json)
File "/home/pi/pytradfri/pytradfri/api/libcoap_api.py", line 159, in _process_ output
return json.loads(output)
File "/usr/lib/python3.4/json/__init__.py", line 318, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.4/json/decoder.py", line 343, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.4/json/decoder.py", line 361, in raw_decode
raise ValueError(errmsg("Expecting value", s, err.value)) from None
ValueError: Expecting value: line 1 column 1 (char 0)

Thank you again :)

moroen
Posts: 103
Joined: Sunday 15 January 2017 12:06
Target OS: Linux
Domoticz version: beta
Location: Norway
Contact:

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

Post by moroen » Monday 02 October 2017 15:37

sejonr wrote:
Sunday 01 October 2017 21:23

I got this...When i have stopped the service ikea-tradfri.service

Waiting for connection
Connected from IPv4Address(TCP, '127.0.0.1', 36926)
Data received: b'{"action": "setConfig", "key": "My Key", "gateway": "192.168.1.45", "observe": "True"}'

But when i start the service and restart domoticz i got this!

IKEA-tradfri COAP-adaptor version 0.3 started (command line)!
Waiting for connection
Unhandled error in Deferred:
Unhandled error in Deffered on startup usually means that the port already is taken, perhaps tradfri.tac is already running?

Try:

Code: Select all

$ sudo systemctrl stop ikea-tradfri

$ python3 tradfri.tac
I have just commited a small change to the tradfri.tac, which should give a more informative message if port-taken is the case...

Regards,
M

strelniece
Posts: 18
Joined: Sunday 20 December 2015 19:32
Target OS: Raspberry Pi
Domoticz version: 3.8153
Location: Sweden
Contact:

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

Post by strelniece » Monday 02 October 2017 20:54

Having some problems me too

can controll the lamp using coap-client, so so far so good.

running tradfri.tac gives (with service stopped)

Code: Select all

pi@pi:~/domoticz/plugins/IKEA-Tradfri $ python3 tradfri.tac
Traceback (most recent call last):
  File "tradfri.tac", line 2, in <module>
    from twisted.internet import protocol, task, reactor, endpoints
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/reactor.py", line 38, in <module>
    from twisted.internet import default
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/default.py", line 56, in <module>
    install = _getInstallFunction(platform)
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/default.py", line 44, in _getInstallFunction
    from twisted.internet.epollreactor import install
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/epollreactor.py", line 24, in <module>
    from twisted.internet import posixbase
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/posixbase.py", line 18, in <module>
    from twisted.internet import error, udp, tcp
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/tcp.py", line 28, in <module>
    from twisted.internet._newtls import (
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/_newtls.py", line 21, in <module>
    from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol
  File "/usr/local/lib/python3.4/dist-packages/twisted/protocols/tls.py", line 63, in <module>
    from twisted.internet._sslverify import _setAcceptableProtocols
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/_sslverify.py", line 38, in <module>
    TLSVersion.TLSv1_1: SSL.OP_NO_TLSv1_1,
AttributeError: 'module' object has no attribute 'OP_NO_TLSv1_1'
service start as should. Added Trådfri in hardware but no devices. the log in Domoticz (debugging mode) says:

Code: Select all

2017-10-02 20:46:48.315 (Trådfri) Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
2017-10-02 20:46:50.271 (Trådfri) Calling message handler 'onHeartbeat'.
2017-10-02 20:46:50.271 (Trådfri) Not connected - nextConnect: 3
2017-10-02 20:46:52.281 (Trådfri) Calling message handler 'onHeartbeat'.
2017-10-02 20:46:52.281 (Trådfri) Not connected - nextConnect: 2
2017-10-02 20:46:54.286 (Trådfri) Calling message handler 'onHeartbeat'.
2017-10-02 20:46:54.286 (Trådfri) Not connected - nextConnect: 1
2017-10-02 20:46:54.286 (Trådfri) Transport set to: 'TCP/IP', 127.0.0.1:1234.
2017-10-02 20:46:54.287 (Trådfri) Connect directive received, action initiated successfully.
2017-10-02 20:46:54.337 (Trådfri) Calling message handler 'onConnect'.
2017-10-02 20:46:54.337 (Trådfri) Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
2017-10-02 20:46:56.293 (Trådfri) Calling message handler 'onHeartbeat'.
2017-10-02 20:46:56.294 (Trådfri) Not connected - nextConnect: 3
2017-10-02 20:46:58.299 (Trådfri) Calling message handler 'onHeartbeat'.
2017-10-02 20:46:58.299 (Trådfri) Not connected - nextConnect: 2
2017-10-02 20:47:00.306 (Trådfri) Calling message handler 'onHeartbeat'.
2017-10-02 20:47:00.306 (Trådfri) Not connected - nextConnect: 1
2017-10-02 20:47:00.306 (Trådfri) Transport set to: 'TCP/IP', 127.0.0.1:1234.
...
Any help?

sejonr
Posts: 16
Joined: Friday 05 May 2017 12:32
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by sejonr » Monday 02 October 2017 23:08

moroen wrote:
Monday 02 October 2017 15:37
sejonr wrote:
Sunday 01 October 2017 21:23

I got this...When i have stopped the service ikea-tradfri.service

Waiting for connection
Connected from IPv4Address(TCP, '127.0.0.1', 36926)
Data received: b'{"action": "setConfig", "key": "My Key", "gateway": "192.168.1.45", "observe": "True"}'

But when i start the service and restart domoticz i got this!

IKEA-tradfri COAP-adaptor version 0.3 started (command line)!
Waiting for connection
Unhandled error in Deferred:
Unhandled error in Deffered on startup usually means that the port already is taken, perhaps tradfri.tac is already running?

Try:

Code: Select all

$ sudo systemctrl stop ikea-tradfri

$ python3 tradfri.tac
I have just commited a small change to the tradfri.tac, which should give a more informative message if port-taken is the case...

Regards,
M
Already tryed that and got this then it waits...
Waiting for connection
Connected from IPv4Address(TCP, '127.0.0.1', 36926)
Data received: b'{"action": "setConfig", "key": "My Key", "gateway": "192.168.1.45", "observe": "True"}'

moroen
Posts: 103
Joined: Sunday 15 January 2017 12:06
Target OS: Linux
Domoticz version: beta
Location: Norway
Contact:

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

Post by moroen » Tuesday 03 October 2017 1:47

strelniece wrote:
Monday 02 October 2017 20:54
Having some problems me too

can controll the lamp using coap-client, so so far so good.

running tradfri.tac gives (with service stopped)

Code: Select all

pi@pi:~/domoticz/plugins/IKEA-Tradfri $ python3 tradfri.tac
Traceback (most recent call last):
  File "tradfri.tac", line 2, in <module>
    from twisted.internet import protocol, task, reactor, endpoints
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/reactor.py", line 38, in <module>
    from twisted.internet import default
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/default.py", line 56, in <module>
    install = _getInstallFunction(platform)
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/default.py", line 44, in _getInstallFunction
    from twisted.internet.epollreactor import install
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/epollreactor.py", line 24, in <module>
    from twisted.internet import posixbase
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/posixbase.py", line 18, in <module>
    from twisted.internet import error, udp, tcp
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/tcp.py", line 28, in <module>
    from twisted.internet._newtls import (
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/_newtls.py", line 21, in <module>
    from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol
  File "/usr/local/lib/python3.4/dist-packages/twisted/protocols/tls.py", line 63, in <module>
    from twisted.internet._sslverify import _setAcceptableProtocols
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/_sslverify.py", line 38, in <module>
    TLSVersion.TLSv1_1: SSL.OP_NO_TLSv1_1,
AttributeError: 'module' object has no attribute 'OP_NO_TLSv1_1'
service start as should. Added Trådfri in hardware but no devices. the log in Domoticz (debugging mode) says:

Code: Select all

2017-10-02 20:46:48.315 (Trådfri) Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
2017-10-02 20:46:50.271 (Trådfri) Calling message handler 'onHeartbeat'.
2017-10-02 20:46:50.271 (Trådfri) Not connected - nextConnect: 3
2017-10-02 20:46:52.281 (Trådfri) Calling message handler 'onHeartbeat'.
2017-10-02 20:46:52.281 (Trådfri) Not connected - nextConnect: 2
2017-10-02 20:46:54.286 (Trådfri) Calling message handler 'onHeartbeat'.
2017-10-02 20:46:54.286 (Trådfri) Not connected - nextConnect: 1
2017-10-02 20:46:54.286 (Trådfri) Transport set to: 'TCP/IP', 127.0.0.1:1234.
2017-10-02 20:46:54.287 (Trådfri) Connect directive received, action initiated successfully.
2017-10-02 20:46:54.337 (Trådfri) Calling message handler 'onConnect'.
2017-10-02 20:46:54.337 (Trådfri) Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
2017-10-02 20:46:56.293 (Trådfri) Calling message handler 'onHeartbeat'.
2017-10-02 20:46:56.294 (Trådfri) Not connected - nextConnect: 3
2017-10-02 20:46:58.299 (Trådfri) Calling message handler 'onHeartbeat'.
2017-10-02 20:46:58.299 (Trådfri) Not connected - nextConnect: 2
2017-10-02 20:47:00.306 (Trådfri) Calling message handler 'onHeartbeat'.
2017-10-02 20:47:00.306 (Trådfri) Not connected - nextConnect: 1
2017-10-02 20:47:00.306 (Trådfri) Transport set to: 'TCP/IP', 127.0.0.1:1234.
...
Any help?

There's probably an error with the version of openssl, it's been discussed in this thread previously. You might find this link helpfull:
https://github.com/django/daphne/issues/83

It's for django and python 2.x, but there's at least two solutions to try!

Regards,
M

moroen
Posts: 103
Joined: Sunday 15 January 2017 12:06
Target OS: Linux
Domoticz version: beta
Location: Norway
Contact:

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

Post by moroen » Tuesday 03 October 2017 1:49

sejonr wrote:
Monday 02 October 2017 23:08
Already tryed that and got this then it waits...
Waiting for connection
Connected from IPv4Address(TCP, '127.0.0.1', 36926)
Data received: b'{"action": "setConfig", "key": "My Key", "gateway": "192.168.1.45", "observe": "True"}'
It probably waits for a return from the coap-client/gateway. It might be a long shot, but have you tried to cycle the power on the gateway? It seems the gateway might hang, while still responding to pings, no coap is returned...

Regards,
M

strelniece
Posts: 18
Joined: Sunday 20 December 2015 19:32
Target OS: Raspberry Pi
Domoticz version: 3.8153
Location: Sweden
Contact:

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

Post by strelniece » Tuesday 03 October 2017 8:32

moroen wrote:
Tuesday 03 October 2017 1:47
strelniece wrote:
Monday 02 October 2017 20:54
Having some problems me too

can controll the lamp using coap-client, so so far so good.

running tradfri.tac gives (with service stopped)

Code: Select all

pi@pi:~/domoticz/plugins/IKEA-Tradfri $ python3 tradfri.tac
Traceback (most recent call last):
  File "tradfri.tac", line 2, in <module>
    from twisted.internet import protocol, task, reactor, endpoints
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/reactor.py", line 38, in <module>
    from twisted.internet import default
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/default.py", line 56, in <module>
    install = _getInstallFunction(platform)
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/default.py", line 44, in _getInstallFunction
    from twisted.internet.epollreactor import install
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/epollreactor.py", line 24, in <module>
    from twisted.internet import posixbase
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/posixbase.py", line 18, in <module>
    from twisted.internet import error, udp, tcp
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/tcp.py", line 28, in <module>
    from twisted.internet._newtls import (
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/_newtls.py", line 21, in <module>
    from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol
  File "/usr/local/lib/python3.4/dist-packages/twisted/protocols/tls.py", line 63, in <module>
    from twisted.internet._sslverify import _setAcceptableProtocols
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/_sslverify.py", line 38, in <module>
    TLSVersion.TLSv1_1: SSL.OP_NO_TLSv1_1,
AttributeError: 'module' object has no attribute 'OP_NO_TLSv1_1'
service start as should. Added Trådfri in hardware but no devices. the log in Domoticz (debugging mode) says:

Code: Select all

2017-10-02 20:46:48.315 (Trådfri) Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
2017-10-02 20:46:50.271 (Trådfri) Calling message handler 'onHeartbeat'.
2017-10-02 20:46:50.271 (Trådfri) Not connected - nextConnect: 3
2017-10-02 20:46:52.281 (Trådfri) Calling message handler 'onHeartbeat'.
2017-10-02 20:46:52.281 (Trådfri) Not connected - nextConnect: 2
2017-10-02 20:46:54.286 (Trådfri) Calling message handler 'onHeartbeat'.
2017-10-02 20:46:54.286 (Trådfri) Not connected - nextConnect: 1
2017-10-02 20:46:54.286 (Trådfri) Transport set to: 'TCP/IP', 127.0.0.1:1234.
2017-10-02 20:46:54.287 (Trådfri) Connect directive received, action initiated successfully.
2017-10-02 20:46:54.337 (Trådfri) Calling message handler 'onConnect'.
2017-10-02 20:46:54.337 (Trådfri) Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
2017-10-02 20:46:56.293 (Trådfri) Calling message handler 'onHeartbeat'.
2017-10-02 20:46:56.294 (Trådfri) Not connected - nextConnect: 3
2017-10-02 20:46:58.299 (Trådfri) Calling message handler 'onHeartbeat'.
2017-10-02 20:46:58.299 (Trådfri) Not connected - nextConnect: 2
2017-10-02 20:47:00.306 (Trådfri) Calling message handler 'onHeartbeat'.
2017-10-02 20:47:00.306 (Trådfri) Not connected - nextConnect: 1
2017-10-02 20:47:00.306 (Trådfri) Transport set to: 'TCP/IP', 127.0.0.1:1234.
...
Any help?

There's probably an error with the version of openssl, it's been discussed in this thread previously. You might find this link helpfull:
https://github.com/django/daphne/issues/83

It's for django and python 2.x, but there's at least two solutions to try!

Regards,
M
Ah, thanks, missed that one, but did at least partly solved the problem, but my lamp will not turn up in devices list,

tradfri.tac gives:

Code: Select all

pi@automata:~/domoticz/plugins/IKEA-Tradfri $ python3 tradfri.tac
IKEA-tradfri COAP-adaptor version 0.3 started (command line)!
Connected from IPv4Address(TCP, '127.0.0.1', 58398)
Data received: b'{"key": "xxxxxxxxxxx", "action": "setConfig", "observe": "True", "gateway": "192.168.0.43"}'
Unhandled Error
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/twisted/python/log.py", line 103, in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
  File "/usr/local/lib/python3.4/dist-packages/twisted/python/log.py", line 86, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "/usr/local/lib/python3.4/dist-packages/twisted/python/context.py", line 122, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/usr/local/lib/python3.4/dist-packages/twisted/python/context.py", line 85, in callWithContext
    return func(*args,**kw)
--- <exception caught here> ---
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
    why = selectable.doRead()
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/tcp.py", line 205, in doRead
    return self._dataReceived(data)
  File "/usr/local/lib/python3.4/dist-packages/twisted/internet/tcp.py", line 211, in _dataReceived
    rval = self.protocol.dataReceived(data)
  File "tradfri.tac", line 69, in dataReceived
    self.factory.initGateway(self, command['gateway'], command['key'], command['observe'])
  File "tradfri.tac", line 250, in initGateway
    for group in self.groups:
builtins.TypeError: 'Group' object is not iterable

Domoticz log gives:

Code: Select all

2017-10-03 08:19:03.212 PluginSystem: Restarting I/O service thread.
2017-10-03 08:19:03.213 (Trådfri) Calling message handler 'onDisconnect'.
2017-10-03 08:19:03.213 (Trådfri) Device has disconnected
2017-10-03 08:19:04.766 (Trådfri) Calling message handler 'onHeartbeat'.
2017-10-03 08:19:04.766 (Trådfri) Not connected - nextConnect: 3
2017-10-03 08:19:06.773 (Trådfri) Calling message handler 'onHeartbeat'.
2017-10-03 08:19:06.773 (Trådfri) Not connected - nextConnect: 2
2017-10-03 08:19:08.777 (Trådfri) Calling message handler 'onHeartbeat'.
2017-10-03 08:19:08.777 (Trådfri) Not connected - nextConnect: 1
2017-10-03 08:19:08.777 (Trådfri) Transport set to: 'TCP/IP', 127.0.0.1:1234.
2017-10-03 08:19:08.777 PluginSystem: Starting I/O service thread.
2017-10-03 08:19:08.778 (Trådfri) Connect directive received, action initiated successfully.
2017-10-03 08:19:08.828 (Trådfri) Calling message handler 'onConnect'.
2017-10-03 08:19:08.828 (Trådfri) Connected successfully to: 192.168.0.43
2017-10-03 08:19:08.828 (Trådfri) Received 61 bytes of data:.
2017-10-03 08:19:08.828 (Trådfri) 7b 22 73 74 61 74 75 73 22 3a 20 22 4f 6b 22 2c 20 22 61 63 {"status":."Ok",."ac
2017-10-03 08:19:08.828 (Trådfri) 74 69 6f 6e 22 3a 20 22 63 6c 69 65 6e 74 43 6f 6e 6e 65 63 tion":."clientConnec
2017-10-03 08:19:08.828 (Trådfri) 74 22 2c 20 22 76 65 72 73 69 6f 6e 22 3a 20 22 30 2e 33 22 t",."version":."0.3"
2017-10-03 08:19:08.829 (Trådfri) 7d .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. }
2017-10-03 08:19:08.829 (Trådfri) Calling message handler 'onMessage'.
2017-10-03 08:19:08.829 (Trådfri) Received: b'{"status": "Ok", "action": "clientConnect", "version": "0.3"}'
2017-10-03 08:19:09.029 (Trådfri) Sending 97 bytes of data:.
2017-10-03 08:19:09.029 (Trådfri) 7b 22 6b 65 79 22 3a 20 22 63 74 4c 69 54 62 62 64 74 4f 49 {"key":."xxxxxxxxxx
2017-10-03 08:19:09.029 (Trådfri) 61 67 6c 45 43 22 2c 20 22 61 63 74 69 6f 6e 22 3a 20 22 73 xxx",."action":."s
2017-10-03 08:19:09.029 (Trådfri) 65 74 43 6f 6e 66 69 67 22 2c 20 22 6f 62 73 65 72 76 65 22 etConfig",."observe"
2017-10-03 08:19:09.030 (Trådfri) 3a 20 22 54 72 75 65 22 2c 20 22 67 61 74 65 77 61 79 22 3a :."True",."gateway":
2017-10-03 08:19:09.030 (Trådfri) 20 22 31 39 32 2e 31 36 38 2e 31 31 2e 34 33 22 7d .. .. .. ."192.168.0.43"}
2017-10-03 08:19:09.230 PluginSystem: Restarting I/O service thread.
2017-10-03 08:19:09.231 (Trådfri) Calling message handler 'onDisconnect'.
2017-10-03 08:19:09.231 (Trådfri) Device has disconnected
2017-10-03 08:19:10.784 (Trådfri) Calling message handler 'onHeartbeat'.
2017-10-03 08:19:10.784 (Trådfri) Not connected - nextConnect: 3
2017-10-03 08:19:12.788 (Trådfri) Calling message handler 'onHeartbeat'.
2017-10-03 08:19:12.788 (Trådfri) Not connected - nextConnect: 2
2017-10-03 08:19:14.792 (Trådfri) Calling message handler 'onHeartbeat'.
2017-10-03 08:19:14.792 (Trådfri) Not connected - nextConnect: 1
2017-10-03 08:19:14.792 (Trådfri) Transport set to: 'TCP/IP', 127.0.0.1:1234.
2017-10-03 08:19:14.793 PluginSystem: Starting I/O service thread.
2017-10-03 08:19:14.793 (Trådfri) Connect directive received, action initiated successfully.

regards

F

sejonr
Posts: 16
Joined: Friday 05 May 2017 12:32
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by sejonr » Tuesday 03 October 2017 16:36

moroen wrote:
Tuesday 03 October 2017 1:49
sejonr wrote:
Monday 02 October 2017 23:08
Already tryed that and got this then it waits...
Waiting for connection
Connected from IPv4Address(TCP, '127.0.0.1', 36926)
Data received: b'{"action": "setConfig", "key": "My Key", "gateway": "192.168.1.45", "observe": "True"}'
It probably waits for a return from the coap-client/gateway. It might be a long shot, but have you tried to cycle the power on the gateway? It seems the gateway might hang, while still responding to pings, no coap is returned...

Regards,
M
It didnt work. I m sorry I give up :( I think i will use another solution here on this forum instead.

Lars65
Posts: 21
Joined: Thursday 14 July 2016 20:49
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by Lars65 » Tuesday 03 October 2017 19:24

I have manage to get it working, except for domoticz where I get this:
2017-10-03 19:09:10.263 (Ikea) Connected successfully to: 192.168.1.233
2017-10-03 19:09:10.314 Error: (Ikea) 'onMessage' failed 'TypeError':'onMessage() missing 2 required positional arguments: 'Status' and 'Extra''.
2017-10-03 19:09:12.669 Error: (Ikea) 'onMessage' failed 'TypeError':'onMessage() missing 2 required positional arguments: 'Status' and 'Extra''.
2017-10-03 19:09:24.092 Error: (Ikea) 'onMessage' failed 'TypeError':'onMessage() missing 2 required positional arguments: 'Status' and 'Extra''.
2017-10-03 19:09:34.113 Error: (Ikea) 'onMessage' failed 'TypeError':'onMessage() missing 2 required positional arguments: 'Status' and 'Extra''.
2017-10-03 19:09:42.130 Error: (Ikea) 'onMessage' failed 'TypeError':'onMessage() missing 2 required positional arguments: 'Status' and 'Extra''.
2017-10-03 19:09:52.099 Error: (Ikea) 'onMessage' failed 'TypeError':'onMessage() missing 2 required positional arguments: 'Status' and 'Extra''.
2017-10-03 19:12:12.123 Error: (Ikea) 'onMessage' failed 'TypeError':'onMessage() missing 2 required positional arguments: 'Status' and 'Extra''.
2017-10-03 19:12:16.131 Error: (Ikea) 'onMessage' failed 'TypeError':'onMessage() missing 2 required positional arguments: 'Status' and 'Extra''.
2017-10-03 19:12:28.105 Error: (Ikea) 'onMessage' failed 'TypeError':'onMessage() missing 2 required positional arguments: 'Status' and 'Extra''.
2017-10-03 19:12:38.124 Error: (Ikea) 'onMessage' failed 'TypeError':'onMessage() missing 2 required positional arguments: 'Status' and 'Ex
in putty i get this:
pi@DomoticzComplete:~/domoticz/plugins/IKEA-Tradfri $ python3 tradfri.tac
IKEA-tradfri COAP-adaptor version 0.3 started (command line)!
Connected from IPv4Address(TCP, '127.0.0.1', 51072)
Data received: b'{"gateway": "192.168.1.233", "observe": "True", "key": "cpsallg GYwgxbeMz", "action": "setConfig"}'
{'action': 'deviceUpdate', 'status': 'Ok', 'result': [{'DeviceID': 65540, 'Name' : 'Lottas lampa', 'State': False, 'Level': 254, 'Hex': None}]}
{'action': 'deviceUpdate', 'status': 'Ok', 'result': [{'DeviceID': 65541, 'Name' : 'Lars lampa', 'State': False, 'Level': 254, 'Hex': None}]}
{'action': 'deviceUpdate', 'status': 'Ok', 'result': [{'DeviceID': 65541, 'Name' : 'Lars lampa', 'State': True, 'Level': 254, 'Hex': None}]}
{'action': 'deviceUpdate', 'status': 'Ok', 'result': [{'DeviceID': 65540, 'Name' : 'Lottas lampa', 'State': True, 'Level': 254, 'Hex': None}]}
Error in annouce:
{'action': 'deviceUpdate', 'status': 'Ok', 'result': [{'DeviceID': 65540, 'Name'

any suggestions?

moroen
Posts: 103
Joined: Sunday 15 January 2017 12:06
Target OS: Linux
Domoticz version: beta
Location: Norway
Contact:

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

Post by moroen » Tuesday 03 October 2017 21:14

Lars65 wrote:
Tuesday 03 October 2017 19:24
I have manage to get it working, except for domoticz where I get this:
2017-10-03 19:09:10.263 (Ikea) Connected successfully to: 192.168.1.233
any suggestions?
You have to match the branch of domoticz with the correct branch of the plugin! :)

The plugin's master branch should work with the master-branch of domoticz (aka latest stable) and the development-branch of the plugin is for the development-branch of domoticz (aka. latest beta)...

From the error message, I think your're using the development branch of the plugin with the latest domoticz stable...

Regards,
M

moroen
Posts: 103
Joined: Sunday 15 January 2017 12:06
Target OS: Linux
Domoticz version: beta
Location: Norway
Contact:

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

Post by moroen » Tuesday 03 October 2017 21:16

sejonr wrote:
Tuesday 03 October 2017 16:36
moroen wrote:
Tuesday 03 October 2017 1:49
sejonr wrote:
Monday 02 October 2017 23:08
Already tryed that and got this then it waits...
Waiting for connection
Connected from IPv4Address(TCP, '127.0.0.1', 36926)
Data received: b'{"action": "setConfig", "key": "My Key", "gateway": "192.168.1.45", "observe": "True"}'
It probably waits for a return from the coap-client/gateway. It might be a long shot, but have you tried to cycle the power on the gateway? It seems the gateway might hang, while still responding to pings, no coap is returned...
It didnt work. I m sorry I give up :( I think i will use another solution here on this forum instead.
Sorry that it didn't work out, if tradfri.tac hangs after setConfig, it's waiting for a reponse from the coap-client...

Regards,
M

sejonr
Posts: 16
Joined: Friday 05 May 2017 12:32
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by sejonr » Tuesday 03 October 2017 22:59

moroen wrote:
Tuesday 03 October 2017 21:16
sejonr wrote:
Tuesday 03 October 2017 16:36
moroen wrote:
Tuesday 03 October 2017 1:49


It probably waits for a return from the coap-client/gateway. It might be a long shot, but have you tried to cycle the power on the gateway? It seems the gateway might hang, while still responding to pings, no coap is returned...
It didnt work. I m sorry I give up :( I think i will use another solution here on this forum instead.
Sorry that it didn't work out, if tradfri.tac hangs after setConfig, it's waiting for a reponse from the coap-client...

Regards,
M
I just controlled one of my IKEA-Lamps with a coap-client command :) So the coap client works but when i run pytradfri commands i get lots of failure like this.....Is it something about ownership? Or a library that is missing?

pi@raspberrypi:~/pytradfri $ sudo python3 -i -m pytradfri 192.168.1.45 sNglOCRRD 0lHRXO0
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.1.45 get ['status']
DEBUG:pytradfri.api.libcoap_api:Received: v:1 t:CON c:GET i:bc25 {} [ ]
{}
Traceback (most recent call last):
File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.4/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/pi/pytradfri/pytradfri/__main__.py", line 19, in <module>
api = api_factory(sys.argv[1], sys.argv[2])
File "/home/pi/pytradfri/pytradfri/api/libcoap_api.py", line 131, in api_facto ry
request(Command('get', ['status']))
File "/home/pi/pytradfri/pytradfri/api/libcoap_api.py", line 78, in request
return _execute(api_commands[0])
File "/home/pi/pytradfri/pytradfri/api/libcoap_api.py", line 72, in _execute
api_command.result = _process_output(return_value, parse_json)
File "/home/pi/pytradfri/pytradfri/api/libcoap_api.py", line 159, in _process_ output
return json.loads(output)
File "/usr/lib/python3.4/json/__init__.py", line 318, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.4/json/decoder.py", line 343, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.4/json/decoder.py", line 361, in raw_decode
raise ValueError(errmsg("Expecting value", s, err.value)) from None
ValueError: Expecting value: line 1 column 1 (char 0)

Ravenbankie
Posts: 4
Joined: Tuesday 26 September 2017 22:53
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by Ravenbankie » Tuesday 03 October 2017 23:50

i'm also pretty lost.

when i run python3 tradfri.tac i get the data below. So for all i know it's working including the plugin. right?

Code: Select all

IKEA-tradfri COAP-adaptor version 0.3 started (command line)!
Waiting for connection
Connected from IPv4Address(TCP, '127.0.0.1', 35828)
Data received: b'{"action": "setConfig", "gateway": "192.168.1.10", "key": "CODE", "observe": "False"}'
Data received: b'{"action": "getLights"}'
Device settings not found for TRADFRI bulb GU10 W 400lm. Creating defaults!
Device settings not found for TRADFRI bulb E27 opal 1000lm. Creating defaults!
Device settings not found for TRADFRI bulb E27 CWS opal 600lm. Creating defaults                                                                                                             !
Device settings not found for TRADFRI bulb E14 W op/ch 400lm. Creating defaults!
Device settings not found for TRADFRI bulb E27 W opal 1000lm. Creating defaults!
{"action": "getLights", "status": "Ok", "result": [{"DeviceID": 65546, "Name": "                                                                                                             TRADFRI bulb GU10 W 400lm 3", "Type": "Light", "Dimmable": true, "HasWB": true,                                                                                                              "HasRGB": false}, {"DeviceID": 65539, "Name": "lamp2 tv", "Type": "Light", "Dimm                                                                                                             able": true, "HasWB": true, "HasRGB": false}, {"DeviceID": 65540, "Name": "lamp1                                                                                                              tv", "Type": "Light", "Dimmable": true, "HasWB": true, "HasRGB": false}, {"Devi                                                                                                             ceID": 65547, "Name": "hal", "Type": "Light", "Dimmable": true, "HasWB": true, "                                                                                                             HasRGB": false}, {"DeviceID": 65545, "Name": "TRADFRI bulb GU10 W 400lm 4", "Typ                                                                                                             e": "Light", "Dimmable": true, "HasWB": true, "HasRGB": false}, {"DeviceID": 655                                                                                                             48, "Name": "eettafel", "Type": "Light", "Dimmable": true, "HasWB": true, "HasRG                                                                                                             B": false}, {"DeviceID": 65537, "Name": "kleurlamp woonkamer", "Type": "Light",                                                                                                              "Dimmable": true, "HasWB": true, "HasRGB": false}, {"DeviceID": 65543, "Name": "                                                                                                             trapkast", "Type": "Light", "Dimmable": true, "HasWB": true, "HasRGB": false}, {                                                                                                             "DeviceID": 65542, "Name": "wc beneden", "Type": "Light", "Dimmable": true, "Has                                                                                                             WB": true, "HasRGB": false}, {"DeviceID": 65538, "Name": "overloop", "Type": "Li                                                                                                             ght", "Dimmable": true, "HasWB": true, "HasRGB": false}, {"DeviceID": 176742, "N                                                                                                             ame": "Group - slaapkamer", "Type": "Group", "Dimmable": true, "HasWB": false},                                                                                                              {"DeviceID": 134152, "Name": "Group - gang", "Type": "Group", "Dimmable": true,                                                                                                              "HasWB": false}, {"DeviceID": 173639, "Name": "Group - groep woonkamer", "Type":                                                                                                              "Group", "Dimmable": true, "HasWB": false}, {"DeviceID": 147804, "Name": "Group                                                                                                              - Groep wc en trapkast", "Type": "Group", "Dimmable": true, "HasWB": false}]}
{'action': 'deviceUpdate', 'status': 'Ok', 'result': [{'DeviceID': 65546, 'Name'                                                                                                             : 'TRADFRI bulb GU10 W 400lm 3', 'State': False, 'Level': 35, 'Hex': None}]}
{'action': 'deviceUpdate', 'status': 'Ok', 'result': [{'DeviceID': 65539, 'Name'                                                                                                             : 'lamp2 tv', 'State': True, 'Level': 68, 'Hex': None}]}
{'action': 'deviceUpdate', 'status': 'Ok', 'result': [{'DeviceID': 65540, 'Name'                                                                                                             : 'lamp1 tv', 'State': True, 'Level': 73, 'Hex': None}]}
{'action': 'deviceUpdate', 'status': 'Ok', 'result': [{'DeviceID': 65547, 'Name'                                                                                                             : 'hal', 'State': False, 'Level': 35, 'Hex': None}]}
{'action': 'deviceUpdate', 'status': 'Ok', 'result': [{'DeviceID': 65545, 'Name'                                                                                                             : 'TRADFRI bulb GU10 W 400lm 4', 'State': False, 'Level': 35, 'Hex': None}]}
{'action': 'deviceUpdate', 'status': 'Ok', 'result': [{'DeviceID': 65548, 'Name'                                                                                                             : 'eettafel', 'State': True, 'Level': 76, 'Hex': 'f1e0b5'}]}
{'action': 'deviceUpdate', 'status': 'Ok', 'result': [{'DeviceID': 65537, 'Name'                                                                                                             : 'kleurlamp woonkamer', 'State': True, 'Level': 152, 'Hex': '0'}]}
{'action': 'deviceUpdate', 'status': 'Ok', 'result': [{'DeviceID': 65543, 'Name'                                                                                                             : 'trapkast', 'State': False, 'Level': 81, 'Hex': None}]}
{'action': 'deviceUpdate', 'status': 'Ok', 'result': [{'DeviceID': 65542, 'Name'                                                                                                             : 'wc beneden', 'State': True, 'Level': 71, 'Hex': None}]}
{'action': 'deviceUpdate', 'status': 'Ok', 'result': [{'DeviceID': 65538, 'Name'                                                                                                             : 'overloop', 'State': False, 'Level': 10, 'Hex': None}]}
{'action': 'deviceUpdate', 'status': 'Ok', 'result': [{'DeviceID': 176742, 'Name                                                                                                             ': 'slaapkamer', 'State': False, 'Level': 0}]}
{'action': 'deviceUpdate', 'status': 'Ok', 'result': [{'DeviceID': 134152, 'Name                                                                                                             ': 'gang', 'State': False, 'Level': 0}]}
{'action': 'deviceUpdate', 'status': 'Ok', 'result': [{'DeviceID': 173639, 'Name                                                                                                             ': 'groep woonkamer', 'State': False, 'Level': 0}]}
{'action': 'deviceUpdate', 'status': 'Ok', 'result': [{'DeviceID': 147804, 'Name                                                                                                             ': 'Groep wc en trapkast', 'State': False, 'Level': 0}]}
Disconnected
When i add it in domoticz (see below) it won't add the devices. and it looks like won't do anything. How can i find the error in domoticz?

i'm on the AIOCOAP branch with Python 3.6.2

Code: Select all

2017-10-03 23:58:21.036 (tradfri) Calling message handler 'onConnect'.
2017-10-03 23:58:21.036 (tradfri) Connected successfully to: 192.168.1.10
2017-10-03 23:58:22.039 (tradfri) Sending 96 bytes of data:.
2017-10-03 23:58:22.039 (tradfri) 7b 22 61 63 74 69 6f 6e 22 3a 20 22 73 65 74 43 6f 6e 66 69 {"action":."setConfi
2017-10-03 23:58:22.039 (tradfri) 67 22 2c 20 22 67 61 74 65 77 61 79 22 3a 20 22 31 39 32 2e g",."gateway":."192.
2017-10-03 23:58:22.039 (tradfri) 31 36 38 2e 31 2e 31 30 22 2c 20 22 6b 65 79 22 3a 20 22 50 168.1.10",."key":."P
2017-10-03 23:58:22.039 (tradfri) 36 50 36 67 30 37 79 7a 5a 57 6f 65 53 44 34 22 2c 20 22 6f code_serial",."o
2017-10-03 23:58:22.039 (tradfri) 62 73 65 72 76 65 22 3a 20 22 54 72 75 65 22 7d .. .. .. .. bserve":."True"}
2017-10-03 23:58:30.507 (tradfri) Calling message handler 'onHeartbeat'.
2017-10-03 23:58:32.513 (tradfri) Calling message handler 'onHeartbeat'.
2017-10-03 23:58:34.520 (tradfri) Calling message handler 'onHeartbeat'.
2017-10-03 23:58:36.526 (tradfri) Calling message handler 'onHeartbeat'.

moroen
Posts: 103
Joined: Sunday 15 January 2017 12:06
Target OS: Linux
Domoticz version: beta
Location: Norway
Contact:

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

Post by moroen » Wednesday 04 October 2017 0:34

sejonr wrote:
Tuesday 03 October 2017 22:59

I just controlled one of my IKEA-Lamps with a coap-client command :) So the coap client works but when i run pytradfri commands i get lots of failure like this.....Is it something about ownership? Or a library that is missing?

pi@raspberrypi:~/pytradfri $ sudo python3 -i -m pytradfri 192.168.1.45 sNglOCRRD 0lHRXO0
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.1.45 get ['status']
DEBUG:pytradfri.api.libcoap_api:Received: v:1 t:CON c:GET i:bc25 {} [ ]
{}
Traceback (most recent call last):
File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
...
File "/usr/lib/python3.4/json/decoder.py", line 361, in raw_decode
raise ValueError(errmsg("Expecting value", s, err.value)) from None
ValueError: Expecting value: line 1 column 1 (char 0)
I'm not able to determine why pytradfri fails, but this line suggest that the library doesn't get a response it can decode from the coap-client. Just to make sure, which version of coap-client do you have?

Regards,
M

sejonr
Posts: 16
Joined: Friday 05 May 2017 12:32
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by sejonr » Wednesday 04 October 2017 9:30

moroen wrote:
Wednesday 04 October 2017 0:34
sejonr wrote:
Tuesday 03 October 2017 22:59

I just controlled one of my IKEA-Lamps with a coap-client command :) So the coap client works but when i run pytradfri commands i get lots of failure like this.....Is it something about ownership? Or a library that is missing?

pi@raspberrypi:~/pytradfri $ sudo python3 -i -m pytradfri 192.168.1.45 sNglOCRRD 0lHRXO0
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.1.45 get ['status']
DEBUG:pytradfri.api.libcoap_api:Received: v:1 t:CON c:GET i:bc25 {} [ ]
{}
Traceback (most recent call last):
File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
...
File "/usr/lib/python3.4/json/decoder.py", line 361, in raw_decode
raise ValueError(errmsg("Expecting value", s, err.value)) from None
ValueError: Expecting value: line 1 column 1 (char 0)
I'm not able to determine why pytradfri fails, but this line suggest that the library doesn't get a response it can decode from the coap-client. Just to make sure, which version of coap-client do you have?

Regards,
M
I used the version fr.o.m. This URL

https://learn.pimoroni.com/tutorial/san ... om-your-pi

Brgd

R

moroen
Posts: 103
Joined: Sunday 15 January 2017 12:06
Target OS: Linux
Domoticz version: beta
Location: Norway
Contact:

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

Post by moroen » Wednesday 04 October 2017 9:40

sejonr wrote:
Wednesday 04 October 2017 9:30

I used the version fr.o.m. This URL

https://learn.pimoroni.com/tutorial/san ... om-your-pi
Ah, that might be the problem. Please try to install coap-client using the instructions/script from pytradfri:

https://github.com/ggravlingen/pytradfr ... -client.sh

Regards,
M

sejonr
Posts: 16
Joined: Friday 05 May 2017 12:32
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by sejonr » Wednesday 04 October 2017 11:12

moroen wrote:
Wednesday 04 October 2017 9:40
sejonr wrote:
Wednesday 04 October 2017 9:30

I used the version fr.o.m. This URL

https://learn.pimoroni.com/tutorial/san ... om-your-pi
Ah, that might be the problem. Please try to install coap-client using the instructions/script from pytradfri:

https://github.com/ggravlingen/pytradfr ... -client.sh

Regards,
M
Hi When i did that i have some error during installation. Can i use sudo before make install ?

Tanks :)

Regards R

globulus
Posts: 2
Joined: Wednesday 04 October 2017 12:41
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by globulus » Wednesday 04 October 2017 13:01

Hi moroen,
I had the same error than andi2016 :
python3 tradfri.tac produces

Code: Select all

for group in self.groups:
builtins.TypeError: 'Group' object is not iterable

Disconnected
coap-client -k xxx coaps://192.168.1.108/15004/
returns

Code: Select all

v:1 t:CON c:GET i:c822 {} [ ]
[159174]
and
coap-client -k xxx coaps://192.168.1.108/.well-known/core
returns

Code: Select all

v:1 t:CON c:GET i:d62f {} [ ]
<//15001/65537>;ct=0;obs,<//15001/65536>;ct=0;obs,<//15004/159174>;ct=0;obs,<//15005/159174>;ct=0;obs,<//15005/159174/211086>;ct=0;obs,<//15005/159174/218489>;ct=0;obs,<//15005/159174/208756>;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
As I added a second group of bulbs to the gateway, it worked !
So the problem seems to be linked to the number of groups.

However, in Domoticz, I added a group from the devices list with the green arrow.
I tried successfuly to change the dim level in the switch tab once and then domoticz crashed with a segmentation fault.
Now Domoticz does not start anymore :

Code: Select all

2017-10-04 12:48:19.102  (Tradfri - Group - chambre) Updating device from 0:'1' to have values 0:'1'.
2017-10-04 12:48:19.105  (Tradfri) Received 121 bytes of data:.
2017-10-04 12:48:19.105  (Tradfri)     7b 22 73 74 61 74 75 73 22 3a 20 22 4f 6b 22 2c 20 22 61 63     {"status":."Ok",."ac
2017-10-04 12:48:19.106  (Tradfri)     74 69 6f 6e 22 3a 20 22 64 65 76 69 63 65 55 70 64 61 74 65     tion":."deviceUpdate
2017-10-04 12:48:19.106  (Tradfri)     22 2c 20 22 72 65 73 75 6c 74 22 3a 20 5b 7b 22 4e 61 6d 65     ",."result":.[{"Name
2017-10-04 12:48:19.106  (Tradfri)     22 3a 20 22 73 61 6c 6f 6e 22 2c 20 22 53 74 61 74 65 22 3a     ":."salon",."State":
2017-10-04 12:48:19.107  (Tradfri)     20 74 72 75 65 2c 20 22 4c 65 76 65 6c 22 3a 20 35 37 2c 20     .true,."Level":.57,.
2017-10-04 12:48:19.107  (Tradfri)     22 44 65 76 69 63 65 49 44 22 3a 20 31 35 39 31 37 34 7d 5d     "DeviceID":.159174}]
2017-10-04 12:48:19.107  (Tradfri)     7d .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..     }
2017-10-04 12:48:19.108  (Tradfri) Calling message handler 'onMessage'.
2017-10-04 12:48:19.108  (Tradfri) Received: b'{"status": "Ok", "action": "deviceUpdate", "result": [{"Name": "salon", "State": true, "Level": 57, "DeviceID": 159174}]}'
2017-10-04 12:48:19.109  (Tradfri - Group - salon) Updating device from 1:'22' to have values 1:'22'.
Erreur de segmentation

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests