sending http command to VeraLite in iviewer

1,187 views
Skip to first unread message

FastEddy

unread,
Oct 6, 2013, 1:06:54 PM10/6/13
to comman...@googlegroups.com
I want to create several buttons in guidesigner to turn a zwave light on and off and a slider to dim it up or down. I have the veralite gateway to communicate to the zwave devices already working using the delivered Micasaverde UI (web interface). I just want the same functionality inside my iviewer project. These are the http commands to veralite to turn on or off a light.
 
 
This one works to dim the light
 
 
These all work in safari on the Ipad but I don't know how to make in work in iviewer. Sorry for the newbie question!
 

 
**Please include as much software version information as possible. This ensures that other users and CommandFusion staff can provide a helpful answer as quickly as possible.** - Please Delete this line BEFORE posting.

Jarrod Bell

unread,
Oct 6, 2013, 6:27:54 PM10/6/13
to comman...@googlegroups.com
In system manager create a system using HTTP protocol. In the address enter 192.168.0.103, then port 3480

Then for each command in the system, just start with the /, eg:

/data_request?id=lu_action&output_format=xml&DeviceNum=21&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0

If that doesnt work, try removing the / at the start of the command.

Otherwise you can use JavaScript, like this:
CF.request("http://192.168.0.103:3480/data_request?id=lu_action&output_format=xml&DeviceNum=21&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1 ", function() {});

Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


--
You received this message because you are subscribed to the Google Groups "CommandFusion Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to commandfusio...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

FastEddy

unread,
Oct 8, 2013, 9:54:02 AM10/8/13
to comman...@googlegroups.com
Thanks, both these work. I now have buttons that can turn the lights on or off. Now I want to make a request and get the status of each light so I know it's dimming state and then update my gui (a text value)with the dimming value (ie. 50%, 30%, etc) I can do this with this command:

This returns a result of:

<device id="21" status="-1">
<states>
<state id="251" service="urn:upnp-org:serviceId:SwitchPower1" variable="Status" value="1"/>
<state id="252" service="urn:upnp-org:serviceId:Dimming1" variable="LoadLevelStatus" value="50"/>
<state id="253" service="urn:upnp-org:serviceId:Dimming1" variable="LoadLevelTarget" value="50"/>
<state id="254" service="urn:micasaverde-com:serviceId:HaDevice1" variable="Configured" value="1"/>

In know my current device is <device id="21" status="-1"> and therefore I can find the line that contains the variable="LoadLevelStatus" value="50". What is the best way to get this value and join it to my text value in my gui? It should tell me my light is 50%.

I just want to understand the steps involved. I have read the WIKI but I am not certain exactly how to go about performing this feedback.

Do I create a javascript that contains a function to make this call and call the function on page load and update the gui then? If I call the function on page load do I retrieve the 
LoadLevelStatus variable and join it to my text node in the GUI?

Am I understanding this correctly? Some guidance would be greatly appreciated?

Barry Gordon

unread,
Oct 8, 2013, 11:46:29 AM10/8/13
to comman...@googlegroups.com

I just posted a Weather Demo on my web site (www.the-gordons.net) It builds a weather page up from feedback in JSON format.  Similar code would do the same for XML formatted feedback. It uses the site api.wunderground.com for the source of the information. To understand wunderground.com go to www.wunderground.com and read the documentation.  You will need to register and obtain a valid api key to use the program. It will work for any US zip code and any area worldwide with some simple changes.

 

JSON is trivial to deal with as a feedback reply since it can be converted to a Javascript object by a single command and then all the parsing and text checking is already done.

 

I had an example of doing this in XML, but unfortunately I deleted it when I decided to go the JSON route.

--

Jarrod Bell

unread,
Oct 8, 2013, 7:05:34 PM10/8/13
to comman...@googlegroups.com
The Dynamic Room List has an example of using CF.request and parsing XML data, check it out here:
https://github.com/CommandFusion/DemoUserInterfaces/blob/master/DynamicRoomList/roomlist.js#L92

Line 92 of roomlist.js is the example code you should take a look at.


Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


Eric Wiersma

unread,
Nov 9, 2013, 4:31:30 AM11/9/13
to comman...@googlegroups.com
Hallo Fast Eddy,
Did you ever got this working?
I am starting with Vera Lite also and have the sending part working but not the feedback.

Eric
--
**********************************************************************
For information, services and offers, please visit our web site:
http://www.klm.com.
This e-mail and any attachment may contain confidential and privileged
material intended for the addressee only.
If you are not the addressee, you are notified that no part of the e-mail
or any attachment may be disclosed, copied or distributed,
and that any other action related to this e-mail or attachment is strictly
prohibited, and may be unlawful.
If you have received this e-mail by error, please notify the sender
immediately by return e-mail, and delete this message.

Koninklijke Luchtvaart Maatschappij NV (KLM), its subsidiaries and/or its
employees shall not be liable for the incorrect or
incomplete transmission of this e-mail or any attachments, nor responsible
for any delay in receipt.
Koninklijke Luchtvaart Maatschappij N.V. (also known as KLM Royal Dutch
Airlines) is registered in Amstelveen, The Netherlands,
with registered number 33014286
**********************************************************************

FastEddy

unread,
Jan 2, 2014, 11:19:06 AM1/2/14
to comman...@googlegroups.com
Hi Eric,

I get a JSON response but I am having trouble parsing the response data and joining it to a text node in iviewer.  My javascript skills are not that great, just learning.Sorry can't help.


On Sunday, October 6, 2013 11:06:54 AM UTC-6, FastEddy wrote:

Guillaume Vigneron

unread,
Jan 2, 2014, 1:31:30 PM1/2/14
to comman...@googlegroups.com
Guys,
I've been successful to manage the Vera Lite with the help of Barry and Jarrod, check that thread: https://groups.google.com/forum/#!searchin/commandfusion/feedback$20json/commandfusion/Lo_F2WXaCHI/AcrjOVQREF0J
Reply all
Reply to author
Forward
0 new messages