I thoughed i made something that looked like it and modify it, but it doesn't work.
I want to look at the word that is behind "data".
So i can make an if/elsif, that runs a script when data is changing.
Code: Select all
"result" : [
{
"AddjMulti" : 1.0,
"AddjMulti2" : 1.0,
"AddjValue" : 0.0,
"AddjValue2" : 0.0,
"BatteryLevel" : 255,
"CustomImage" : 108,
"Data" : "Charging",
"Description" : "",response "item OK" is printed. But after that i am stuck.
Code: Select all
return {
on = {
--devices = {'Xiaomi Mi Robot Vacuum - Status',
devices = {'Slide2'},
httpResponses = { "VacState"}
},
execute = function(dz, item)
if item.isHTTPResponse then
print("HTTPReponse found")
if item.ok then
print("item OK")
local myArr = item.json.result
local state = myArr.data
print (state)
end
else
-- logWrite("Timer or Device triggered event")
dz.openURL(
{
url = "http://xxx.xxx.xxx.xxx:xxx/json.htm?type=devices&rid=350",
method = "GET",
callback = "VacState",
})
end
end
}