Hallo, ik ben mijn Blocky's om aan het zetten naar DZVentz. Nu loop ik vast op waarschijnlijk iets heel simpels (ben geen held in scripting).
Mijn huidige blocky doet:
Wanneer de voordeur opengaat tussen sunset en sunrise (nighttime) en het licht in de gang staat uit is minder dan 30% gedimd, zet het licht in de gang dan op 100% voor 2 minuten
Daarvoor heb ik zoiets gefabriceerd, op basis van de scripts die wel werken:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
| -- 245 = Front door
-- 229 = Hallway light
return {
active = true,
on = {
devices = {245},
},
execute = function(domoticz, switch)
if domoticz.devices(245).state == "Open" and domoticz.devices(229).state == "Off" or domoticz.devices(229).level <= 30 and timeofday['Nighttime'] then
domoticz.devices(229).dimTo(100)
end
end
} |
Hierbij krijg ik de melding in de log: Error: EventSystem: Lua script Hallway light did not return a commandArray
Uiteindelijk wil ik die in 1 script combineren met het volgende:
Wanneer de deur open gaat en er is niemand thuis, maak screenshot via webcam en stuur door via Telegram.
Het grappige, dit onderdeel heb ik nu prima los werken in een script. Namelijk:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
| return {
active = true,
on = {
devices = {245},
},
execute = function(domoticz, switch)
if domoticz.devices(245).state == "Open" and domoticz.devices(30).state == "Off" then
local teleTok = '[Telegram API]'
local chatId = '[chatidhier invullen]'
local snapFile = '/home/pi/domoticz/scripts/camera_'
local domoReq = 'http://127.0.0.1:8080/camsnapshot.jpg?idx=3'
local camName = 'Hallway-door'
local textMess = 'Frontdoor is opened!'
os.execute('wget -O "'..snapFile..camName..'.jpg" "'..domoReq..'"')
os.execute('curl -s -X POST "https://api.telegram.org/bot'..teleTok..'/sendPhoto?chat_id='..chatId..'" -F photo="@'..snapFile..camName..'.jpg" -F caption="'..textMess..'"')
os.execute("rm " ..snapFile..camName..'.jpg')
end
end
} |
Kan iemand mij verder op weg helpen