Page 1 of 1

Philips hue dimmer switch

Posted: Thursday 06 August 2020 15:17
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

Re: Philips hue dimmer switch

Posted: Thursday 06 August 2020 16:18
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 2800 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
}

Re: Philips hue dimmer switch

Posted: Friday 07 August 2020 0:40
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.

Re: Philips hue dimmer switch

Posted: Friday 07 August 2020 1:09
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
}

Re: Philips hue dimmer switch  [Solved]

Posted: Friday 07 August 2020 9:16
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.

Re: Philips hue dimmer switch

Posted: Tuesday 06 April 2021 13:46
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?

Re: Philips hue dimmer switch

Posted: Tuesday 06 April 2021 14:29
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.

Re: Philips hue dimmer switch

Posted: Tuesday 06 April 2021 14:43
by Obelix
That's too bad,
thanks!