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

Python and python framework
moroen
Posts: 192
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 23 January 2018 19:18

moffe wrote:
Tuesday 23 January 2018 17:47
Stupid question...but I haven't been able to find out how I use the development branch?
I have the latest beta build 3.8834 and I get these messages:
2018-01-23 16:45:51.540 (Ikea Tradfri) Connected successfully to: 192.168.0.72
2018-01-23 16:45:51.541 Error: (Ikea Tradfri) 'onMessage' failed 'TypeError':'onMessage() missing 2 required positional arguments: 'Status' and 'Extra''.
2018-01-23 16:46:02.111 PluginSystem: Restarting I/O service thread.
2018-01-23 16:46:02.112 (Ikea Tradfri) Device has disconnected
Try:

Code: Select all

$ git clone https://github.com/moroen/IKEA-Tradfri-plugin.git IKEA-Tradfri
$ cd IKEA-Tradfri
$ git checkout development
Regards,
M

moffe
Posts: 19
Joined: Friday 23 August 2013 8:32
Target OS: Raspberry Pi
Domoticz version: V3.8834
Location: Sweden
Contact:

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

Post by moffe » Tuesday 23 January 2018 22:29

Thanks... That helped, kind of :)
2018-01-23 21:23:54.806 (Ikea Tradfri) Connected successfully to: 192.168.0.72
2018-01-23 21:24:05.078 PluginSystem: Restarting I/O service thread.
2018-01-23 21:24:05.078 (Ikea Tradfri) Device has disconnected
No Errors but those messages only and no devices/lamps.

moroen
Posts: 192
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 24 January 2018 1:35

moffe wrote:
Tuesday 23 January 2018 22:29
Thanks... That helped, kind of :)
2018-01-23 21:23:54.806 (Ikea Tradfri) Connected successfully to: 192.168.0.72
2018-01-23 21:24:05.078 PluginSystem: Restarting I/O service thread.
2018-01-23 21:24:05.078 (Ikea Tradfri) Device has disconnected
No Errors but those messages only and no devices/lamps.
Ok, try running the adapter from the command line, and post the outputted I'll take a look! :)

Regards,
M

moffe
Posts: 19
Joined: Friday 23 August 2013 8:32
Target OS: Raspberry Pi
Domoticz version: V3.8834
Location: Sweden
Contact:

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

Post by moffe » Wednesday 24 January 2018 10:00

I did not see these kind of errors with the mainbranch... sorry about all these printouts
Wasn't sure what exactly you wanted.
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri$ coap-client -k xxxxx coaps://192.168.0.72/.well-known/core
v:1 t:CON c:GET i:a1cb {} [ ]
<//15006>;ct=0;obs,<//15001>;ct=0;obs,<//15004>;ct=0;obs,<//15004/add>;ct=0,<//15004/remove>;ct=0,<//15010>;ct=0;obs,<//15005>;ct=0;obs,<//15011/15012>;ct=0;obs,<//15011/9034>;ct=0,<//15011/9030>;ct=0,<//15011/9031>;ct=0,<//15011/9094>;ct=0;obs,<//15011/9095>;ct=0;obs,<//15011/9104>;ct=0;obs,<//15010/315645>;ct=0;obs,<//15001/65540>;ct=0;obs,<//15001/65543>;ct=0;obs,<//15001/65541>;ct=0;obs,<//15001/65542>;ct=0;obs,<//15001/65544>;ct=0;obs,<//15001/65538>;ct=0;obs,<//15001/65539>;ct=0;obs,<//15001/65537>;ct=0;obs,<//15001/65536>;ct=0;obs,<//15001/65546>;ct=0;obs,<//15001/65545>;ct=0;obs,<//15005/156072/223698>;ct=0;obs,<//15005/156072/212379>;ct=0;obs,<//15005/156072/203663>;ct=0;obs,<//15005/156073/223699>;ct=0;obs,<//15005/156073/223700>;ct=0;obs,<//15005/156073/223701>;ct=0;obs,<//15004/156073>;ct=0;obs,<//15005/156073>;ct=0;obs,<//15005/141990/220431>;ct=0;obs,<//15005/141990/220595>;ct=0;obs,<//15005/141990/220176>;ct=0;obs,<//15004/156072>;ct=0;obs,<//15005/156072>;ct=0;obs,<//15004/141990>;ct=0;obs,<//15005/141990>;ct=0;obs,<//15011/9063>;ct=0
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri$ sudo systemctl status -l ikea-tradfri.service
● 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-01-23 21:27:56 CET; 11h ago
Main PID: 354 (twistd)
CGroup: /system.slice/ikea-tradfri.service
└─354 /usr/bin/python3 /usr/local/bin/twistd --nodaemon --rundir=/home/pi/domoticz/plugins/IKEA-Tradfri --pidfile=/home/pi/domoticz/plugins/IKEA-Tra

Jan 24 08:53:50 raspberrypi twistd[354]: self.factory.initGateway(self, command)
Jan 24 08:53:50 raspberrypi twistd[354]: File "/home/pi/domoticz/plugins/IKEA-Tradfri/tradfri.tac", line 275, in initGateway
Jan 24 08:53:50 raspberrypi twistd[354]: self.devices = self.api(self.api(self.gateway.get_devices()))
Jan 24 08:53:50 raspberrypi twistd[354]: File "/usr/local/lib/python3.5/dist-packages/pytradfri/api/libcoap_api.py", line 92, in request
Jan 24 08:53:50 raspberrypi twistd[354]: return self._execute(api_commands)
Jan 24 08:53:50 raspberrypi twistd[354]: File "/usr/local/lib/python3.5/dist-packages/pytradfri/api/libcoap_api.py", line 81, in _execute
Jan 24 08:53:50 raspberrypi twistd[354]: raise RequestTimeout() from None
Jan 24 08:53:50 raspberrypi twistd[354]: pytradfri.error.RequestTimeout:
Jan 24 08:53:50 raspberrypi twistd[354]:
Jan 24 08:53:50 raspberrypi twistd[354]: 2018-01-24T08:53:50+0100 [stdout#info] Disconnected
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri$ twistd -n -y tradfri.tac
2018-01-24T08:54:53+0100 [-] Loading tradfri.tac...
2018-01-24T08:54:53+0100 [-] Loaded.
2018-01-24T08:54:53+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] twistd 17.9.0 (/usr/bin/python3 3.5.3) starting up.
2018-01-24T08:54:53+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] reactor class: twisted.internet.epollreactor.EPollReactor.
2018-01-24T08:54:53+0100 [-] AdaptorFactory starting on 1234
2018-01-24T08:54:53+0100 [builtins.AdaptorFactory#info] Starting factory <AdaptorFactory object at 0x76012cf0>
2018-01-24T08:54:59+0100 [stdout#info] Connected from IPv4Address(TCP, '127.0.0.1', 55240)
2018-01-24T08:55:10+0100 [CoapAdapter,0,127.0.0.1] Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/twisted/python/log.py", line 103, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/usr/local/lib/python3.5/dist-packages/twisted/python/log.py", line 86, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/usr/local/lib/python3.5/dist-packages/twisted/python/context.py", line 122, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/usr/local/lib/python3.5/dist-packages/twisted/python/context.py", line 85, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "/usr/local/lib/python3.5/dist-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
why = selectable.doRead()
File "/usr/local/lib/python3.5/dist-packages/twisted/internet/tcp.py", line 205, in doRead
return self._dataReceived(data)
File "/usr/local/lib/python3.5/dist-packages/twisted/internet/tcp.py", line 211, in _dataReceived
rval = self.protocol.dataReceived(data)
File "tradfri.tac", line 76, in dataReceived
self.factory.initGateway(self, command)
File "tradfri.tac", line 275, in initGateway
self.devices = self.api(self.api(self.gateway.get_devices()))
File "/usr/local/lib/python3.5/dist-packages/pytradfri/api/libcoap_api.py", line 92, in request
return self._execute(api_commands)
File "/usr/local/lib/python3.5/dist-packages/pytradfri/api/libcoap_api.py", line 81, in _execute
raise RequestTimeout() from None
pytradfri.error.RequestTimeout:

2018-01-24T08:55:10+0100 [stdout#info] Disconnected
2018-01-24T08:55:15+0100 [stdout#info] Connected from IPv4Address(TCP, '127.0.0.1', 55242)
[
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri$ python3 tradfri.tac
IKEA-tradfri COAP-adaptor version 0.6 started (command line)!
Connected from IPv4Address(TCP, '127.0.0.1', 59356)
Data received: b'{"groups": "False", "gateway": "192.168.0.72", "observe": "True", "pollinterval": "30", "action": "setConfig", "identity": "IKEA01", "psk": "XXXXXX"}'
Initializing gateway
Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/twisted/python/log.py", line 103, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/usr/local/lib/python3.5/dist-packages/twisted/python/log.py", line 86, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/usr/local/lib/python3.5/dist-packages/twisted/python/context.py", line 122, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/usr/local/lib/python3.5/dist-packages/twisted/python/context.py", line 85, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "/usr/local/lib/python3.5/dist-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
why = selectable.doRead()
File "/usr/local/lib/python3.5/dist-packages/twisted/internet/tcp.py", line 205, in doRead
return self._dataReceived(data)
File "/usr/local/lib/python3.5/dist-packages/twisted/internet/tcp.py", line 211, in _dataReceived
rval = self.protocol.dataReceived(data)
File "tradfri.tac", line 76, in dataReceived
self.factory.initGateway(self, command)
File "tradfri.tac", line 275, in initGateway
self.devices = self.api(self.api(self.gateway.get_devices()))
File "/usr/local/lib/python3.5/dist-packages/pytradfri/api/libcoap_api.py", line 92, in request
return self._execute(api_commands)
File "/usr/local/lib/python3.5/dist-packages/pytradfri/api/libcoap_api.py", line 81, in _execute
raise RequestTimeout() from None
pytradfri.error.RequestTimeout:
root@raspberrypi:/home/pi/domoticz/plugins/IKEA-Tradfri# python3 -i -m pytradfri 192.168.0.72
DEBUG:pytradfri.util:JSON file not found: tradfri_standalone_psk.conf
Please provide the 'Security Code' on the back of your Tradfri gateway: XXXXXXXX
DEBUG:pytradfri.util:JSON file not found: tradfri_standalone_psk.conf
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 post ['15011', '9063']: {'9090': 'c00138337c2d4cf3b9284bfa64e6cf5a'}
DEBUG:pytradfri.api.libcoap_api:Received: {"9091":"2AjUjWJi6gIPi3BP","9029":"1.3.0014"}
Generated PSK: 2AjUjWJi6gIPi3BP
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15001']
DEBUG:pytradfri.api.libcoap_api:Received: [65540,65543,65541,65542,65544,65538,65539,65537,65536,65546,65545]
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15001', 65540]
DEBUG:pytradfri.api.libcoap_api:Received: {"9002":1506181596,"9001":"TRADFRI bulb GU10 WS 400lm","9020":1516766404,"9003":65540,"9054":0,"5750":2,"9019":1,"3":{"0":"IKEA of Sweden","1":"TRADFRI bulb GU10 WS 400lm","2":"","3":"1.2.217","6":1},"3311":[{"5850":0,"5851":111,"9003":0,"5717":0,"5711":370,"5709":30138,"5710":26909,"5706":"f1e0b5"}]}
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15001', 65543]
DEBUG:pytradfri.api.libcoap_api:Received: {"9002":1506606717,"9001":"TRADFRI bulb GU10 WS 400lm 4","9020":1516718013,"9003":65543,"9054":0,"5750":2,"9019":1,"3":{"0":"IKEA of Sweden","1":"TRADFRI bulb GU10 WS 400lm","2":"","3":"1.2.217","6":1},"3311":[{"5850":0,"5851":111,"9003":0,"5717":0,"5711":370,"5709":30138,"5710":26909,"5706":"f1e0b5"}]}
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15001', 65541]
DEBUG:pytradfri.api.libcoap_api:Received: {"9002":1506181673,"9001":"TRADFRI bulb GU10 WS 400lm 2","9020":1516766406,"9003":65541,"9054":0,"5750":2,"9019":1,"3":{"0":"IKEA of Sweden","1":"TRADFRI bulb GU10 WS 400lm","2":"","3":"1.2.217","6":1},"3311":[{"5850":0,"5851":111,"9003":0,"5717":0,"5711":370,"5709":30138,"5710":26909,"5706":"f1e0b5"}]}
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15001', 65542]
DEBUG:pytradfri.api.libcoap_api:Received: {"9002":1506181778,"9001":"TRADFRI bulb GU10 WS 400lm 3","9020":1516766461,"9003":65542,"9054":0,"5750":2,"9019":1,"3":{"0":"IKEA of Sweden","1":"TRADFRI bulb GU10 WS 400lm","2":"","3":"1.2.217","6":1},"3311":[{"5850":0,"5851":91,"9003":0,"5717":0,"5711":370,"5709":30138,"5710":26909,"5706":"f1e0b5"}]}
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15001', 65544]
DEBUG:pytradfri.api.libcoap_api:Received: {"9002":1506606774,"9001":"TRADFRI bulb GU10 WS 400lm 5","9020":1516718033,"9003":65544,"9054":0,"5750":2,"9019":1,"3":{"0":"IKEA of Sweden","1":"TRADFRI bulb GU10 WS 400lm","2":"","3":"1.2.217","6":1},"3311":[{"5850":0,"5851":111,"9003":0,"5717":0,"5711":370,"5709":30138,"5710":26909,"5706":"f1e0b5"}]}
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15001', 65538]
DEBUG:pytradfri.api.libcoap_api:Received: {"9002":1507399195,"9001":"TRADFRI bulb E14 W op/ch 400lm 4","9020":1516698657,"9003":65538,"9054":0,"5750":2,"9019":1,"3":{"0":"IKEA of Sweden","1":"TRADFRI bulb E14 W op/ch 400lm","2":"","3":"1.2.214","6":1},"3311":[{"5850":0,"5851":1,"9003":0}]}
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15001', 65539]
DEBUG:pytradfri.api.libcoap_api:Received: {"9002":1506181295,"9001":"TRADFRI bulb E14 W op/ch 400lm 3","9020":1516698660,"9003":65539,"9054":0,"5750":2,"9019":1,"3":{"0":"IKEA of Sweden","1":"TRADFRI bulb E14 W op/ch 400lm","2":"","3":"1.2.214","6":1},"3311":[{"5850":0,"5851":1,"9003":0}]}
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15001', 65537]
DEBUG:pytradfri.api.libcoap_api:Received: {"9002":1506181106,"9001":"TRADFRI bulb E14 W op/ch 400lm","9020":1516694850,"9003":65537,"9054":0,"5750":2,"9019":1,"3":{"0":"IKEA of Sweden","1":"TRADFRI bulb E14 W op/ch 400lm","2":"","3":"1.2.214","6":1},"3311":[{"5850":0,"5851":1,"9003":0}]}
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15001', 65536]
DEBUG:pytradfri.api.libcoap_api:Received: {"9002":1507398531,"9001":"TRADFRI remote control","9020":1515354466,"9003":65536,"9054":0,"5750":0,"9019":1,"3":{"9":60,"0":"IKEA of Sweden","1":"TRADFRI remote control","2":"","3":"1.2.214","6":3},"15009":[{"9003":0}]}
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15001', 65546]
DEBUG:pytradfri.api.libcoap_api:Received: {"9002":1510430521,"9001":"TRADFRI remote control 2","9020":1516743674,"9003":65546,"9054":0,"5750":0,"9019":1,"3":{"9":74,"0":"IKEA of Sweden","1":"TRADFRI remote control","2":"","3":"1.2.214","6":3},"15009":[{"9003":0}]}
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15001', 65545]
DEBUG:pytradfri.api.libcoap_api:Received: {"9002":1507399005,"9001":"TRADFRI wireless dimmer","9020":1516707192,"9003":65545,"9054":0,"5750":0,"9019":1,"3":{"9":34,"0":"IKEA of Sweden","1":"TRADFRI wireless dimmer","2":"","3":"1.2.248","6":3},"15009":[{"9003":0}]}
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15004']
DEBUG:pytradfri.api.libcoap_api:Received: [156073,156072,141990]
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15005', <pytradfri.command.Command object at 0x76702cf0>]
DEBUG:pytradfri.api.libcoap_api:Received: [156073,156072,141990]
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15010']
DEBUG:pytradfri.api.libcoap_api:Received: [315645]
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15011', '15012']
DEBUG:pytradfri.api.libcoap_api:Received: {"9023":"2.tradfri.pool.ntp.org","9092":0,"9059":1516780675,"9069":1515402535,"9060":"2018-01-24T07:57:55.012568Z","9062":0,"9061":0,"9029":"1.3.14","9055":100,"9081":"7e177152044000c4","9072":0,"9082":true,"9083":"090-90-084","9106":0,"9093":0,"9054":0,"9080":0,"9066":5,"9105":0,"9073":0,"9071":1,"9074":0,"9075":0,"9076":0,"9077":0,"9078":0,"9079":0}

Example commands:
> devices
> homekit_id
> light.light_control.lights
> api(light.light_control.set_dimmer(10))
> api(light.light_control.set_dimmer(254))
> api(light.light_control.set_xy_color(254))
> api(lights[1].light_control.set_dimmer(20))
> tasks[0].repeat_days_list
> api(gateway.reboot())
> groups
> moods
> tasks
> dump_devices()
> dump_all()
>>>
Last edited by moffe on Wednesday 24 January 2018 13:28, edited 2 times in total.

martjah
Posts: 15
Joined: Wednesday 11 June 2014 11:54
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by martjah » Wednesday 24 January 2018 10:54

So i'm running into an issue and i do not know how to solve it. I will post the initial errors so other people can find it via Google.

I get the following error:
Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
but i am able to connect to the hub via command line using this command:
python3 tradfri.tac
After troubleshooting (no real Linux knowledge)
The connection is succesfull in Domoticz when i run this command:
twistd -ny tradfri.tac
So i think this needs to run at startup of the raspberry. How do i add this to the startup?

moffe
Posts: 19
Joined: Friday 23 August 2013 8:32
Target OS: Raspberry Pi
Domoticz version: V3.8834
Location: Sweden
Contact:

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

Post by moffe » Wednesday 24 January 2018 10:59

martjah wrote:
Wednesday 24 January 2018 10:54
So i'm running into an issue and i do not know how to solve it. I will post the initial errors so other people can find it via Google.

I get the following error:
Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
but i am able to connect to the hub via command line using this command:
python3 tradfri.tac
After troubleshooting (no real Linux knowledge)
The connection is succesfull in Domoticz when i run this command:
twistd -ny tradfri.tac
So i think this needs to run at startup of the raspberry. How do i add this to the startup?
I'm quessing it could be this:
root@raspberrypi:/home/pi/domoticz/plugins/IKEA-Tradfri# cat ikea-tradfri.service
[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=pi
Group=pi


Restart=always

[Install]
WantedBy=multi-user.target
Mine was domoticz and I changed that to pi or root worked. Also need to check that you have correct accessrights to that directory
sudo chown -R pi.pi /home/pi/domoticz/plugins/IKEA-Tradfri/

martjah
Posts: 15
Joined: Wednesday 11 June 2014 11:54
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by martjah » Wednesday 24 January 2018 11:13

Thnx for the fast reply. But unfortunately that's not it.

What i have: (in the past i tried user=pi group=domoticz.
[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=pi
Group=pi

Restart=always

[Install]
WantedBy=multi-user.target
the ikea-tradfri.service file has 755 permissions so all have execution permissions.
The directory also has 755 and pi is owner.

The path is working for twitd as i get a reply from twistd with the optional commands.
/usr/local/bin/twistd
the path for plugin:
pi@Domoticz:~/domoticz/plugins/IKEA-Tradfri $ pwd
/home/pi/domoticz/plugins/IKEA-Tradfri

**edit**: as i do not know how to solve it in the "normal" way. i did use this line in the crontab file:
@reboot sudo twistd -ny /home/pi/domoticz/plugins/IKEA-Tradfri/tradfri.tac

Rafik89
Posts: 2
Joined: Monday 01 January 2018 15:42
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

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

Post by Rafik89 » Friday 26 January 2018 0:19

I have problem...
root@localhost:~/domoticz/plugins/IKEA-Tradfri# python3 -i -m pytradfri 192.168.1.241
DEBUG:pytradfri.util:JSON file not found: tradfri_standalone_psk.conf
Please provide the 'Security Code' on the back of your Tradfri gateway: xxxxxxx
DEBUG:pytradfri.util:JSON file not found: tradfri_standalone_psk.conf
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.1.241 post ['15011', '9063']: {'9090': 'xxxxxx'}
Traceback (most recent call last):
File "/usr/lib/python3.5/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.5/dist-packages/pytradfri/__main__.py", line 47, in <module>
psk = api_factory.generate_psk(args.key)
File "/usr/local/lib/python3.5/dist-packages/pytradfri/api/libcoap_api.py", line 160, in generate_psk
self._psk = self.request(Gateway().generate_psk(existing_psk_id))
File "/usr/local/lib/python3.5/dist-packages/pytradfri/api/libcoap_api.py", line 92, in request
return self._execute(api_commands)
File "/usr/local/lib/python3.5/dist-packages/pytradfri/api/libcoap_api.py", line 81, in _execute
raise RequestTimeout() from None
pytradfri.error.RequestTimeout
>>>

User avatar
Minglarn
Posts: 150
Joined: Friday 21 August 2015 19:27
Target OS: Raspberry Pi
Domoticz version: v3.8153
Location: Stockholm / Sweden
Contact:

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

Post by Minglarn » Friday 26 January 2018 19:13

Hi!

How is the development ongoing for Domoticz?
Wondering if I should buy the gateway and some bulbs to get started with, but as I want to control from Domoticz i asking if its stable enough.

What is your thoughts about Trådfri plugin? Is it a go or no go? ;)

Running the latest stable version on RPI3, the latest beta broke my config. :)
When you eliminate the impossible, whatever remains, however improbable, must be the truth.” -Spock in Star Trek VI

bandit
Posts: 1
Joined: Saturday 27 January 2018 10:57
Target OS: Windows
Domoticz version:
Contact:

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

Post by bandit » Saturday 27 January 2018 10:59

API does not seem to be comming any time soon;

https://www.reddit.com/r/tradfri/commen ... tive_from/

TRADFRIIKEA TRÅDFRI Team 4 point for 1 dag siden
Hi great to be here

We haven't ruled out an API in the future but I can't promise if or when it will come. I'll mark you down in the voting aye column.

You unfortunately can't adjust the sensitivity of the motion sensor but you could perhaps try adjusting the placement of it? I'll take your feedback though since I haven't heard that specific issue before.

We are always working on improving both the system and the products, the dimmer needs a bit of a flick of the wrist if you are trying to turn things all the way on or off but I hope the dimming should be smooth. If you continue to have problems with it I'm happy to share your feedback with the team.

/Chris

moffe
Posts: 19
Joined: Friday 23 August 2013 8:32
Target OS: Raspberry Pi
Domoticz version: V3.8834
Location: Sweden
Contact:

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

Post by moffe » Saturday 27 January 2018 12:44

I haven't still been able to get this working :(
I wonder how should I do to remove everything and then try to reinstall it?
Has someone made a step by step instruction how to install it to work with the latest beta?
IKEA-tradfri COAP-adaptor version 0.5 started (command line)!
Connected from IPv4Address(TCP, '127.0.0.1', 51876)
Data received: b'{"gateway": "192.168.0.72", "groups": "False", "psk": "XXXXXX", "pollinterval": "30", "identity": "IKEA01", "observe": "True", "action": "setConfig"}'
Initializing gateway
Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/twisted/python/log.py", line 103, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/usr/local/lib/python3.5/dist-packages/twisted/python/log.py", line 86, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/usr/local/lib/python3.5/dist-packages/twisted/python/context.py", line 122, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/usr/local/lib/python3.5/dist-packages/twisted/python/context.py", line 85, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "/usr/local/lib/python3.5/dist-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
why = selectable.doRead()
File "/usr/local/lib/python3.5/dist-packages/twisted/internet/tcp.py", line 205, in doRead
return self._dataReceived(data)
File "/usr/local/lib/python3.5/dist-packages/twisted/internet/tcp.py", line 211, in _dataReceived
rval = self.protocol.dataReceived(data)
File "tradfri.tac", line 76, in dataReceived
self.factory.initGateway(self, command)
File "tradfri.tac", line 275, in initGateway
self.devices = self.api(self.api(self.gateway.get_devices()))
File "/usr/local/lib/python3.5/dist-packages/pytradfri/api/libcoap_api.py", line 92, in request
return self._execute(api_commands)
File "/usr/local/lib/python3.5/dist-packages/pytradfri/api/libcoap_api.py", line 81, in _execute
raise RequestTimeout() from None
pytradfri.error.RequestTimeout:

Disconnected
This works:
python3 -i -m pytradfri 192.168.0.72
DEBUG:pytradfri.util:JSON file not found: tradfri_standalone_psk.conf
Please provide the 'Security Code' on the back of your Tradfri gateway: XXXXXXXX
DEBUG:pytradfri.util:JSON file not found: tradfri_standalone_psk.conf
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 post ['15011', '9063']: {'9090': '65c17f9442bf404cb630d4a9c2d12f47'}
DEBUG:pytradfri.api.libcoap_api:Received: {"9091":"O3749zMXzecPwBhM","9029":"1.3.0014"}
Generated PSK: O3749zMXzecPwBhM
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15001']
DEBUG:pytradfri.api.libcoap_api:Received: [65540,65543,65541,65542,65544,65538,65539,65537,65536,65546,65545]
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15001', 65540]
DEBUG:pytradfri.api.libcoap_api:Received: {"9002":1506181596,"9001":"TRADFRI bulb GU10 WS 400lm","9020":1516996746,"9003":65540,"9054":0,"5750":2,"9019":1,"3":{"0":"IKEA of Sweden","1":"TRADFRI bulb GU10 WS 400lm","2":"","3":"1.2.217","6":1},"3311":[{"5850":0,"5851":111,"9003":0,"5717":0,"5711":370,"5709":30138,"5710":26909,"5706":"f1e0b5"}]}
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15001', 65543]
DEBUG:pytradfri.api.libcoap_api:Received: {"9002":1506606717,"9001":"TRADFRI bulb GU10 WS 400lm 4","9020":1516996795,"9003":65543,"9054":0,"5750":2,"9019":1,"3":{"0":"IKEA of Sweden","1":"TRADFRI bulb GU10 WS 400lm","2":"","3":"1.2.217","6":1},"3311":[{"5850":0,"5851":111,"9003":0,"5717":0,"5711":370,"5709":30138,"5710":26909,"5706":"f1e0b5"}]}
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15001', 65541]
DEBUG:pytradfri.api.libcoap_api:Received: {"9002":1506181673,"9001":"TRADFRI bulb GU10 WS 400lm 2","9020":1516996628,"9003":65541,"9054":0,"5750":2,"9019":1,"3":{"0":"IKEA of Sweden","1":"TRADFRI bulb GU10 WS 400lm","2":"","3":"1.2.217","6":1},"3311":[{"5850":0,"5851":111,"9003":0,"5717":0,"5711":370,"5709":30138,"5710":26909,"5706":"f1e0b5"}]}
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15001', 65542]
DEBUG:pytradfri.api.libcoap_api:Received: {"9002":1506181778,"9001":"TRADFRI bulb GU10 WS 400lm 3","9020":1516996662,"9003":65542,"9054":0,"5750":2,"9019":1,"3":{"0":"IKEA of Sweden","1":"TRADFRI bulb GU10 WS 400lm","2":"","3":"1.2.217","6":1},"3311":[{"5850":0,"5851":91,"9003":0,"5717":0,"5711":370,"5709":30138,"5710":26909,"5706":"f1e0b5"}]}
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15001', 65544]
DEBUG:pytradfri.api.libcoap_api:Received: {"9002":1506606774,"9001":"TRADFRI bulb GU10 WS 400lm 5","9020":1516996839,"9003":65544,"9054":0,"5750":2,"9019":1,"3":{"0":"IKEA of Sweden","1":"TRADFRI bulb GU10 WS 400lm","2":"","3":"1.2.217","6":1},"3311":[{"5850":0,"5851":111,"9003":0,"5717":0,"5711":370,"5709":30138,"5710":26909,"5706":"f1e0b5"}]}
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15001', 65538]
DEBUG:pytradfri.api.libcoap_api:Received: {"9002":1507399195,"9001":"TRADFRI bulb E14 W op/ch 400lm 4","9020":1517044257,"9003":65538,"9054":0,"5750":2,"9019":1,"3":{"0":"IKEA of Sweden","1":"TRADFRI bulb E14 W op/ch 400lm","2":"","3":"1.2.214","6":1},"3311":[{"5850":0,"5851":254,"9003":0}]}
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15001', 65539]
DEBUG:pytradfri.api.libcoap_api:Received: {"9002":1506181295,"9001":"TRADFRI bulb E14 W op/ch 400lm 3","9020":1517044262,"9003":65539,"9054":0,"5750":2,"9019":1,"3":{"0":"IKEA of Sweden","1":"TRADFRI bulb E14 W op/ch 400lm","2":"","3":"1.2.214","6":1},"3311":[{"5850":0,"5851":196,"9003":0}]}
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15001', 65537]
DEBUG:pytradfri.api.libcoap_api:Received: {"9002":1506181106,"9001":"TRADFRI bulb E14 W op/ch 400lm","9020":1517040453,"9003":65537,"9054":0,"5750":2,"9019":1,"3":{"0":"IKEA of Sweden","1":"TRADFRI bulb E14 W op/ch 400lm","2":"","3":"1.2.214","6":1},"3311":[{"5850":0,"5851":47,"9003":0}]}
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15001', 65536]
DEBUG:pytradfri.api.libcoap_api:Received: {"9002":1507398531,"9001":"TRADFRI remote control","9020":1515354466,"9003":65536,"9054":0,"5750":0,"9019":1,"3":{"9":60,"0":"IKEA of Sweden","1":"TRADFRI remote control","2":"","3":"1.2.214","6":3},"15009":[{"9003":0}]}
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15001', 65546]
DEBUG:pytradfri.api.libcoap_api:Received: {"9002":1510430521,"9001":"TRADFRI remote control 2","9020":1517003002,"9003":65546,"9054":0,"5750":0,"9019":1,"3":{"9":74,"0":"IKEA of Sweden","1":"TRADFRI remote control","2":"","3":"1.2.214","6":3},"15009":[{"9003":0}]}
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15001', 65545]
DEBUG:pytradfri.api.libcoap_api:Received: {"9002":1507399005,"9001":"TRADFRI wireless dimmer","9020":1516968169,"9003":65545,"9054":0,"5750":0,"9019":1,"3":{"9":34,"0":"IKEA of Sweden","1":"TRADFRI wireless dimmer","2":"","3":"1.2.248","6":3},"15009":[{"9003":0}]}
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15004']
DEBUG:pytradfri.api.libcoap_api:Received: [156073,156072,141990]
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15005', <pytradfri.command.Command object at 0x76708bf0>]
DEBUG:pytradfri.api.libcoap_api:Received: [156073,156072,141990]
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15010']
DEBUG:pytradfri.api.libcoap_api:Received: [315645]
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.0.72 get ['15011', '15012']
DEBUG:pytradfri.api.libcoap_api:Received: {"9023":"2.tradfri.pool.ntp.org","9092":0,"9059":1517049769,"9069":1515402535,"9060":"2018-01-27T10:42:49.021568Z","9062":0,"9061":0,"9029":"1.3.14","9055":100,"9081":"7e177152044000c4","9072":0,"9082":true,"9083":"090-90-084","9106":0,"9093":0,"9054":0,"9080":0,"9066":5,"9105":0,"9073":0,"9071":1,"9074":0,"9075":0,"9076":0,"9077":0,"9078":0,"9079":0}

Example commands:
> devices
> homekit_id
> light.light_control.lights
> api(light.light_control.set_dimmer(10))
> api(light.light_control.set_dimmer(254))
> api(light.light_control.set_xy_color(254))
> api(lights[1].light_control.set_dimmer(20))
> tasks[0].repeat_days_list
> api(gateway.reboot())
> groups
> moods
> tasks
> dump_devices()
> dump_all()

User avatar
Minglarn
Posts: 150
Joined: Friday 21 August 2015 19:27
Target OS: Raspberry Pi
Domoticz version: v3.8153
Location: Stockholm / Sweden
Contact:

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

Post by Minglarn » Saturday 27 January 2018 15:39

Minglarn wrote:
Friday 26 January 2018 19:13
Hi!

How is the development ongoing for Domoticz?
Wondering if I should buy the gateway and some bulbs to get started with, but as I want to control from Domoticz i asking if its stable enough.

What is your thoughts about Trådfri plugin? Is it a go or no go? ;)

Running the latest stable version on RPI3, the latest beta broke my config. :)
Nevermind... Bought myself a Philips Hue v2 set. At Least my wife is happy..
Quote: "Hi Siri, turn the lights of in the kitchen" ...

And it works flawless... :)
When you eliminate the impossible, whatever remains, however improbable, must be the truth.” -Spock in Star Trek VI

moroen
Posts: 192
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 » Saturday 27 January 2018 17:36

Rafik89 wrote:
Friday 26 January 2018 0:19
I have problem...
root@localhost:~/domoticz/plugins/IKEA-Tradfri# python3 -i -m pytradfri 192.168.1.241
DEBUG:pytradfri.util:JSON file not found: tradfri_standalone_psk.conf
Please provide the 'Security Code' on the back of your Tradfri gateway: xxxxxxx
DEBUG:pytradfri.util:JSON file not found: tradfri_standalone_psk.conf
DEBUG:pytradfri.api.libcoap_api:Executing 192.168.1.241 post ['15011', '9063']: {'9090': 'xxxxxx'}
Traceback (most recent call last):
File "/usr/lib/python3.5/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.5/dist-packages/pytradfri/__main__.py", line 47, in <module>
psk = api_factory.generate_psk(args.key)
File "/usr/local/lib/python3.5/dist-packages/pytradfri/api/libcoap_api.py", line 160, in generate_psk
self._psk = self.request(Gateway().generate_psk(existing_psk_id))
File "/usr/local/lib/python3.5/dist-packages/pytradfri/api/libcoap_api.py", line 92, in request
return self._execute(api_commands)
File "/usr/local/lib/python3.5/dist-packages/pytradfri/api/libcoap_api.py", line 81, in _execute
raise RequestTimeout() from None
pytradfri.error.RequestTimeout
>>>
The connection to the gateway times out. Have you tried using the coap-client directly?

Code: Select all

$ coap-client -k "GW-KEY" coaps://IP:5684/.well-known/core
where key is the key printed on the bottom of the gateway

If that works, check to see if you can generate an ident/psk-pair:

Code: Select all

$ coap-client -m post -u "Client_identity" -k "GW-KEY" -e '{"9090":"TESTME"}' "coaps://IP:5684/15011/9063"
This should return something like: {"9091":"PSK","9029":"1.3.0014"}, where PSK will be the pre-shared key

and finally if that works, see if you can connect using the defined ident/psk:

Code: Select all

$ coap-client -u "TESTME" -k "PSK" coaps://IP:5684/.well-known/core
If the last command returns well-know/core, the coat-client works as it should. Then make sure to use the same ident/psk pair in the plugin config-page...

Edit: spelling

Regards,
M
Last edited by moroen on Sunday 28 January 2018 2:27, edited 1 time in total.

moroen
Posts: 192
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 » Saturday 27 January 2018 17:39

moffe wrote:
Saturday 27 January 2018 12:44
I haven't still been able to get this working :(
I wonder how should I do to remove everything and then try to reinstall it?
Has someone made a step by step instruction how to install it to work with the latest beta?
The plugin times out, while using pytradfri appears to work from the command line, the fault has probably something to do with the ident/psk pair used from the plugin... Take a look at my answer to Rafik89 above, and try using the client directly to create and verify a ident/psk pair, and then using this pair from the plugin-configpage.

Regards,
M

moroen
Posts: 192
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 » Saturday 27 January 2018 17:45

Minglarn wrote:
Saturday 27 January 2018 15:39
Minglarn wrote:
Friday 26 January 2018 19:13
Hi!

How is the development ongoing for Domoticz?
Wondering if I should buy the gateway and some bulbs to get started with, but as I want to control from Domoticz i asking if its stable enough.

What is your thoughts about Trådfri plugin? Is it a go or no go? ;)

Running the latest stable version on RPI3, the latest beta broke my config. :)
Nevermind... Bought myself a Philips Hue v2 set. At Least my wife is happy..
Quote: "Hi Siri, turn the lights of in the kitchen" ...

And it works flawless... :)
The wife being happy is probably the most important part! :D

I'm actively developing the plugin, currently switching the backend to a service written in golang, but no, I wouldn't at the moment consider Domoticz with python-plugins and the tradfri plugin stable! It's running quite happily on my system, using the latest beta-branch of Domoticz (compiled from source, which I would consider absolutely necessary when using beta-domoticz), but a lot of people have various problems both with Domoticz and python in general, and this plugin specifically, so not stable by a long shot! :o

Regards,
M

rasper
Posts: 27
Joined: Sunday 10 January 2016 23:46
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Netherlands
Contact:

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

Post by rasper » Saturday 27 January 2018 19:20

moroen wrote:
Saturday 27 January 2018 17:45
Minglarn wrote:
Saturday 27 January 2018 15:39
Minglarn wrote:
Friday 26 January 2018 19:13
Hi!

How is the development ongoing for Domoticz?
Wondering if I should buy the gateway and some bulbs to get started with, but as I want to control from Domoticz i asking if its stable enough.

What is your thoughts about Trådfri plugin? Is it a go or no go? ;)

Running the latest stable version on RPI3, the latest beta broke my config. :)
Nevermind... Bought myself a Philips Hue v2 set. At Least my wife is happy..
Quote: "Hi Siri, turn the lights of in the kitchen" ...

And it works flawless... :)
The wife being happy is probably the most important part! :D

I'm actively developing the plugin, currently switching the backend to a service written in golang, but no, I wouldn't at the moment consider Domoticz with python-plugins and the tradfri plugin stable! It's running quite happily on my system, using the latest beta-branch of Domoticz (compiled from source, which I would consider absolutely necessary when using beta-domoticz), but a lot of people have various problems both with Domoticz and python in general, and this plugin specifically, so not stable by a long shot! :o

Regards,
M
My setup is similar to moroens and also reasonably stable. The weakest part in my setup is the ikea hub itself; it sometimes hangs and then needs to be restarted and when restarted sometimes for (to me) unknown reasons loses psk data.

moffe
Posts: 19
Joined: Friday 23 August 2013 8:32
Target OS: Raspberry Pi
Domoticz version: V3.8834
Location: Sweden
Contact:

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

Post by moffe » Sunday 28 January 2018 11:44

Hmm ok... thanks. Here:
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri$ coap-client -k "XXXXXXXX" coaps://192.168.0.72:5684/.well-known/core
v:1 t:CON c:GET i:fbf3 {} [ ]
<//15006>;ct=0;obs,<//15001>;ct=0;obs,<//15004>;ct=0;obs,<//15004/add>;ct=0,<//15004/remove>;ct=0,<//15010>;ct=0;obs,<//15005>;ct=0;obs,<//15011/15012>;ct=0;obs,<//15011/9034>;ct=0,<//15011/9030>;ct=0,<//15011/9031>;ct=0,<//15011/9094>;ct=0;obs,<//15011/9095>;ct=0;obs,<//15011/9104>;ct=0;obs,<//15010/315645>;ct=0;obs,<//15001/65540>;ct=0;obs,<//15001/65543>;ct=0;obs,<//15001/65541>;ct=0;obs,<//15001/65542>;ct=0;obs,<//15001/65544>;ct=0;obs,<//15001/65538>;ct=0;obs,<//15001/65539>;ct=0;obs,<//15001/65537>;ct=0;obs,<//15001/65536>;ct=0;obs,<//15001/65546>;ct=0;obs,<//15001/65545>;ct=0;obs,<//15005/156072/223698>;ct=0;obs,<//15005/156072/212379>;ct=0;obs,<//15005/156072/203663>;ct=0;obs,<//15005/156073/223699>;ct=0;obs,<//15005/156073/223700>;ct=0;obs,<//15005/156073/223701>;ct=0;obs,<//15004/156073>;ct=0;obs,<//15005/156073>;ct=0;obs,<//15005/141990/220431>;ct=0;obs,<//15005/141990/220595>;ct=0;obs,<//15005/141990/220176>;ct=0;obs,<//15004/156072>;ct=0;obs,<//15005/156072>;ct=0;obs,<//15004/141990>;ct=0;obs,<//15005/141990>;ct=0;obs,<//15011/9063>;ct=0

pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri$ coap-client -m post -u "Client_identity" -k "XXXXXXXX" -e '{"9090":"IKEA01"}' "coaps://192.168.0.72:5684/15011/9063"
v:1 t:CON c:POST i:bb23 {} [ ]
4.00

pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri$ coap-client -u "IKEA01" -k "PSK" coaps://192.168.0.72:5684/.well-known/core
v:1 t:CON c:GET i:d5ed {} [ ]
Jan 28 10:35:27 ALRT 20 invalidate peer
Jan 28 10:35:27 WARN received alert, peer has been invalidated

moroen
Posts: 192
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 » Sunday 28 January 2018 16:37

moffe wrote:
Sunday 28 January 2018 11:44
Hmm ok... thanks. Here:
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri$ coap-client -k "XXXXXXXX" coaps://192.168.0.72:5684/.well-known/core
v:1 t:CON c:GET i:fbf3 {} [ ]
<//15006>;ct=0;obs,<//15001>;ct=0;obs,<//15004>;ct=0;obs,<//15004/add>;ct=0,<//15004/remove>;ct=0,<//15010>;ct=0;obs,<//15005>;ct=0;obs,<//15011/15012>;ct=0;obs,<//15011/9034>;ct=0,<//15011/9030>;ct=0,<//15011/9031>;ct=0,<//15011/9094>;ct=0;obs,<//15011/9095>;ct=0;obs,<//15011/9104>;ct=0;obs,<//15010/315645>;ct=0;obs,<//15001/65540>;ct=0;obs,<//15001/65543>;ct=0;obs,<//15001/65541>;ct=0;obs,<//15001/65542>;ct=0;obs,<//15001/65544>;ct=0;obs,<//15001/65538>;ct=0;obs,<//15001/65539>;ct=0;obs,<//15001/65537>;ct=0;obs,<//15001/65536>;ct=0;obs,<//15001/65546>;ct=0;obs,<//15001/65545>;ct=0;obs,<//15005/156072/223698>;ct=0;obs,<//15005/156072/212379>;ct=0;obs,<//15005/156072/203663>;ct=0;obs,<//15005/156073/223699>;ct=0;obs,<//15005/156073/223700>;ct=0;obs,<//15005/156073/223701>;ct=0;obs,<//15004/156073>;ct=0;obs,<//15005/156073>;ct=0;obs,<//15005/141990/220431>;ct=0;obs,<//15005/141990/220595>;ct=0;obs,<//15005/141990/220176>;ct=0;obs,<//15004/156072>;ct=0;obs,<//15005/156072>;ct=0;obs,<//15004/141990>;ct=0;obs,<//15005/141990>;ct=0;obs,<//15011/9063>;ct=0

pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri$ coap-client -m post -u "Client_identity" -k "XXXXXXXX" -e '{"9090":"IKEA01"}' "coaps://192.168.0.72:5684/15011/9063"
v:1 t:CON c:POST i:bb23 {} [ ]
4.00

pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri$ coap-client -u "IKEA01" -k "PSK" coaps://192.168.0.72:5684/.well-known/core
v:1 t:CON c:GET i:d5ed {} [ ]
Jan 28 10:35:27 ALRT 20 invalidate peer
Jan 28 10:35:27 WARN received alert, peer has been invalidated
Since the second line doesn't return a PSK, you probably already have generated a PSK for the ident IKEA01. There is currently, as far as I know, no way to generate a new PSK for an ident already created, so you need to create a new ident/psk pair.

The last line implies that the supplied IDENT and PSK fails. I would try generating a pair from scratch, you need to use a new ident, for example IKEA02.

Regards,
M

moffe
Posts: 19
Joined: Friday 23 August 2013 8:32
Target OS: Raspberry Pi
Domoticz version: V3.8834
Location: Sweden
Contact:

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

Post by moffe » Sunday 28 January 2018 19:00

Finally... thanks it worked. :o

dzdm
Posts: 9
Joined: Monday 05 February 2018 15:24
Target OS: Linux
Domoticz version:
Contact:

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

Post by dzdm » Tuesday 06 February 2018 16: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 :)

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests