HELP NEEDED, why doesn?t this code work?

Nice one!

C

[quote=“dgb, post:20, topic:205898”][quote=“akbooer, post:12, topic:205898”]Well, this would seem to be the smoking gun…

01 03/16/19 12515500.101 LuaInterface::CallFunction_Scene Scene 37 failed attempt to call a nil value <0x7655e520> [/quote]

Thanks DGB,

The Device ID from the temp sensor is correct,
I also adjusted the code but despite without success…
I?ve sent the Vera log files to Vera support, May be they have a solution.

Anyway thanks!!

This error means that the code is trying to evaluating something that is a nil value as a function.

The only part of the code that could cause this is the conditional…

if (tonumber(Temp1)  > 24 ) then

If the Temp1 variable has a nil or non-numeric value, the tonumber function will evaluate to nil and the code will fail with the “attempt to call a nil value” error.

You can try changing the conditional to:

if ((tonumber(Temp1) or 0) > 24 ) then

which will ensure that the left hand side of the conditional will evaluate to a number and not fail.

Then you will need figure out why the variable Temp1 is not numeric…

The luup.variable_get function will only return a nil value or a string. It will return a nil value if the variable does not exist… The SID and Variable you are using is correct… so check that the device id for your temperature sensor is correct. If the variable has never been initialized (ie: new device), it will return an empty string… and the code change will catch that…[/quote]

Problem solved !! :slight_smile:

thanks everyone and Vera support!
The problem was the ?poll? time from my Fibaro FGK 102 door/temp sensor.
Initially it polled every 10800 sec (3hr), so I lowered the value to 600 sec…that worked!!

THANKS!