One virt. Switch for many Blindes with parcentage

Moderator: leecollings

Post Reply
zavjah
Posts: 36
Joined: Tuesday 13 August 2019 10:20
Target OS: Raspberry Pi / ODroid
Domoticz version:

One virt. Switch for many Blindes with parcentage

Post 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
snellejellep
Posts: 241
Joined: Tuesday 16 May 2017 13:05
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Neterlands
Contact:

Re: One virt. Switch for many Blindes with parcentage

Post 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
}
raspberry pi | xiaomi vacuum | yeelight | philips hue | zwave | ubiquiti unifi | harmony | sonoff | zigbee2mqtt | https://www.youtube.com/channel/UC2Zidl ... m1OLuNldfQ
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest