return { on = { devices = {'test'}, }, execute = function(domoticz, device) if(device.state == 'On') then local teleTok = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx' local chatId = 'xxxxxxxxx' local snapFile = '/home/pi/domoticz/scripts/camera_' local domoReq = 'http://admin:admin@192.168.0.xx:xx/cgi-bin/snapshot.cgi' local camName = 'Kamera' 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"') os.execute("rm " ..snapFile..camName..'.jpg') end end }