We have moved at community.getvera.com

Author Topic: Vera feedback to iRule  (Read 14946 times)

Offline bltpyro

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
Vera feedback to iRule
« on: January 30, 2013, 11:09:49 am »
I am considering iRule to bring my home automation and A/V together in one app. Since iRule is supposed to support "feedback" now, has anyone got that to work with Vera?
Also, it seems like the standard of using port 80 to communicate with Vera externally is too insecure. Can iRule be set up as an interface with the secure https://cp.mios.com as long as you provide the username and password?

I'm not new to programming but am to XML/HTML/HTTP/UPnP etc, so I am going through a few tutorials before I start the iRule trial.

On a side note, how does Open Remote compare with iRule?

Thanks

Offline garrettwp

  • Master Member
  • *******
  • Posts: 6371
  • Karma: +227/-128
  • Vera 3, Lite, ISY994
Re: Vera feedback to iRule
« Reply #1 on: January 30, 2013, 11:47:49 am »
bltpyro,

There is a lot of information on this forum that will answer most of your questions on here. I use irule for my dedicated home theatre and with Vera. However, I have not used the feedback portion of irule.

Port 80 is only used for Vera's web interace and is only accessible on your internal network. The api calls to interface with vera use ports 3480 and 49451. Have a look here for some info:

http://wiki.micasaverde.com/index.php/UI_Simple
http://wiki.micasaverde.com/index.php/Luup_Lua_extensions
http://wiki.micasaverde.com/index.php/Luup_Requests
http://wiki.micasaverde.com/index.php/Luup_Devices

Unless you plan on using irule outside of your network, there is no point of going through the mios servers. Unless you open ports to vera on the outside of the network (which I do not recommend) security should not be an issue e.g. port 80.

- Garrett
« Last Edit: January 30, 2013, 11:50:52 am by garrettwp »

Offline bltpyro

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
Re: Vera feedback to iRule
« Reply #2 on: January 31, 2013, 03:06:07 pm »
I have looked through the threads but didn't find anything on feedback or going through the mios servers. I did see one post on using an alternative method to reporting that I will probably look at again. I was planning on using iRule outside of the network. I figure as long as I'm going through the effort to make a nice UI to interface with Vera, I might as well use that externally too instead of the website or another app. I didn't want to open the ports, which is why I was wondering how you could access the secured mios servers using iRule.

Do you think iRule is worth it? I had considered Demopad, but I will be on android which it looks like they have no plans to support. Roomie doesn't seem to be as flexible, but is better for a quick set up.

Offline glennsp

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Re: Vera feedback to iRule
« Reply #3 on: February 01, 2013, 04:58:55 am »
After trying out a number of different apps, I decided to go for iRule a couple months ago and I'm very pleased with my decision. I use iRule on a daily basis and constantly extending it. Highly recommended!

I use feedback extensively. It works OK, but iRule misses a few features that would make it much more convenient to use. For instance, they don't use variables so you have to hard code device ids etc. everywhere. But don't let that scare you too much, it works pretty well. And from what I understand, they are working hard on improving this bit.

Here's an example of a how I set up a thermostat query:

1. Create a Network Code under your MiCasaVerde device (I just imported one that someone else had created as a starting point), called Thermostat Query. This will be used to fetch the temperatures. Use the following fields:
Code: [Select]
data: data_request?id=lu_status&DeviceNum=<your-thermostat-device-id>&output_format=xml
2. Create a new numeric feeback (you need the pro version for this) called CurrentTemperature, with the following fields:
Code: [Select]
CurrentTemperature:
Prefix: *"CurrentTemperature" value="
Suffix: ">*

Value:
format: Ascii
notation: Decimal
point position: floating
formula: x
min: -30
max: 100
value units: celsius
3. Open the entrances of panel you want to use for displaying thermostat info. Drag the Thermostat Query into the entrance.
4. Drag the feedback anywhere on the panel

Add the proper gateway to your app and you should have a temperature reading when you open the panel!

Good luck and have fun!

Offline garrettwp

  • Master Member
  • *******
  • Posts: 6371
  • Karma: +227/-128
  • Vera 3, Lite, ISY994
Re: Vera feedback to iRule
« Reply #4 on: February 01, 2013, 05:58:17 am »
Great info glennsp and welcome to the forum!

- Garrett

Offline bltpyro

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
Re: Vera feedback to iRule
« Reply #5 on: February 01, 2013, 02:07:32 pm »
Thanks guys for the info. I finally got the trial, but am confused at setting up a button to just send https://fwd2.mios.com/demovera/myvera123/12345/data_request?id=lu_action &DeviceNum=4&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=10, with my own information of course. Normal use is assumed to be local, using a gateway with the local IP address and port, but how to I just send the full URL?
« Last Edit: February 01, 2013, 02:41:42 pm by bltpyro »

Offline glennsp

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Re: Vera feedback to iRule
« Reply #6 on: February 04, 2013, 01:34:00 pm »
Thanks, Garrett!

bltpyro, don't include the server address or ip in the request in iRule Builder. You specify this in the iOS app.

In the iOS app, go to Gateways, press Edit and "Add new gateway" under HTTP.
Select Devices, Add device and select you MiCasaVerde device.
Specify your ip, port 3480 and you username and password. HTTP Method should be GET.

In your example, use /demovera/myvera123/12345/data_request?id=lu_action&DeviceNum=4&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=10 in the iRule Builder and fwd2.mios.com in the iOS app.

And remember, you need the Pro version if you want to try feedback, the trial doesn't have this.

-Glenn

Offline bltpyro

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
Re: Vera feedback to iRule
« Reply #7 on: February 13, 2013, 01:27:30 pm »
Man I  just can't seem to get this working. So for the HTTP gateway, IP = https://fwd2.mios.com?  Also, you put your username/password in both the builder and also in the username and password section for the gateway? It seems like I have tried every combination and it just isn't working.

Offline Brientim

  • Sr. Hero Member
  • ******
  • Posts: 2497
  • Karma: +78/-7
Re: Vera feedback to iRule
« Reply #8 on: February 13, 2013, 02:48:24 pm »
To confirm the server for your unit use the link below, you do not need to enter your userne just use as is.

http://sta1.mios.com/locator_json.php?username=user

Refer http://wiki.micasaverde.com/index.php/UI_Simple

Offline Shorty

  • Jr. Member
  • **
  • Posts: 94
  • Karma: +1/-0
Re: Vera feedback to iRule
« Reply #9 on: March 31, 2014, 01:13:49 am »
Sorry to resurrect an old post but I am in the same situation.  I can get feedbacks to work locally but not through fwdX.mios.com

For the gateway I am setting it as fwd4.mios.com
port: 80 (I've tried 443, 3480, as well).
l/p: tried leaving them blank since the irule command will send them.  have also tried entering them

The irule gateway icon turns green but nothing is working.

Has anyone successfully implemented feedbacks through the mios servers and give detailed info.  Maybe even include what they are using for prefix/suffix in the feedbacks to rule that out as well.

Offline RichardTSchaefer

  • Community Beta
  • Master Member
  • ******
  • Posts: 10091
  • Karma: +764/-143
Re: Vera feedback to iRule
« Reply #10 on: March 31, 2014, 08:38:19 am »
You will have to use the gateway that is specified by the call to:

     http://sta1.mios.com/locator_json.php?username=user

And it can and does change from time to time.

NOTE: This will NOT work for UI6 and later.

Offline garrettwp

  • Master Member
  • *******
  • Posts: 6371
  • Karma: +227/-128
  • Vera 3, Lite, ISY994
Re: Vera feedback to iRule
« Reply #11 on: March 31, 2014, 10:18:33 am »
Do you have to go through the Mios servers? Why not use the ip address of your Vera.

- Garrett


Offline Shorty

  • Jr. Member
  • **
  • Posts: 94
  • Karma: +1/-0
Re: Vera feedback to iRule
« Reply #12 on: April 01, 2014, 01:55:30 am »
Thanks guys for the replies.

I did use the proper gateway (fwd4) in my case.  Didn't use the IP directly as I was working from home and 3480 isn't open to the web.  Then I got consumed trying to figure out what I was doing incorrect.

Have either of you successfully got it to work through the servers?  Could you copy and paste what works?

Thanks

Offline garrettwp

  • Master Member
  • *******
  • Posts: 6371
  • Karma: +227/-128
  • Vera 3, Lite, ISY994
Re: Vera feedback to iRule
« Reply #13 on: April 01, 2014, 06:38:16 am »
I only use iRule for controlling my equipment. I do not use it to provide feedback from Vera. I do have it issue a few vera commands to turn on some of the switches and outlets for my home theater equipment. I use my local ip address of Vera.

- Garrett

Offline Jamr

  • Hero Member
  • *****
  • Posts: 847
  • Karma: +30/-8
Re: Vera feedback to iRule
« Reply #14 on: April 01, 2014, 08:09:37 pm »
I only use iRule for controlling my equipment. I do not use it to provide feedback from Vera. I do have it issue a few vera commands to turn on some of the switches and outlets for my home theater equipment. I use my local ip address of Vera.

- Garrett

Garrett, do you get any delay using your IRule to issue commands to your Vera to turn on some switches and outlets?
I get a huge delay (sometimes not at all) in trying to do this.