Ikea Remote N2 dimming in DzVents

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
peterbos
Posts: 93
Joined: Saturday 07 November 2020 21:41
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Ikea Remote N2 dimming in DzVents

Post by peterbos »

Hi,

I have the 4 button Ikea N2 remote. I want to use this to control non-Ikea bulbs, using DzVents. This remote sends 12 messages, depending on the time you push a button. Each button can send 3 messages. For example the Dim button sends V5 when pressed shortly, V4 when you hold the button and V6 when you stop holding the button (only after V4, not after V5). Switching on and off is no problem using V5 and the toggleSwitch() function, but I can't figure out how to create a dim function. The problem is that the remote only sends out one V4 message when the button is pressed. If it would be sending V4 messages as long at the button was pressed it would be easy making the dim function. With only one V4 message you will have to do some loop until V6 is send. Is there a way to build this kind of loop in DzVents?

Peter
User avatar
boum
Posts: 135
Joined: Friday 18 January 2019 11:31
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: France
Contact:

Re: Ikea Remote N2 dimming in DzVents

Post by boum »

add a `customEvents` trigger to your script.
On V4 trigger, set a persistent data, user variable or dummy switch to ON. Then call `domoticz.emitEvent(custom_trigger_name).afterSec(0.5)` to reenter your sript later. On custom event, check your dummy/variable, if still on, change level on your bulb and re-emit the event.

On V6, reset your dummy/variable. You can stop the dimming immediately by triggering your script on V6 (or the extra state)
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests