Getting Setpoint into variable

Hiya
Getting some funky speech stuff, but would like to get the setpoint of my Thermostat as well

Trying:

local HallSet = 0.5+luup.variable_get("urn:upnp-org:serviceId:Heater1", "CurrentSetpoint", 80))

Any ideas why it’s failing?

Cheers!

C

Hi Catman,

luup.variable.get returns two values. The variable value and a time stamp it last changed. So you may need to split this is two statements and try then.

Cheers Rene

Thanks.

Can I ask how I might do that? In fact is there any way I can see what is being returned at all? is there a better place to be trying code than in the Lua window direct?

Cheers

C

Hi Catman,

local HallSet = luup.variable_get("urn:upnp-org:serviceId:Heater1", "CurrentSetpoint", 80))
HallSet = HallSet + 0.5

If you have ALTUI installed these type of things are simply tested using its Lua Code Test function as you can use the print statement and directly see the results.

local HallSet = luup.variable_get("urn:upnp-org:serviceId:Heater1", "CurrentSetpoint", 80))
print(HallSet)
HallSet = HallSet + 0.5
print(HallSet)

If you do not have ALTUI you can only use luup.log to write to the Vera log file and search in that for the results. Doable, but not as handy. I’d strongly recommend ALTUI if you want to write little snippets of Lua code like this. I use it all the time.

Cheers Rene

1 Like

In fact, not, since Lua semantics require that the additional return parameters are discarded if the result is used in an expression.

Adding parentheses around a function call counts as using in an expression, but there’s no need unless it’s being used as a parameter to another function call.

1 Like

You are both fine people! I shall use AltUI (it’s already installed)

I shall crack on!

C

Well that didn’t take long

local HallSet = luup.variable_get("urn:upnp-org:serviceId:Heater1", "CurrentSetpoint", 80)
print(HallSet)

Returns nil

So I guess I’m asking the wrong question of the device? Although none of the variables listed return anything other than Nil

Is the problem I’m passing the wrong device?

urn:schemas-upnp-org:device:Heater:1

C

yep, wrong service if. Look under advanced, variables for the correct one.

Sorry, not seeing anything like that under variables :frowning:

I’ve got
Device type: urn:schemas-upnp-org:device:Heater:1
In Attributes

What am I doing wrong now? :smiley:

PS sorry I’m so rubbish, hopefully I only ask the question once!
C

Hover the cursor over the variable name and there should be a pop-up with the serviceId. Alternatively, look under Actions for the device and do the same there.

as the mighty @akbooer said. plus, if you have ALTUI installed, it’s easier to get it. for Heaters, look at both urn:upnp-org:serviceId:TemperatureSetpoint1 / CurrentSetpoint and urn:upnp-org:serviceId:TemperatureSetpoint1_Heat / CurrentSetpoint.

Thanks so much!

C

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.