Page 1 of 1

Éxtract value from json status output

Posted: Tuesday 23 February 2016 14:20
by Bram81
Hi,

Im trying to get a value of a dummy sensor to be able to use it in an event. Value is shown on the dashboard, but not seen by the event system. When I check all the incomming data with a lua script with just

Code: Select all

for i, v in pairs(devicechanged) do print(i, v)
the sensor value is empty.
When I try to check the status of the sensor using: /json.htm?type=devices&rid=138

My output is:

Code: Select all

"
ActTime" : 1456232893,
   "ServerTime" : "2016-02-23 14:08:13",
   "Sunrise" : "07:40",
   "Sunset" : "18:05",
   "result" : [
      {
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "BatteryLevel" : 255,
         "CustomImage" : 0,
         "Data" : "Humidity 2 %",
         "Description" : "",
         "Favorite" : 1,
         "HardwareID" : 29,
         "HardwareName" : "bram",
         "HardwareType" : "Dummy (Does nothing, use for virtual switches only)",
         "HardwareTypeVal" : 15,
         "HaveTimeout" : false,
         "Humidity" : 2,
         "HumidityStatus" : "Normal",
         "ID" : "140D9",
         "LastUpdate" : "2016-02-23 14:08:12",
         "Name" : "Bodemvochtigheid Kruiden",
         "Notifications" : "true",
         "PlanID" : "0",
         "PlanIDs" : [ 0 ],
         "Protected" : false,
         "ShowNotifications" : true,
         "SignalLevel" : "-",
         "SubType" : "LaCrosse TX3",
         "Timers" : "false",
         "Type" : "Humidity",
         "TypeImg" : "temperature",
         "Unit" : 1,
         "Used" : 1,
         "XOffset" : "0",
         "YOffset" : "0",
         "idx" : "138"
      }
   ],
   "status" : "OK",
   "title" : "Devices"
Now my question is whether there is a way to get the value of the line "Humidity' into a LUA script or use the value to update a uservariable?
Hope someone can help me out. Thanks!