Detect openLuup

Is there a way for a plugin to know if it is executed on openLuup ?

It seems that there is no special information in luup namespace.

The whole point, of course, is that it doesn’t.

As I mentioned in the release announcement for 5.5

[quote=“akbooer, post:2, topic:189447”]The philosophy here is that openLuup itself should remain as true as possible* to standard Vera functionality. That way we can ensure that most plugins written for Vera run also under openLuup.

(* with the notable exceptions of: not crashing, not running out of memory, and not using much CPU.)[/quote]

In fact, it’s incredibly easy to tell… but what for?

I did originally write VeraBridge to run on a standard Vera, and the old version should do just that. However the new one, and obviously the openLuupExtensions plugin are specifically written for openLuup - but only because they have to be. Almost by definition, they add functionality that is not there in the original.

Again,

HOWEVER... now having gained the freedom to make improvements, the Extensions plugin is going to add extra facilities over time.

What’s your plan?

Some basic differences can be seen by running this code in Lua Test

print (luup.attr_get "PK_AccessPoint")
print (luup.attr_get "BuildVersion")
print (luup.version_minor)

which gives these answers

88800127
*1.7.0*
0

which are all different from those which you would get from a real Vera.

OK, I will try.
It’s because one of my plugin decompress lzo files (which do not exist on openLuup).

Ah yes, a number do try that.

Best approach is to code so that a decompression failure is not fatal and then just continue with the decompressed file, which should be there already.

Or perhaps even better, install a dummy pluto-lzo which does nothing, that way, nothing changes in the plugin.

I will try that… but I look for the troubles by accumulating the difficulties (test a plugin on Windows and ZeroBraneStudio)

The biggest problems are caused by os.execute for utilities that are not there in a Windows machine.

Best practice would be to use Lua equivalents where possible, for example os.remove rather than spawning rm, or also use the Lua File System library through

lfs = require "lfs"

It works with LFS

local lfs = require("lfs")
if lfs.attributes("/etc/cmh-ludl/" .. fileName .. ".lzo", "mode") then
	-- Do something
end