Scene not working oddness

Then I am at a loss. This makes no sense to me either. I honestly have not used the scene editor of the vera in a couple of years as I moved all my scenes to openluup.

1 Like

I’ll stick with Reactor! Genuinely appreciate your help!

C

Remember that luup.variable_get() returns two values: the variable value, and the timestamp of last update. If you wrap that with tonumber(), you end up sending two parameters–the two values returned–and tonumber tries to use the timestamp as the radix (base) for conversion. To fix that:

local temp = luup.variable_get( ... )
local numval = tonumber( temp )

-- or, using extra parens to throw away extra returned values:

local numval = tonumber( (luup.variable_get( ... )) )
1 Like

What @rigpapa said. It’s more similar to the other question about code by @Catman than a problem with the plugin.

Thanks

I hear you but not quite with it. If I do:

local temp = luup.variable_get( ... )
print (temp)

I only get one number, so what happened to the timestamp?

I guess the other bit is ‘Why does it work from the test windows and reactor, but not executed as a scene’?

C

Do you have other scenes?
Are any scenes working with lua code in or just this one?

Good shout. I have one other one that only does an os.execut to turn one the radio

07      02/08/20 7:30:00.113    Event::Evaluate 3  scene Alarm_Clock is true users: allow:1 <0x74485520>
08      02/08/20 7:30:00.113    Scene::RunScene running 31 Alarm_Clock <0x74485520>
01      02/08/20 7:30:00.114    ESC[31;1mLuaInterface::CallFunction_Scene Scene  31 failed attempt to call a nil valueESC[0m <0x74485520>
06      02/08/20 7:30:00.184    Device_Variable::m_szValue_set device: 164 service: urn:toggledbits-com:serviceId:ReactorValues variable: ESC[35;1mHeatStopESC[0m was: 1 now: 0 #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x74c85520>

Here’s the Lua

os.execute ("/BedroomWakeup >/dev/null 2>&1 <&- &")

BedroomWakeup:

curl "192.168.70.52/api/v1/commands/?cmd=volume&volume=9"
curl "192.168.70.52/api/v1/commands/?cmd=play"
sleep 600
curl "192.168.70.52/api/v1/commands/?cmd=volume&volume=12"
sleep 900
curl "192.168.70.52/api/v1/commands/?cmd=volume&volume=15"
sleep 1800
curl "192.168.70.52/api/v1/commands/?cmd=stop"

Clunky I know, but works to turn on the ‘radio’ in the bedroom and then gradually turn up the volume

This has worked for years
and indeed yesterday:

07	02/07/20 6:00:00.147	Event::Evaluate 3  scene Alarm_Clock is true users: allow:1 <0x74eb9520>
08	02/07/20 6:00:00.148	Scene::RunScene running 31 Alarm_Clock <0x74eb9520>
07	02/07/20 6:00:10.154	Event::Evaluate 3  scene Alarm_Clock is false repeat 0/1 <0x74eb9520>

So something appears to have broken to stop me running Lua in scenes.

Any ideas to sort?

TIA

C

Just restored from yesterday am backup. Alarm clock works again, so will try that scene creation.

EDIT: And the new scene works as well. So odd!

C

when you created scene 85 did you delete scene 84?

maybe you introduced something else and the engine stopped working. remember that the “startup LUA” and scenes are merged and run together. anyway, glad it’s working again for you. I had to swap some code calling telegram with os.execute, because it stopped working. sometimes luup has its oddness.

1 Like

Hmm, I can’t honestly recall. Probably not (cos of reloads) and I can’t check now cos of the restore :frowning:

C

then there was probably an error in that code (84). As therealdb has said, any error in any scene code and all scenes with lua will fail to work.

That’s what probably caused this behaviour.

1 Like

I like the theory, the problem is that a simple ctrl-a / ctrl-c / ctrl-v (i.e. copy and paste) of (what must be identical code) worked last night in the test windows and this morning in a new scene.

I mean I simply cannot believe that the code there was different. I deleted it a couple of times as well.

I’m more tempted to believe that the issue was more a toys out of pram thing by the engine. When I was testing yesterday pm (and getting it wrong) I had a reload (I’ve seen this before when I’m being clumsy) so perhaps something then went amiss?

C

Copy and paste can some times pick up strange text, what text editor are you using.

Any way just some of my thoughts, glad it’s working now.

1 Like

This was direct from test window to scene and back.

Yeah, know about the un-printed quotables (as I think we used to call them back in my modem whispering days) but as you say, all good.

And thanks for your support!

C

You only get one because you only receive one. Try:

local temp1,temp2 = luup.variable_get( ... )
print(temp1,temp2)

-- or better yet to illustrate...
print( luup.variable_get( ... ) )
2 Likes

Thank! I’ll try tomorrow!

C

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