Page 46 of 48

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

Posted: Saturday 31 October 2020 12:41
by moroen
JimmyH1969 wrote: Friday 30 October 2020 15:02 Hi,

The IKEA App says it's on the latest version... not sure ofcourse
The HUB says: version 1.11.51

Is that the latest?
That's newer than the version that caused all the trouble with the plugin, perhaps IKEA has fixed something, since JimmyH1969 have success using the 0.7.3 version of the plugin... This warrants further investigation!

Regards,
M

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

Posted: Sunday 01 November 2020 15:28
by Sarcas
Just sharing my experiences here.

I installed the plugin today on my rp3. Yesterday I installed a Tradfri hub and several bulbs and dimmers, switches and more stuff. I did not read the forum posts and followed all the steps described on the GitHub page. And it works.

I mean, I had counted on spending the whole Sunday afternoon and evening trying to get it to work, changing my scripts reverting to backups explaining my wife why it is dark in the house. But it just works. I added everything in Domoticz in my scenes, in my scripts, and it is still working. Lights go on, lights go off, they dim when they are supposed to. It is just weird.

I checked and double-checked. No errors. Everything works. The wife is happy and tells me I have now time to walk the dog. I can’t explain it. This never happened to me before.

;)

S.

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

Posted: Tuesday 03 November 2020 13:46
by JimmyH1969
moroen wrote: Saturday 31 October 2020 12:41
JimmyH1969 wrote: Friday 30 October 2020 15:02 Hi,

The IKEA App says it's on the latest version... not sure ofcourse
The HUB says: version 1.11.51

Is that the latest?
That's newer than the version that caused all the trouble with the plugin, perhaps IKEA has fixed something, since JimmyH1969 have success using the 0.7.3 version of the plugin... This warrants further investigation!

Regards,
M
Hi,
Not sure if they fixed anything. Using py3coap 0.9.0 and the latest version of the plugin i still had delays when switching the lights.
Anything we/I can do to help?
Jimmy...

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

Posted: Tuesday 03 November 2020 13:57
by Jasper79
Delay is setup on hardware page, set mine to 30 seconds.
If turning on with the IKEA remote there's a delay from 0~30 seconds before they show up on domoticz and when turning the lights on through domoticz it's instant for me.

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

Posted: Tuesday 03 November 2020 14:45
by JimmyH1969
I'm unable to switch on multiple lights quickly. So from the two (or more) lights in a scene/group only the first will switch on. After a minute or so i'm able to switch on the second light. With version 0.7.3 of the plugin i don't have that issue.

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

Posted: Tuesday 03 November 2020 20:40
by moroen
JimmyH1969 wrote: Tuesday 03 November 2020 14:45 I'm unable to switch on multiple lights quickly. So from the two (or more) lights in a scene/group only the first will switch on. After a minute or so i'm able to switch on the second light. With version 0.7.3 of the plugin i don't have that issue.
This should be fixed for plugin version 0.9.4 and higher, using py3coap version 0.9.0.

Version 0.7.3 of the plugin is quite old, it was committed in january 2020, what version of py3coap are you using?

The version you're using is from before the fix that enabled the plugin to work along with HASS, most of that was later reverted in order to support the latest version of IKEA-firmware. So the version you're using (0.7.3) and the latest version (0.9.x and higher) are actually doing the same thing, just implemented a bit differently.

Again, plugin 0.10.0 and pycoap 0.9.0 should work...

Regards,
M

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

Posted: Wednesday 04 November 2020 17:29
by JimmyH1969
Installing py3coap 0.9.0 is not possible because there is no 32bit version of it, so i installed 0.9.1
I then installed version 0.10.0 of the plugin and executed: plugin.py list
Result: py3coap not found

Then i installed py3coap 0.8.0 in combination with plugin version 0.10.0 and executed: plugin.py list
Result: py3coap not found

Then i tried all plugins starting from version 0.10.0 until version 0.9.5 and they all result in: py3coap not found
Installing version 0.9.4 results in: CRITICAL:root:Gateway not specified
Specifying the IP and KEY and it works

So for me the latest working combinations is: py3coap 0.8.0 with plugin version 0.9.4, but with this combination i have the delay in between switching a couple of lights.

Again: pycoap 0.7.0 (not py3coap) and plugin 0.7.3 work like a charm :D

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

Posted: Thursday 05 November 2020 14:23
by moroen
JimmyH1969 wrote: Wednesday 04 November 2020 17:29 So for me the latest working combinations is: py3coap 0.8.0 with plugin version 0.9.4, but with this combination i have the delay in between switching a couple of lights.
Again: pycoap 0.7.0 (not py3coap) and plugin 0.7.3 work like a charm :D
I'm glad you've found a combination that works for you, but you're missing out on some of the new functions in newer versions of the plugin. I'm trying to make py3coap wheels for 32 bit python on windows, but's it's a nightmare... :evil: Not giving up, but you might consider using coapcmd instead of py(3)coap on windows in the meantime...

Regards,
M

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

Posted: Thursday 05 November 2020 17:47
by JimmyH1969
First of all, thanks a lot for creating this plugin. I think you made a lot of people happy and that includes me! So i don't want to sound ungrateful or anything like that, i just want to help out finding a solution if thats possible.

That said....
-Is there a changelog so i can see what functions i'm missing now?
-Any idea why the message "py3coap not found" pops up with plugin versions 0.9.5 and above? Is it a path/filelocation thing?
-If i can help by testing things just shout!
;)

Thanks again!

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

Posted: Thursday 05 November 2020 22:06
by moroen
JimmyH1969 wrote: Thursday 05 November 2020 17:47 First of all, thanks a lot for creating this plugin. I think you made a lot of people happy and that includes me! So i don't want to sound ungrateful or anything like that, i just want to help out finding a solution if thats possible.

That said....
-Is there a changelog so i can see what functions i'm missing now?
-Any idea why the message "py3coap not found" pops up with plugin versions 0.9.5 and above? Is it a path/filelocation thing?
-If i can help by testing things just shout!
;)

Thanks again!
No worries, you're not comming across as ungratefull! 8-)

The py3coap not found-message is actually somewhat of a misnomer, I've found that the real reason is that the win32 wheel of py3coap just isn't working, all the python parts are in place, but the actual library-file (DLL in windows-parlance) is missing...

I'm currently working on getting py3coap to compile on windows, but at the moment, without much luck! Sometimes I think my efforts would be better spend creating a prebuild 64bit binary of Domoticz, that would support 64 bit python, but... I left windows development years ago, and this has reminded me why... :(

Anyway, hopefully it will get sorted, and when I need someone to test, I'll give you a shout!

And as for what you're missing, it's not that much:
- Better battery monitoring
- Button for rebooting the gateway
- Better command line tool for controlling the gateway

Regards,
M

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

Posted: Saturday 07 November 2020 12:59
by moroen
A small update:

I have a working version of py3coap for 32 bit python on windows, but it only works with CPython compiled with the mingw32 gcc toolset. The official Python distributions on windows are compiled with Microsofts Visual C++. At the moment golang only supports mingw, so there we are... In order to get this to work, one needs to install an unofficial version of python, using msys2 or chocolatey.

I'm simply not convinced that this is worth the hassle, as long as using coapcmd instead of py3coap provides exactly the same functionality with a lot less hassle and hoops to jump through to get it working. This is also why I created coapcmd as an alternative to py3coap in the first place, since py3coap is unavailable on several systems, like Synology, and I think I'll count windows among these systems as well.

The changes made in py3coap to support the latest version of tradfri firmware also removed a lot of the performance gains of py3coap versus coapcmd, and from the plugin's side, there is NO difference between using py3coap or coapcmd...

Regards,
M

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

Posted: Saturday 07 November 2020 19:10
by JimmyH1969
Allright, maybe i missed al that, but how do i switch to coapcmd? What steps on Windows should i take to use coapcmd?

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

Posted: Sunday 08 November 2020 18:33
by moroen
JimmyH1969 wrote: Saturday 07 November 2020 19:10 Allright, maybe i missed al that, but how do i switch to coapcmd? What steps on Windows should i take to use coapcmd?
1. Update to the latest version of the plugin (as of now 0.10.1)
2. Download the latest version of coapcmd from github (https://github.com/moroen/coapcmd/releases/tag/v0.1.6), 32 bits or 64 bit version for windows, doesn't matter.
3. Rename the downloaded coapcmd-windows-*.exe to coapcmd.exe and place it in plugins/IKEA-Tradfri/bin (create the directory if it doesn't exist)
4. Set coapcmd as the transport for tradfricoap:

Code: Select all

$ python3 plugin.py config api coapcmd
5. Restart domoticz

Regards,
M

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

Posted: Friday 11 December 2020 19:32
by RedEarth
Hi moroen :)
I've been using your IKEA-Tradfri plugin on Domoticz on a Synology NAS for the last couple of months and it's been working quite nicely, although I had a few lockups after a power outage and also a lockup when replacing my router, which assigned my Tradfri gateway a different IP address, so of course I had to reconfigure the plugin. I got it all working again, but then today I decided it would be a good idea to update the plugin, as I see there have been several updates since I first installed it which might address some of the lockups I've been having.
I have to use coapcmd due to being on a Synology, and I saw that there's been some fairly major changes, so I deleted the whole plugin folder, and followed your instructions from the top. Everything went OK up to running the command that specifies the gateway IP address and key (substituting the appropriate values for IP and KEY):

Code: Select all

python3 plugin.py config gw IP KEY
but this then returns the following error:

Code: Select all

Traceback (most recent call last):
  File "plugin.py", line 128, in <module>
    process_args(args)
  File "/volume1/@appstore/domoticz/var/plugins/IKEA-Tradfri/tradfricoap/tradfricoap/cli.py", line 100, in process_args
    set_config(args)
  File "/volume1/@appstore/domoticz/var/plugins/IKEA-Tradfri/tradfricoap/tradfricoap/cli.py", line 205, in set_config
    from tradfricoap.gateway import create_ident
ModuleNotFoundError: No module named 'tradfricoap.gateway'
Can you advise what's gone wrong please? Have I missed a step?

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

Posted: Monday 14 December 2020 10:32
by moroen
RedEarth wrote: Friday 11 December 2020 19:32 Hi moroen :)
I've been using your IKEA-Tradfri plugin on Domoticz on a Synology NAS for the last couple of months and it's been working quite nicely, although I had a few lockups after a power outage and also a lockup when replacing my router, which assigned my Tradfri gateway a different IP address, so of course I had to reconfigure the plugin. I got it all working again, but then today I decided it would be a good idea to update the plugin, as I see there have been several updates since I first installed it which might address some of the lockups I've been having.
I have to use coapcmd due to being on a Synology, and I saw that there's been some fairly major changes, so I deleted the whole plugin folder, and followed your instructions from the top. Everything went OK up to running the command that specifies the gateway IP address and key (substituting the appropriate values for IP and KEY):

Code: Select all

python3 plugin.py config gw IP KEY
but this then returns the following error:

Code: Select all

Traceback (most recent call last):
  File "plugin.py", line 128, in <module>
    process_args(args)
  File "/volume1/@appstore/domoticz/var/plugins/IKEA-Tradfri/tradfricoap/tradfricoap/cli.py", line 100, in process_args
    set_config(args)
  File "/volume1/@appstore/domoticz/var/plugins/IKEA-Tradfri/tradfricoap/tradfricoap/cli.py", line 205, in set_config
    from tradfricoap.gateway import create_ident
ModuleNotFoundError: No module named 'tradfricoap.gateway'
Can you advise what's gone wrong please? Have I missed a step?
Have you installed the tradfricoap module:

Code: Select all

$ pip3 install tradfricoap
If you have the module installed, and it still fails, try installing tradfricoap into the plugin directory:

Code: Select all

$ pip3 uninstall tradfricoap
$ cd plugins/IKEA-Tradfri
$ git clone https://github.com/moroen/tradfricoap.git
If you use tradfrocoap installed into the plugin directory, you'll need to use git to update to later versions:

Code: Select all

$ cd plugins/IKEA-Tradfri/tradfricoap
$ git pull
Reagards,
M

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

Posted: Tuesday 15 December 2020 18:55
by RedEarth
thanks for the reply, pip3 isn't available (I think this is due to being a Synology NAS if I've understood the installer instructions correctly?)

I already had a tradfricoap folder within the IKEA-Tradfri plugin folder so I went into it and did a git pull, this did find some updates (4 changed, 13 added, 4 deleted), but I still get the same error when running the main plugin script to do the configuration.

I then deleted the tradfricoap folder and ran the git clone command to grab a completely fresh copy, but still then get the same error when running the plugin script.

Are the most recent changes now relying on installing tradfricoap via pip3, i.e. the alternative install process (for Synology) can no longer be used or needs altering maybe? Happy to try some things if you can guide me through (my linux knowledge is limited, and python even less.. :oops: )

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

Posted: Wednesday 16 December 2020 20:09
by Jacques
Hello,

I managed to install everything to on my Pi and all seems well.
if I execute python3 plugin.py list the output is:
Lights:
65538: Midden 1 (State: 1 - Level: 53 - Hex: efd275)
65539: Midden 2 (State: 1 - Level: 50 - Hex: efd275)
65540: Midden 3 (State: 1 - Level: 63 - Hex: efd275)
65541: Voor 1 (State: 1 - Level: 56 - Hex: efd275)
65542: Voor 2 (State: 1 - Level: 56 - Hex: efd275)
65544: Voor 3 (State: 1 - Level: 56 - Hex: efd275)

Groups:
131076: TRADFRI GROUP 2
131077: SuperGroup

Others:
65545: TRADFRI remote control (State: None - Level: None - Hex: None)
65546: TRADFRI remote control 2 (State: None - Level: None - Hex: None)

Batteries:
65545: TRADFRI remote control - 87
65546: TRADFRI remote control 2 - 87

So it finds my devices.

And I can use the plugin in the hardware tab, however it is not creating devices.
The log says the following:

2020-12-16 20:06:33.730 Error: (IKEA) 'onHeartbeat' failed 'NameError':'name 'close_connection' is not defined'.
2020-12-16 20:06:33.731 Error: (IKEA) ----> Line 785 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py', function onHeartbeat

Can you help me?

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

Posted: Wednesday 16 December 2020 22:14
by moroen
RedEarth wrote: Tuesday 15 December 2020 18:55 thanks for the reply, pip3 isn't available (I think this is due to being a Synology NAS if I've understood the installer instructions correctly?)

I already had a tradfricoap folder within the IKEA-Tradfri plugin folder so I went into it and did a git pull, this did find some updates (4 changed, 13 added, 4 deleted), but I still get the same error when running the main plugin script to do the configuration.

I then deleted the tradfricoap folder and ran the git clone command to grab a completely fresh copy, but still then get the same error when running the plugin script.

Are the most recent changes now relying on installing tradfricoap via pip3, i.e. the alternative install process (for Synology) can no longer be used or needs altering maybe? Happy to try some things if you can guide me through (my linux knowledge is limited, and python even less.. :oops: )
There was an import error which I hadn't caught, if you update to the latest version, this should be resolved. And you're right, pip3 isn't needed on Synology, and the instructions for Synology are outdated, I'll get around to update them as soon as possible!

Regards,
M

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

Posted: Wednesday 16 December 2020 22:18
by moroen
Jacques wrote: Wednesday 16 December 2020 20:09 Hello,

I managed to install everything to on my Pi and all seems well.
if I execute python3 plugin.py list the output is:
Lights:
65538: Midden 1 (State: 1 - Level: 53 - Hex: efd275)
65539: Midden 2 (State: 1 - Level: 50 - Hex: efd275)
65540: Midden 3 (State: 1 - Level: 63 - Hex: efd275)
65541: Voor 1 (State: 1 - Level: 56 - Hex: efd275)
65542: Voor 2 (State: 1 - Level: 56 - Hex: efd275)
65544: Voor 3 (State: 1 - Level: 56 - Hex: efd275)

Groups:
131076: TRADFRI GROUP 2
131077: SuperGroup

Others:
65545: TRADFRI remote control (State: None - Level: None - Hex: None)
65546: TRADFRI remote control 2 (State: None - Level: None - Hex: None)

Batteries:
65545: TRADFRI remote control - 87
65546: TRADFRI remote control 2 - 87

So it finds my devices.

And I can use the plugin in the hardware tab, however it is not creating devices.
The log says the following:

2020-12-16 20:06:33.730 Error: (IKEA) 'onHeartbeat' failed 'NameError':'name 'close_connection' is not defined'.
2020-12-16 20:06:33.731 Error: (IKEA) ----> Line 785 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py', function onHeartbeat

Can you help me?
The most likely reason is an incorrect set of components. The result from version should show:

Code: Select all

$ python3 plugin.py version
IKEA Tradfri Plugin: 0.10.3
Tradfricoap: 0.0.17
Py3coap: 0.9.2
coapcmd: (...) 0.1.7
Regards,
M

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

Posted: Thursday 17 December 2020 21:11
by RedEarth
moroen wrote: Wednesday 16 December 2020 22:14 There was an import error which I hadn't caught, if you update to the latest version, this should be resolved. And you're right, pip3 isn't needed on Synology, and the instructions for Synology are outdated, I'll get around to update them as soon as possible!

Regards,
M
All working beautifully now, thanks very much for you help! :D