How to get values from http?

Hi everyone.
I have a question about http requests and received values.
I have setup emoncms and when i use a link with the api key and specific id i get in my browser the specific value. For example if i hit in a browser, i get a returned value [“16.37”] in the browser.
How can i make that value display in openhab 2???
Thanks in advance

Thanks but i still can’t get it to work.
Could i have some examples please ?
I have tried everything i could reading from the openhab 2 documentation for http binding but i cant get it to work.
I just want that number to appear in my openhab interface nothing more

You need to configure the binding for incoming requests:

http="<[<url>:<refreshintervalinmilliseconds>:<transformationrule>]" , so in your case

Number Temperature "Temperatur [%.1f °C]" { http="<[] }

or something similar should work. I cannot give you a working example, I’m using the binding only for outgoing messages.
For more information you need to read the json section:

I would first try it with a String item:

String Temperature "Temperatur [%s °C]" { http="<[*\["(.*)"\].*)] }

If that works then try it with a Number item:

Number Temperature "Temperatur [%.1f °C]" { http="<[*\["(.*)"\].*)] }
1 Like

Thank you guys.
I solved the problem by installing the regex transform.
I tried all of the above but with no luck at first and then i noticed in the console an error about regex rule.I installed the transformation and with the appropriate format i finally see my values.
Thanks once more.


can you share your solution with us? I have the same problem.
Thank you in advance!

Here is my item config.

String  		Phase_1  	"1η Φάση [%s Watt]"		<energy>	{ http="<[*))]"}
String 			Phase_2  	"2η Φάση [%s Watt]"		<energy>	{ http="<[*))]"}
String 			Phase_3 	"3η Φάση [%s Watt]"		<energy>	{ http="<[*))]"}


This is my item:
String HomePower “Consumption [%s Watt]” { http="<[*))]"}

My sitemap includes:
String item=HomePower icon=“energy”

feed ID and apikey are OK - I get the right number if I type in browser:

After putting this item in .items my BasicUI and ClassicUI stopped responding.

Am I missing something? Where I go wrong?

Thanks in advance,

In my sitemap i have

Frame label="Καταναλώσεις" {
  		Text label="Καταναλώσεις" icon="energy" {
				Text item=Phase_1
				Text item=Phase_2
				Text item=Phase_3
				Text item=Total_Power_Consumption


And here some screenshots

Tried with many Regex expressions but no luck :sweat:
I will keep trying. I will post if I succeed.
Thank you for help.

Finnaly I have connect OH2 and EmonCMS via MQTT.

My home.sitemap include:
Text item=HomePower icon=“energy”

My home.items include:
Number HomePower “Power [%s Watts]” { mqtt="<[emonhub:emon/emontx1/power1:state:default]" }

My mqtt.cfg (in folder services) include:
mqtt:emonhub.user=xxxxxxx (default:emonpi)
mqtt:emonhub.pwd=xxxxxxx (default:emonpimqtt2016)

I’m not sure if everything is by the book but it is working for me. I did not change anything on EmonCMS site.