Author Topic: MultiString Plugin  (Read 17828 times)

Offline JohnRob

  • Full Member
  • ***
  • Posts: 175
  • Karma: +9/-4
MultiString Plugin - Syntax
« Reply #90 on: January 18, 2017, 08:34:18 pm »
With RichardTSchafer's comment and some investigation I have LUA code that will read and write to a Multistring Variable.

Interesting, I found the Variable name used in the code is not the same as shown in the device / control section of Multistring.
Specifically the device shows  variables as V1. V2...V5.   However the code must use Variable1, Variable2...Variable5.

The below code needs only to have the device ID (dID) of MultiString to work.

Read Variable5  (V5)
Code: [Select]
local tmpValue, timeStamp = luup.variable_get("urn:upnp-org:serviceId:VContainer1","Variable5", dID)
luup.log("V5 Read Contents xxxxx")
luup.log(tmpValue)
luup.log(timeStamp)


Set Variable5  (V5)
Code: [Select]
local returnArguments = luup.call_action("urn:upnp-org:serviceId:VContainer1", "SetVariable5", {["newVariable5"] = "set"}, dID)
luup.log("V5 Set Contents yyyyy")
luup.log(error) -- not verified
luup.log(error_msg) -- not verified
--returns: error (number), error_msg (string), job (number), arguments (table)

The xxxxx and yyyyy in the log is simply to make it easy to search for.


I hope this helps some folks.


Offline Tommi

  • Sr. Newbie
  • *
  • Posts: 35
  • Karma: +0/-0
Re: MultiString Plugin
« Reply #91 on: January 19, 2017, 05:26:32 am »

Offline akbooer

  • Master Member
  • *******
  • Posts: 5227
  • Karma: +226/-67
  • "Less is more"
Re: MultiString Plugin
« Reply #92 on: January 19, 2017, 05:40:51 am »
any hint how to use it from http call?
trying
http://IP:port/data_request?id=variableset&DeviceNum=XXX&serviceId=urn:schemas-upnp-org:device:VContainer1&Variable2=66
and
http://IP:port/data_request?id=action&output_format=xml&DeviceNum=XXX&serviceId=urn:schemas-upnp-org:device:VContainer1&action=SetVariable2&newVariable2=66
first return OK and no change on variables (nil variable added)
second "ERROR: No implementation"

  • DON'T use variable_set.
  • you have the serviceID wrong on the second call (you're trying to use a device schema.)  Try "urn:upnp-org:serviceId:VContainer1"

The details are kind-of critical.

3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P.
Razberry, MySensors Arduino, HomeWave, AltUI, DataYours, openLuup, ZWay, ZeroBrane Studio.

Offline Tommi

  • Sr. Newbie
  • *
  • Posts: 35
  • Karma: +0/-0
Re: MultiString Plugin
« Reply #93 on: January 19, 2017, 06:40:06 am »
any hint how to use it from http call?
trying
http://IP:port/data_request?id=variableset&DeviceNum=XXX&serviceId=urn:schemas-upnp-org:device:VContainer1&Variable2=66
and
http://IP:port/data_request?id=action&output_format=xml&DeviceNum=XXX&serviceId=urn:schemas-upnp-org:device:VContainer1&action=SetVariable2&newVariable2=66
first return OK and no change on variables (nil variable added)
second "ERROR: No implementation"

  • DON'T use variable_set.
  • you have the serviceID wrong on the second call (you're trying to use a device schema.)  Try "urn:upnp-org:serviceId:VContainer1"

The details are kind-of critical.

Perfect, thanks :)

Offline Chrisfraser05

  • Sr. Member
  • ****
  • Posts: 436
  • Karma: +16/-30
Re: MultiString Plugin
« Reply #94 on: March 11, 2017, 01:25:27 pm »
I just wanted to say thanks to Rex for the plugin and to everyone for this thread.

I first started using the plugin a good while back but only for putting text into tasker.

With the help of this thread I've created a watchdog timer for Vera and Domoticz so the other one emails me if either one hangs up or otherwise goes off the network.


Cheers guys

Offline d55m14

  • Sr. Member
  • ****
  • Posts: 402
  • Karma: +7/-1
Re: MultiString Plugin
« Reply #95 on: July 28, 2017, 09:33:05 am »
Hi,

it seems that with the last firmware upgrade (1.7.2931 on VeraEdge) the command to set Name or Value via UI7 Control page of the device is not working.

Anybody with the same problem ?

tnks

donato