Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- return {
- on = {
- timer = {'every minute'},
- devices = {'Спальня Light', 'Спальня Switch'}
- },
- logging = {
- level = domoticz.LOG_ERROR
- },
- execute = function(dz, item)
- local Light = dz.devices('Спальня Light')
- local IP = '192.168.1.37'
- local PORT = '55443'
- local t = dz.time
- if (t.matchesRule('at 00:00-08:00')) then bright = 1 param = "[\"color\", 16750848, "..bright.."]" end
- if (t.matchesRule('at 08:00-23:00')) then bright = 100 param = "[\"ct\", 3812, "..bright.."]" end
- if (t.matchesRule('at 23:00-00:00')) then bright = 10 param = "[\"ct\", 3812, "..bright.."]" end
- function LightOn()
- SetScene = "sudo echo -ne '{\"id\":1, \"method\":\"set_scene\", \"params\":"..param.."}\\r\\n' | nc -w1 " ..IP.." " ..PORT..""
- dz.utils.osExecute('('..SetScene..' > /dev/null)&')
- Light.dimTo(bright).afterSec(0.5)
- end
- if (item.isDevice) then
- if (item.name == 'Спальня Switch' and item.state ~= 'Off') then
- if (item.levelName == 'Click') then
- if (Light.state ~= 'Off') then
- Light.switchOff()
- else
- LightOn()
- end
- end
- if (item.levelName == 'Double Click') then
- bright = 25
- param = "[\"ct\", 3812,"..bright.."]"
- LightOn()
- end
- if (item.levelName == 'Long Click') then
- bright = 100
- param = "[\"color\", 16766634,"..bright.."]"
- LightOn()
- end
- end
- end
- if (item.isTimer) then
- if (Light.state ~= 'Off') then
- if (t.rawTime == '0:1:0') then
- bright = 1
- param = "[\"color\", 16750848, "..bright.."]"
- LightOn()
- end
- if (t.rawTime == '8:0:0') then
- bright = 100
- param = "[\"ct\", 3812,"..bright.."]"
- LightOn()
- end
- if (t.rawTime == '22:59:0') then
- bright = 10
- param = "[\"ct\", 3812,"..bright.."]"
- LightOn()
- end
- end
- end
- end
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement