I'm having problems using the afterMin function in dzvents. For some reason, the following does not work:
dz.notify('Washingmachine', 'The laundry is done', PRIORITY_LOW, dz.NSS_PUSHOVER).afterMin(15)
The notification is sent immediately and the log file says: 'attempt to index a nil value'. What could be the problem?
afterMin() problem
Moderator: leecollings
- pgielen
- Posts: 91
- Joined: Monday 18 February 2019 14:44
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: Boxmeer
- Contact:
afterMin() problem
https://robothuis.nl, RPi4B, RFXCOM XL, Aeotec Z-Stick, ESP Easy, Weatherstation, several switches and sensors, Ikea Trädfri, Philips Hue, Foscam, Reolink, Lyric T6, Ring
- felix63
- Posts: 244
- Joined: Monday 07 December 2015 9:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.1
- Location: Gouda
- Contact:
Re: afterMin() problem
According to the DzVents documentation notify doesn't support the afterMin option.
- Spoiler: show
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: afterMin() problem
domoticz does not natively support delayed notifications. Please see attached for a workaround.pgielen wrote: ↑Saturday 30 March 2019 22:59 I'm having problems using the afterMin function in dzvents. For some reason, the following does not work:
dz.notify('Washingmachine', 'The laundry is done', PRIORITY_LOW, dz.NSS_PUSHOVER).afterMin(15)
The notification is sent immediately and the log file says: 'attempt to index a nil value'. What could be the problem?
Code: Select all
--
-- Is the laundry ready?
--
local webResponse = 'delayedNotificationForWashingMachineReady'
return { on = {
devices = { 'Floodsensor trillingen' },
httpResponses = { webResponse },
},
data = { vibrationStateUpdates = { history = true, maxMinutes = 5 } },
execute = function(dz, item)
local function delayedNotification(delay)
url = dz.settings['Domoticz url'] .. '/json.htm?type=command¶m=addlogmessage&message=' .. webResponse
dz.openURL({
url = url,
method = 'GET',
callback = webResponse
}).afterMin(delay)
end
if item.isHTTPResponse then
dz.notify('Washingmachine', 'The laundry is done', PRIORITY_LOW,nil,nil, dz.NSS_PUSHOVER) -- syntax is notify(subject, message, priority, sound, extra, subsystem)
else
dz.data.vibrationStateUpdates.add(item.state)
local vibcnt = dz.data.vibrationStateUpdates.size
print('Status changes in the last 5 minutes: '.. vibcnt)
if (vibcnt > 15) then
print('Spin drying')
delayedNotification(15)
dz.data.vibrationStateUpdates.reset() -- remove entries in persistent history
end
end
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
- pgielen
- Posts: 91
- Joined: Monday 18 February 2019 14:44
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: Boxmeer
- Contact:
Re: afterMin() problem
Thanks, I'll try this.
https://robothuis.nl, RPi4B, RFXCOM XL, Aeotec Z-Stick, ESP Easy, Weatherstation, several switches and sensors, Ikea Trädfri, Philips Hue, Foscam, Reolink, Lyric T6, Ring
Who is online
Users browsing this forum: No registered users and 1 guest