Hi,
I want to read an url and put the result into a variable in habpanel. Ex:
Url want to read: http://xxx.xxx.x.x :xxxx/data_request?id=variableget&Variable=Status (that will display 1 or 0)
I then want to use that variable to decide if I want to run
url 2 (http://192.168.1.8:3480/data_request?id=action&output_format=xml&action=SetTarget&newTargetValue=0 )
or
url 3 (http://192.168.1.8:3480/data_request?id=action&output_format=xml&action=SetTarget&newTargetValue=1 ) with and ng-if and a ng-click
Is that possible?
Thanks
/Claus
There is a guide here, on how to monitor WAN ip, and notify when that changes.
I think you can use that.
Try to search for it
/Robert
rossko57
(Rossko57)
May 27, 2017, 9:17am
3
That sounds very much like a Switch in OpenHAB terms, with Exec binding inputs and outputs
rlkoshak
(Rich Koshak)
May 27, 2017, 3:49pm
4
I would use the http binding to read the first url. You don’t say under what circumstances you want to read it. Do you poll it periodically, read it base on some event?
In a rule I would then use the http actions to call the urls based on the state of the item that got the first url.
Hi Rick,
I want to poll it periodically. So if I can put it in a item.
I have tried with HTTP binding, but I could not get that to work.
Do you have an example on how I could do it?
Thanks
/Claus
rlkoshak
(Rich Koshak)
May 27, 2017, 9:27pm
6
In what way do it not work?
http.cfg:
weatherConditions.url=http://api.wunderground.com/api/e9f3c8d72995d1cd/conditions/q/pws:KCOMONUM13.json
weatherConditions.updateInterval=30000
items:
String vWeather_Conditions "Current Conditions [%s]"
{ http="<[weatherConditions:420000:JSONPATH($.current_observation.weather)]" }
In your case, you probably can use default
in place of the JSONPATH transform.
rlkoshak:
http actions
How is the default?
This is the url I want to read:
http://xxx.xxx.xxx.xxx :xxxxx/data_request?id=variableget&DeviceNum=xxx&serviceId=urn:micasaverde-com:serviceId:DoorLock1&Variable=Status
Sorry for all the questions, but I’m a new bee
/Claus
I dont get the status. Here is how I done it:
http.cfg:
Status.url=http://xxx.xxx.xxx.xxx:xxxx/data_request?id=variableget&DeviceNum=xx&serviceId=urn:micasaverde-com:serviceId:DoorLock1&Variable=Status
Status.updateInterval=30000
Item:
String vStatus “Current Conditions [%s]” { sendHttpGetRequest(http://xxx.xxx.xxx.xxx :xxxx/data_request?id=variableget&DeviceNum=xx&serviceId=urn:micasaverde-com:serviceId:DoorLock1&Variable=Status) }
Sitemap:
Text item=vStatus
The abobe settings display only a - instead of the the current status
Is that correct?
rlkoshak
(Rich Koshak)
May 28, 2017, 12:51am
10
Please go through the beginners tutorial and read the HTTP binding readme.
Your item makes no sense. Look at the example Item I posted above. The stuff that goes between the {} should look like that. What you have belongs in a rule, not an item definition.