Page 1 of 1

One virt. Switch for many Blindes with parcentage

Posted: Thursday 04 June 2020 10:14
by zavjah
Hi all,

I have 6 blinds in my house that work perfectly with domoticz and FIBARO FGRM223 Roller Shutter. For each one I have one on/off switch to open/close them but I would also like to have a % switch so I can open/close them partially. Now, of course I can make 6 virtual switches and accomplish this, but then I'd have 12 switches, 2 for each blind.

Is there a way to make a virtual switch where I could
  • select one of the blinds in eg. drop down menu and
  • then enter the Level in %
so when I hit submit I can manage the values in a dzvents script and pass it to the blind?

thx for any suggestions,
zavjah

Re: One virt. Switch for many Blindes with parcentage

Posted: Thursday 04 June 2020 11:23
by snellejellep
i use the script below for lamps in a group.
the lamps are in a group and i use the script to dim the group using a dummy dimmer switch.

maby this works if you put your blinds into a group and then create a dummy dimmer switch to control that group using the script?

the dummy device is called Tuinkamer licht in the script
the group to be dimmed is called Tuinkamer lampen in the script

replace those two with your own group and switch and you may give it a try?

Code: Select all

return 
{
    on = 
    {
        devices = 
        {
            'Tuinkamer licht' -- device Trigger
        },
    },

    
    execute = function(dz, item)
        _G.logMarker =  _G.moduleLabel
    
        local myGroup = dz.groups('Tuinkamer lampen') 
        
        if item.state ~= 'Off' and item.level > 0 then
            myGroup.devices().forEach(function(dv)
                dz.log(dv.name ..' ==>> device-level: ' .. dv.level,dz.LOG_FORCE)
                dv.dimTo(item.level)
           end)
        elseif item.state == 'Off' then
            dz.log(item.name ..'; state: ' .. item.state,dz.LOG_FORCE)
            myGroup.switchOff()
        end
    end
}