livehouse-automation / veraflux

Vera Plugin to send device data to InfluxDB
4 stars 0 forks source link

Unused tstamp variables #4

Closed antonywinn closed 6 years ago

antonywinn commented 6 years ago

Example:

local period, tstamp = luup.variable_get(VERAFLUX_SID, "Period", parentDevice)

Added as part of debugging, can probably be removed.

mikenye commented 6 years ago

Nope, pretty sure these need to stay. If you have a look at the luup documentation for luup.variable_get:

From: http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_variable_get

function: variable_get parameters: service (string), variable (string), device (string or number) returns: value (string) and Unix time stamp (number) of when the variable last changed

The variable_get function returns two parameters - the value and a timestamp.

Originally, I didn't have the tstamp variable as I referenced code I found on the internet (luup/lua n00b). After studying the doco, it would appear that we should be using two variables - if you see the example code in the link above it specifically shows two variables being used.