Sonoff POW2 espurna FW reflashed, items for U,I,P,Q,cosfi,energy via http bindig

Hi,
values from http api request are shown in internet browser via http requests:

Is this item definition possible ?

String Pow2_Voltage “Pow2 [%s]” (Sonoff) { http="<[http://sonoffpow2ip/api/voltage?apikey=xxxxxxxxxxxxxxxx]" }
Answer is 223 (meanings Volt)

http://sonoffpow2ip/api/voltage?apikey=xxxxxxxxxxxxxxxx
http://sonoffpow2ip/api/current?apikey=xxxxxxxxxxxxxxxx
http://sonoffpow2ip/api/power?apikey=xxxxxxxxxxxxxxxx
http://sonoffpow2ip/api/apparent?apikey=xxxxxxxxxxxxxxxx
http://sonoffpow2ip/api/factor?apikey=xxxxxxxxxxxxxxxx
http://sonoffpow2ip/api/energy?apikey=xxxxxxxxxxxxxxxx

How shoulde be defined items for this Numbers ? Strings ? vaules ?
Thanks.

If the result of the transform is just a number with no units or extra spaces then you can use a Number. Otherwise you need to use a String or parse it there non number parts using a Rule.

Hello Rich. Thanks for answer.
It looks like string without anything.

String Pow2_Voltage “Pow2 [%s]” (Sonoff) { http="<[http://pow2ip/api/voltage?apikey=xxxxxxxx]" }
gives no value back to string item.

Perhaps, but as as far as one can tell in that screenshot there could be a space before or after the 230 or there could be some HTML tags which would be hidden in the browser.

Do you see errors in the log?

Small python script returns the value:

#!/usr/bin/python3
import requests

r = requests.get(‘http://pow2ip/api/voltage?apikey=xxxxxxxxxxxxxxxx’)
data = r.content
print(“Voltage=”,data,“V”)

returns
(‘Voltage=’, ‘231’, ‘V’)

How should i put the 232 value to a string item and convert it to number.
Number would be used in rules for comparissons.

Have you installed the HTTP binding?

Yes of course

Hi,
this returns string
String Pow2_Voltage “Pow2 Voltage [%s V]” (Sonoff) { http="<[http://sonoffip/api/voltage?apikey=xxxxxxxxxxxxxxxxx:3000:JSONPATH($.data)]" }

For display it is enough. But I need to make some rules for comparison of number values.
If Pow2_Power is greater as high trigger value = daikin is on, if Pow2_Power is below low trigger value= daikin is off.

How to convert string value to number please ?
Can it be done with REGEX g´transformation or converting rule should be created ?
Thanks.

Like I said above, if what JSONPATH($.data) is just a number with no spaces or non-number characters then just change the Item type to Number.

Number Pow2_Voltage ...

If not, you will need a Rule that triggers when Pow2_Voltage changes, strips off the extraneous characters using String.split or a regex transform and updates the value of the Number Pow2_Voltage_Proxy Item.

Item Number definition works fine, thanks for help Rich.