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

Python and python framework

Moderator: leecollings

Basssment
Posts: 38
Joined: Thursday 18 October 2018 14:04
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: netherlands, Kuuk
Contact:

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

Post by Basssment »

moroen wrote: Saturday 29 February 2020 17:06
Basssment wrote: Saturday 29 February 2020 8:40 ~/domoticz/plugins/IKEA-Tradfri $ python3 plugin.py list
Traceback (most recent call last):
File "plugin.py", line 41, in <module>
import Domoticz
ModuleNotFoundError: No module named 'Domoticz'

Looks like my module has been corupted? Should i reinstall Maybe? If so, how :)
It appears that you're not running the latest version of the plugin, indicated by the "ModuleNotFoundError" you're seeing, in the newest version domoticz is imported in line 176, so your plugin.py is from before the command line part of the plugin was moved from tradfricoap.py to plugin.py.

Shut down domoticz, update to the latest version of the plugin and py3coap, and restart domoticz

Code: Select all

$ sudo systemctl stop domoticz.service
$ cd domoticz/plugins/IKEA-Tradfri
$ git pull
$ sudo -H pip3 install -U py3coap
$ sudo systemctl stop domoticz.service
The plugin version, as seen on the hardware page in domoticz should be version 0.9.1 and py3coap version 0.8.0.

The latest IKEA firmware update went without a hitch on my system, but if the hardware entries for IKEA has been totally corrupted in domoticz, the easiest (unless you have a lot of devices and scenes) is to go to the hardware page in domotica, select IKEA-Tradfri and press delete to remove the plugin, and then add it again...

Regards,
M
Hi Moroen,

I did do update it!
Look at my outcome if I try
$ git pull

Code: Select all

~/domoticz/plugins/IKEA-Tradfri $ git pull
Your configuration specifies to merge with the ref 'refs/heads/pycoap'
from the remote, but no such ref was fetched.
If I still try to update it gives me the following:

Code: Select all

~/domoticz/plugins/IKEA-Tradfri $ sudo -H pip3 install -U py3coap
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already up-to-date: py3coap in /usr/local/lib/python3.7/dist-packages (0.8.0)
Tried deleting the hardware function and readding it
The bulbs are all there now, but the error i get still remains

Code: Select all

 2020-03-01 12:51:46.952 Error: (Ikea) ----> Line 312 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py'
2020-03-01 12:51:46.952 Error: (Ikea) ----> Line 217 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py'
2020-03-01 12:51:46.952 Error: (Ikea) ----> Line 101 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py'
2020-03-01 12:51:46.952 Error: (Ikea) ----> Line 65 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py'
2020-03-01 12:51:46.952 Error: (Ikea) ----> Line 71 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py'
2020-03-01 12:51:46.952 Error: (Ikea) ----> Line 73 in '/home/pi/domoticz/plugins/IKEA-Tradfri/tradfricoap.py'
2020-03-01 12:51:46.952 Error: (Ikea) ----> Line 41 in '/home/pi/domoticz/plugins/IKEA-Tradfri/tradfricoap.py'
2020-03-01 12:51:46.952 Error: (Ikea) ----> Line 47 in '/usr/local/lib/python3.7/dist-packages/pycoap/pycoap.py' 
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 »

Basssment wrote: Sunday 01 March 2020 12:53 $ git pull

Code: Select all

~/domoticz/plugins/IKEA-Tradfri $ git pull
Your configuration specifies to merge with the ref 'refs/heads/pycoap'
from the remote, but no such ref was fetched.
If I still try to update it gives me the following:

Code: Select all

~/domoticz/plugins/IKEA-Tradfri $ sudo -H pip3 install -U py3coap
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already up-to-date: py3coap in /usr/local/lib/python3.7/dist-packages (0.8.0)
Tried deleting the hardware function and readding it
The bulbs are all there now, but the error i get still remains

Code: Select all

 2020-03-01 12:51:46.952 Error: (Ikea) ----> Line 312 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py'
2020-03-01 12:51:46.952 Error: (Ikea) ----> Line 217 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py'
2020-03-01 12:51:46.952 Error: (Ikea) ----> Line 101 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py'
2020-03-01 12:51:46.952 Error: (Ikea) ----> Line 65 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py'
2020-03-01 12:51:46.952 Error: (Ikea) ----> Line 71 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py'
2020-03-01 12:51:46.952 Error: (Ikea) ----> Line 73 in '/home/pi/domoticz/plugins/IKEA-Tradfri/tradfricoap.py'
2020-03-01 12:51:46.952 Error: (Ikea) ----> Line 41 in '/home/pi/domoticz/plugins/IKEA-Tradfri/tradfricoap.py'
2020-03-01 12:51:46.952 Error: (Ikea) ----> Line 47 in '/usr/local/lib/python3.7/dist-packages/pycoap/pycoap.py' 
You're still on an older version, the pycoap branch has been merged into master and removed. To update you need to switch back to the master branch:

Code: Select all

$ cd domoticz/plugins/IKEA-Tradfri
$ git checkout master
$ git pull
If you still get any errors from git, it's probably easier just to remove the IKEA-Plugin directory and just clone it again:

Code: Select all

$ cd domoticz/plugins
$ rm -rf IKEA-https://github.com/moroen/IKEA-Tradfri-plugin.git
$ git clone https://github.com/moroen/IKEA-Tradfri-plugin.git IKEA-Tradfri
$ cd IKEA-Tradfri
$ python3 plugin.py config IP KEY
Regards,
M
Basssment
Posts: 38
Joined: Thursday 18 October 2018 14:04
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: netherlands, Kuuk
Contact:

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

Post by Basssment »

Thank you Moroen,

It works without having ussues installing the master.
only getting an error in the log of domoticz:

2020-03-01 21:19:49.389 Error: (Ikea) Illegal value for 'Montior batteries'. Using default (No)

Thanx Bas!
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 »

Basssment wrote: Sunday 01 March 2020 21:22 Thank you Moroen,

It works without having ussues installing the master.
only getting an error in the log of domoticz:

2020-03-01 21:19:49.389 Error: (Ikea) Illegal value for 'Montior batteries'. Using default (No)

Thanx Bas!
Glad to hear it! To get rid of that last message, just select the plugin on the hardware page, set "Monitor Batteries" to yes or no and press "Update"...

Regards,
M
trusky77
Posts: 18
Joined: Tuesday 24 December 2019 12:44
Target OS: -
Domoticz version:

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

Post by trusky77 »

moroen wrote: Saturday 29 February 2020 17:07
trusky77 wrote: Thursday 27 February 2020 14:56 Hi!!
In last line have a problem.
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ sudo -H pip3 install -U py3coap
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 7, in <module>
from pip._internal.main import main
ModuleNotFoundError: No module named 'pip._internal.main'

Thx
I'm afraid that it appears that your installation of python has been corrupted. It might be possible to fix it by restoring the distro version of python with apt...

Regards,
M

Good morning,
Yesterday I repaired Python and it worked fine all day. I didn't see any errors in the registry but today if errors have started to come out. I just saw it because I have connected from work. I have restarted but the same errors still appear. Until yesterday it sure worked, today I still have not been able to try it.

Code: Select all

2020-03-02 11:09:53.962 Error: (IKEA Tradfri) 'onStart' failed 'JSONDecodeError'.
2020-03-02 11:09:53.962 Error: (IKEA Tradfri) ----> Line 669 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py', function onStart
2020-03-02 11:09:53.962 Error: (IKEA Tradfri) ----> Line 541 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py', function onStart
2020-03-02 11:09:53.963 Error: (IKEA Tradfri) ----> Line 342 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py', function registerDevices
2020-03-02 11:09:53.963 Error: (IKEA Tradfri) ----> Line 240 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py', function indexRegisteredDevices
2020-03-02 11:09:53.963 Error: (IKEA Tradfri) ----> Line 339 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py', function updateDevice
2020-03-02 11:09:53.963 Error: (IKEA Tradfri) ----> Line 320 in '/home/pi/domoticz/plugins/IKEA-Tradfri/tradfricoap/device.py', function get_device
2020-03-02 11:09:53.963 Error: (IKEA Tradfri) ----> Line 45 in '/home/pi/domoticz/plugins/IKEA-Tradfri/tradfricoap/device.py', function __init__
2020-03-02 11:09:53.963 Error: (IKEA Tradfri) ----> Line 348 in '/usr/lib/python3.7/json/__init__.py', function loads
2020-03-02 11:09:53.963 Error: (IKEA Tradfri) ----> Line 337 in '/usr/lib/python3.7/json/decoder.py', function decode
2020-03-02 11:09:53.963 Error: (IKEA Tradfri) ----> Line 355 in '/usr/lib/python3.7/json/decoder.py', function raw_decode
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 »

trusky77 wrote: Monday 02 March 2020 12:41
moroen wrote: Saturday 29 February 2020 17:07
trusky77 wrote: Thursday 27 February 2020 14:56 Hi!!
In last line have a problem.
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ sudo -H pip3 install -U py3coap
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 7, in <module>
from pip._internal.main import main
ModuleNotFoundError: No module named 'pip._internal.main'

Thx
I'm afraid that it appears that your installation of python has been corrupted. It might be possible to fix it by restoring the distro version of python with apt...

Regards,
M

Good morning,
Yesterday I repaired Python and it worked fine all day. I didn't see any errors in the registry but today if errors have started to come out. I just saw it because I have connected from work. I have restarted but the same errors still appear. Until yesterday it sure worked, today I still have not been able to try it.

Code: Select all

2020-03-02 11:09:53.962 Error: (IKEA Tradfri) 'onStart' failed 'JSONDecodeError'.
2020-03-02 11:09:53.962 Error: (IKEA Tradfri) ----> Line 669 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py', function onStart
2020-03-02 11:09:53.962 Error: (IKEA Tradfri) ----> Line 541 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py', function onStart
2020-03-02 11:09:53.963 Error: (IKEA Tradfri) ----> Line 342 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py', function registerDevices
2020-03-02 11:09:53.963 Error: (IKEA Tradfri) ----> Line 240 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py', function indexRegisteredDevices
2020-03-02 11:09:53.963 Error: (IKEA Tradfri) ----> Line 339 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py', function updateDevice
2020-03-02 11:09:53.963 Error: (IKEA Tradfri) ----> Line 320 in '/home/pi/domoticz/plugins/IKEA-Tradfri/tradfricoap/device.py', function get_device
2020-03-02 11:09:53.963 Error: (IKEA Tradfri) ----> Line 45 in '/home/pi/domoticz/plugins/IKEA-Tradfri/tradfricoap/device.py', function __init__
2020-03-02 11:09:53.963 Error: (IKEA Tradfri) ----> Line 348 in '/usr/lib/python3.7/json/__init__.py', function loads
2020-03-02 11:09:53.963 Error: (IKEA Tradfri) ----> Line 337 in '/usr/lib/python3.7/json/decoder.py', function decode
2020-03-02 11:09:53.963 Error: (IKEA Tradfri) ----> Line 355 in '/usr/lib/python3.7/json/decoder.py', function raw_decode
What do you get if you try to list the devices from the command line?

Code: Select all

$ python3 plugin.py list
I would guess you have a "stale device" of some kind. If it's not to much work, deleting the plugin from the hardware-page and adding it again, probably will solve this error.

Regards,
M
trusky77
Posts: 18
Joined: Tuesday 24 December 2019 12:44
Target OS: -
Domoticz version:

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

Post by trusky77 »

moroen wrote: Monday 02 March 2020 20:20
trusky77 wrote: Monday 02 March 2020 12:41
moroen wrote: Saturday 29 February 2020 17:07

I'm afraid that it appears that your installation of python has been corrupted. It might be possible to fix it by restoring the distro version of python with apt...

Regards,
M

Good morning,
Yesterday I repaired Python and it worked fine all day. I didn't see any errors in the registry but today if errors have started to come out. I just saw it because I have connected from work. I have restarted but the same errors still appear. Until yesterday it sure worked, today I still have not been able to try it.

Code: Select all

2020-03-02 11:09:53.962 Error: (IKEA Tradfri) 'onStart' failed 'JSONDecodeError'.
2020-03-02 11:09:53.962 Error: (IKEA Tradfri) ----> Line 669 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py', function onStart
2020-03-02 11:09:53.962 Error: (IKEA Tradfri) ----> Line 541 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py', function onStart
2020-03-02 11:09:53.963 Error: (IKEA Tradfri) ----> Line 342 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py', function registerDevices
2020-03-02 11:09:53.963 Error: (IKEA Tradfri) ----> Line 240 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py', function indexRegisteredDevices
2020-03-02 11:09:53.963 Error: (IKEA Tradfri) ----> Line 339 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py', function updateDevice
2020-03-02 11:09:53.963 Error: (IKEA Tradfri) ----> Line 320 in '/home/pi/domoticz/plugins/IKEA-Tradfri/tradfricoap/device.py', function get_device
2020-03-02 11:09:53.963 Error: (IKEA Tradfri) ----> Line 45 in '/home/pi/domoticz/plugins/IKEA-Tradfri/tradfricoap/device.py', function __init__
2020-03-02 11:09:53.963 Error: (IKEA Tradfri) ----> Line 348 in '/usr/lib/python3.7/json/__init__.py', function loads
2020-03-02 11:09:53.963 Error: (IKEA Tradfri) ----> Line 337 in '/usr/lib/python3.7/json/decoder.py', function decode
2020-03-02 11:09:53.963 Error: (IKEA Tradfri) ----> Line 355 in '/usr/lib/python3.7/json/decoder.py', function raw_decode
What do you get if you try to list the devices from the command line?

Code: Select all

$ python3 plugin.py list
I would guess you have a "stale device" of some kind. If it's not to much work, deleting the plugin from the hardware-page and adding it again, probably will solve this error.

Regards,
M

Code: Select all

pi@raspberrypi:~ $ python3 plugin.py list
python3: can't open file 'plugin.py': [Errno 2] No such file or directory
Oops, it's true now the command doesn't work. I tried this when I did the python installation and it is true that I added a new plugin. Then I restored a copy of domoticz to have everything as it was before and I left it that way. Because there are few devices I will try it. Thank you!!
Menelas
Posts: 1
Joined: Tuesday 31 March 2020 16:15
Target OS: -
Domoticz version:
Contact:

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

Post by Menelas »

Hi! First of all, thanks to Moroen for his work! I managed to pair my Tradfri gateway with Domoticz annd its first plug!

I was wondering, is it normal that the switch from domoticz is not automatically to ON and OFF as for others? It keeps sending the cureent command. For my other cheap chinese relay, on follows off and so on. I have to observe the status and wait for 30 seconds. Not a huge big deal, just wondering.

And as a bonus,I saw it was not currently supported, but is it part of the plan to make motion sensor working with the plugin? Or there is a king of roadblock?

Thanks
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 »

Menelas wrote: Tuesday 31 March 2020 16:20 Hi! First of all, thanks to Moroen for his work! I managed to pair my Tradfri gateway with Domoticz annd its first plug!

I was wondering, is it normal that the switch from domoticz is not automatically to ON and OFF as for others? It keeps sending the cureent command. For my other cheap chinese relay, on follows off and so on. I have to observe the status and wait for 30 seconds. Not a huge big deal, just wondering.

And as a bonus,I saw it was not currently supported, but is it part of the plan to make motion sensor working with the plugin? Or there is a king of roadblock?

Thanks
I'm not quite sure what you're asking, but when using Domoticz to switch the plug on or off, the status should update right away. If you turn the plug on/off using a remote or the Ikea app, the status will update after the poll intervall, as long as you have enabled polling...

I'm working on implementing observations, and that should enable support for motion sensors. But the current covid-19 pandemic is keeping me busy at work, so I have less time to spend on the plugin, but it's coming as soon as I can manage!

Regards,
M
Stimpy68
Posts: 40
Joined: Wednesday 09 May 2018 16:37
Target OS: Linux
Domoticz version:
Location: The Hague, The Netherlands
Contact:

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

Post by Stimpy68 »

I'm having problems with the status updates, when switching from domoticz it works fine. But when switching with the IKEA app, IKEA switch or Google home it's not always updating, Executing the list cmd on the cli returns the right values, but it seems that it's not reflected in domoticz.

Running Domoticz 2020.1 and plugin verrsion 0.9.2
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 »

Stimpy68 wrote: Monday 06 April 2020 8:45 I'm having problems with the status updates, when switching from domoticz it works fine. But when switching with the IKEA app, IKEA switch or Google home it's not always updating, Executing the list cmd on the cli returns the right values, but it seems that it's not reflected in domoticz.

Running Domoticz 2020.1 and plugin verrsion 0.9.2
You have polling enabled and have waited the polling interval? Does it sometimes update and other times not? Is it always the same lights that aren't updated or all lighs/devices?

Regards,
M
Stimpy68
Posts: 40
Joined: Wednesday 09 May 2018 16:37
Target OS: Linux
Domoticz version:
Location: The Hague, The Netherlands
Contact:

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

Post by Stimpy68 »

moroen wrote: Tuesday 07 April 2020 11:41
Ok, did some testing, here are my settings:
Aantekening 2020-04-07 152238.png
Aantekening 2020-04-07 152238.png (25.81 KiB) Viewed 1891 times
All lights off:

Code: Select all

python3 plugin.py list
Lights:
65550: Lamp 1 (State: 0 - Level: 139 - Hex: f1e0b5)
65551: Lamp 2 (State: 0 - Level: 139 - Hex: f1e0b5)
65538: Boven (State: 0 - Level: 127 - Hex: f1e0b5)
65539: Onder (State: 0 - Level: 127 - Hex: f1e0b5)
65537: Midden (State: 0 - Level: 127 - Hex: f1e0b5)
65565: Keukenlamp (State: 0 - Level: 127 - Hex: f1e0b5)
65556: midden 1 (State: 0 - Level: 127 - Hex: f1e0b5)
65555: onder 1 (State: 0 - Level: 125 - Hex: f1e0b5)
65546: boven 2 (State: 0 - Level: 127 - Hex: f1e0b5)
65545: boven 1 (State: 0 - Level: 124 - Hex: f1e0b5)
65553: onder 2 (State: 0 - Level: 124 - Hex: f1e0b5)
65544: midden 2 (State: 0 - Level: 125 - Hex: f1e0b5)
65567: TRADFRI driver (State: 0 - Level: 127 - Hex: None)

Others:
65564: TRADFRI remote control 2 (State: None - Level: None - Hex: None)
65549: TRADFRI remote control (State: None - Level: None - Hex: None)
65566: TRADFRI remote control 3 (State: None - Level: None - Hex: None)

Batteries:
65564: TRADFRI remote control 2 - 34
65549: TRADFRI remote control - 16
65566: TRADFRI remote control 3 - 60
Turned on a few lights with the IKEA app:

Code: Select all

Lights:
65550: Lamp 1 (State: 1 - Level: 203 - Hex: f1e0b5)
65551: Lamp 2 (State: 1 - Level: 203 - Hex: f1e0b5)
65538: Boven (State: 1 - Level: 203 - Hex: f1e0b5)
65539: Onder (State: 1 - Level: 203 - Hex: f1e0b5)
65537: Midden (State: 1 - Level: 203 - Hex: f1e0b5)
65565: Keukenlamp (State: 1 - Level: 19 - Hex: efd275)
65556: midden 1 (State: 0 - Level: 127 - Hex: f1e0b5)
65555: onder 1 (State: 0 - Level: 125 - Hex: f1e0b5)
65546: boven 2 (State: 0 - Level: 127 - Hex: f1e0b5)
65545: boven 1 (State: 0 - Level: 124 - Hex: f1e0b5)
65553: onder 2 (State: 0 - Level: 124 - Hex: f1e0b5)
65544: midden 2 (State: 0 - Level: 125 - Hex: f1e0b5)
65567: TRADFRI driver (State: 1 - Level: 203 - Hex: None)

Others:
65564: TRADFRI remote control 2 (State: None - Level: None - Hex: None)
65549: TRADFRI remote control (State: None - Level: None - Hex: None)
65566: TRADFRI remote control 3 (State: None - Level: None - Hex: None)

Batteries:
65564: TRADFRI remote control 2 - 34
65549: TRADFRI remote control - 16
65566: TRADFRI remote control 3 - 60
This time they showed "On" in Domoticz, turned them off again with the IKEA app:

Code: Select all

Lights:
65550: Lamp 1 (State: 0 - Level: 203 - Hex: f1e0b5)
65551: Lamp 2 (State: 0 - Level: 203 - Hex: f1e0b5)
65538: Boven (State: 0 - Level: 203 - Hex: f1e0b5)
65539: Onder (State: 0 - Level: 203 - Hex: f1e0b5)
65537: Midden (State: 0 - Level: 203 - Hex: f1e0b5)
65565: Keukenlamp (State: 0 - Level: 19 - Hex: efd275)
65556: midden 1 (State: 0 - Level: 127 - Hex: f1e0b5)
65555: onder 1 (State: 0 - Level: 125 - Hex: f1e0b5)
65546: boven 2 (State: 0 - Level: 127 - Hex: f1e0b5)
65545: boven 1 (State: 0 - Level: 124 - Hex: f1e0b5)
65553: onder 2 (State: 0 - Level: 124 - Hex: f1e0b5)
65544: midden 2 (State: 0 - Level: 125 - Hex: f1e0b5)
65567: TRADFRI driver (State: 0 - Level: 203 - Hex: None)

Others:
65564: TRADFRI remote control 2 (State: None - Level: None - Hex: None)
65549: TRADFRI remote control (State: None - Level: None - Hex: None)
65566: TRADFRI remote control 3 (State: None - Level: None - Hex: None)

Batteries:
65564: TRADFRI remote control 2 - 34
65549: TRADFRI remote control - 16
65566: TRADFRI remote control 3 - 60
Checked the logs:

Code: Select all

2020-04-07 15:33:51.646 (IKEA) Calling message handler 'onHeartbeat'.
2020-04-07 15:33:51.648 (IKEA - Keukenlamp) Updating device from 1:'7' to have values 0:'7'.
2020-04-07 15:33:51.651 (IKEA - Keukenlamp - Color) Updating device from 1:'30' to have values 0:'30'.
2020-04-07 15:33:51.660 (IKEA - Lamp 2) Updating device from 1:'79' to have values 0:'79'.
2020-04-07 15:33:51.664 (IKEA - Lamp 2 - Color) Updating device from 1:'20' to have values 0:'20'.
2020-04-07 15:33:51.667 (IKEA - Boven) Updating device from 1:'79' to have values 0:'79'.
2020-04-07 15:33:51.670 (IKEA - Boven - Color) Updating device from 1:'20' to have values 0:'20'.
2020-04-07 15:33:51.685 (IKEA - Lamp 1) Updating device from 1:'79' to have values 0:'79'.
2020-04-07 15:33:51.689 (IKEA - Lamp 1 - Color) Updating device from 1:'20' to have values 0:'20'.
2020-04-07 15:33:51.692 (IKEA - TRADFRI driver) Updating device from 1:'79' to have values 0:'79'.
2020-04-07 15:33:51.695 (IKEA - Midden) Updating device from 1:'79' to have values 0:'79'.
2020-04-07 15:33:51.698 (IKEA - Midden - Color) Updating device from 1:'20' to have values 0:'20'.
2020-04-07 15:33:51.701 (IKEA - Onder) Updating device from 1:'79' to have values 0:'79'.
2020-04-07 15:33:51.704 (IKEA - Onder - Color) Updating device from 1:'20' to have values 0:'20'.
2020-04-07 15:33:51.823 (IKEA - TRADFRI remote control 2 - Battery) Updating device from 0:'34' to have values 0:'34'.
2020-04-07 15:33:51.826 (IKEA - TRADFRI remote control - Battery) Updating device from 0:'16' to have values 0:'16'.
2020-04-07 15:33:51.829 (IKEA - TRADFRI remote control 3 - Battery) Updating device from 0:'60' to have values 0:'60'.
2020-04-07 15:34:01.626 (IKEA) Pushing 'onHeartbeatCallback' on to queue
2020-04-07 15:34:01.652 (IKEA) Processing 'onHeartbeatCallback' message
2020-04-07 15:34:01.652 (IKEA) Calling message handler 'onHeartbeat'.
2020-04-07 15:34:11.628 (IKEA) Pushing 'onHeartbeatCallback' on to queue
2020-04-07 15:34:11.633 (IKEA) Processing 'onHeartbeatCallback' message
2020-04-07 15:34:11.633 (IKEA) Calling message handler 'onHeartbeat'. 
Domoticz still says the lights are On.... With last seen time of 15:28.

EDIT: Did another test, removed the monitor batteries option, and now, after 10 minutes the lights still show as On in Domoticz, even is they are Off. Logs shows no updates except :

Code: Select all

 2020-04-07 15:52:04.367 (IKEA) Pushing 'onHeartbeatCallback' on to queue
2020-04-07 15:52:04.394 (IKEA) Processing 'onHeartbeatCallback' message
2020-04-07 15:52:04.394 (IKEA) Calling message handler 'onHeartbeat'.
2020-04-07 15:52:14.370 (IKEA) Pushing 'onHeartbeatCallback' on to queue
2020-04-07 15:52:14.377 (IKEA) Processing 'onHeartbeatCallback' message
2020-04-07 15:52:14.377 (IKEA) Calling message handler 'onHeartbeat'. 
When the Monitor batteries option was enabled, the only thing I could in the logs that the status of the batteries was updating, no other devices were shown.

Restarted the plugin, and this is the log:

Code: Select all

 2020-04-07 15:54:43.885 Status: (IKEA) Stop directive received.
2020-04-07 15:54:43.885 Status: (IKEA) Exiting work loop.
2020-04-07 15:54:43.985 Status: (IKEA) Stopping threads.
2020-04-07 15:54:43.985 Status: (IKEA) Stopped.
2020-04-07 15:54:43.985 Status: (IKEA) Started.
2020-04-07 15:54:44.036 (IKEA) Debug logging mask set to: PYTHON PLUGIN QUEUE IMAGE DEVICE CONNECTION MESSAGE ALL
2020-04-07 15:54:44.036 (IKEA) Number of icons loaded = 4
2020-04-07 15:54:44.036 (IKEA) Icon 129 BatteryFull
2020-04-07 15:54:44.036 (IKEA) Icon 130 BatteryOk
2020-04-07 15:54:44.036 (IKEA) Icon 131 BatteryLow
2020-04-07 15:54:44.036 (IKEA) Icon 132 BatteryEmpty
2020-04-07 15:54:44.049 (IKEA - Boven) Updating device from 0:'79' to have values 1:'52'.
2020-04-07 15:54:44.053 (IKEA - Boven - Color) Updating device from 0:'20' to have values 1:'20'.
2020-04-07 15:54:44.071 (IKEA - Midden) Updating device from 0:'79' to have values 1:'52'.
2020-04-07 15:54:44.075 (IKEA - Midden - Color) Updating device from 0:'20' to have values 1:'20'.
2020-04-07 15:54:44.085 (IKEA - Onder) Updating device from 0:'79' to have values 1:'52'.
2020-04-07 15:54:44.089 (IKEA - Onder - Color) Updating device from 0:'20' to have values 1:'20'.
2020-04-07 15:54:44.106 (IKEA - Kantoor lamp) Updating device from 1:'79' to have values 1:'52'.
2020-04-07 15:54:44.300 (IKEA) Processing: 65564: TRADFRI remote control 2 (State: None - Level: None - Hex: None) - None
2020-04-07 15:54:44.300 (IKEA) Processing: 65549: TRADFRI remote control (State: None - Level: None - Hex: None) - None
2020-04-07 15:54:44.300 (IKEA) Processing: 65566: TRADFRI remote control 3 (State: None - Level: None - Hex: None) - None
2020-04-07 15:54:44.035 Status: (IKEA) Entering work loop.
2020-04-07 15:54:44.035 Status: (IKEA) Initialized version 0.9.2, author 'moroen' 
Seems that there are devices missing?

Rebooted the Domoticz VM, and now the log only shows the remotes.
Stimpy68
Posts: 40
Joined: Wednesday 09 May 2018 16:37
Target OS: Linux
Domoticz version:
Location: The Hague, The Netherlands
Contact:

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

Post by Stimpy68 »

Decided to connect all my IKEA bulbs and remotes to Philip Hue bridge. :geek: Just wasn't worth the hassle anymore of getting this plugin to work as it should :|
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 »

Stimpy68 wrote: Saturday 18 April 2020 10:25 Decided to connect all my IKEA bulbs and remotes to Philip Hue bridge. :geek: Just wasn't worth the hassle anymore of getting this plugin to work as it should :|
I've been unable to reproduce your error, the plugin works as expected on my four different systems. I'm sorry it didn't work out as excpected, and glad you have found a solution you're happy with!

Regards,
M
JimmyH1969
Posts: 153
Joined: Tuesday 28 June 2016 16:38
Target OS: Windows
Domoticz version: Beta
Location: Amersfoort NL
Contact:

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

Post by JimmyH1969 »

Just to let you know. The last reboot was about two weeks ago and that was for something else, but the plugin has been running since the last update without any errors. I'm using it on Windows and that works just fine. I don't use any other remotes do, just domoticz.
flexx
Posts: 6
Joined: Tuesday 21 April 2020 17:13
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

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

Post by flexx »

i'm struggeling to install the plugin onto my Synology 414 nas.
I believe I followed all steps correctly (after trying several times) but now i'm stuck at step 4, configuring the trafri coap.

The command sudo python3 plugin.py config 192.168.x.y ************** generates the following output.

Code: Select all

Traceback (most recent call last):
  File "plugin.py", line 172, in <module>
    create_ident(args.IP, args.KEY, CONFIGFILE)
  File "/volume1/@appstore/domoticz/var/plugins/IKEA-Tradfri/tradfricoap/coapcmd_api.py", line 81, in create_ident
    result = json.loads(subprocess.run([_coapCMD, "post", "--ident", "Client_identity", "--key", key, uri, payload], stdout=subprocess.PIPE).stdout.decode('utf-8'))
  File "/volume1/@appstore/py3k/usr/local/lib/python3.5/subprocess.py", line 696, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/volume1/@appstore/py3k/usr/local/lib/python3.5/subprocess.py", line 950, in __init__
    restore_signals, start_new_session)
  File "/volume1/@appstore/py3k/usr/local/lib/python3.5/subprocess.py", line 1544, in _execute_child
    raise child_exception_type(errno_num, err_msg)
PermissionError: [Errno 13] Permission denied
I have no clue how to troubleshoot this and can't find anything on this forum to push me in the right direction.
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 »

flexx wrote: Tuesday 21 April 2020 17:24 i'm struggeling to install the plugin onto my Synology 414 nas.
I believe I followed all steps correctly (after trying several times) but now i'm stuck at step 4, configuring the trafri coap.

The command sudo python3 plugin.py config 192.168.x.y ************** generates the following output.

Code: Select all

Traceback (most recent call last):
  File "plugin.py", line 172, in <module>
    create_ident(args.IP, args.KEY, CONFIGFILE)
  File "/volume1/@appstore/domoticz/var/plugins/IKEA-Tradfri/tradfricoap/coapcmd_api.py", line 81, in create_ident
    result = json.loads(subprocess.run([_coapCMD, "post", "--ident", "Client_identity", "--key", key, uri, payload], stdout=subprocess.PIPE).stdout.decode('utf-8'))
  File "/volume1/@appstore/py3k/usr/local/lib/python3.5/subprocess.py", line 696, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/volume1/@appstore/py3k/usr/local/lib/python3.5/subprocess.py", line 950, in __init__
    restore_signals, start_new_session)
  File "/volume1/@appstore/py3k/usr/local/lib/python3.5/subprocess.py", line 1544, in _execute_child
    raise child_exception_type(errno_num, err_msg)
PermissionError: [Errno 13] Permission denied
I have no clue how to troubleshoot this and can't find anything on this forum to push me in the right direction.
I've never installed the plugin on a NAS myself, but from the error I would first make sure that you're able to run the coapcmd as the sudo user:

Code: Select all

$ cd domoticz/plugins/IKEA-Tradfri
$ sudo ./bin/coapcmd
and if that works, make sure that the plugin-directory is writable by the sudo user:

Code: Select all

$ cd domoticz/plugins/IKEA-Tradfri
$ sudo touch test.txt
The above command is for a standard posix-shell (linux), but I would guess you have some kind of shell on the NAS as well?

If this works, and the plugin still fails, let me know, and I'll look further!

Regards,
M
flexx
Posts: 6
Joined: Tuesday 21 April 2020 17:13
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

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

Post by flexx »

thnx for the fast answer moroen,
folder rights I already checked and even modified to allow everything (chmod 777)

However the first test failed already!

Code: Select all

$ sudo ./bin/coapcmd
responds with a command not found.

Most likely that part is not properly installed.
First of all the folder structure on a synology Nas is a bit differtent.

The plugin folder is:
/volume1/@appstore/domoticz/var/plugins/IKEA-Tradfri/

listing:

Code: Select all

drwxrwxrwx 8 root root  4096 Apr 21 21:34 .
drwxr-xr-x 5 1000 1000  4096 Apr 20 23:02 ..
drwxrwxrwx 4 root root  4096 Apr 21 16:18 bin
-rw-r--r-- 1 root root    95 Apr 20 23:02 .bumpversion.cfg
-rw-r--r-- 1 root root   729 Apr 20 23:02 cli.py
-rw-r--r-- 1 root root   109 Apr 21 17:10 config.json
drwxr-xr-x 8 root root  4096 Apr 20 23:02 .git
-rw-r--r-- 1 root root  1230 Apr 20 23:02 .gitignore
-rw-r--r-- 1 root root    24 Apr 20 23:02 .hound.yml
drwxr-xr-x 2 root root  4096 Apr 20 23:02 icons
-rw-r--r-- 1 root root   402 Apr 20 23:02 install_coapcmd.sh
-rw-r--r-- 1 root root 25775 Apr 20 23:02 plugin.py
drwxr-xr-x 2 root root  4096 Apr 20 23:08 __pycache__
-rw-r--r-- 1 root root  5658 Apr 20 23:02 README.md
-rw-r--r-- 1 root root  1565 Apr 20 23:02 README-PI.md
-rw-r--r-- 1 root root  2029 Apr 20 23:02 README-Synology.md
-rw-r--r-- 1 root root    15 Apr 20 23:02 requirements.txt
drwxr-xr-x 5 root root  4096 Apr 20 23:06 src
-rw-r--r-- 1 root root     0 Apr 21 21:34 test.txt
drwxr-xr-x 3 root root  4096 Apr 20 23:08 tradfricoap
in the /volume1/@appstore/domoticz/var/plugins/IKEA-Tradfri/bin

Code: Select all

drwxrwxrwx 4 root root 4096 Apr 21 16:18 .
drwxrwxrwx 8 root root 4096 Apr 21 21:34 ..
drwxrwxrwx 5 root root 4096 Apr 21 16:18 coapcmd
drwxr-xr-x 5 root root 4096 Apr 21 16:17 src
/volume1/@appstore/domoticz/var/plugins/IKEA-Tradfri/bin/coapcmd folder

Code: Select all

drwxrwxrwx 5 root root  4096 Apr 21 16:18 .
drwxrwxrwx 4 root root  4096 Apr 21 16:18 ..
-rw-r--r-- 1 root root  2199 Apr 21 16:18 azure-pipelines.yml
drwxr-xr-x 2 root root  4096 Apr 21 16:18 cmd
drwxr-xr-x 8 root root  4096 Apr 21 16:18 .git
-rw-r--r-- 1 root root   402 Apr 21 16:18 install_coapcmd.sh
-rw-r--r-- 1 root root 11358 Apr 21 16:18 LICENSE
-rw-r--r-- 1 root root   665 Apr 21 16:18 main.go
-rw-r--r-- 1 root root  1373 Apr 21 16:18 README.md
drwxr-xr-x 5 root root  4096 Apr 21 16:20 src
Most likely I did not install coapcmd properly. Multiple methods were described but non of them resulted in a IKEA-Tradfri/bin/coapcmd structure.
At the end I created the bin folder manually and installed from there.
Is it possible that the install script can't hande the synology folder structure?

The sudo touch test.txt does nog give any response. At least no error message, so I believe this part is ok?

Installation specific question
If the installation went wrong I don't understand what goes wrong.
The first method (Compiling within a golang development enviroment:) will install in the $GOPATH/bin
However $GOPATH <> /volume1/@appstore/domoticz/var/plugins/IKEA-Tradfri/
after installation there is no bin file within the /IKEA-Tradfri/ folder
NOTE: Restesting this method again immedeatly fails now with "exec: "gcc": executable file not found in $PATH" (I start to see a pattern here....)
I was under the impression GO was working propperly as shown in output by method 3

Code: Select all

Checking git... Ok
Checking go... Ok
Something wrong with $PATH??

The second method (Compiling outside a golang development enviroment:) has the same issue.
Method seems to work, somethin is installing however not in the /IKEA-Tradfri/bin folder
The only might-be issue is see is a message "exec: "gcc": executable file not found in $PATH" somewere in the middle of the output

The third method (Using the provided install-script:)
is unclear for me were to start. Do I need to create the \bin folder manually?
I executed this command from the IKEA-Tradfri/ folder and then the bash install from the /IKEA-Tradfri/coapcmd folder.
The only might-be issue is see is a message "exec: "gcc": executable file not found in $PATH" as last output line

PATH ISSUES?
I did edit the profile according the GOLANG install guide: I added the line "export PATH=$PATH:/usr/local/go/bin"

Code: Select all

#/etc/profile: system-wide .profile file for ash.

umask 022

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin
export PATH

export PATH=$PATH:/usr/local/go/bin

PGDATA=/var/services/pgsql
export PGDATA

TERMINFO=/usr/share/terminfo
export TERMINFO

TERM=${TERM:-cons25}
export TERM

PAGER=more
export PAGER

export LC_ALL=en_US.utf8
export LANG=en_US.utf8

PS1="`hostname`> "

alias dir="ls -al"
alias ll="ls -la"

ulimit -c unlimited

if [ -f /etc.defaults/.bashrc_profile ]; then
	source /etc.defaults/.bashrc_profile
fi
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 »

flexx wrote: Tuesday 21 April 2020 21:48 Installation specific question
If the installation went wrong I don't understand what goes wrong.
The first method (Compiling within a golang development enviroment:) will install in the $GOPATH/bin
However $GOPATH <> /volume1/@appstore/domoticz/var/plugins/IKEA-Tradfri/
after installation there is no bin file within the /IKEA-Tradfri/ folder
NOTE: Restesting this method again immedeatly fails now with "exec: "gcc": executable file not found in $PATH" (I start to see a pattern here....)
I was under the impression GO was working propperly as shown in output by method 3

Code: Select all

Checking git... Ok
Checking go... Ok
Something wrong with $PATH??
The script only checks that the go command is available, it's not checking that the go command is able to actually compile anything... The error about missing gcc indicates that go is not working as it should on your system?
flexx wrote: Tuesday 21 April 2020 21:48
The second method (Compiling outside a golang development enviroment:) has the same issue.
Method seems to work, somethin is installing however not in the /IKEA-Tradfri/bin folder
The only might-be issue is see is a message "exec: "gcc": executable file not found in $PATH" somewere in the middle of the output
Again, this seems to indicate that go can't find the gnu c compiler, and thus can't compile the go source files... I haven't thought about making the install script check for gcc (or clang on macos), I'll update it!
flexx wrote: Tuesday 21 April 2020 21:48
The third method (Using the provided install-script:)
is unclear for me were to start. Do I need to create the \bin folder manually?
I executed this command from the IKEA-Tradfri/ folder and then the bash install from the /IKEA-Tradfri/coapcmd folder.
The only might-be issue is see is a message "exec: "gcc": executable file not found in $PATH" as last output line
The install_coapcmd.sh script should be run in the IKEA-Tradfri directory, and you should end up with a binary file bin/coapcmd, not a directory structure bin/coapcmd/*... One point of failure I can see in the script, is that the temporary GOPATH doesn't get set as it should. Could you please try the follwing steps:

Code: Select all

$ export GOPATH=echo `pwd`
$ echo $GOPATH
If echo $GOPATH returns "/volume1/@appstore/domoticz/var/plugins/IKEA-Tradfri/" continue with:

Code: Select all

$ go get -v github.com/moroen/coapcmd
If the $GOPATH doesn't get set to the correct directory, setting it manually before running go get should do the trick...

Let me know how it goes!

Regards,
M
flexx
Posts: 6
Joined: Tuesday 21 April 2020 17:13
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

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

Post by flexx »

Code: Select all

$ export GOPATH=echo `pwd`
$ echo $GOPATH
returns
-sh: export: `/volume1/@appstore/domoticz/var/plugins/IKEA-Tradfri': not a valid identifier

I adjusted this to: (without space between echo and `pwd`)

Code: Select all

$ export GOPATH=echo`pwd`
$ echo $GOPATH
then echo $GOPATH gives
echo/volume1/@appstore/domoticz/var/plugins/IKEA-Tradfri


Step 2:
sudo go get -v github.com/moroen/coapcmd

runtime/cgo
# runtime/cgo
exec: "gcc": executable file not found in $PATH

echo $PATH:
/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin:/usr/local/go/bin

folder list /usr/local/go

Code: Select all

drwxr-xr-x 10 root root  4096 Apr  8 21:13 .
drwxr-xr-x 12 root root  4096 Apr 20 20:47 ..
drwxr-xr-x  2 root root  4096 Apr  8 21:13 api
-rw-r--r--  1 root root 55383 Apr  8 21:13 AUTHORS
drwxr-xr-x  2 root root  4096 Apr  8 21:28 bin
-rw-r--r--  1 root root  1339 Apr  8 21:13 CONTRIBUTING.md
-rw-r--r--  1 root root 90098 Apr  8 21:13 CONTRIBUTORS
drwxr-xr-x  7 root root  4096 Apr  8 21:13 doc
-rw-r--r--  1 root root  5686 Apr  8 21:13 favicon.ico
drwxr-xr-x  3 root root  4096 Apr  8 21:13 lib
-rw-r--r--  1 root root  1479 Apr  8 21:13 LICENSE
drwxr-xr-x 12 root root  4096 Apr  8 21:13 misc
-rw-r--r--  1 root root  1303 Apr  8 21:13 PATENTS
drwxr-xr-x  5 root root  4096 Apr  8 21:28 pkg
-rw-r--r--  1 root root  1607 Apr  8 21:13 README.md
-rw-r--r--  1 root root    26 Apr  8 21:13 robots.txt
-rw-r--r--  1 root root   397 Apr  8 21:13 SECURITY.md
drwxr-xr-x 47 root root  4096 Apr  8 21:13 src
drwxr-xr-x 23 root root 12288 Apr  8 21:13 test
-rw-r--r--  1 root root     8 Apr  8 21:13 VERSION
list /usr/local/go/bin

Code: Select all

drwxr-xr-x  2 root root     4096 Apr  8 21:28 .
drwxr-xr-x 10 root root     4096 Apr  8 21:13 ..
-rwxr-xr-x  1 root root 13577060 Apr  8 21:28 go
-rwxr-xr-x  1 root root  3321590 Apr  8 21:27 gofmt
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest