EvertJob

Untitled

Feb 5th, 2019
450
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.99 KB | None | 0 0
  1. local cameras = {
  2.     {
  3.         ['name']        = 'Voordeur',
  4.         ['ip']          = '192.168.2.220'
  5.     }, {
  6.         ['name']        = 'Achterdeur',
  7.         ['ip']          = '192.168.2..211'
  8.     }
  9. }
  10. return {
  11.    on = {
  12.       timer = { 'every minute' },
  13.       httpResponses = { 'cameraStatus' }
  14.    },
  15.    logging = {
  16.         marker = "Camera"
  17.     },
  18.    execute = function(domoticz, item)
  19.        
  20.        for i, camera in pairs(cameras) do
  21.            
  22.         if (item.isTimer) then
  23.              domoticz.openURL({
  24.                 url = 'http://'..camera['ip']..'',
  25.                 callback = 'cameraStatus'
  26.               })
  27.         end
  28.         if (item.isHTTPResponse) then
  29.          if (item.ok) then
  30.             domoticz.log("Camera '"..camera['name'].."' is online!")
  31.          else
  32.             domoticz.log("Camera '"..camera['name'].."' is offline!")
  33.             sendTelegram("*Let op!*%0ACamera '"..camera['name'].."' is offline!", "private")
  34.          end
  35.          
  36.         end
  37.     end
  38.    end
  39. }
Advertisement
Add Comment
Please, Sign In to add comment