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

Python and python framework

Moderator: leecollings

jeroenkl
Posts: 113
Joined: Sunday 14 July 2013 22:00
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: NL
Contact:

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

Post by jeroenkl »

moroen wrote: Wednesday 05 February 2020 0:15
bartplessers wrote: Monday 03 February 2020 22:57
moroen wrote: Monday 03 February 2020 17:43
Just a small update: Initial tests suggests that using a persistent connection to the gateway, enables the peaceful coexistence of both HASS and Domoticz!
That's great news!
There's an updated version of py3coap (0.8.0) which at least on my testing setup enables working with both HASS and domoticz at the same time. As a added bonus it also offers a slightly faster connection to the gateway (listing devices using plugin.py reduced from 0.6 s to 0.3s on my setup), should be a bit gentler on the gateway and offers somewhat better handling of timeouts. It's available on testpypi, and after a bit more testing, it will be available on the official index.

Would you be as kind as to try it out, and confirm that it works alongside HASS? Install with:

Code: Select all

$ sudo -H pip3 install -U -i https://test.pypi.org/simple/ py3coap
Regards,
M
Also checking it as I've got problems running it alongside zigbee2mqtt on Buster
User avatar
bartplessers
Posts: 12
Joined: Sunday 28 July 2019 22:21
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by bartplessers »

Hi Moroen,

Everything still up'n' running here. +/- 20h for now.
I will let it running for few days now and then try to decrease the polling interval.
Current setup:
- 4 instances of hass running on different servers
- 1 instance of domoticz, also running on one of them
All connected to the same IKEA bridge without any prob now...

Grtz
dressie
Posts: 156
Joined: Monday 25 May 2015 22:44
Target OS: Raspberry Pi / ODroid
Domoticz version: V2020.2
Location: Netherlands
Contact:

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

Post by dressie »

moroen wrote: Tuesday 04 February 2020 22:44
dressie wrote: Tuesday 04 February 2020 6:57 Well....the reboot did work, not for long. It's so bad now that the Ikea app won't connect from time to time and looses it's settings.
Is there a way to go back to the 8 version? The 0.9.0 really killed it.
There's a new version available (0.9.1) that hopefully should address this and the (frequent) "thread seems to have ended unexpectedly"-error. There is no need to update py3coap.

Major changes:
- Batteries are polled along with other devices, using the same polling interval
- Monitoring batteries or not are configurable from the IKEA Hardware page

As before, it's recommended that the polling interval isn't to short, frequent polling used to freeze the gateway, now it appears to invalidate IDENT/PSK-pairs for other connections (including the IKEA App) and possibly still freeze the gateway. An interval of about 60 seconds should work, but a longer interval is recommended!

Regards,
M
Little update! So far, so good! It's running very stable on my Synology setup. I have the polling time set to 60 seconds, Ikea-app seems more stable (although the app itself is crap to start with). Thank you, again, for your work! The plugin has come quite far!
User avatar
bartplessers
Posts: 12
Joined: Sunday 28 July 2019 22:21
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by bartplessers »

moroen wrote: Wednesday 05 February 2020 0:15 Would you be as kind as to try it out, and confirm that it works alongside HASS? Install with:
Hi Moroen,

Running now for 2 days, no prob till now.

I'm decreasing Polling interval (seconds) to 60.


keep you informed,
Bart
User avatar
heggink
Posts: 977
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

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

Post by heggink »

I had limited issues with v7.x. I have no issues with this latest version so very happy. Many thanks.

Sent from phone.

Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
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 »

heggink wrote: Friday 07 February 2020 10:55 I had limited issues with v7.x. I have no issues with this latest version so very happy. Many thanks.

Sent from phone.
Glad to hear it! But just to make sure I undestand this correctly, are you using the latest py3coap (0.8.0) from testpypi or the latest version of the plugin (0.9.1) or both?

Regards,
M
User avatar
heggink
Posts: 977
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

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

Post by heggink »

Both

Sent from phone.

Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
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 »

pycoap 0.8.0 has been available in testing since 5. feb, and so far I haven't received any feedback about errors, so version 0.8.0 is now available in the regular python package index.

Update with:

Code: Select all

$ sudo pip3 install -U py3coap
Regards,
M
wvdweerd
Posts: 22
Joined: Saturday 20 October 2018 18:53
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: The Netherlands
Contact:

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

Post by wvdweerd »

moroen wrote: Thursday 13 February 2020 11:42 pycoap 0.8.0 has been available in testing since 5. feb, and so far I haven't received any feedback about errors, so version 0.8.0 is now available in the regular python package index.
Regards,
M
I am running pycoap 0.8.0 and the trafdri plugin 0.9.1 now for a week, and sofar I have not had a single error :mrgreen:
So this combination seems a very stable version.

Thanks for your efforts!

Regards,
Wouter
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 »

Hello again. Forgive for my English as a translator ... I've been running the plugin for a while now. Now I have decided to upgrade from Raspbian Stretch to Buster and I have started to get several errors and it does not work for me.

2020-02-22 14:00:54.641 Error: (IKEA-Tradfri) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/IKEA-Tradfri/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2020-02-22 14:00:54.641 Error: (IKEA Tradfri) Module Import failed, exception: 'SystemExit'
2020-02-22 14:00:54.641 Error: (IKEA Tradfri) Error Line details not available.
2020-02-22 14:01:44.843 Error: IKEA Tradfri hardware (14) thread seems to have ended unexpectedly
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: Saturday 22 February 2020 14:07 Hello again. Forgive for my English as a translator ... I've been running the plugin for a while now. Now I have decided to upgrade from Raspbian Stretch to Buster and I have started to get several errors and it does not work for me.

2020-02-22 14:00:54.641 Error: (IKEA-Tradfri) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/IKEA-Tradfri/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2020-02-22 14:00:54.641 Error: (IKEA Tradfri) Module Import failed, exception: 'SystemExit'
2020-02-22 14:00:54.641 Error: (IKEA Tradfri) Error Line details not available.
2020-02-22 14:01:44.843 Error: IKEA Tradfri hardware (14) thread seems to have ended unexpectedly
Does listing the devices work?

Code: Select all

$ python3 plugin.py list
Regards,
M
User avatar
heggink
Posts: 977
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

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

Post by heggink »

Hey moroen,

Quick question: your plugin page on Github still indicates that motion sensors are not supported. That said, ggravlingen's original work does seem to support motion sensors. Given the price of these (and my frustration with cheap chinese zwave motion sensors that still cost > $22 a piece), any chance motion sensors can make it into the plugin at some point?

Thanks for the great work.

H
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
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 »

heggink wrote: Monday 24 February 2020 19:31 Hey moroen,

Quick question: your plugin page on Github still indicates that motion sensors are not supported. That said, ggravlingen's original work does seem to support motion sensors. Given the price of these (and my frustration with cheap chinese zwave motion sensors that still cost > $22 a piece), any chance motion sensors can make it into the plugin at some point?

Thanks for the great work.

H
I really haven't kept up with pytradfri, but if pytradfri supports motion sensors, I would guess this is by using coap observations. I'm currently working on implementing coap observations for this plugin, and if/when enabled, support for motion sensors should be possible. I have run into a snag on how to get the changed values into domoticz, but have some other ideas to try out, and feel pretty confident that observations will be possible at some point in the not to distant future!

Regards,
M
User avatar
heggink
Posts: 977
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

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

Post by heggink »

That sounds really good! Thanks up front.

Sent from phone.

Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
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 22 February 2020 18:00
trusky77 wrote: Saturday 22 February 2020 14:07 Hello again. Forgive for my English as a translator ... I've been running the plugin for a while now. Now I have decided to upgrade from Raspbian Stretch to Buster and I have started to get several errors and it does not work for me.

2020-02-22 14:00:54.641 Error: (IKEA-Tradfri) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/IKEA-Tradfri/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2020-02-22 14:00:54.641 Error: (IKEA Tradfri) Module Import failed, exception: 'SystemExit'
2020-02-22 14:00:54.641 Error: (IKEA Tradfri) Error Line details not available.
2020-02-22 14:01:44.843 Error: IKEA Tradfri hardware (14) thread seems to have ended unexpectedly
Does listing the devices work?

Code: Select all

$ python3 plugin.py list
Regards,
M

If I put the command you tell me. It puts me: Traceback (most recent call last): File "plugin.py", Line 41, in <module> import Domoticz Modulenotfounderror: no module named "Domoticz"
If I put the same command in my backup before updating to Buster, it says: the same.
But if I put in this same copy this command: python3 tradfricoap.py
it says . Lights:
65547: TRADFRI bulb 3 (0 - 0 - 0)
65539: Lampara Javi (0 - 1 - efd275)
65546: Lampara Sonia (0 - 1 - efd275)

Others:
65538: Mando Javi (None - None - None)
65545: Mando Sonia (None - None - None)

In Buster I have also tried to put this last command but it gives this other error: Pycoap module not found
Install with "pip3 install -r requirements.txt" or select another api with "python3 tradfricoap.py api"

Sorry my traduced English... 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 »

trusky77 wrote: Tuesday 25 February 2020 14:55
moroen wrote: Saturday 22 February 2020 18:00
trusky77 wrote: Saturday 22 February 2020 14:07 Hello again. Forgive for my English as a translator ... I've been running the plugin for a while now. Now I have decided to upgrade from Raspbian Stretch to Buster and I have started to get several errors and it does not work for me.

2020-02-22 14:00:54.641 Error: (IKEA-Tradfri) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/IKEA-Tradfri/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2020-02-22 14:00:54.641 Error: (IKEA Tradfri) Module Import failed, exception: 'SystemExit'
2020-02-22 14:00:54.641 Error: (IKEA Tradfri) Error Line details not available.
2020-02-22 14:01:44.843 Error: IKEA Tradfri hardware (14) thread seems to have ended unexpectedly
Does listing the devices work?

Code: Select all

$ python3 plugin.py list
Regards,
M

If I put the command you tell me. It puts me: Traceback (most recent call last): File "plugin.py", Line 41, in <module> import Domoticz Modulenotfounderror: no module named "Domoticz"
If I put the same command in my backup before updating to Buster, it says: the same.
But if I put in this same copy this command: python3 tradfricoap.py
it says . Lights:
65547: TRADFRI bulb 3 (0 - 0 - 0)
65539: Lampara Javi (0 - 1 - efd275)
65546: Lampara Sonia (0 - 1 - efd275)

Others:
65538: Mando Javi (None - None - None)
65545: Mando Sonia (None - None - None)

In Buster I have also tried to put this last command but it gives this other error: Pycoap module not found
Install with "pip3 install -r requirements.txt" or select another api with "python3 tradfricoap.py api"

Sorry my traduced English... Thanks
You need to update to the latest version of both the plugin and py3coap...

Code: Select all

$ cd domoticz/plugins/IKEA-Tradfri
$ git pull
$ sudo -H pip3 install -U py3coap
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: Tuesday 25 February 2020 19:29
trusky77 wrote: Tuesday 25 February 2020 14:55
moroen wrote: Saturday 22 February 2020 18:00

Does listing the devices work?

Code: Select all

$ python3 plugin.py list
Regards,
M

If I put the command you tell me. It puts me: Traceback (most recent call last): File "plugin.py", Line 41, in <module> import Domoticz Modulenotfounderror: no module named "Domoticz"
If I put the same command in my backup before updating to Buster, it says: the same.
But if I put in this same copy this command: python3 tradfricoap.py
it says . Lights:
65547: TRADFRI bulb 3 (0 - 0 - 0)
65539: Lampara Javi (0 - 1 - efd275)
65546: Lampara Sonia (0 - 1 - efd275)

Others:
65538: Mando Javi (None - None - None)
65545: Mando Sonia (None - None - None)

In Buster I have also tried to put this last command but it gives this other error: Pycoap module not found
Install with "pip3 install -r requirements.txt" or select another api with "python3 tradfricoap.py api"

Sorry my traduced English... Thanks
You need to update to the latest version of both the plugin and py3coap...

Code: Select all

$ cd domoticz/plugins/IKEA-Tradfri
$ git pull
$ sudo -H pip3 install -U py3coap
Regards,
M
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
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 »

Hello,

I’m having a problem since Ikea did an update. Some bulbs have changed in the tradfri app and in domoticz i see a lot of new bulbs. Could change one of three that did not respond anymore but two cant be controlled anymore from domoticz.
Updated my buster to the latest version.
Got the following error before and after the update.

Code: Select all

   2020-02-29 08:27:43.310 Error: (Ikea) 'onStart' failed 'UriNotFoundError':'Uri not found'.
2020-02-29 08:27:43.310 Error: (Ikea) ----> Line 312 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py'
2020-02-29 08:27:43.310 Error: (Ikea) ----> Line 217 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py'
2020-02-29 08:27:43.310 Error: (Ikea) ----> Line 101 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py'
2020-02-29 08:27:43.310 Error: (Ikea) ----> Line 65 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py'
2020-02-29 08:27:43.310 Error: (Ikea) ----> Line 71 in '/home/pi/domoticz/plugins/IKEA-Tradfri/plugin.py'
2020-02-29 08:27:43.310 Error: (Ikea) ----> Line 73 in '/home/pi/domoticz/plugins/IKEA-Tradfri/tradfricoap.py'
2020-02-29 08:27:43.310 Error: (Ikea) ----> Line 41 in '/home/pi/domoticz/plugins/IKEA-Tradfri/tradfricoap.py'
2020-02-29 08:27:43.310 Error: (Ikea) ----> Line 47 in '/usr/local/lib/python3.7/dist-packages/pycoap/pycoap.py' 
Did an update On the pycoap and plug-in.
After i get the same error.
Wenn listing i get the next error.

~/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 :)
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: 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
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: 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
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest