Porting Gcal3 to openluup

A couple of years ago I was going to make an openluup specific port of GCal3 and then got distracted …
GCal3, over the past year or so, has been not needed code changes. Recently google made a change that needed an immediate fix … Fortunately it was easy enough to identify so I issues a quick patch file.

A couple of folks using openluup picked up the patch file - functionally working but a UI problem - like no UI :frowning:

So I’m reinvigorated to take a look at openluup - but am traveling over the next few weeks and cannot get physically to my server to install etc. .

One question (for now) to maybe solve the UI problem. In the patched file (nothing to do with the google issue) just from a more recent GCal version - I have this code:

if ( luup.version_branch == 1 and luup.version_major == 7 and GCV.UI7Check == "false") then
    GCV.UI7Check = "true"
    luup.attr_set("device_json", "D_GCal3_UI7.json", lul_device)

(Yes - I know the if looks strange)

Several questiions:

  1. Do the luup.version and luup.version_major variables have meaning / return particular values in openluup ?
  2. If no - is there a simple way to tell if the code is running on openluup?
  3. Does the line luup.attr_set(“device_json” … do anything in openluup?

Hi,

akbooer sure added a quick reliable check to see if you are running on openLuup. I use this bit of code to determine what a plugin is running on (part of a library of utils i compiled):

local _UI5 = 5
local _UI6 = 6
local _UI7 = 7
local _UI8 = 8
local _OpenLuup = 99

	-- See what system we are running on, some Vera or OpenLuup
	local function _getui()
		if (luup.attr_get("openLuup",0) ~= nil) then
			return _OpenLuup
		else
			return luup.version_major
		end
		return _UI7
	end

Cheers Rene

That’s great news!

1) Do the luup.version and luup.version_major variables have meaning / return particular values in openluup ?

No, it’s always 7.00. It emulates UI7 luup calls.

2) If no - is there a simple way to tell if the code is running on openluup?

Yes. There’s a variable luup.openLuup which is non-nil (actually, a table) in openLuup. So you can write

if luup.openLuup then 
  -- we're running under openLuup
end
3) Does the line luup.attr_set("device_json" .... do anything in openluup?

…er, yes, I hope. It sets that device attribute.

Thanks guys. I have made some fairly small changes to the current, latest GCal code base and it looks like it will no longer cause issues in openLuup. With that said - I will now look at putting this code into Alt App Store.

One question I have - does openlup pull all the files from the github folder or just those that it expects to be “plugin related”. I’m assuming and hoping the former. The reason I’m asking is that I’m thinking of including the test calendar id and the test credentials file as part of the initial install setup. So it would be nice if the install from github, by default, pulled the credentials file as well as the plugin files.

This is an AltAppStore thing, rather than specifically an openLuup one. See the instruction here:

http://forum.micasaverde.com/index.php/topic,38102.msg284743.html#msg284743

In particular, judicious use of the Folder and Pattern fields can get you close to what you want. If you’ve named files in the usual way, then a pattern of [tt]“[DIJLS]_%w+%.%w+”[/tt] should work just fine.

Thanks. This will get me on the right track.

I just installed an openluup / AltUI instance on my Mac and can get it sorted out and tested while I?m on the road.