MultiString Plugin

MultiString V1.2 has been released in the App Store.

The plugin provides five string variables with custom names that are displayed on the device tile in Vera’s user interface. The name and value of each variable may be set from the device’s Control tab, using scene and PLEG actions or through luup.variable_set(…) calls. These parameters may also be accessed as PLEG Device Properties and with luup.variable_get(…) calls. Scene trigger events are provided for each variable. The events allow the conditions: goes below; goes above and equals the specified constant.

MultiString uses the same Device-type and ServiceID pioneered by the VariableContainer plugin. This should allow compatibility with existing mobile Apps. If you install MultiString on a system where VariableContainer is already present, there will be side effects. On my UI5 test system, all the devices were converted to the MultiString device interface but otherwise seemed to work correctly. It is possible that there could be issues due to multiple definition of the Service IDs so I do not recommend co-residence.

The plugin is designed to work with either UI5 or UI7. When run on UI7, some files have to be moved when the plugin is first initialized. This happens automatically but an additional Reload Luup and browser page refresh is required before the device UI is displayed correctly.

Instructions are available here.

Version history and planned enhancements.

Edit: 25/02/2015 09:25 V1.0 released in App Store. No icon on UI7.
Edit: 25/02/2015 14:00 V1.1 released in App Store. See Version history.
Edit: 12/03/2015 00:10 V1.2 released in App Store. Fixed for firmware 7.0.5.

The behavior is caused by the DeviceType to JSON mapping.
You have two JSON files for the same DeviceType … I do not know if the final mapping is deterministic.

The behavior is caused by the DeviceType to JSON mapping. You have two JSON files for the same DeviceType

Yes - I knew it would happen. It shouldn’t be much of a problem: if users already have the original plugin, they don’t need to install MultiString.

I do not know if the final mapping is deterministic.

It may not be an absolute but it always seems to obey the last device to be initialized - typically the highest device ID.

This is a list of the enhancements and fixes planned for future releases. Where a version number is shown, the change is completed and will be in the indicated release.

[ul][li]Watch this space.[/li][/ul]

This is a list of fixes and enhancements incorporated in each released version.

[ul][li]There was a tiny error converting some timestamps with milliseconds - 1 ms in 45 years! (V1.2)[/li]
[li]The UI display was not correct on UI7 version 7.0.5 (V1.2)[/li]
[li]Allow nil or empty strings to clear names & values. (V1.1)[/li]
[li]Selectable rounding option for numeric variable values. (V1.1)[/li]
[li]Convert Epoch timestamp to human-readable form. (V1.1)[/li]
[li]Icon not displayed on UI7. (V1.1)[/li]
[li]Initial release. (V1.0)[/li][/ul]

Edit: 25/02/2015 14:05 V1.1 released.
Edit: 12/03/2015 00:06 V1.2 released.

MultiString V1.1 is released in the App Store.

Enhancements include options for select-able rounding of numeric values and conversion of timestamps to human-readable form.

See the Instructions link in the first post for details.

Thanks for the plug-in, You sure got that done quickly.

I never had the original VC so I have one question, what is the “Options” variable intended to be used for?

BTW the plugin works well with the ImperiHome Android app.

I never had the original VC so I have one question, what is the "Options" variable intended to be used for?

VC didn’t have an Options variable. That is something I have taken to adding to all my plugins. It gives users the ability to adjust the functionality to suit their needs. It is all explained in the Instructions.

BTW the plugin works well with the ImperiHome Android app.

Thanks for that feedback.

Ok I just told myself to RTFM. :slight_smile:

Now my question on “Options”. Would it be nice to retain the original value before being adjusted like rounding in particular. There seems to be a case for both the presentation and original value for calculations.

Maybe since this plug-in is based on strings it implies that it is the presentation of the value and there could be another place to retain variables that the type might be non-strings.

Anyway I like the simplicity of the plugin and am happy to have it available.

Now my question on "Options". Would it be nice to retain the original value before being adjusted like rounding in particular. There seems to be a case for both the presentation and original value for calculations.

I did consider that. Rounding is most useful when the device is being used to display values computed in PLEG logic or other plugins. In this case, the source of the number can retain the full precision. Where MultiString is used as a repository for precise values, don’t use rounding. If the application requires both a rounded and the non-rounded numbers, they could be stored in separate variables. I haven’t ruled it out for a possible future enhancement.

Maybe since this plug-in is based on strings it implies that it is the presentation of the value and there could be another place to retain variables that the type might be non-strings.

This is what most of us do. We store values in global variables, additional device variables or PLEG Conditions. This is fine as long as you don’t need to see them on the UI or with a mobile App. As you suggest, MultiString is more concerned with the presentation of the data in a simple form.

Thanks for your comments. So far I have only implemented features that I have wanted myself or seen other members desire. I shall consider all suggestions with a moderately-open mind. :wink:

REX,

Variable container was supported in a few apps. Is this plugin also going to work or is it totally different?

I’m trying to get my ROOMBA status (Thinking Cleaner Plugin) to work in ImperiHome. PLEG can already see the status (charging, Docked, Trickle charging, cleaning…) I want to try and pass that threw and display it in ImperiHome on a tile.

[quote=“integlikewhoa, post:10, topic:186129”]REX,

Variable container was supported in a few apps. Is this plugin also going to work or is it totally different?

I’m trying to get my ROOMBA status (Thinking Cleaner Plugin) to work in ImperiHome. PLEG can already see the status (charging, Docked, Trickle charging, cleaning…) I want to try and pass that threw and display it in ImperiHome on a tile.[/quote]

The reason that I used the device-type, Service ID, variables and actions previously used by VariableContainer was to, as far as I can, maintain compatibility for mobile Apps.

@mnaz reports above that it works with ImperiHome. It also works for me using AutHomation.

I can confirm that it does work in Imperihome.

What I don’t understand yet is how to copy the current status of one device and have that update in MultiString. Do I need to really make an action for each possible status?

What I don't understand yet is how to copy the current status of one device and have that update in MultiString. Do I need to really make an action for each possible status?

That’s more of a PLEG question than MultiString. I would bind a Device Property to your source (Roomba Status) and use that in a Condition (with Repeat on). The Action for the Condition would set a MultiString variable to the value of the Device Property using the {(name-of-property)} syntax.

Thanks I got it to work.

Much appreciated, hard to accept that I’d lose my VC (I use them a lot) if I ever decided to move beyond UI5…

Thank you Rex! Thanks to chixxi as well for making this compatible. I for one will miss him. One of my main concerns with the upcoming update to UI7 was the loss of this capability.

I am thinking about changing my Variable Container(s) to your MultiString. I have a good many lines of Lua that reference 6 Variable Container(s). What would you suggest as the best approach? I was thinking about copying and pasting all of the Lua code into text files, removing the Variable Container plugin, installing Multistring and pasting the code back in. With the new dID(s) of course. :wink:

Thanks again! Mark

A while ago I wrote a bit of code to access VContainers by device name, rather than ID, so that I never had to worry about changing them again (assuming, of course, that you keep the same name!!)

http://forum.micasaverde.com/index.php/topic,9022.msg112744.html#msg112744

…could easily be modified for MultiString devices.

Not sure if this might help in your case @MarkAgain?

[quote=“MarkAgain, post:16, topic:186129”]Thank you Rex! Thanks to chixxi as well for making this compatible. I for one will miss him. One of my main concerns with the upcoming update to UI7 was the loss of this capability.

I am thinking about changing my Variable Container(s) to your MultiString. I have a good many lines of Lua that reference 6 Variable Container(s). What would you suggest as the best approach? I was thinking about copying and pasting all of the Lua code into text files, removing the Variable Container plugin, installing Multistring and pasting the code back in. With the new dID(s) of course. :wink:

Thanks again! Mark[/quote]

The easiest approach would be to convert the existing devices to MultiString so that they retain their device numbers. You then should not need to change any Lua code. First install MultiString to get all the new files loaded. Leave the new device for the moment. This will change the appearance of your existing VC devices but they will not really be MultiString yet.

Convert each VC device to MultiString as follows:

Open the device’s Advanced tab. The device-type is already the same. All that should be necessary is to change device_file to D_MString.xml and impl_file to I_MString.xml. Then Save/Reload and refresh the page. There will be a change in appearance but the functionality should be the same.

Vera will still think the devices are using the VC plugin so they will not be listed on the MultiString APP tab. If you keep the new device, this will download any updates which will also be used by the converted devices.

I would convert one device and check it all still works before doing them all. :wink:

You can also change the pluginid in the device (From the advanced tab) … than it should show up as a MultiString plugin in the APPS menu.

I never tried that. That’s a good tip, Richard.