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

Python and python framework
dzjr
Posts: 11
Joined: Monday 02 July 2018 23:35
Target OS: Raspberry Pi
Domoticz version: 4.9942B
Location: Alkmaar, The Netherlands
Contact:

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

Post by dzjr » Sunday 09 September 2018 21:22

moroen wrote:
Friday 31 August 2018 14:17

Glad it worked out for you!

I've been toying with an idea to handle the whole IDENT/PSK-thing differently, I'll use your experience as motivation to finally getting it implemented...

Regards,
M
Excuse me for the late reaction, nice to hear the you used my experience as a motivation!

Preheps it is also posible (for @GGravelingen ) to look at the libcoap install script, i had some problems whit installing it.

Regards
dzjr
Raspberry Pi-3 Domoticz Beta
Tradfri Pluging by Moroen, Home made MySensors, Luftdaten, Home & Garden automatisation

moroen
Posts: 177
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 11 September 2018 10:22

dzjr wrote:
Sunday 09 September 2018 21:22

Preheps it is also posible (for @GGravelingen ) to look at the libcoap install script, i had some problems whit installing it.

Regards
dzjr
Removing the dependency on libcoap is the next big thing on the list, I just need to decide whether to keep using python for the adapter or switch it to something that supports COAPS a bit more natively.

Regards,
M

moroen
Posts: 177
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 12 September 2018 20:17

MichaelvK wrote:
Sunday 09 September 2018 19:54
Thanks!


Got it working indeed , missed an update of Domoticz, but as this is handled as a package, had to pick a beta from Jadahl.
Great!
All I now have to figure out is to have the "python3 tradfri.tac" as a daemon / service on Synology.
Not as easy as it sounds..

Great stuff this plugin!!
Could I as you a question, as I do not have access to a synolgy? How easy (or difficult) would it be to compile and run a golang application on a synology nas? I am currently experimenting with other implementations of the plugin.

Regards,
M

dzjr
Posts: 11
Joined: Monday 02 July 2018 23:35
Target OS: Raspberry Pi
Domoticz version: 4.9942B
Location: Alkmaar, The Netherlands
Contact:

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

Post by dzjr » Saturday 15 September 2018 20:35

moroen wrote:
Tuesday 04 September 2018 22:38
The latest version of the plugin's development branch now has a rather major change, a change that will break a current installation of the plugin, though rather easy to fix.

Instead of generating a (or using a known) IDENT/PSK pair, and then entering this information on the plugin setup page, the IDENT/PSK is handled by the adaptor, and generated using a configure.py python scipt, which need to be executed once before the adapter starts.

Anyone updating to the newest version are encouraged to the check out the readme for instructions, and report errors, problems or suggestions in this thread. Hopefully this change will alleviate a rather common problem getting the adapter to run, as you only need to supply the gateway IP and master-key on setup, no more manually using the coap-client directly to generate the IDENT/PSK-pair.

Regards,
M
Hello Moroen (and others here)

Thank you for the new version, i had some problems whit the plugin so i try-ed a new install and i used the new tutorial (off course).

It works very fine!
The only problem i have is whit installing the COAP client from GGravelingen (it is not working) and the error that i don't have the service_identity ( pip3 install service_identity helped.

and now it is running without problems.

Thanks again!

dzjr
Raspberry Pi-3 Domoticz Beta
Tradfri Pluging by Moroen, Home made MySensors, Luftdaten, Home & Garden automatisation

MichaelvK
Posts: 5
Joined: Tuesday 02 January 2018 20:43
Target OS: NAS (Synology & others)
Domoticz version: 4.9992
Location: Harderwijk, the Netherlands
Contact:

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

Post by MichaelvK » Sunday 16 September 2018 16:44

moroen wrote:
Wednesday 12 September 2018 20:17

Could I as you a question, as I do not have access to a synolgy? How easy (or difficult) would it be to compile and run a golang application on a synology nas? I am currently experimenting with other implementations of the plugin.

Regards,
M
I am not familiar with golang, sorry about that.
It was just a flow of getting and installing make, automake, gcc, python3, pip3, twisted and so forth.
I do have a second Nas available where I can try to get it to the current state , unfortunately it is not really working anymore (had it working for a moment).

My version is as following:
IKEA-tradfri COAP-adaptor version 0.7
Development Branche
Domoticz 4.9992 via Jadahl.com

Running the adapter via

Code: Select all

sudo /volume1/@entware-ng/opt/bin/python3 /usr/local/domoticz/var/plugins/IKEA-Tradfri/tradfri.tac
Domoticz connects, but it is stuck at the following:
Spoiler: show
IKEA-tradfri COAP-adaptor version 0.7 started (command line)!
Connected from IPv4Address(type='TCP', host='127.0.0.1', port=41826)
Data received: b'{"observe": "True", "groups": "False", "action": "initGateway", "pollinterval": "30"}'
Initializing gateway
Unhandled Error
Traceback (most recent call last):
File "/volume1/@entware-ng/opt/lib/python3.6/site-packages/twisted/python/log.py", line 103, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/volume1/@entware-ng/opt/lib/python3.6/site-packages/twisted/python/log.py", line 86, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/volume1/@entware-ng/opt/lib/python3.6/site-packages/twisted/python/context.py", line 122, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/volume1/@entware-ng/opt/lib/python3.6/site-packages/twisted/python/context.py", line 85, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "/volume1/@entware-ng/opt/lib/python3.6/site-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
why = selectable.doRead()
File "/volume1/@entware-ng/opt/lib/python3.6/site-packages/twisted/internet/tcp.py", line 243, in doRead
return self._dataReceived(data)
File "/volume1/@entware-ng/opt/lib/python3.6/site-packages/twisted/internet/tcp.py", line 249, in _dataReceived
rval = self.protocol.dataReceived(data)
File "/usr/local/domoticz/var/plugins/IKEA-Tradfri/tradfri.tac", line 88, in dataReceived
self.factory.initGateway(self, command)
File "/usr/local/domoticz/var/plugins/IKEA-Tradfri/tradfri.tac", line 287, in initGateway
self.devices = self.api(self.api(self.gateway.get_devices()))
File "/volume1/@entware-ng/opt/lib/python3.6/site-packages/pytradfri-5.5.1-py3.6.egg/pytradfri/api/libcoap_api.py", line 96, in request

File "/volume1/@entware-ng/opt/lib/python3.6/site-packages/pytradfri-5.5.1-py3.6.egg/pytradfri/api/libcoap_api.py", line 85, in _execute

pytradfri.error.RequestTimeout:

Disconnected
Synology DS216+ & Domoticz as a Package (Jadahl)
connected:
Denon AVR2200W
Panasonic TX-L47ET60B
Doorbell Action
Several KAKU Action Flamingo's
Ali-Express WiFi cam
Ali-Express WiFi PTZ cam (soon)
Ali-Express PIR's
IKEA Trådfri

MichaelvK
Posts: 5
Joined: Tuesday 02 January 2018 20:43
Target OS: NAS (Synology & others)
Domoticz version: 4.9992
Location: Harderwijk, the Netherlands
Contact:

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

Post by MichaelvK » Sunday 16 September 2018 17:02

The errors were my fault, somehow the IP got changed for the gateway, after which I received really weird results that the python script received return calls.

if someone else get these:

Code: Select all

Initializing gateway
Unhandled Error
Traceback (most recent call last):
  File "/opt/lib/python3.6/site-packages/twisted/python/log.py", line 103, in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
  File "/opt/lib/python3.6/site-packages/twisted/python/log.py", line 86, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "/opt/lib/python3.6/site-packages/twisted/python/context.py", line 122, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/opt/lib/python3.6/site-packages/twisted/python/context.py", line 85, in callWithContext
    return func(*args,**kw)
--- <exception caught here> ---
  File "/opt/lib/python3.6/site-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
    why = selectable.doRead()
  File "/opt/lib/python3.6/site-packages/twisted/internet/tcp.py", line 243, in doRead
    return self._dataReceived(data)
  File "/opt/lib/python3.6/site-packages/twisted/internet/tcp.py", line 249, in _dataReceived
    rval = self.protocol.dataReceived(data)
  File "/usr/local/domoticz/var/plugins/IKEA-Tradfri/tradfri.tac", line 88, in dataReceived
    self.factory.initGateway(self, command)
  File "/usr/local/domoticz/var/plugins/IKEA-Tradfri/tradfri.tac", line 287, in initGateway
    self.devices = self.api(self.api(self.gateway.get_devices()))
  File "/opt/lib/python3.6/site-packages/pytradfri-5.5.1-py3.6.egg/pytradfri/api/libcoap_api.py", line 96, in request
    
  File "/opt/lib/python3.6/site-packages/pytradfri-5.5.1-py3.6.egg/pytradfri/api/libcoap_api.py", line 85, in _execute
    
pytradfri.error.RequestTimeout: 
Just check the IP address of the gateway you are trying to reach from Domoticz.. :roll:
Synology DS216+ & Domoticz as a Package (Jadahl)
connected:
Denon AVR2200W
Panasonic TX-L47ET60B
Doorbell Action
Several KAKU Action Flamingo's
Ali-Express WiFi cam
Ali-Express WiFi PTZ cam (soon)
Ali-Express PIR's
IKEA Trådfri

rwijbenga
Posts: 20
Joined: Sunday 25 September 2016 22:59
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by rwijbenga » Monday 17 September 2018 13:13

@moroen

Ikea has now the new Control Outlet plugs in store, and I have them here. :D

But the are not yet working with this plugin, the work in the Ikea app.

I guess the device code/name must be added to devices.ini.....

Or are you planning an update for support of the Control Outlet?

moroen
Posts: 177
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 17 September 2018 18:10

rwijbenga wrote:
Monday 17 September 2018 13:13
@moroen

Ikea has now the new Control Outlet plugs in store, and I have them here. :D

But the are not yet working with this plugin, the work in the Ikea app.

I guess the device code/name must be added to devices.ini.....

Or are you planning an update for support of the Control Outlet?
Unfortunately, the tradfri outlets are still not available here in Norway, and until I get my hands on a couple of these things, I don't think I'll be able to implement support for them in the plugin. If someone could post the model description I might be able to get it working without having a real outlet, but I wouldn't be to hopeful.

I'll keep my eyes on the IKEA-website, and I plan to order a couple of these outlets as soon as they are available and implement support for them!

Regards,
M

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests