UI7 Plugin Migration

[quote=“lolodomo, post:59, topic:182574”]For information, I was finally able to get icon and state incons working in UI7 with one unique JSON file common to UI5 and UI7 and with a unique location for the icons.

To keep compatibility with UI5, I will keep my icons in /www/cmh/skins/default/icons. Then in JSON file, a new line has to be added for UI7, something like this: “default_icon”: “…/…/…/icons/myPluginIcon.png”.

For state icons, apparently, it is allowed to mix UI5 content and UI7 content. For UI7, in the img tab, I set something like: “img”: “…/…/…/icons/myPluginStateIcon.png”.[/quote]

Apparently, using relative path is working when in the local network but not through a remote access. Tested with Firefox.

This is an old bug that I hoped they would fix in UI7
Relative URL icons are served from the MCV servers in remote mode. They do not try to forward this. This was a terrible premature optimization considering icons are often cached by the browser.

As a consequence only MCV icons are served up with relative URLs remotely.

On the basis that imitation is the best form of flattery. I did something that I think is a little more ‘lightweight’ and which cleans up after itself. The ui5 D_plugin.json file is considered the default and the D_plugin7.json the one for UI7.

EDIT: DO NOT TRY THIS AT HOME. IT LOOKS LIKE VERA TRIES TO BE “HELPFUL” AND DEMANDS TO LOOK FOR THE FILE THAT I "HELPFULLY’ DELETED IN THE CODE BELOW. THE RESULT IS A BOOT LOOP !

local ui7file = "/etc/cmh-ludl/D_plugin7.json"
local defaultfile = "/etc/cmh-ludl/D_plugin.json"
if (luup.version_major == 7) then
  local _ = os.execute'mv ' .. ui7file .. " " .. defaultfile)
else -- must be UI 5
  local _ = os.execute('rm -f ' .. ui7file)
end

On a more serious note - I believe I have the same issue that you reported.

I’ve just started with porting my plugin to UI7. The good news is that everything functions - except the front panel. In UI5 I had an ‘Arm’ button (which I ‘toggle’). No ‘Bypass’. and a ‘Check’ button. They also appear in the control tab and the ‘Bypass’ button is there too.

With no changes to the UI5 D_ … json file Everything in the control tab works as expected. On the front panel, the ‘Arm’ buttom works and ‘toggles’ but the ‘Check’ button fails to execute the underlying code. A look at the logs suggest that it’s not even being recognized.

Is this the same problem you had ? Did you find a resolution ?

Has anybody figured out some rule / guidelines / tutorial to understand the placement of controls in UI7, especially on the dashboard page ? my plugin (IPhone, Cplus, IPX800) appear all messy and different from UI5. any pointer/help appreciated

It seems to me that the controls get rendered in the order that they are defined in the json and are placed in the next spot - left to right, top down.

It seems to me that the controls get rendered in the order that they are defined in the json and are placed in the next spot - left to right, top down.[/quote]

There seems to be some changes with ui7.0.3.
The buttons continues to be html float left, but the label and variable seem now to follow an absolute positioning scheme per the top left hints in the json file
I however have not found a way to position a multi state button in the top navigation bar like the motion detector or binary switch does ( without playing dirty tricks with negative top hints…) there must be a better way. Would be good to have a doc about scene group control group and the device layout positioning rules…

  • 1 (or more like +10)

Hello, the value seems to be not changed in the UI when you come after, despite the text displayed.
In fact, the new value is sent to the LUA part of your plugin.

You can watch your variable and do something

luup.variable_watch("initPluginInstance", SID_RGBController, "DeviceId", lul_device)
  • 1 (or more like +10)[/quote]

+1!!!
Been fiddling with trying to make the Smartswitch plugin play nice with UI7 restrictions… Finding it extremely difficuilt to figure out how to at least make my device LONGER. seems like the height is fixed, but yet a dimmable light is longer?

Can you even define the height of the device? I’ve set the Y value in the top of the json file, but that does nothing…
It seems like adding row/columns only increases or decreases the columns/ rows, but has no effect on the actual size of the device itself… This of course is no problem, because you can normally simply flip to the device’s Control tab, and set things there, but the problem comes into play when you want to set things in a scene, and have no access to the full control page…

I understand the new design philosophy, but then at least give us better controls to use, like a REAL multistate action button… or a working dropdown list?

Maybe I don’t understand enough… Some help would be greatly appreciated from those in the know :slight_smile:
T

Thank you, I was able to get the Insteon FanLinc working with Altsteon based on this info!