mjwwit / node-red-contrib-ikea-tradfri

Node-RED nodes to get updates from and control devices connected to an IKEA TRADFRI gateway
3 stars 3 forks source link

Feature Request - Status of Remotecontrols #21

Closed smartinick closed 2 years ago

smartinick commented 2 years ago

Hi,

i've recently switched from https://flows.nodered.org/node/@fetchbot/node-red-contrib-ikea-home-smart which supports the observation of remotes, so we know the battery-status of the small cr2032 and we could capture button presses and use them for controlling something totally different. This library is also based on https://github.com/AlCalzone/node-tradfri-client, so i believe it should not be too hard to add this feature here, at least the awareness about the battery-status is a huge thing...

if i could, i'd try to implement this myself, but after a while peeking around the code of this library, i feel sad and useless here :(

for starting points, here's the mention of a device type "remote": https://github.com/fetchbot/node-red-contrib-ikea-home-smart#status-node-output and it seems that here's the part about handling the deviceupdatedcallback for remotes: https://github.com/fetchbot/node-red-contrib-ikea-home-smart/blob/8fe1b1535a2b116d5898a3ab639d3e22f162a49c/node-ikea.js#L165

but as i'm not really into java/typescript i'm lost here.... :( maybe someone is up for this feature request?

Thanks & Brgds, Martin.

mjwwit commented 2 years ago

Observing battery state of devices is supported. The payloads contain a deviceInfo.battery value which shows you the battery percentage.

As for capturing remote button clicks, I didn't know this was possible. It's not documented anywhere in the source library documentation. I'll have another go at it using the implementation info you found, thanks for this!

matthiashh commented 2 years ago

I am new to this, but my feeling is that the requested feature with the button presses would be needed to make use of shortcut buttons or simple "on/off" buttons in node-red to do self-defined behavior. In that case, I'd totally second that feature request. For me it would be fine to trigger these behaviors from node-red, but for visitors it sounds nicer when there are also physical buttons somewhere.

mjwwit commented 2 years ago

After a long time trying to get this to work, but only succeeding partially I have to conclude that this is not possible. The gateway does not expose button press information for remotes. You can get state changed messages from the remote after pressing a button, but this happens only because some other property of the remote changed, like the battery percentage. You also cannot see which button was pressed, making it rather useless. If you want to control non-tradfri devices with a tradfri remote I suggest you look into custom Zigbee dongle solution instead of using the gateway.