Very good library. This inspired to me to make it one similar for sending message & pictures to Pushbullet.
One downside of a pure-Lua approach for this problem is that it makes the dzVent event handling loop busy for a few seconds, the time it takes to capture the picture from the camera and call the APIs on Pushbullet backend.
As far as I understand the event handling loop will be unable to handle any other events in those few seconds, and you may see the following messages in the domoticz log that warn you about that.
Code: Select all
dzVents: !Info: ------ Finished myscript.lua after >9 seconds. (using 0.871 seconds CPU time !)
To fix this I have decided to still use the library, but spawn a separate Lua process like this:
Code: Select all
os.execute('cd /home/pi/domoticz/scripts/dzVents/scripts/modules/ ; /usr/bin/lua tgsendpic.lua ' .. '"' .. cameraId .. '"' .. ' "' .. message .. '" &')