-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvolume_slider.lua
24 lines (18 loc) · 992 Bytes
/
volume_slider.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
-- Original script from: https://gist.github.com/C-Duv/03de85cafc2cd2324e9d856d5889e5cb
commandArray = {}
-- Name of the dummy Domoticz dimmer:
DomDevice = 'GŁOŚNOŚĆ'
if devicechanged[DomDevice] then
--print(DomDevice..' received order: '..devicechanged[DomDevice]) -- DEBUG:
if string.match(devicechanged[DomDevice], 'Set Level: ') then -- "Set Level: 42 %" type of order
print(DomDevice..' level changed ('..otherdevices_svalues[DomDevice]..')') -- DEBUG:
-- Compute the volume: Use the "Set Level: 42 %" order and strip anything that's not a digit
volume = devicechanged[DomDevice]:gsub('%D', '')
volumestr = tonumber(volume)
fullurl = 'http://[OPENWEBIF_IP]/web/vol?set=set' .. volumestr
print('adres: ' .. fullurl)
-- Supports level=0 (even though Domoticz seems to handle it: Setting device's level/slider to "0", sets device to "Off")
commandArray['OpenURL']= fullurl
end
end
return commandArray