I get the value out of the answer. But when using it, the script gives me a error.
This one
Code: Select all
2019-11-07 21:22:38.066 Status: dzVents: Error (2.4.19): ...ticz/scripts/dzVents/generated_scripts/test telegram.lua:16: attempt to call local 'onstate' (a number value)But don't know how to solve. Somebody has an idea?
The script which gives this error
Code: Select all
return {
on = {
devices = {'Trigger device'},
httpResponses = { "Telegram_Callback"}
},
execute = function(dz, item)
local teleTok = '12345:0987654321'
local chatId = '123456789'
if item.isHTTPResponse then
if (item.ok) then
local onstate = item.json.result.message_id
print (onstate)
os.execute('curl -s -X POST "https://api.telegram.org/'..teleTok..'/deleteMessage?chat_id='..chatId..'&message_id='..onstate'"').afterSec(10)
else
print ('niet goed')
end
else
dz.openURL(
{
url = "https://api.telegram.org/bot12345:0987654321/sendMessage?chat_id=123456789&text=Isstil",
method = "GET",
callback = "Telegram_Callback",
})
end
end
}