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

Python and python framework

Moderator: leecollings

jakkes72
Posts: 23
Joined: Sunday 10 January 2016 20:37
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by jakkes72 »

I did a new install...

And again received errors...:

Nov 15 20:41:24 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Service hold-off time over, scheduling restart.
Nov 15 20:41:24 Domoticz.labots.nl systemd[1]: Stopped IKEA Tradfri COAP-adapter.
Nov 15 20:41:24 Domoticz.labots.nl systemd[1]: Started IKEA Tradfri COAP-adapter.
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: Unhandled Error
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: Traceback (most recent call last):
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: File "/home/pi/.local/lib/python3.5/site-packages/twisted/application/app.py", line 674, in run
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: runApp(config)
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: File "/home/pi/.local/lib/python3.5/site-packages/twisted/scripts/twistd.py", line 25, in runApp
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: runner.run()
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: File "/home/pi/.local/lib/python3.5/site-packages/twisted/application/app.py", line 381, in run
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: self.application = self.createOrGetApplication()
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: File "/home/pi/.local/lib/python3.5/site-packages/twisted/application/app.py", line 453, in createOrGetApplication
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: application = getApplication(self.config, passphrase)
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: --- <exception caught here> ---
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: File "/home/pi/.local/lib/python3.5/site-packages/twisted/application/app.py", line 464, in getApplication
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: application = service.loadApplication(filename, style, passphrase)
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: File "/home/pi/.local/lib/python3.5/site-packages/twisted/application/service.py", line 416, in loadApplication
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: application = sob.loadValueFromFile(filename, 'application')
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: File "/home/pi/.local/lib/python3.5/site-packages/twisted/persisted/sob.py", line 177, in loadValueFromFile
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: eval(codeObj, d, d)
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: File "/home/pi/domoticz/plugins/IKEA-Tradfri/tradfri.tac", line 34, in <module>
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: deviceConfig.read(INIFILE)
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: File "/usr/lib/python3.5/configparser.py", line 696, in read
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: self._read(fp, filename)
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: File "/usr/lib/python3.5/configparser.py", line 1108, in _read
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: raise e
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: configparser.ParsingError: Source contains parsing errors: '/home/pi/domoticz/plugins/IKEA-Tradfri/devices.ini'
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: [line 41]: '[]\n'
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: Failed to load application: Source contains parsing errors: '/home/pi/domoticz/plugins/IKEA-Tradfri/devices.ini'
Nov 15 20:41:25 Domoticz.labots.nl twistd[969]: [line 41]: '[]\n'
Nov 15 20:41:25 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Main process exited, code=exited, status=1/FAILURE
Nov 15 20:41:25 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Unit entered failed state.
Nov 15 20:41:25 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Failed with result 'exit-code'.
Nov 15 20:41:26 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Service hold-off time over, scheduling restart.
Nov 15 20:41:26 Domoticz.labots.nl systemd[1]: Stopped IKEA Tradfri COAP-adapter.
Nov 15 20:41:26 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Start request repeated too quickly.
Nov 15 20:41:26 Domoticz.labots.nl systemd[1]: Failed to start IKEA Tradfri COAP-adapter.
Nov 15 20:41:26 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Unit entered failed state.
Nov 15 20:41:26 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Failed with result 'exit-code'.


At this point i had a look in devices.ini..., and the [] was there again.
Removed this line, and started the service again:

Nov 15 20:43:08 Domoticz.labots.nl systemd[1]: Started IKEA Tradfri COAP-adapter.
Nov 15 20:43:10 Domoticz.labots.nl twistd[1012]: 2018-11-15T20:43:09+0100 [-] Loading /home/pi/domoticz/plugins/IKEA-Tradfri/tradfri.tac...
Nov 15 20:43:10 Domoticz.labots.nl twistd[1012]: 2018-11-15T20:43:10+0100 [-] Loaded.
Nov 15 20:43:10 Domoticz.labots.nl twistd[1012]: 2018-11-15T20:43:10+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] twistd 18.9.0 (/usr/bin/python3 3.5.3) starting up.
Nov 15 20:43:10 Domoticz.labots.nl twistd[1012]: 2018-11-15T20:43:10+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] reactor class: twisted.internet.epollreactor.EPollReactor.
Nov 15 20:43:10 Domoticz.labots.nl twistd[1012]: 2018-11-15T20:43:10+0100 [-] AdaptorFactory starting on 1234
Nov 15 20:43:10 Domoticz.labots.nl twistd[1012]: 2018-11-15T20:43:10+0100 [builtins.AdaptorFactory#info] Starting factory <AdaptorFactory object at 0x75fd72f0>
Nov 15 20:43:21 Domoticz.labots.nl twistd[1012]: 2018-11-15T20:43:21+0100 [stdout#info] Connected from IPv4Address(type='TCP', host='127.0.0.1', port=45478)
Nov 15 20:44:36 Domoticz.labots.nl twistd[1012]: 2018-11-15T20:44:36+0100 [stdout#info] Error in announce: Request timed out
Nov 15 20:44:36 Domoticz.labots.nl twistd[1012]: 2018-11-15T20:44:36+0100 [stdout#info] Disconnected
Nov 15 20:44:51 Domoticz.labots.nl twistd[1012]: 2018-11-15T20:44:51+0100 [stdout#info] Connected from IPv4Address(type='TCP', host='127.0.0.1', port=45480)
Nov 15 20:45:26 Domoticz.labots.nl twistd[1012]: 2018-11-15T20:45:26+0100 [stdout#info] Error in announce: Request timed out
Nov 15 20:45:26 Domoticz.labots.nl twistd[1012]: 2018-11-15T20:45:26+0100 [stdout#info] Disconnected
Nov 15 20:45:41 Domoticz.labots.nl twistd[1012]: 2018-11-15T20:45:41+0100 [stdout#info] Connected from IPv4Address(type='TCP', host='127.0.0.1', port=45482)

Now it al seems to work..., but after a reboot the [] is again in the devices.ini
Did the trick of removing the [] again, and it works agian:

Nov 15 20:51:04 Domoticz.labots.nl systemd[1]: Started IKEA Tradfri COAP-adapter.
Nov 15 20:51:06 Domoticz.labots.nl twistd[932]: 2018-11-15T20:51:05+0100 [-] Loading /home/pi/domoticz/plugins/IKEA-Tradfri/tradfri.tac...
Nov 15 20:51:06 Domoticz.labots.nl twistd[932]: 2018-11-15T20:51:06+0100 [-] Loaded.
Nov 15 20:51:06 Domoticz.labots.nl twistd[932]: 2018-11-15T20:51:06+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] twistd 18.9.0 (/usr/bin/python3 3.5.3) starting up.
Nov 15 20:51:06 Domoticz.labots.nl twistd[932]: 2018-11-15T20:51:06+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] reactor class: twisted.internet.epollreactor.EPollReactor.
Nov 15 20:51:06 Domoticz.labots.nl twistd[932]: 2018-11-15T20:51:06+0100 [-] AdaptorFactory starting on 1234
Nov 15 20:51:06 Domoticz.labots.nl twistd[932]: 2018-11-15T20:51:06+0100 [builtins.AdaptorFactory#info] Starting factory <AdaptorFactory object at 0x75f502f0>
Nov 15 20:51:12 Domoticz.labots.nl twistd[932]: 2018-11-15T20:51:12+0100 [stdout#info] Connected from IPv4Address(type='TCP', host='127.0.0.1', port=40822)
Nov 15 20:51:25 Domoticz.labots.nl twistd[932]: 2018-11-15T20:51:25+0100 [stdout#info] Failed to connect to gateway: Request timeout
Nov 15 20:51:25 Domoticz.labots.nl twistd[932]: 2018-11-15T20:51:25+0100 [stdout#info] Disconnected
moroen
Posts: 408
Joined: Sunday 15 January 2017 11:06
Target OS: Linux
Domoticz version: beta
Location: Norway
Contact:

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

Post by moroen »

tjabas wrote: Thursday 15 November 2018 20:43 I just noticed this tread, does this mean that ikea trådfri gateway works directly in Domoticz without decontz?
You need the official IKEA Tradfri gateway. This plugin then enables domoticz to communicate with the IKEA gateway...

Regards,
M
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by tjabas »

ok, nice, so there is no use for a zigbee stick and deconz , can ikea gateway also communicate with phillips hue?
moroen
Posts: 408
Joined: Sunday 15 January 2017 11:06
Target OS: Linux
Domoticz version: beta
Location: Norway
Contact:

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

Post by moroen »

tjabas wrote: Thursday 15 November 2018 21:33 ok, nice, so there is no use for a zigbee stick and deconz , can ikea gateway also communicate with phillips hue?
You can use a Hue Bridge to control IKEA Tradfri bulbs, and I've seen some reports that it's possible to control HUE bulbs from the IKEA Gateway, but I haven't tried it myself, and I have no idea if it would work with this plugin, even though it might... Perhaps I should by a HUE bulb sometime and try...

Regards,
M
moroen
Posts: 408
Joined: Sunday 15 January 2017 11:06
Target OS: Linux
Domoticz version: beta
Location: Norway
Contact:

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

Post by moroen »

jakkes72 wrote: Thursday 15 November 2018 20:52 I did a new install...

And again received errors...:

At this point i had a look in devices.ini..., and the [] was there again.
Removed this line, and started the service again:

Now it al seems to work..., but after a reboot the [] is again in the devices.ini
Did the trick of removing the [] again, and it works agian:

Nov 15 20:51:04 Domoticz.labots.nl systemd[1]: Started IKEA Tradfri COAP-adapter.
Nov 15 20:51:06 Domoticz.labots.nl twistd[932]: 2018-11-15T20:51:05+0100 [-] Loading /home/pi/domoticz/plugins/IKEA-Tradfri/tradfri.tac...
Nov 15 20:51:06 Domoticz.labots.nl twistd[932]: 2018-11-15T20:51:06+0100 [-] Loaded.
Nov 15 20:51:06 Domoticz.labots.nl twistd[932]: 2018-11-15T20:51:06+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] twistd 18.9.0 (/usr/bin/python3 3.5.3) starting up.
Nov 15 20:51:06 Domoticz.labots.nl twistd[932]: 2018-11-15T20:51:06+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] reactor class: twisted.internet.epollreactor.EPollReactor.
Nov 15 20:51:06 Domoticz.labots.nl twistd[932]: 2018-11-15T20:51:06+0100 [-] AdaptorFactory starting on 1234
Nov 15 20:51:06 Domoticz.labots.nl twistd[932]: 2018-11-15T20:51:06+0100 [builtins.AdaptorFactory#info] Starting factory <AdaptorFactory object at 0x75f502f0>
Nov 15 20:51:12 Domoticz.labots.nl twistd[932]: 2018-11-15T20:51:12+0100 [stdout#info] Connected from IPv4Address(type='TCP', host='127.0.0.1', port=40822)
Nov 15 20:51:25 Domoticz.labots.nl twistd[932]: 2018-11-15T20:51:25+0100 [stdout#info] Failed to connect to gateway: Request timeout
Nov 15 20:51:25 Domoticz.labots.nl twistd[932]: 2018-11-15T20:51:25+0100 [stdout#info] Disconnected
The underlying problem is that connection to the gateway times out. If you could try to stop domoticz, pull the latest development branch, run configure.py with the IP and master key. Then try a dry-run of the adapter:

Code: Select all

$ python3 tradfri.tac --dryrun
The adapter will then try to connect to the gateway and register all the devices. Please post the output of the dryrun!

Regards,
M
jakkes72
Posts: 23
Joined: Sunday 10 January 2016 20:37
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by jakkes72 »

pi@Domoticz:~/domoticz/plugins/IKEA-Tradfri $ python3 tradfri.tac --dryrun
IKEA-tradfri COAP-adaptor version 0.8.6 started (command line)!
Initializing gateway
Adding light with ID: 65542
Adding light with ID: 65545
Adding socket with ID: 65538
Adding light with ID: 65546
Adding light with ID: 65544
Adding light with ID: 65539
Adding light with ID: 65543
Device settings not found for . Creating defaults!
Traceback (most recent call last):
File "tradfri.tac", line 572, in <module>
endpoints.serverFromString(reactor, "tcp:1234").listen(AdaptorFactory()).addErrback(error)
File "tradfri.tac", line 309, in __init__
self.sendDeviceList(None)
File "tradfri.tac", line 427, in sendDeviceList
devices.append({"DeviceID": aDevice.deviceID, "Name": aDevice.deviceName, "Type": "Light", "Dimmable": stringToBool(deviceConfig[aDevice.modelNumber]['dimmable']), "HasWB": stringToBool(deviceConfig[aDevice.modelNumber]['haswb']), "HasRGB": stringToBool(deviceConfig[aDevice.modelNumber]['hasrgb'])})
File "/usr/lib/python3.5/configparser.py", line 956, in __getitem__
raise KeyError(key)
KeyError: ''

Something else...: I have a plug that is not currently accepted in Homekit... Could this be the device that gives the [] ??

Removed the plug, and a lamp that was disconnected voor a while... result:
Connected from IPv4Address(type='TCP', host='127.0.0.1', port=60300)
Data received: b'{"action": "initGateway", "pollinterval": "5", "groups": "False", "observe": "True"}'
Initializing gateway
Adding light with ID: 65542
Adding light with ID: 65545
Adding light with ID: 65546
Adding light with ID: 65544
Adding light with ID: 65539
Adding light with ID: 65543
Data received: b'{"action": "getLights"}'
Device settings not found for . Creating defaults!
Unhandled Error
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.5/site-packages/twisted/python/log.py", line 103, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/home/pi/.local/lib/python3.5/site-packages/twisted/python/log.py", line 86, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/home/pi/.local/lib/python3.5/site-packages/twisted/python/context.py", line 122, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/home/pi/.local/lib/python3.5/site-packages/twisted/python/context.py", line 85, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "/home/pi/.local/lib/python3.5/site-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
why = selectable.doRead()
File "/home/pi/.local/lib/python3.5/site-packages/twisted/internet/tcp.py", line 243, in doRead
return self._dataReceived(data)
File "/home/pi/.local/lib/python3.5/site-packages/twisted/internet/tcp.py", line 249, in _dataReceived
rval = self.protocol.dataReceived(data)
File "tradfri.tac", line 97, in dataReceived
self.factory.sendDeviceList(self)
File "tradfri.tac", line 427, in sendDeviceList
devices.append({"DeviceID": aDevice.deviceID, "Name": aDevice.deviceName, "Type": "Light", "Dimmable": stringToBool(deviceConfig[aDevice.modelNumber]['dimmable']), "HasWB": stringToBool(deviceConfig[aDevice.modelNumber]['haswb']), "HasRGB": stringToBool(deviceConfig[aDevice.modelNumber]['hasrgb'])})
File "/usr/lib/python3.5/configparser.py", line 956, in __getitem__
raise KeyError(key)
builtins.KeyError: ''
moroen
Posts: 408
Joined: Sunday 15 January 2017 11:06
Target OS: Linux
Domoticz version: beta
Location: Norway
Contact:

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

Post by moroen »

jakkes72 wrote: Sunday 18 November 2018 19:46 Device settings not found for . Creating defaults!
It looks like you have a device with a blank modelNumber, that's the reason for the [] in the device.ini file... I would guess it also is the reason the adapter fails, I've never seen a blank modelNumber before, and thus haven't implemented handling such a case...

Regards,
M
jakkes72
Posts: 23
Joined: Sunday 10 January 2016 20:37
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by jakkes72 »

At this moment i have:
2 switches (round ones) (removed them now)
3 lamps
1 dimmer

No i have this output:
pi@Domoticz:~/domoticz/plugins/IKEA-Tradfri $ python3 tradfri.tac
IKEA-tradfri COAP-adaptor version 0.8.6 started (command line)!
Connected from IPv4Address(type='TCP', host='127.0.0.1', port=60648)
Data received: b'{"action": "initGateway", "pollinterval": "5", "groups": "False", "observe": "True"}'
Initializing gateway
Adding light with ID: 65545
Adding light with ID: 65546
Adding light with ID: 65544
Adding light with ID: 65543
Data received: b'{"action": "getLights"}'
Device settings not found for TRADFRI transformer 10W. Creating defaults!
{"action": "getLights", "result": [{"Type": "Light", "HasWB": false, "HasRGB": false, "Dimmable": true, "DeviceID": 65544, "Name": "TRADFRI bulb E14 W op/ch 400lm"}, {"Type": "Light", "HasWB": false, "HasRGB": false, "Dimmable": true, "DeviceID": 65545, "Name": "TRADFRI bulb E14 W op/ch 400lm 2"}, {"Type": "Light", "HasWB": true, "HasRGB": false, "Dimmable": true, "DeviceID": 65546, "Name": "Gordijnen"}, {"Type": "Light", "HasWB": true, "HasRGB": false, "Dimmable": true, "DeviceID": 65543, "Name": "Lamp Hal Douche"}], "status": "Ok"}
Announcing changed devices!
Error in announce: Request timed out
Disconnected
Connected from IPv4Address(type='TCP', host='127.0.0.1', port=60650)
Data received: b'{"action": "initGateway", "pollinterval": "5", "groups": "False", "observe": "True"}'
Initializing gateway
Adding light with ID: 65545
Adding light with ID: 65546
Adding light with ID: 65544
Adding light with ID: 65543
Data received: b'{"action": "getLights"}'
{"action": "getLights", "result": [{"Type": "Light", "HasWB": false, "HasRGB": false, "Dimmable": true, "DeviceID": 65544, "Name": "TRADFRI bulb E14 W op/ch 400lm"}, {"Type": "Light", "HasWB": false, "HasRGB": false, "Dimmable": true, "DeviceID": 65545, "Name": "TRADFRI bulb E14 W op/ch 400lm 2"}, {"Type": "Light", "HasWB": true, "HasRGB": false, "Dimmable": true, "DeviceID": 65546, "Name": "Gordijnen"}, {"Type": "Light", "HasWB": true, "HasRGB": false, "Dimmable": true, "DeviceID": 65543, "Name": "Lamp Hal Douche"}], "status": "Ok"}
Announcing changed devices!
{'action': 'deviceUpdate', 'result': [{'DeviceID': 65545, 'Name': 'TRADFRI bulb E14 W op/ch 400lm 2', 'Hex': None, 'State': True, 'Level': 199}], 'status': 'Ok'}
{'action': 'deviceUpdate', 'result': [{'DeviceID': 65546, 'Name': 'Gordijnen', 'Hex': None, 'State': True, 'Level': 216}], 'status': 'Ok'}
{'action': 'deviceUpdate', 'result': [{'DeviceID': 65544, 'Name': 'TRADFRI bulb E14 W op/ch 400lm', 'Hex': None, 'State': True, 'Level': 198}], 'status': 'Ok'}
{'action': 'deviceUpdate', 'result': [{'DeviceID': 65543, 'Name': 'Lamp Hal Douche', 'Hex': 'f1e0b5', 'State': False, 'Level': 254}], 'status': 'Ok'}
Data received: b'{"action": "announceChanged"}'
Announcing changed devices!
Data received: b'{"action": "announceChanged"}'
Announcing changed devices!
Data received: b'{"action": "announceChanged"}'
Announcing changed devices!
Data received: b'{"action": "announceChanged"}'
Announcing changed devices!
Data received: b'{"action": "announceChanged"}'
Announcing changed devices!
Data received: b'{"action": "announceChanged"}'
Announcing changed devices!


It seems it works! have to find out if the error is in one of the switches or in the lamps that are not connected now
Keep you informed!!!
kteeven
Posts: 3
Joined: Saturday 24 November 2018 22:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by kteeven »

Hopefully somebody can help me here ;)
For serveral days im struggeling with making tradfri working on my pi with domoticz. I followed the steps on https://github.com/moroen/IKEA-Tradfri-plugin. Nowhere i got an error

Code: Select all

pi@Domoticz:~/domoticz/plugins/IKEA-Tradfri $ ./configure.py 192.168.1.108 xxx --debug
Config created!
In the logging of the web GUI in domoticz i see nothing related to the plugin but the tradfri adapter is not showing in the hardware list.

On thing i doubt about is the user in the ikea-tradfri.service file. what should this be?

Code: Select all

[Unit]
Description=IKEA Tradfri COAP-adapter

[Service]
Type=simple
ExecStart=/usr/local/bin/twistd --nodaemon \
      --rundir=/home/pi/domoticz/plugins/IKEA-Tradfri \
      --pidfile=/home/pi/domoticz/plugins/IKEA-Tradfri/twistd.pid \
      --python=/home/pi/domoticz/plugins/IKEA-Tradfri/tradfri.tac

User=domoticz
Group=domoticz

Restart=always

[Install]
WantedBy=multi-user.target



hopefully somebody can help me, thanks a lot!
Thijs74
Posts: 2
Joined: Saturday 24 February 2018 9:35
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by Thijs74 »

After strugling around to get things working...

Finally managed to reproduce a working coppy :D :D
It seems that installing several programs (twisted, pytradfri etc.) are sensitive to the sudo command.
some do require it, while others don't seem to like it.

Have used a blank SD card with a fresh installation of Raspbian Lite, installation doen on a RPI2B and a RPI3B+

Please find the steps I have followed below:
Raspian Lite (Nov. 2018)

SD Card preparation:
1. Flash SD with Raspbian Lite
2. create a file ssh.txt (no contents needed) to enable ssh

Startup RPI - Putty for SSH connection:
1. sudo apt-get update
2. sudo apt-get upgrade
3. sudo apt-get install python3-pip autoconf libtool
4. curl –L install.domoticz.com | sudo bash
5. cd /home/pi/domoticz/plugins
6. git clone https://github.com/moroen/IKEA-Tradfri-plugin.git IKEA-Tradfri
7. cd IKEA-Tradfri
8. bash ./install-coap-client.sh
9. pip3 install pytradfri
10. sudo pip3 install twisted
11. pip3 install service-identity
12. ./configure.py IP KEY
13. python3 tradfri.tac
14. ./configure.py –skip-config –create-service
15. sudo cp ikea-tradfri.service /etc/systemd/system
16. sudo systemctl daemon-reload
17. sudo systemctl start ikea-tradfri.service
18. sudo systemctl enable ikea-tradfri.service
19. Reboot or Restart domoticz

NOTE: Wheb SD card is placed in another RPI, you will have to run step 12 again.
This forum thread has been of great use, during trouble shooting :P :P

Kind regards,

Thijs
moroen
Posts: 408
Joined: Sunday 15 January 2017 11:06
Target OS: Linux
Domoticz version: beta
Location: Norway
Contact:

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

Post by moroen »

kteeven wrote: Saturday 24 November 2018 22:35 Hopefully somebody can help me here ;)
For serveral days im struggeling with making tradfri working on my pi with domoticz. I followed the steps on https://github.com/moroen/IKEA-Tradfri-plugin. Nowhere i got an error

Code: Select all

pi@Domoticz:~/domoticz/plugins/IKEA-Tradfri $ ./configure.py 192.168.1.108 xxx --debug
Config created!
In the logging of the web GUI in domoticz i see nothing related to the plugin but the tradfri adapter is not showing in the hardware list.
If the plugin is located in the correct folder (../domoticz/plugins/IKEA-Tradfri) but doesn't show up in the hardware list, the most common reason is that the python plugin framework is disabled. When starting domoticz, one of the first lines in the log should be:

Code: Select all

2018-11-25 22:12:53.695  Status: PluginSystem: Started, Python version '3.x.x'.
If not, domoticz can't find the python library...
kteeven wrote: Saturday 24 November 2018 22:35 On thing i doubt about is the user in the ikea-tradfri.service file. what should this be?

Code: Select all

[Unit]
Description=IKEA Tradfri COAP-adapter

[Service]
Type=simple
ExecStart=/usr/local/bin/twistd --nodaemon \
      --rundir=/home/pi/domoticz/plugins/IKEA-Tradfri \
      --pidfile=/home/pi/domoticz/plugins/IKEA-Tradfri/twistd.pid \
      --python=/home/pi/domoticz/plugins/IKEA-Tradfri/tradfri.tac

User=domoticz
Group=domoticz

Restart=always

[Install]
WantedBy=multi-user.target



hopefully somebody can help me, thanks a lot!
That service file looks mostly fine, but are you running domoticz as a user called domoticz? It looks like you have domoticz installed as the pi user. The User and Group must match the user running domoticz.

Regards,
M
schumi2004
Posts: 24
Joined: Tuesday 17 October 2017 19:38
Target OS: NAS (Synology & others)
Domoticz version: 4.10603
Contact:

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

Post by schumi2004 »

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!!
How did you managed to get it running on your Synology?
Are you using Docker?

My NAS is unable to run Docker so i need to compile it on the NAS itself but that doesn't seem to be that straight forward as described in plugin readme.
MichaelvK
Posts: 7
Joined: Tuesday 02 January 2018 19: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 »

I have installed the bunch which is needed, coap client, twisted and all. Then make sure you are on the later beta versions and follow the updated read.me from the beta release of the tradfri addin from moroen. At first I also was not running the python enabled version of Domoticz from jadahl.com.
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
kteeven
Posts: 3
Joined: Saturday 24 November 2018 22:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by kteeven »

After last message i start focussing on python part.
When i run

Code: Select all

pi@Domoticz:/ $ python3 -V
Python 3.5.2
But when I try to install the tradfri

Code: Select all

sudo pip3 install pytradfri
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pytradfri
  Using cached https://www.piwheels.org/simple/pytradfri/pytradfri-6.0.1-py3-none-any.whl
pytradfri requires Python '>=3.5' but the running Python is 3.4.2
I tried to uninstall 3.4.2 version. but then Pip is not working anymore. and by installing this one again i got 3.4.2 for free :roll:

What do i do wrong???
kteeven
Posts: 3
Joined: Saturday 24 November 2018 22:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by kteeven »

Today i started with a fresh install of domoticz and OS. I wish i did this before. it is now working.

Thanks anyhow!
MichaelvK
Posts: 7
Joined: Tuesday 02 January 2018 19: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 »

Ahh, I was thinking of explaining my workaround, but thanks for your quick update.

I had experimented with docker, bootstrapping synology and all kind of other things, but at the end all got fixed in the current release.
(Otherwise you have symbolic linking to everywhere in order to get the correct version of python working, missing GCC compilers and all that crap..)

Good to know you succeeded as well!
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
PieterKruithof
Posts: 2
Joined: Tuesday 04 December 2018 21:38
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10266
Location: Zuid-Holland
Contact:

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

Post by PieterKruithof »

Hi,

I'm a newbe here on Domoticz. I had some experience with Pimatic before, but more and more interested in Domoticz for my new setup. I managed, after some trial and error, to install the Python script and the Tradfri lights are now up and running in my Domoticz. Works pretty well! (Thanks Moroen! ;) )

There is one thing I don't like in the result: all my lights show up in the Domoticz devices list as two devices. All the lights have 1 dimmer switch and 1 selector switch for the color temperature. Even the type spot without color temperature has a selector for it. There is no combined switch for each light.

For instance: I have 12 spotlights (GU10) connected in the ceiling. They show up as 24 devices in my list. If i want to use a dimmer and set the color temperature, i end up with 24 switches in the interface :cry: .

:?: Is there anyway two 'connect' these two switches (and devices) to one? I mean something like how the Philips Hue bulbs show up in the interface: 1 device with multiple settings.

Thanks for the advice!

Pieter
Hardware RPi 3B+ / RFX433trxXL
Domoticz: 4.10266
Python: 3.5.3
RFX433trxXL
moroen
Posts: 408
Joined: Sunday 15 January 2017 11:06
Target OS: Linux
Domoticz version: beta
Location: Norway
Contact:

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

Post by moroen »

PieterKruithof wrote: Sunday 09 December 2018 22:18 There is one thing I don't like in the result: all my lights show up in the Domoticz devices list as two devices. All the lights have 1 dimmer switch and 1 selector switch for the color temperature. Even the type spot without color temperature has a selector for it. There is no combined switch for each light.

For instance: I have 12 spotlights (GU10) connected in the ceiling. They show up as 24 devices in my list. If i want to use a dimmer and set the color temperature, i end up with 24 switches in the interface :cry: .

:?: Is there anyway two 'connect' these two switches (and devices) to one? I mean something like how the Philips Hue bulbs show up in the interface: 1 device with multiple settings.
I quite agree, the solution with two devices per light is far from ideal. The reason is that the plugin-framework doesn't provide a combined dimmer AND selector device-type, at least as far as I can tell. I haven't gotten around to dig into the code for defining device-types in order to implement a combined device.

As for the 12 spotlights, you could combine them into one or more groups using the Ikea Tradfri app, and enable "Add groups as devices". You'll still end up with all the devices in the device-list, but you would also get ONE device that controls all the lights as if they were one. Then you'll able to add this single device to your switches-page..

Regards,
M
User avatar
Involver
Posts: 4
Joined: Thursday 18 August 2016 22:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Location: Amsterdam
Contact:

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

Post by Involver »

Hello All,

First a big thanks to all contributers to make the Tradfri plugin possible! I have been running the plugin for a few months now without too much issues (occasionally my gateway seems unresponsive to some of the dimmers). I've noticed that the plugin has been updated and I would like to update mine as well, but before I break anything; can someone please give a quick explanation on how to update from github? Can i just copy the new files (mainly the tradfri.tac and plugin.py).. much appreciated!

regards,

David
Domoticz - RPi - RFXCom - KaKu - Synology - HikVision - Oregon Scientific - YouLess - Anna
moroen
Posts: 408
Joined: Sunday 15 January 2017 11:06
Target OS: Linux
Domoticz version: beta
Location: Norway
Contact:

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

Post by moroen »

Involver wrote: Monday 10 December 2018 15:50 Hello All,

First a big thanks to all contributers to make the Tradfri plugin possible! I have been running the plugin for a few months now without too much issues (occasionally my gateway seems unresponsive to some of the dimmers). I've noticed that the plugin has been updated and I would like to update mine as well, but before I break anything; can someone please give a quick explanation on how to update from github? Can i just copy the new files (mainly the tradfri.tac and plugin.py).. much appreciated!

regards,

David
If you've installed the plugin using git, updating is quite simple. Stop domoticz, pull the changes and restart domotitcz:

Code: Select all

$ sudo systemctl stop domoticz.service
$ cd domoticz/plugins/IKEA-Tradfri
$ git checkout master
$ git pull
$ sudo systemctl start domoticz.service
If you haven't updated in a while, it might be a good idea to upgrade pytradfri as well:

Code: Select all

$ pip3 install --upgrade pytradfri
Regards,
M
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest