New plugin for IKEA Tradfri

tldr; Nope.

I had a cross compilation setup prepared for a configuration that was probably similar to 7.0.29 firmware. In the latest firmware (7.0.31) multiple things have been updated, which is great. Drawback is that I can start all over again.

Besides that, several bugs were discovered in both the plugin and the required library (thanks to some users that are trying to use the plugin on openLuup). Development and specifically debugging is significantly easier or a ‘regular’ pc-based linux installation.

Multiple enhancements have been added to the plugin since my first post, such as (experimental) support for blinds, storing device names used in openLuup on Tradfri as well and multiple small fixes. But unfortunately you can still only use it on openLuup and it is not stable yet.

2 Likes

Thanks for the update @vwout , no pressure from my side. This plugin would be nice to have but it is not something I can’t live without.

I have bought 5 Fyrtur Blinds so when its ready for testing I’m on it…

I already wrote a blind (phun intented) implementation for the Fyrtur devices. A recent version of the plugin should detect the blinds. I’m curious to see the results of that lucky shot.

aha… I can’t se any blinds coming up, I guess I have connection with the trådfri gateway when ring is black

You have an old version of the plugin. Be sure to get the latest files from Github.
You should see a ‘Debugging’ (switch it on!) and ‘Update devices’ (set to ‘poll’) switch.
afbeelding

I downloaded the latest but now I can’t get connected with black ring…

Can you send me a PM with the log, from start after reloading?

hmm How do I create a log
?

To get the log, go to http://where_openluup_is_running:3480/openLuup. In the Logs menu, choose ‘Log’.

Hmmm but I’m not running open Luup

Ah, you are running into the current main limitation stated in the opening post: “I posted this plugin in the openLuup category, because this plugin for now only works on a Linux system running openLuup.”.
I want to get this running on Vera eventually, but that requires some additional work unfortunately.

aha i see… thanx anyway

Hi,

Once again, thanks for a great plugin :slight_smile:

One think I dream about, is groups, the groups in IKEA gateway, so when having to turn a room, with 4-5 bulbs, you don’t have to turn bulb 1, 2 etc. but turn on the room, like in the app (I don’t know if that’s possible)

Regards

Hi @cokeman, thank you very much for all the testing!
Nice that it works reliably now.

In the long (private) PM thread, you mentioned that the plugin is usually fast, but slow from time to time, especially when changing the state fast.
Both appearances of slowness are probably caused by the fact that openLuup does not use multiple threads, but one large event-loop to handle everything. Most of the time that is idle, so a device change will immediately be handled. The polling of Tradfri devices is one of the things that happens once every x seconds during this loop. As far as I know, but maybe @akbooer can correct me, it is not possible to run a timed task as real thread, outside of the main loop, with openLuup.

In your case, with many devices that are polled regularly, polling of all devices may take that long that you notice it either on the UI, or by the response of the device itself. In addition, the Tradfri gateway sometimes does not respond - I don’t know why - and this happens more frequently when the gateway is hit with load of requests. And this is what is done with every poll iteration.

There are two mitigations as far as I see:

  • Use observe instead of poll; this removes the need for the blocking poll. The downside is that observe used to loose the connection to the Tradfri gateway eventually. This might however be improved with all the memory (leak) fixes.
  • Wait until the plugin works in Vera. Vera actually does use threads for scheduled jobs, which means polling does not block other actions. Unfortunatey I have not succeeded in building my coap library for Vera yet.

Regarding support for Tradfri Groups:
I have not spend any time at implementing groups yet, but I think a basic implementation is trivial.
The reason I did not so far is that I considered Vera to be the main controller. Devices, such as lamps are therefore primarily controlled by Vera. To control multiple bulbs at once, you would typically use a scene (or, preferred by me, Reactor). This scenario would for example support combining Tradfri & other bulbs.

So a group could be modeled as a scene. That would allow representing the links between the devices that are controlled by the group. The features of a group however will be severely limited when it is modeled as a scene.
The most basic implementation is to represent a group by switch.
In the IKEA app, besides switching on/off, a group can also control the brightness and color (or both, as a preset represented by a ‘mood’). This means a group is best represented as an RGB bulb and each mood as a separate RGB bulb as well.
Any suggestions or other ideas?

I’ve not followed this thread, nor, obviously, the PMs, but I understand there is a plugin with a polling loop. What it’s polling, how often, and what protocol is unclear to me.

If it’s TCP-related (sockets / HTTP / …) then, if it’s not doing it already, this can be written with asynchronous I/O that doesn’t block the process. It’s true that openLuup is single-threaded, but if the processor is busy with other things, no matter how many threads you have, there will be delays.

I’m happy to try and advise if there’s a well-posed problem to solve.

Hi,

Well the Ikea app, shows the room, as a bulb or RGB bulb, depending on what kind of bulb is in the room. and you show them perfectly depending on the bulb.

So why not use the same way for a group, if possible ?

I will try the observe mode and see if that improves the speed

3 posts were split to a new topic: Polling strategy for Tradfri plugin

I had a look at the groups (called ‘rooms’ in the IKEA app).
Groups only seem to be semi-first class citizens in the Tradfri data model. Only the relational part (members and mood) are real members of the object, which means they are updated properly.

The other attributes like state, (dimming) level and color temperature are derived from the devices contained in the group:

  • A group is shown as ‘on’ when any of the devices is active
  • The dimming level is the average dimming of all bulbs in the group

The group attributes related to the state and level are not updated by Tradfri however. So this will require some housekeeping to keep the object states in sync.

To be continued :slight_smile:

1 Like

Tradfri plugin v0.3.0 has been released.

  • Support for Groups. Groups need to be activated on the Gateway device Control panel. A group is represented as a light device, to be able to switch it on/off, set brightness and color, regardless of which devices are in the group.
  • The plugin will now poll the Tradfri devices for their state instead of relying on observing. The poll interval defaults to 30 seconds and can be changed by modifying the PollInterval attribute.

The plugin is now also available from the AltAppStore.

Best Home Automation shopping experience. Shop at getvera!

© 2021 Ezlo Innovation, All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules