Set Hub Variable > 255 characters from an App

Attempting to set a Hub Variable with a connector > 225 chracters from an app, but keep getting an error that the variable is > 255 characters, however when initially setting or updating the variable from settings: HubVariables, it accepts more than 255 characters. Note: needed the connector to select it in the app.

Is there some way to do this?

Code I've tried

setGlobalVar(${hubVariable}, ${workCodes})

Input field
input "hubVariable", "capability.variable", title: "Hub Variable used to store code cache", required: true, multiple: false

There's a limit of 255 characters for a String variable. You probably should use a local file instead.

1 Like

Is there any documentation or an example of doing that? I will also need to access/read the information from a driver

This isn't possible, and there are not available methods (hence no documentation). You can access a local file from RM. I guess RM could call some method in a driver to pass a long string to it.

If all you need are text files, did this mainly as a demonstration:


Thank you for posting this. I looked at it earlier and although it would definitely work, I was concerned the login overhead may rather high when processing a real time device command. Your thoughts?

I didn't optimize the login, but I was thinking that you could probably save the cookie value to state, and reuse it from there instead of requesting it each time (on my todo list to test, but...)

Decided to store it in a virtual device, quick and easy.

1 Like

Any updates regarding this?

I am trying to store a string > 255 (weather summary from darksky) so i can send it to a speech device with %variable% attribute (sonos one).

UPDATE: nevermind, using local variable works. Maybe others will have the same issue, so i will leave this as a partial fix.