Page 22 of 48

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

Posted: Saturday 10 November 2018 0:35
by RapTile
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?

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

Posted: Saturday 10 November 2018 8:41
by markis
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! :)

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

Posted: Sunday 11 November 2018 0:59
by RapTile
markis wrote: Saturday 10 November 2018 8: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

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

Posted: Sunday 11 November 2018 17:06
by markis
RapTile wrote: Sunday 11 November 2018 0: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.

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

Posted: Sunday 11 November 2018 23:40
by heggink
You should probably stick to 3.6 as I am reading a bunch of issues with 3.7.

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

Posted: Monday 12 November 2018 15:53
by markis
This guide "How to Install Python 3.6 on Ubuntu & LinuxMint" did the trick!
https://tecadmin.net/install-python-3-6 ... linuxmint/

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

Posted: Monday 12 November 2018 18:16
by jakkes72
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?

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

Posted: Tuesday 13 November 2018 7:55
by moroen
jakkes72 wrote: Monday 12 November 2018 18: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

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

Posted: Tuesday 13 November 2018 21:12
by moroen
jakkes72 wrote: Monday 12 November 2018 18: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

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

Posted: Tuesday 13 November 2018 22:37
by markis
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 $

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

Posted: Tuesday 13 November 2018 23:20
by jakkes72
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...

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

Posted: Wednesday 14 November 2018 13:49
by moroen
jakkes72 wrote: Tuesday 13 November 2018 23: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

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

Posted: Wednesday 14 November 2018 13:54
by moroen
markis wrote: Tuesday 13 November 2018 22: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

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

Posted: Wednesday 14 November 2018 18:50
by moroen
moroen wrote: Wednesday 14 November 2018 13:49
jakkes72 wrote: Tuesday 13 November 2018 23: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

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

Posted: Wednesday 14 November 2018 19:51
by jakkes72
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.

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

Posted: Wednesday 14 November 2018 21:19
by moroen
jakkes72 wrote: Wednesday 14 November 2018 19: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 19: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

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

Posted: Wednesday 14 November 2018 21:28
by jakkes72
[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

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

Posted: Wednesday 14 November 2018 21:49
by jakkes72
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...

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

Posted: Thursday 15 November 2018 19:14
by moroen
jakkes72 wrote: Wednesday 14 November 2018 21: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

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

Posted: Thursday 15 November 2018 20:43
by tjabas
I just noticed this tread, does this mean that ikea trådfri gateway works directly in Domoticz without decontz?