We have moved at community.getvera.com

Author Topic: lua code for retrieving local temperature ???  (Read 2254 times)

Offline svanni

  • Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
lua code for retrieving local temperature ???
« on: October 31, 2018, 01:21:40 pm »
Can somebody share the code to get only the local current temperature value from the following XML file:

https://forecast.weather.gov/MapClick.php?lat=37.5237&lon=-122.2785&unit=0&lg=english&FcstType=dwml

Thank you in advance.

Offline tedtorres

  • Newbie
  • *
  • Posts: 5
  • Karma: +1/-0
Re: lua code for retrieving local temperature ???
« Reply #1 on: December 22, 2018, 04:26:33 pm »
OK, I'm a noob, so pardon me.....
BUT.  I needed the temperature for some code....

1) i installed the "Virtual Outdoor Temperature Sensor" (from APPS)

2) this gets the temp from that 'sensor' (which gets it from the web)

local DEVICE_NO  = 30 -- the virtual temp sensor device number
local LS_SID     = "urn:upnp-org:serviceId:TemperatureSensor1" -- the ID

local currentLevel = luup.variable_get (LS_SID, "CurrentTemperature", DEVICE_NO) or 0
currentLevel = tonumber(currentLevel)

i know it's not what you asked for, but returns the same result.... the local temp.

I'll look at the logs, maybe i can see exactly that the VOTS calls.