Philips hue dimmer switch  [Solved]

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

Moderator: leecollings

Post Reply
kroonp
Posts: 43
Joined: Friday 17 July 2020 11:03
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Philips hue dimmer switch

Post by kroonp »

I am looking for a way to use the hue dimmer / switch in dzvents. Until now nothing can be found. There are 4 buttons that can be pressed short and long. I have not been able to find how to use this in dzVents. Is there anyone who has information about it.
Thankx,
Peter
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Philips hue dimmer switch

Post by waaren »

kroonp wrote: Thursday 06 August 2020 15:17 I am looking for a way to use the hue dimmer / switch in dzvents. Until now nothing can be found. There are 4 buttons that can be pressed short and long. I have not been able to find how to use this in dzVents. Is there anyone who has information about it.
Thankx,
Peter
This Hue device was implemented in domoticz in version V.11454 as a selector switch with 9 levels. (see below)
NB. Depending on the set poll interval for the Hue hardware module in domoticz there can be delay between pressing the button and the event triggered.
Hue twilight.png
Hue twilight.png (31.36 KiB) Viewed 2783 times
A dzVents script to make use of the selector could look like

Code: Select all

return
{
    on =
    {
        devices =
        {
            'Hue twilight', -- change to name of your Hue selector / dimmerswitch
        }
    },

    logging =
    {
        level = domoticz.LOG_DEBUG,
        marker = 'Hue dimmer / selector',
    },

    execute = function(dz, item)


        dz.log('Device ' .. item.name .. ' updated. Last level was ' .. item.lastLevel .. '; new level is ' .. item.level .. ' (' .. item.levelName .. ')', dz.LOG_DEBUG)

        actions =
        {
            ['Button 1 long'] = function() return '1L'  end,
            ['Button 2 long'] = function() return '2L'  end,
            ['Button 3 long'] = function() return '3L' end,
            ['Button 4 long'] = function() return '4L' end,
            ['Button 1 short'] = function() return '1S' end,
            ['Button 2 short'] = function() return '2S' end,
            ['Button 3 short'] = function() return '3S' end,
            ['Button 4 short'] = function() return '4S' end,
            ['Off'] = function() return 'Off' end,
        }

        dz.log('Short name for ' .. item.levelName .. ' ==>> ' .. actions[item.levelName](),LOG_DEBUG)
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
kroonp
Posts: 43
Joined: Friday 17 July 2020 11:03
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Philips hue dimmer switch

Post by kroonp »

Thank you for the reply. Unfortunately I do not yet understand how I can switch on a device with for example -button1 short-. But that is due to my inconsideration. I keep trying.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Philips hue dimmer switch

Post by waaren »

kroonp wrote: Friday 07 August 2020 0:40 Thank you for the reply. Unfortunately I do not yet understand how I can switch on a device with for example -button1 short-. But that is due to my inconsideration. I keep trying.
Hope this will help you understand

Code: Select all

return
{
    on =
    {
        devices =
        {
            'Hue twilight', -- change to name of your Hue selector / dimmerswitch
        }
    },

    logging =
    {
        level = domoticz.LOG_DEBUG,
        marker = 'Hue dimmer / selector',
    },

    execute = function(dz, item)

        deviceToSwitch = dz.devices('testDevice') -- change to name of device to switch when button 1 is pressed short

        dz.log('Device ' .. item.name .. ' updated. Last level was ' .. item.lastLevel .. '; new level is ' .. item.level .. ' (' .. item.levelName .. ')', dz.LOG_DEBUG)

        actions =
        {
            ['Button 1 long'] = function() return '1L'  end,
            ['Button 2 long'] = function() return '2L'  end,
            ['Button 3 long'] = function() return '3L' end,
            ['Button 4 long'] = function() return '4L' end,
            ['Button 1 short'] = function() return '1S' end,
            ['Button 2 short'] = function() return '2S' end,
            ['Button 3 short'] = function() return '3S' end,
            ['Button 4 short'] = function() return '4S' end,
            ['Off'] = function() return 'Off' end,
        }

        dz.log('Short name for ' .. item.levelName .. ' ==>> ' .. actions[item.levelName](),LOG_DEBUG)

        if item.levelName == 'Button 1 short' then 
            deviceToSwitch.switchOn()
        end
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
kroonp
Posts: 43
Joined: Friday 17 July 2020 11:03
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Philips hue dimmer switch  [Solved]

Post by kroonp »

Thank you very much, I get it now. I have adjusted my script and it now works the way I intended it to. Thanks again and have a nice weekend.
Obelix
Posts: 8
Joined: Thursday 25 February 2021 15:28
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Philips hue dimmer switch

Post by Obelix »

Is there also a possibility to use the switch for 'dynamic' dimming like the Hue dimmer switch can do using the Hue AP?
So press and hold button 2 to have dynamic brighter light?
Now I can also press longer to add a delta to the status.
I would like dynamic dimm + and -.

Is that possible?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Philips hue dimmer switch

Post by waaren »

Obelix wrote: Tuesday 06 April 2021 13:46 I would like dynamic dimm + and -.
Is that possible?
I don't think this is possible other then with native Hue hub.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Obelix
Posts: 8
Joined: Thursday 25 February 2021 15:28
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Philips hue dimmer switch

Post by Obelix »

That's too bad,
thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest