waaren wrote: ↑Thursday 04 June 2020 13:54
Ragdag wrote: ↑Thursday 04 June 2020 13:44
On the logging, won't logging to SD Card wear out my SD card really fast?
Faster then without but I never had any corrupt SD card during the years I still used SD cards for this. If you do a quick search in this forum you will find that there are many opinions on the topic and also a lot of creative alternatives.
Thanks, will take a stab at that.
Just tested with my revised script but it also looks trips multiple times using the switch.
It does not make sense for me since I do not see the switch being sent multiple times in the log
It triggers at 14:13:15.652 and that triggers 3 devices.
Then at 14:13:27.723 it finished the test and holds the alarm and switches off the 3 devices
Code: Select all
2020-06-04 14:13:15.652 (Z-wave) Light/Switch (Sensor)
2020-06-04 14:13:15.665 (Z-wave) General/Alarm (Alarm Type: Smoke Alarm 1 (0x01))
2020-06-04 14:13:15.682 (Z-wave) Light/Switch (Smoke Alarm - Overloop)
2020-06-04 14:13:15.649 Status: OpenZWave: Alarm received (Smoke Alarm: Smoke Test), NodeID: 12 (0x0c)
2020-06-04 14:13:15.896 Status: dzVents: Info: FireAlarm: ------ Start internal script: DZ_FireAlarm_v2: Device: "Smoke Alarm - Overloop (Z-wave)", Index: 320
2020-06-04 14:13:15.897 Status: dzVents: Debug: FireAlarm: Processing device-adapter for $Smoke Alarm - Schuur: Switch device adapter
2020-06-04 14:13:15.898 Status: dzVents: Debug: FireAlarm: Processing device-adapter for $Smoke Alarm - Zolder: Switch device adapter
2020-06-04 14:13:15.901 Status: dzVents: Debug: FireAlarm: OpenURL: url = https://api.pushover.net/1/messages.json
2020-06-04 14:13:15.901 Status: dzVents: Debug: FireAlarm: OpenURL: method = POST
2020-06-04 14:13:15.901 Status: dzVents: Debug: FireAlarm: OpenURL: post data = {"message":"Brand Alarm Schuur\nStatus: Clear","priority":1,"sound":"siren","title":"Brand Alarm","token":"bbb","user":"aaa"}
2020-06-04 14:13:15.901 Status: dzVents: Debug: FireAlarm: OpenURL: headers = {["Content-Type"]="application/json"}
2020-06-04 14:13:15.901 Status: dzVents: Debug: FireAlarm: OpenURL: callback = FireAlarm
2020-06-04 14:13:15.901 Status: dzVents: Debug: FireAlarm: OpenURL: url = https://api.pushover.net/1/messages.json
2020-06-04 14:13:15.901 Status: dzVents: Debug: FireAlarm: OpenURL: method = POST
2020-06-04 14:13:15.901 Status: dzVents: Debug: FireAlarm: OpenURL: post data = {"message":"Brand Alarm Schuur\nStatus: Smoke Test","priority":1,"sound":"siren","title":"Brand Alarm","token":"bbb","user":"aaa"}
2020-06-04 14:13:15.901 Status: dzVents: Debug: FireAlarm: OpenURL: headers = {["Content-Type"]="application/json"}
2020-06-04 14:13:15.901 Status: dzVents: Debug: FireAlarm: OpenURL: callback = FireAlarm
2020-06-04 14:13:15.901 Status: dzVents: Debug: FireAlarm: OpenURL: url = https://api.pushover.net/1/messages.json
2020-06-04 14:13:15.901 Status: dzVents: Debug: FireAlarm: OpenURL: method = POST
2020-06-04 14:13:15.901 Status: dzVents: Debug: FireAlarm: OpenURL: post data = {"message":"Brand Alarm Schuur\nStatus: Clear","priority":1,"sound":"siren","title":"Brand Alarm","token":"bbb","user":"aaa"}
2020-06-04 14:13:15.901 Status: dzVents: Debug: FireAlarm: OpenURL: headers = {["Content-Type"]="application/json"}
2020-06-04 14:13:15.902 Status: dzVents: Debug: FireAlarm: OpenURL: callback = FireAlarm
2020-06-04 14:13:15.902 Status: dzVents: Info: FireAlarm: ------ Finished DZ_FireAlarm_v2
2020-06-04 14:13:19.512 (Power-Gas) P1 Smart Meter (kWh Totaal)
2020-06-04 14:13:26.175 (Z-wave) Temp (Temp Overloop)
2020-06-04 14:13:27.013 (Z-wave) Usage (Unknown)
2020-06-04 14:13:27.023 (Z-wave) General/kWh (kWh Wasmachine)
2020-06-04 14:13:27.723 (Z-wave) Light/Switch (Sensor)
2020-06-04 14:13:27.729 (Z-wave) General/Alarm (Alarm Type: Smoke Alarm 1 (0x01))
2020-06-04 14:13:27.737 (Z-wave) Light/Switch (Smoke Alarm - Overloop)
2020-06-04 14:13:27.720 Status: OpenZWave: Alarm received (Smoke Alarm: Clear), NodeID: 12 (0x0c)
2020-06-04 14:13:27.975 Status: dzVents: Info: FireAlarm: ------ Start internal script: DZ_FireAlarm_v2: Device: "Smoke Alarm - Overloop (Z-wave)", Index: 320
2020-06-04 14:13:27.976 Status: dzVents: Debug: FireAlarm: Processing device-adapter for $Smoke Alarm - Schuur: Switch device adapter
2020-06-04 14:13:27.976 Status: dzVents: Debug: FireAlarm: Processing device-adapter for $Smoke Alarm - Zolder: Switch device adapter
2020-06-04 14:13:27.979 Status: dzVents: Debug: FireAlarm: OpenURL: url = https://api.pushover.net/1/messages.json
2020-06-04 14:13:27.979 Status: dzVents: Debug: FireAlarm: OpenURL: method = POST
2020-06-04 14:13:27.979 Status: dzVents: Debug: FireAlarm: OpenURL: post data = {"message":"Brand Alarm Schuur\nStatus: Clear","priority":1,"sound":"siren","title":"Brand Alarm","token":"bbb","user":"aaa"}
2020-06-04 14:13:27.979 Status: dzVents: Debug: FireAlarm: OpenURL: headers = {["Content-Type"]="application/json"}
2020-06-04 14:13:27.979 Status: dzVents: Debug: FireAlarm: OpenURL: callback = FireAlarm
2020-06-04 14:13:27.980 Status: dzVents: Debug: FireAlarm: OpenURL: url = https://api.pushover.net/1/messages.json
2020-06-04 14:13:27.980 Status: dzVents: Debug: FireAlarm: OpenURL: method = POST
2020-06-04 14:13:27.980 Status: dzVents: Debug: FireAlarm: OpenURL: post data = {"message":"Brand Alarm Schuur\nStatus: Clear","priority":1,"sound":"siren","title":"Brand Alarm","token":"bbb","user":"aaa"}
2020-06-04 14:13:27.980 Status: dzVents: Debug: FireAlarm: OpenURL: headers = {["Content-Type"]="application/json"}
2020-06-04 14:13:27.980 Status: dzVents: Debug: FireAlarm: OpenURL: callback = FireAlarm
2020-06-04 14:13:27.980 Status: dzVents: Debug: FireAlarm: OpenURL: url = https://api.pushover.net/1/messages.json
2020-06-04 14:13:27.980 Status: dzVents: Debug: FireAlarm: OpenURL: method = POST
2020-06-04 14:13:27.980 Status: dzVents: Debug: FireAlarm: OpenURL: post data = {"message":"Brand Alarm Schuur\nStatus: Clear","priority":1,"sound":"siren","title":"Brand Alarm","token":"bbb","user":"aaa"}
2020-06-04 14:13:27.980 Status: dzVents: Debug: FireAlarm: OpenURL: headers = {["Content-Type"]="application/json"}
2020-06-04 14:13:27.980 Status: dzVents: Debug: FireAlarm: OpenURL: callback = FireAlarm
2020-06-04 14:13:27.980 Status: dzVents: Info: FireAlarm: ------ Finished DZ_FireAlarm_v2
Somehow in the DzVents script is triggered 6 times while the switch that triggers the DzVents is only switched 2 times
Here is my current script
Code: Select all
local scriptVar = 'FireAlarm'
return
{
on =
{
devices =
{
303, -- Schuur
320, -- Overloop
330, -- Zolder
}
},
logging =
{
level = domoticz.LOG_DEBUG,
marker = scriptVar,
},
execute = function(dz, item)
if item.isHTTPResponse then
dz.log(item.data,dz.LOG_DEBUG)
return
end
local function pushover(PushoverUser, PushoverApp, title, message, priority, sound)
dz.openURL({
url = 'https://api.pushover.net/1/messages.json',
method = 'POST',
callback = scriptVar,
postData =
{
token = PushoverApp.token,
user = PushoverUser.key,
message = message,
title = title or 'Pushover from dzVents',
priority = priority or 0,
sound = sound or 'echo',
},
})
end
local PushoverUsers =
{
['USER1'] = { ['key'] = 'aaa' },
['USER2'] = { ['key'] = 'bbb'},
['Familie'] = { ['key'] = 'ccc'},
}
local PushoverApps =
{
['Domoticz'] = { ['token'] = 'ddd' },
['Huis'] = { ['token'] = 'eee' },
['Test'] = { ['token'] = 'fff' },
['Was'] = { ['token'] = 'ggg' },
['Alarm'] = { ['token'] = 'hhh' },
}
local SchuurSmokeSwitch = dz.devices(303)
local OverloopSmokeSwitch = dz.devices(320)
local ZolderSmokeSwitch = dz.devices(330)
local SchuurSmokeAlarm = dz.devices(336)
local OverloopSmokeAlarm = dz.devices(326)
local ZolderSmokeAlarm = dz.devices(329)
if (item.isDevice) then
if (SchuurSmokeSwitch.state == 'On') then
pushover(PushoverUsers.USER1, PushoverApps.Alarm, 'Brand Alarm', 'Brand Alarm Schuur\nStatus: ' .. SchuurSmokeAlarm.state, 1, 'siren' )
elseif (SchuurSmokeSwitch.state == 'Off') then
pushover(PushoverUsers.USER1, PushoverApps.Alarm, 'Brand Alarm', 'Brand Alarm Schuur\nStatus: ' .. SchuurSmokeAlarm.state, 1, 'siren' )
end
if (OverloopSmokeSwitch.state == 'On') then
pushover(PushoverUsers.USER1, PushoverApps.Alarm, 'Brand Alarm', 'Brand Alarm Overloop\nStatus: ' .. OverloopSmokeAlarm.state, 1, 'siren' )
elseif (OverloopSmokeSwitch.state == 'Off') then
pushover(PushoverUsers.USER1, PushoverApps.Alarm, 'Brand Alarm', 'Brand Alarm Overloop\nStatus: ' .. OverloopSmokeAlarm.state, 1, 'siren' )
end
if (ZolderSmokeSwitch.state == 'On') then
pushover(PushoverUsers.USER1, PushoverApps.Alarm, 'Brand Alarm', 'Brand Alarm Zolder\nStatus: ' .. ZolderSmokeAlarm.state, 1, 'siren' )
elseif (ZolderSmokeSwitch.state == 'Off') then
pushover(PushoverUsers.USER1, PushoverApps.Alarm, 'Brand Alarm', 'Brand Alarm Zolder\nStatus: ' .. ZolderSmokeAlarm.state, 1, 'siren' )
end
end
end
}