UI7 Plugin Migration

I thought it would be useful to have a thread where developers could pool their discoveries on what it takes to migrate plugins to work under UI7.

I have started testing on the Release Candidate (1.7.318). The basic functionality seems the same as on UI5 but there are several differences in the way the UI works.

There is a new attribute for each device (device_json) that specifies the json file. I think this should be helpful if it allows devices of the same type to use different json. It may allow me to simplify the way I change the button text in MultiSwitch.

UI/json Changes
The mechanism for icons is totally different. It is now much more flexible. The icon files now reside in /www/cmh/skins/default/icons/device_states. You can see how this is used by downloading D_DimmableLight1.json.

There is a new control element - multi_state_button - which allows different text according to the value of a device variable. This should be useful. See D_DimmableLight1.json for the syntax.

There are some new options for the slider control including a Validation section - presumably for scene actions. Right now my plugins that use a slider are not positioning it correctly so need some investigation.

Input controls are not working the same as on UI5. The text is larger and lower. It looks as though the box size will need to be increased.

My label and variable controls are not displaying on the front of the device block although they are OK on the Control tab. Investigation required…

Some of the above appear to require different json files for UI5 and UI7 versions. Can the App Store manage this or does it need to be handled in the Implementation initialization logic?

Other Changes
The current lack of an Advanced tab in the scene editor makes it hard to specify anything other than a simple button action. You can, of course, use the Luup option but that isn’t very user-friendly. I trust RTS will not have this problem in PLEG…

There is no Create another button for plugins. Right now you have to manually create subsequent devices under APPS → Develop Apps → Create device. It requires valid entries for Device type, Upnp Device Filename and Upnp Implementation Filename. Once the device has been created, you then need to enter the json file name under the device_json attribute.

There does not seem to be a way to display the plugin’s Help file. Does this need to be added to the device UI as another tab?

Thanks for opening this topic and providing the first information.

What about child devices management ? No change ?

Regarding JavaScript, same version of JQuery as for UI 6 ?

Will plugin developers be relegated to discovering differences in UI7, effectively reverse-engineering what is expected to work properly, or will Vera publish an authoritative reference of required changes vs. UI7 bugs?

I have asked Support if they have any documentation on plugin migration. There was some for UI4 → UI5 so it is possible. I shall update this thread if I get anything useful.

What about child devices management ? No change ?

I have seen some posts about this. Apparently UI7 is more picky about the device_type used in child creation. It needs to match that used in the specified device_file - seems reasonable to me. I would hope that the default json file specified in the device_file will be used automatically but have not yet checked to see if that is so.

Regarding JavaScript, same version of JQuery as for UI 6 ?

How do you find that out? I have had to make a slight change to some js but I never, personally tested it under UI6. I just had to replace an Object.extend( … ) from the Prototype era with a more OOP version.

I don’t know how to determine it but it was said on the forum (futzle ?) that UI5 is using JQuery 1.5 while UI6 is using JQuery 1.6.

I am using Object.extend in my generic call_action function ! Thank for the remark, I will fix that.

I got the information from one of the more active MCV employees in an email. UI5 used Prototype 1.7 (in the $ variable) and JQuery 1.5 (in the jQuery variable). UI6 uses JQuery 1.6 in both $ and jQuery (so, no Prototype at all). UI7 reputedly uses a later version again of jQuery.

jQuery has evolved quite a bit since 1.5; I don’t think it’s likely that we will be able to write single-codebase JavaScript tabs that are correct for UI5 to UI7 inclusive.

I don't think it's likely that we will be able to write single-codebase JavaScript tabs that are correct for UI5 to UI7 inclusive.

I suppose it is possible to have js scripts for both versions along with json files for both versions and select the appropriate one during initialization. May also need to move icon files to the correct folder… It would be easier if the App Store could manage this during the plugin installation process.

Also looks like “urn:micasaverde-com:serviceId:HaDevice1”,“CommFailure”, “0” may be enforced. Not 100% but on one of my plugins I had to add this in otherwise device failed.

The ability to set the device_json attribute does not allow devices of the same device type to use different json files. The file used by the last device to load - presumably always the one with the highest device ID - gets used by all the others. This is how it works on UI5 too. Bizarrely, all the devices use the icon loaded by the device that loaded first…

Bottom line: If you want different json, you have to use a different device type.

They could have fixed this long time problem too.

The other one is to have different services defined for the same service type. Impossible with UI5. Did you check if it has been fixed in UI7 ?

The other one is to have different services defined for the same service type. Impossible with UI5. Did you check if it has been fixed in UI7 ?

I don’t understand this issue. Can you explain it?

[quote=“RexBeckett, post:12, topic:182574”]

The other one is to have different services defined for the same service type. Impossible with UI5. Did you check if it has been fixed in UI7 ?

I don’t understand this issue. Can you explain it?[/quote]

In UI5 you cannot have two devices using two different services having the same type, for example one AVTransport service for Sonos, another for Onkyo. The Vera only considers one of them and uses it for all devices implementing this service type.

HaPe reported that my buttons on the main Sonos device are not working (action not called). Do you have working buttons on your side ? Something to change in the JSON file for buttons ?

Even if we use only really basic JQuery calls ?

If not, is there a way to find inside the JS file what UI version is being run ?

What about the new unit displayed for the temperature device. It looks like “?” is hardcoded in the JSON file ? If our plugin want to set a Fahrenheit temperature, is it possible to change that ?

HaPe reported that my buttons on the main Sonos device are not working (action not called). Do you have working buttons on your side ? Something to change in the JSON file for buttons ?[/quote]

My buttons are still working. The positioning on the front page is messed-up but they still fire the actions and display status correctly.

I’ve been wrestling with the json to try and get my device tiles to display nicely. It seems to work a little differently to UI5. It appears to render the controls in the order they are defined in ControlGroup and places them in the next available space. The fine positioning that was possible in UI5 does not seem to work anymore. After a lot of trial-and-error, I can get all my buttons on the tile but the layout doesn’t follow the x and y offsets predictably. I thought it was tricky getting a good layout on UI5; now it is much harder. ::slight_smile:

I discovered that you can have one of the json tabs displayed automatically when clicking the right arrow on the device tile. You do this by adding the line:

			"top_navigation_tab": 1,

to your tab. It works but the display is smaller than the normal tab so stuff at the bottom gets lost. Also, for some weird reason, input controls do not work when the tab is displayed this way.

Input controls now use a larger font. I used to set them to a height of 15 now they need to be 25.

With the different mechanism for icons and the change in the way controls are rendered, I am forced to have different json files for UI5 and UI7. I’m planning to include both files in the release package and select the UI7 version during plugin initialization when appropriate. The code looks like this:

if luup.version_major == 7 then local jsonfile = luup.attr_get("device_json", lul_device) local ui7json = "D_MiLightRGBW_UI7.json" if jsonfile ~= ui7json then luup.attr_set("device_json", ui7json, lul_device) end end

This will probably require an extra reload when the device is first created but users cannot inadvertently install the wrong plugin version. I will probably use the same mechanism to move icon files to the new folder.

Hi Rex

Can you please run this code with UI7 and give me the result ?

local url = require("socket.url") local str = "one two" luup.log(str .. " -> " .. url.escape(str))

The result in UI5 is:

luup_log:0: one two -> one%20two 

Any idea if lua version has changed ?

[quote=“RexBeckett, post:18, topic:182574”]I discovered that you can have one of the json tabs displayed automatically when clicking the right arrow on the device tile. You do this by adding the line:

			"top_navigation_tab": 1,

to your tab. It works but the display is smaller than the normal tab so stuff at the bottom gets lost. Also, for some weird reason, input controls do not work when the tab is displayed this way.[/quote]

Interesting discovery.
Is it working even with a JS tab ?

Input controls now use a larger font. I used to set them to a height of 15 now they need to be 25.

I use flash input fields only in one my plugins and mine have a height of 20 !

I will probably use the same mechanism to move icon files to the new folder.

The old directory still exist ? If not, will it be created when installing from the store ?