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

Python and python framework
RapTile
Posts: 58
Joined: Saturday 10 March 2018 3:01
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by RapTile » Saturday 10 November 2018 1:35

Got it working.
Upgraded python
Made sure the ssl stuf was working with above post
followed your readme

Thanks for your support and awesome plugin!

What interval did u set it to?

markis
Posts: 6
Joined: Sunday 19 February 2017 22:16
Target OS: Raspberry Pi
Domoticz version: 4.9700
Contact:

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

Post by markis » Saturday 10 November 2018 9:41

I need basic help installing support for IKEA trådfri Gateway.
I'm trying to follow the instructions: https://github.com/moroen/IKEA-Tradfri-plugin

I've installed python.
I've installed libcoap: $ bash ./install-coap-client.sh

But I cannot Install pytradfri-library with "$ pip3 install pytradfri". I do not have pip3.
I guess there is some problems with my python installation and I'm trying to understand the information found in https://www.domoticz.com/wiki/Using_Python_plugins.
Checking the version:
pi@Domoticz:~ $ python3 -V
Python 3.4.2

pi@Domoticz:~ $ dpkg --get-selections | grep libpython
libpython-stdlib:armhf install
libpython2.7:armhf install
libpython2.7-minimal:armhf install
libpython2.7-stdlib:armhf install
libpython3-stdlib:armhf install
libpython3.4:armhf install
libpython3.4-minimal:armhf install
libpython3.4-stdlib:armhf install

Next question; When I get pip3 working, how and what do I download from https://github.com/ggravlingen/pytradfri?

I really appreciate if you could help me! :)

RapTile
Posts: 58
Joined: Saturday 10 March 2018 3:01
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by RapTile » Sunday 11 November 2018 1:59

markis wrote:
Saturday 10 November 2018 9:41
I need basic help installing support for IKEA trådfri Gateway.
I'm trying to follow the instructions: https://github.com/moroen/IKEA-Tradfri-plugin

I've installed python.
I've installed libcoap: $ bash ./install-coap-client.sh

But I cannot Install pytradfri-library with "$ pip3 install pytradfri". I do not have pip3.
I guess there is some problems with my python installation and I'm trying to understand the information found in https://www.domoticz.com/wiki/Using_Python_plugins.
Checking the version:
pi@Domoticz:~ $ python3 -V
Python 3.4.2

pi@Domoticz:~ $ dpkg --get-selections | grep libpython
libpython-stdlib:armhf install
libpython2.7:armhf install
libpython2.7-minimal:armhf install
libpython2.7-stdlib:armhf install
libpython3-stdlib:armhf install
libpython3.4:armhf install
libpython3.4-minimal:armhf install
libpython3.4-stdlib:armhf install

Next question; When I get pip3 working, how and what do I download from https://github.com/ggravlingen/pytradfri?

I really appreciate if you could help me! :)
First make sure you upgrade python
https://raspberrypi.stackexchange.com/q ... python-3-6

apt-get install pip3 should do the trick i suppose.

I received SSL errors and followed this link to fix that:
https://github.com/k4m4/kickthemout/issues/251

markis
Posts: 6
Joined: Sunday 19 February 2017 22:16
Target OS: Raspberry Pi
Domoticz version: 4.9700
Contact:

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

Post by markis » Sunday 11 November 2018 18:06

RapTile wrote:
Sunday 11 November 2018 1:59
First make sure you upgrade python
https://raspberrypi.stackexchange.com/q ... python-3-6

apt-get install pip3 should do the trick i suppose.

I received SSL errors and followed this link to fix that:
https://github.com/k4m4/kickthemout/issues/251
Should I upgrade to the latest Python?
https://www.python.org/ftp/python/
Looks like 3.7.1 is the latest.

User avatar
heggink
Posts: 600
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi
Domoticz version: V4.9999
Location: NL
Contact:

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

Post by heggink » Monday 12 November 2018 0:40

You should probably stick to 3.6 as I am reading a bunch of issues with 3.7.
Pi3, latest beta
RFXCOM, z-wave (AEOTEC, switches, temhum, pir, contacts),
Plugwise2py, P1 'smart'meter & solar panel
Alexa, Wifi Cams motion detection
ESP: relays, PIR & Temp/TempHum
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest

markis
Posts: 6
Joined: Sunday 19 February 2017 22:16
Target OS: Raspberry Pi
Domoticz version: 4.9700
Contact:

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

Post by markis » Monday 12 November 2018 16:53

This guide "How to Install Python 3.6 on Ubuntu & LinuxMint" did the trick!
https://tecadmin.net/install-python-3-6 ... linuxmint/

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

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

Post by jakkes72 » Monday 12 November 2018 19:16

I tried a new install, using https://github.com/moroen/IKEA-Tradfri-plugin

All the steps work well, config created:
pi@Domoticz:~/domoticz/plugins $ git clone https://github.com/moroen/IKEA-Tradfri-plugin.git IKEA-Tradfri
Cloning into 'IKEA-Tradfri'...
remote: Enumerating objects: 21, done.
remote: Counting objects: 100% (21/21), done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 485 (delta 9), reused 10 (delta 4), pack-reused 464
Receiving objects: 100% (485/485), 126.17 KiB | 0 bytes/s, done.
Resolving deltas: 100% (273/273), done.

pi@Domoticz:~/domoticz/plugins $ cd IKEA-Tradfri/
pi@Domoticz:~/domoticz/plugins/IKEA-Tradfri $ ./configure.py 10.60.0.xx 1xxx
Config created!

pi@Domoticz:~/domoticz/plugins/IKEA-Tradfri $ python3 tradfri.tac
IKEA-tradfri COAP-adaptor version 0.8.3 started (command line)!
Connected from IPv4Address(type='TCP', host='127.0.0.1', port=52502)
Data received: b'{"action": "initGateway", "groups": "False", "pollinterval": "5", "observe": "True"}'
Initializing gateway
Adding light with ID: 65542
Adding socket with ID: 65538
Adding light with ID: 65545

pi@Domoticz:~/domoticz/plugins/IKEA-Tradfri $ ./configure.py --skip-config --create-service

The content of the service:
[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=pi
Group=pi

Restart=always

[Install]
WantedBy=multi-user.target

pi@Domoticz:~/domoticz/plugins/IKEA-Tradfri $ sudo cp ikea-tradfri.service /etc/systemd/system
pi@Domoticz:~/domoticz/plugins/IKEA-Tradfri $ sudo systemctl daemon-reload
pi@Domoticz:~/domoticz/plugins/IKEA-Tradfri $ sudo systemctl start ikea-tradfri.service
pi@Domoticz:~/domoticz/plugins/IKEA-Tradfri $ sudo systemctl enable ikea-tradfri.service
pi@Domoticz:~/domoticz/plugins/IKEA-Tradfri $

When looking in the log od Domoticz:
2018-11-12 18:03:45.522 (TradFri) Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
2018-11-12 18:03:45.522 (TradFri) Device has disconnected
2018-11-12 18:04:00.550 (TradFri) Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
2018-11-12 18:04:00.550 (TradFri) Device has disconnected
2018-11-12 18:04:15.527 (TradFri) Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
2018-11-12 18:04:15.528 (TradFri) Device has disconnected
2018-11-12 18:04:30.553 (TradFri) Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
2018-11-12 18:04:30.553 (TradFri) Device has disconnected
2018-11-12 18:04:45.531 (TradFri) Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
2018-11-12 18:04:45.531 (TradFri) Device has disconnected
2018-11-12 18:05:00.559 (TradFri) Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
2018-11-12 18:05:00.559 (TradFri) Device has disconnected
2018-11-12 18:05:15.536 (TradFri) Failed to connect to IKEA tradfri COAP-adapter! Status: 111 Description: Connection refused
2018-11-12 18:05:15.537 (TradFri) Device has disconnected


pi@Domoticz:~/domoticz/plugins/IKEA-Tradfri $ sudo systemctl status ikea-tradfri.service
● ikea-tradfri.service - IKEA Tradfri COAP-adapter
Loaded: loaded (/etc/systemd/system/ikea-tradfri.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2018-11-12 18:06:15 CET; 1min 44s ago
Process: 6833 ExecStart=/usr/local/bin/twistd --nodaemon --rundir=/home/pi/domoticz/plugins/IKEA-Tradfri --pidfi
Main PID: 6833 (code=exited, status=1/FAILURE)

Nov 12 18:06:15 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Failed with result 'exit-code'.
Nov 12 18:06:15 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Service hold-off time over, scheduling restar
Nov 12 18:06:15 Domoticz.labots.nl systemd[1]: Stopped IKEA Tradfri COAP-adapter.
Nov 12 18:06:15 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Start request repeated too quickly.
Nov 12 18:06:15 Domoticz.labots.nl systemd[1]: Failed to start IKEA Tradfri COAP-adapter.
Nov 12 18:06:15 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Unit entered failed state.
Nov 12 18:06:15 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Failed with result 'exit-code'.

When i remove de dir home/pi/domoticz/plugins/IKEA-Tradfri and start again at step 4, everything works one time, until i try to make it start as a service...

Is this normal behaviour, and should i proceed with making the docker image?

moroen
Posts: 221
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 13 November 2018 8:55

jakkes72 wrote:
Monday 12 November 2018 19:16
Is this normal behaviour, and should i proceed with making the docker image?
No, you should be able to start it as service, I'll look into it!

Regards,
M

moroen
Posts: 221
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 13 November 2018 22:12

jakkes72 wrote:
Monday 12 November 2018 19:16
pi@Domoticz:~/domoticz/plugins/IKEA-Tradfri $ sudo systemctl status ikea-tradfri.service
● ikea-tradfri.service - IKEA Tradfri COAP-adapter
Loaded: loaded (/etc/systemd/system/ikea-tradfri.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2018-11-12 18:06:15 CET; 1min 44s ago
Process: 6833 ExecStart=/usr/local/bin/twistd --nodaemon --rundir=/home/pi/domoticz/plugins/IKEA-Tradfri --pidfi
Main PID: 6833 (code=exited, status=1/FAILURE)

Nov 12 18:06:15 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Failed with result 'exit-code'.
Nov 12 18:06:15 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Service hold-off time over, scheduling restar
Nov 12 18:06:15 Domoticz.labots.nl systemd[1]: Stopped IKEA Tradfri COAP-adapter.
Nov 12 18:06:15 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Start request repeated too quickly.
Nov 12 18:06:15 Domoticz.labots.nl systemd[1]: Failed to start IKEA Tradfri COAP-adapter.
Nov 12 18:06:15 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Unit entered failed state.
Nov 12 18:06:15 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Failed with result 'exit-code'.

When i remove de dir home/pi/domoticz/plugins/IKEA-Tradfri and start again at step 4, everything works one time, until i try to make it start as a service...

Is this normal behaviour, and should i proceed with making the docker image?
Could you please provide the systemd journal for ikea-tradfri?

Code: Select all

$ sudo journalctl -f -u ikea-tradfri
And if you don't mind me asking, why are you trying to both enable ikea-tradfri as a systemd-service and building a docker image?

Regards,
M

markis
Posts: 6
Joined: Sunday 19 February 2017 22:16
Target OS: Raspberry Pi
Domoticz version: 4.9700
Contact:

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

Post by markis » Tuesday 13 November 2018 23:37

I'm almost there but I cannot configure the COAP adaptor.

Code: Select all

pi@Domoticz:~/domoticz/plugins/IKEA-Tradfri $ ./configure.py 192.168.x.y zzzzzzzzzz
Traceback (most recent call last):
  File "./configure.py", line 3, in <module>
    from pytradfri import Gateway
ImportError: No module named 'pytradfri'
As you can see, pytradfri is installed and Python version is newer than 3.5.

Code: Select all

pi@Domoticz:~/domoticz/plugins/IKEA-Tradfri $ pip3 -V
pip 18.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)

pi@Domoticz:~/domoticz/plugins/IKEA-Tradfri $ pip3 list
Package        Version
-------------- -------
attrs          18.2.0
Automat        0.7.0
constantly     15.1.0
hyperlink      18.0.0
idna           2.7
incremental    17.5.0
pip            18.1
PyHamcrest     1.9.0
pytradfri      6.0.1
setuptools     39.0.1
six            1.11.0
Twisted        18.9.0
zope.interface 4.6.0
pi@Domoticz:~/domoticz/plugins/IKEA-Tradfri $

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

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

Post by jakkes72 » Wednesday 14 November 2018 0:20

pi@Domoticz:~ $ sudo journalctl -f -u ikea-tradfri
-- Logs begin at Thu 2016-11-03 18:16:43 CET. --
Nov 12 18:46:06 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Service hold-off time over, scheduling restart.
Nov 12 18:46:06 Domoticz.labots.nl systemd[1]: Stopped IKEA Tradfri COAP-adapter.
Nov 12 18:46:06 Domoticz.labots.nl systemd[1]: Started IKEA Tradfri COAP-adapter.
Nov 12 18:46:08 Domoticz.labots.nl twistd[1926]: Fatal: No config.json found
Nov 12 18:46:08 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Service hold-off time over, scheduling restart.
Nov 12 18:46:08 Domoticz.labots.nl systemd[1]: Stopped IKEA Tradfri COAP-adapter.
Nov 12 18:46:08 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Start request repeated too quickly.
Nov 12 18:46:08 Domoticz.labots.nl systemd[1]: Failed to start IKEA Tradfri COAP-adapter.
Nov 12 18:46:08 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Unit entered failed state.
Nov 12 18:46:08 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Failed with result 'start-limit-hit'.

It wasn't quit obvious for me that it was a choice, so i tried both...

moroen
Posts: 221
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 14 November 2018 14:49

jakkes72 wrote:
Wednesday 14 November 2018 0:20
pi@Domoticz:~ $ sudo journalctl -f -u ikea-tradfri
-- Logs begin at Thu 2016-11-03 18:16:43 CET. --
Nov 12 18:46:06 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Service hold-off time over, scheduling restart.
Nov 12 18:46:06 Domoticz.labots.nl systemd[1]: Stopped IKEA Tradfri COAP-adapter.
Nov 12 18:46:06 Domoticz.labots.nl systemd[1]: Started IKEA Tradfri COAP-adapter.
Nov 12 18:46:08 Domoticz.labots.nl twistd[1926]: Fatal: No config.json found
Nov 12 18:46:08 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Service hold-off time over, scheduling restart.
Nov 12 18:46:08 Domoticz.labots.nl systemd[1]: Stopped IKEA Tradfri COAP-adapter.
Nov 12 18:46:08 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Start request repeated too quickly.
Nov 12 18:46:08 Domoticz.labots.nl systemd[1]: Failed to start IKEA Tradfri COAP-adapter.
Nov 12 18:46:08 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Unit entered failed state.
Nov 12 18:46:08 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Failed with result 'start-limit-hit'.

It wasn't quit obvious for me that it was a choice, so i tried both...
The adapter fails to find config.json when run as a service. If config.json is located in the same directory as tradfri.tac, this shouldn't happen... I can't see a obvious reason this fails. I'll make some changes to make the error message a bit more informative as soon as possible.

Regards,
M

moroen
Posts: 221
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 14 November 2018 14:54

markis wrote:
Tuesday 13 November 2018 23:37
I'm almost there but I cannot configure the COAP adaptor.

Code: Select all

pi@Domoticz:~/domoticz/plugins/IKEA-Tradfri $ ./configure.py 192.168.x.y zzzzzzzzzz
Traceback (most recent call last):
  File "./configure.py", line 3, in <module>
    from pytradfri import Gateway
ImportError: No module named 'pytradfri'
As you can see, pytradfri is installed and Python version is newer than 3.5.

Code: Select all

pi@Domoticz:~/domoticz/plugins/IKEA-Tradfri $ pip3 -V
pip 18.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)

pi@Domoticz:~/domoticz/plugins/IKEA-Tradfri $ pip3 list
Package        Version
-------------- -------
attrs          18.2.0
Automat        0.7.0
constantly     15.1.0
hyperlink      18.0.0
idna           2.7
incremental    17.5.0
pip            18.1
PyHamcrest     1.9.0
pytradfri      6.0.1
setuptools     39.0.1
six            1.11.0
Twisted        18.9.0
zope.interface 4.6.0
pi@Domoticz:~/domoticz/plugins/IKEA-Tradfri $
I'm running out of ideas why pytradfri can't be found, when it clearly it's installed... Still able to import it from interactive python when in another directory than the plugin?

Regards,
M

moroen
Posts: 221
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 14 November 2018 19:50

moroen wrote:
Wednesday 14 November 2018 14:49
jakkes72 wrote:
Wednesday 14 November 2018 0:20
pi@Domoticz:~ $ sudo journalctl -f -u ikea-tradfri
-- Logs begin at Thu 2016-11-03 18:16:43 CET. --
Nov 12 18:46:06 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Service hold-off time over, scheduling restart.
Nov 12 18:46:06 Domoticz.labots.nl systemd[1]: Stopped IKEA Tradfri COAP-adapter.
Nov 12 18:46:06 Domoticz.labots.nl systemd[1]: Started IKEA Tradfri COAP-adapter.
Nov 12 18:46:08 Domoticz.labots.nl twistd[1926]: Fatal: No config.json found
Nov 12 18:46:08 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Service hold-off time over, scheduling restart.
Nov 12 18:46:08 Domoticz.labots.nl systemd[1]: Stopped IKEA Tradfri COAP-adapter.
Nov 12 18:46:08 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Start request repeated too quickly.
Nov 12 18:46:08 Domoticz.labots.nl systemd[1]: Failed to start IKEA Tradfri COAP-adapter.
Nov 12 18:46:08 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Unit entered failed state.
Nov 12 18:46:08 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Failed with result 'start-limit-hit'.

It wasn't quit obvious for me that it was a choice, so i tried both...
The adapter fails to find config.json when run as a service. If config.json is located in the same directory as tradfri.tac, this shouldn't happen... I can't see a obvious reason this fails. I'll make some changes to make the error message a bit more informative as soon as possible.

Regards,
M
If this still fails, try the latest development-branch, it should display some more info...

Regards,
M

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

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

Post by jakkes72 » Wednesday 14 November 2018 20:51

Had to figure out out to use a develop branch... is it to correct to use git clone -b develop http://etc...?

Now i have this output: (did a reboot)

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

The file config.json is (and was) in the IKEA-tradfri directory.

moroen
Posts: 221
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 14 November 2018 22:19

jakkes72 wrote:
Wednesday 14 November 2018 20:51
Had to figure out out to use a develop branch... is it to correct to use git clone -b develop http://etc...?
That's one way of doing it, but you can switch between branches using just one directory with the help of the checkout command:

Code: Select all

$ git clone http://....
$ cd IKEA-Tradfri
$ git checkout development
$ git checkout master
jakkes72 wrote:
Wednesday 14 November 2018 20:51
Now i have this output: (did a reboot)

Nov 14 20:01:47 Domoticz.labots.nl twistd[3882]: configparser.ParsingError: Source contains parsing errors: '/home/pi/domoticz/plugins/IKEA-Tradfri/devices.ini'
Nov 14 20:01:47 Domoticz.labots.nl twistd[3882]: [line 41]: '[]\n'
Nov 14 20:01:47 Domoticz.labots.nl twistd[3882]: Failed to load application: Source contains parsing errors: '/home/pi/domoticz/plugins/IKEA-Tradfri/devices.ini'
Nov 14 20:01:47 Domoticz.labots.nl twistd[3882]: [line 41]: '[]\n'
Nov 14 20:01:47 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Main process exited, code=exited, status=1/FAILURE
Nov 14 20:01:47 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Unit entered failed state.
Nov 14 20:01:47 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Failed with result 'exit-code'.
Nov 14 20:01:47 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Service hold-off time over, scheduling restart.
Nov 14 20:01:47 Domoticz.labots.nl systemd[1]: Stopped IKEA Tradfri COAP-adapter.
Nov 14 20:01:47 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Start request repeated too quickly.
Nov 14 20:01:47 Domoticz.labots.nl systemd[1]: Failed to start IKEA Tradfri COAP-adapter.
Nov 14 20:01:47 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Unit entered failed state.
Nov 14 20:01:47 Domoticz.labots.nl systemd[1]: ikea-tradfri.service: Failed with result 'exit-code'.

The file config.json is (and was) in the IKEA-tradfri directory.
Strange, now you have a different error than before. The previous error was config.json not found, now there's something wrong with the devices.ini file??? devices.ini hasn't changed for many months, there is no reason for it to suddenly throw parsing-errors! Could you please post the contents of your devices.ini?

Regards,
M

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

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

Post by jakkes72 » Wednesday 14 November 2018 22:28

[DEFAULT]
hasrgb = False
dimmable = True
haswb = True

[TRADFRI bulb E14 WS opal 400lm]
dimmable = True
haswb = True
hasrgb = False

[TRADFRI bulb E14 W op/ch 400lm]
dimmable = True
haswb = False
hasrgb = False

[TRADFRI bulb E27 W opal 1000lm]
dimmable = True
haswb = False
hasrgb = False

[TRADFRI bulb E27 WS opal 980lm]
dimmable = True
haswb = True
hasrgb = False

[TRADFRI bulb GU10 WS 400lm]
dimmable = True
haswb = True
hasrgb = False

[TRADFRI bulb E27 CWS opal 600lm]
dimmable = True
haswb = False
hasrgb = True

[FLOALT panel WS 30x30]
dimmable = True
haswb = True
hasrgb = False

[]

[TRADFRI transformer 10W]
hasrgb = False
dimmable = True
haswb = True

Removed the line []

And started the service again:
Nov 14 21:24:10 Domoticz.labots.nl systemd[1]: Started IKEA Tradfri COAP-adapter.
Nov 14 21:24:11 Domoticz.labots.nl twistd[22439]: 2018-11-14T21:24:11+0100 [-] Loading /home/pi/domoticz/plugins/IKEA-Tradfri/tradfri.tac...
Nov 14 21:24:11 Domoticz.labots.nl twistd[22439]: 2018-11-14T21:24:11+0100 [-] Loaded.
Nov 14 21:24:11 Domoticz.labots.nl twistd[22439]: 2018-11-14T21:24:11+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] twistd 18.9.0 (/usr/bin/python3 3.5.3) starting up.
Nov 14 21:24:11 Domoticz.labots.nl twistd[22439]: 2018-11-14T21:24:11+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] reactor class: twisted.internet.epollreactor.EPollReactor.
Nov 14 21:24:11 Domoticz.labots.nl twistd[22439]: 2018-11-14T21:24:11+0100 [-] AdaptorFactory starting on 1234
Nov 14 21:24:11 Domoticz.labots.nl twistd[22439]: 2018-11-14T21:24:11+0100 [builtins.AdaptorFactory#info] Starting factory <AdaptorFactory object at 0x75fad2f0>
Nov 14 21:24:15 Domoticz.labots.nl twistd[22439]: 2018-11-14T21:24:15+0100 [stdout#info] Connected from IPv4Address(type='TCP', host='127.0.0.1', port=54178)
Nov 14 21:24:30 Domoticz.labots.nl twistd[22439]: 2018-11-14T21:24:30+0100 [CoapAdapter,0,127.0.0.1] Unhandled Error
Nov 14 21:24:30 Domoticz.labots.nl twistd[22439]: Traceback (most recent call last):
Nov 14 21:24:30 Domoticz.labots.nl twistd[22439]: File "/home/pi/.local/lib/python3.5/site-packages/twisted/python/log.py", line 103, in callWithLogger
Nov 14 21:24:30 Domoticz.labots.nl twistd[22439]: return callWithContext({"system": lp}, func, *args, **kw)
Nov 14 21:24:30 Domoticz.labots.nl twistd[22439]: File "/home/pi/.local/lib/python3.5/site-packages/twisted/python/log.py", line 86, in callWithContext
Nov 14 21:24:30 Domoticz.labots.nl twistd[22439]: return context.call({ILogContext: newCtx}, func, *args, **kw)
Nov 14 21:24:30 Domoticz.labots.nl twistd[22439]: File "/home/pi/.local/lib/python3.5/site-packages/twisted/python/context.py", line 122, in callWithContext
Nov 14 21:24:30 Domoticz.labots.nl twistd[22439]: return self.currentContext().callWithContext(ctx, func, *args, **kw)
Nov 14 21:24:30 Domoticz.labots.nl twistd[22439]: File "/home/pi/.local/lib/python3.5/site-packages/twisted/python/context.py", line 85, in callWithContext
Nov 14 21:24:30 Domoticz.labots.nl twistd[22439]: return func(*args,**kw)
Nov 14 21:24:30 Domoticz.labots.nl twistd[22439]: --- <exception caught here> ---
Nov 14 21:24:30 Domoticz.labots.nl twistd[22439]: File "/home/pi/.local/lib/python3.5/site-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
Nov 14 21:24:30 Domoticz.labots.nl twistd[22439]: why = selectable.doRead()
Nov 14 21:24:30 Domoticz.labots.nl twistd[22439]: File "/home/pi/.local/lib/python3.5/site-packages/twisted/internet/tcp.py", line 243, in doRead
Nov 14 21:24:30 Domoticz.labots.nl twistd[22439]: return self._dataReceived(data)
Nov 14 21:24:30 Domoticz.labots.nl twistd[22439]: File "/home/pi/.local/lib/python3.5/site-packages/twisted/internet/tcp.py", line 249, in _dataReceived
Nov 14 21:24:30 Domoticz.labots.nl twistd[22439]: rval = self.protocol.dataReceived(data)
Nov 14 21:24:30 Domoticz.labots.nl twistd[22439]: File "/home/pi/domoticz/plugins/IKEA-Tradfri/tradfri.tac", line 108, in dataReceived
Nov 14 21:24:30 Domoticz.labots.nl twistd[22439]: self.factory.announceChanged()
Nov 14 21:24:30 Domoticz.labots.nl twistd[22439]: File "/home/pi/domoticz/plugins/IKEA-Tradfri/tradfri.tac", line 344, in announceChanged
Nov 14 21:24:30 Domoticz.labots.nl twistd[22439]: print("Error in annouce: {0}:{1}".format(e, e.message))
Nov 14 21:24:30 Domoticz.labots.nl twistd[22439]: builtins.AttributeError: 'RequestTimeout' object has no attribute 'message'
Nov 14 21:24:30 Domoticz.labots.nl twistd[22439]:
Nov 14 21:24:30 Domoticz.labots.nl twistd[22439]: 2018-11-14T21:24:30+0100 [stdout#info] Disconnected
Nov 14 21:24:45 Domoticz.labots.nl twistd[22439]: 2018-11-14T21:24:45+0100 [stdout#info] Connected from IPv4Address(type='TCP', host='127.0.0.1', port=54180)
Nov 14 21:25:00 Domoticz.labots.nl twistd[22439]: 2018-11-14T21:25:00+0100 [CoapAdapter,1,127.0.0.1] Unhandled Error
Nov 14 21:25:00 Domoticz.labots.nl twistd[22439]: Traceback (most recent call last):
Nov 14 21:25:00 Domoticz.labots.nl twistd[22439]: File "/home/pi/.local/lib/python3.5/site-packages/twisted/python/log.py", line 103, in callWithLogger
Nov 14 21:25:00 Domoticz.labots.nl twistd[22439]: return callWithContext({"system": lp}, func, *args, **kw)
Nov 14 21:25:00 Domoticz.labots.nl twistd[22439]: File "/home/pi/.local/lib/python3.5/site-packages/twisted/python/log.py", line 86, in callWithContext
Nov 14 21:25:00 Domoticz.labots.nl twistd[22439]: return context.call({ILogContext: newCtx}, func, *args, **kw)
Nov 14 21:25:00 Domoticz.labots.nl twistd[22439]: File "/home/pi/.local/lib/python3.5/site-packages/twisted/python/context.py", line 122, in callWithContext
Nov 14 21:25:00 Domoticz.labots.nl twistd[22439]: return self.currentContext().callWithContext(ctx, func, *args, **kw)
Nov 14 21:25:00 Domoticz.labots.nl twistd[22439]: File "/home/pi/.local/lib/python3.5/site-packages/twisted/python/context.py", line 85, in callWithContext
Nov 14 21:25:00 Domoticz.labots.nl twistd[22439]: return func(*args,**kw)
Nov 14 21:25:00 Domoticz.labots.nl twistd[22439]: --- <exception caught here> ---
Nov 14 21:25:00 Domoticz.labots.nl twistd[22439]: File "/home/pi/.local/lib/python3.5/site-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
Nov 14 21:25:00 Domoticz.labots.nl twistd[22439]: why = selectable.doRead()
Nov 14 21:25:00 Domoticz.labots.nl twistd[22439]: File "/home/pi/.local/lib/python3.5/site-packages/twisted/internet/tcp.py", line 243, in doRead
Nov 14 21:25:00 Domoticz.labots.nl twistd[22439]: return self._dataReceived(data)
Nov 14 21:25:00 Domoticz.labots.nl twistd[22439]: File "/home/pi/.local/lib/python3.5/site-packages/twisted/internet/tcp.py", line 249, in _dataReceived
Nov 14 21:25:00 Domoticz.labots.nl twistd[22439]: rval = self.protocol.dataReceived(data)
Nov 14 21:25:00 Domoticz.labots.nl twistd[22439]: File "/home/pi/domoticz/plugins/IKEA-Tradfri/tradfri.tac", line 108, in dataReceived
Nov 14 21:25:00 Domoticz.labots.nl twistd[22439]: self.factory.announceChanged()
Nov 14 21:25:00 Domoticz.labots.nl twistd[22439]: File "/home/pi/domoticz/plugins/IKEA-Tradfri/tradfri.tac", line 344, in announceChanged
Nov 14 21:25:00 Domoticz.labots.nl twistd[22439]: print("Error in annouce: {0}:{1}".format(e, e.message))
Nov 14 21:25:00 Domoticz.labots.nl twistd[22439]: builtins.AttributeError: 'RequestTimeout' object has no attribute 'message'
Nov 14 21:25:00 Domoticz.labots.nl twistd[22439]:
Nov 14 21:25:00 Domoticz.labots.nl twistd[22439]: 2018-11-14T21:25:00+0100 [stdout#info] Disconnected

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

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

Post by jakkes72 » Wednesday 14 November 2018 22:49

After a reboot (again) i looked again in the devices.ini...
And there was again a line []
Deleted the line, and restarted the services.
I was able to switch off a lamp..., but not switch it on.

So i had a look in the devices.ini again, and the [] was there again...

moroen
Posts: 221
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 » Thursday 15 November 2018 20:14

jakkes72 wrote:
Wednesday 14 November 2018 22:49
After a reboot (again) i looked again in the devices.ini...
And there was again a line []
Deleted the line, and restarted the services.
I was able to switch off a lamp..., but not switch it on.

So i had a look in the devices.ini again, and the [] was there again...
I have a pretty good idea HOW it fails, but can't quite figure out WHY it fails... :?

Could you please pull the latest development-branch and try again? I don't think it will solve your problem, but if you post the log, it might give me a better idea of what's going on... As a bonus, these changes makes the handling of gateway timeouts a bit more solid...

Regards,
M

tjabas
Posts: 179
Joined: Sunday 11 December 2016 14:51
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by tjabas » Thursday 15 November 2018 21:43

I just noticed this tread, does this mean that ikea trådfri gateway works directly in Domoticz without decontz?

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest