This still appears to not work. Is there something I can do about this?
I have the following LUA
Code: Select all
-- Notification data push string
-- print('notification data push string')
function urlencode(str)
if (str) then
str = string.gsub (str, "\n", "\r\n")
str = string.gsub (str, "([^%w ])",
function (c) return string.format ("%%%02X", string.byte(c)) end)
str = string.gsub (str, " ", "+")
end
return str
end
commandArray = {}
if (devicechanged['Notification_String']) then
print("Notification String changed to - " .. devicechanged['Notification_String'])
commandArray['OpenURL'] = "http://{myURL}?value="..urlencode(devicechanged['Notification_String'])
end
return commandArray
If I update the virtual sensor using
Code: Select all
curl -s -i -H Accept: application/json 'http://127.0.0.1:8080/json.htm?type=command¶m=udevice&idx=413&nvalue=0&svalue=This+is+test+8'
the LUA gets triggered and all is great. However if I updating it using
Code: Select all
commandArray[#commandArray+1]={['UpdateDevice'] = '413|0|This is test 9' }
The text sensor still gets updated, but the devicechanged LUA doesn't get triggered.
The whole point of this is to just be able to update the text sensor and automatically get it pushed to the notification server. I don't want to have to do the openURL / urlencode every time.