Problems regex after switch from oh2 on oh3

Hi all,

in OH2 I had a items file with lines like this:
Number PV_Einspeisung_aktuell_KW “PV Einspeisung Aktuell 2.99.0: [%.2f] KW” { http="<[http://192.168.1.102/plugins/smartmeter/index.php:6000:REGEX(.AH0648EY:Delivery_CalculatedPower_OBIS_\d.\d\d.\d:(\d+.\d+).)]" }

and it worked. In OH3, I added this line into the items file and the resulst is “null”. I added a thing with a channel to keep the web page resulst. It works:

AH0648EY:Last_Update:2021-06-30 08:26:29 AH0648EY:Last_UpdateLoxEpoche:394273589 AH0648EY:Consumption_Total_OBIS_1.8.0:047453.913 AH0648EY:Consumption_Tarif1_OBIS_1.8.1:024126.841 AH0648EY:Consumption_Tarif2_OBIS_1.8.2:023327.072 AH0648EY:Consumption_Tarif3_OBIS_1.8.3: AH0648EY:Consumption_Tarif4_OBIS_1.8.4: AH0648EY:Consumption_Tarif5_OBIS_1.8.5: AH0648EY:Consumption_Tarif6_OBIS_1.8.6: AH0648EY:Consumption_Tarif7_OBIS_1.8.7: AH0648EY:Consumption_Tarif8_OBIS_1.8.8: AH0648EY:Consumption_Tarif9_OBIS_1.8.9: AH0648EY:Consumption_CalculatedPower_OBIS_1.99.0:2.1600 AH0648EY:Consumption_Power_OBIS_1.7.0: AH0648EY:Delivery_Total_OBIS_2.8.0:020585.348 AH0648EY:Delivery_Tarif1_OBIS_2.8.1:020583.555 AH0648EY:Delivery_Tarif2_OBIS_2.8.2:000001.793 AH0648EY:Delivery_Tarif3_OBIS_2.8.3: AH0648EY:Delivery_Tarif4_OBIS_2.8.4: AH0648EY:Delivery_Tarif5_OBIS_2.8.5: AH0648EY:Delivery_Tarif6_OBIS_2.8.6: AH0648EY:Delivery_Tarif7_OBIS_2.8.7: AH0648EY:Delivery_Tarif8_OBIS_2.8.8: AH0648EY:Delivery_Tarif9_OBIS_2.8.9: AH0648EY:Delivery_CalculatedPower_OBIS_2.99.0:**0.0000** AH0648EY:Delivery_Power_OBIS_2.7.0: AH0648EY:Total_Power_OBIS_15.7.0: AH0648EY:Total_Power_OBIS_16.7.0: #EOF 

Now i add a Regex transformation, as I am interested in the bold marked value:

.*AH0648EY:Delivery_CalculatedPower_OBIS_2.99.0:(\\d+.\\d+).*

I tried this on Regex testers and there it works. In the channel I do not see a value. What am I doing wrong?

thanks in advance

All we can do is guess at this stage - please post your full Thing and Item configurations.

Do you have the REGEX Transformation Service installed?

yes. regex is installed. I configured thing via OH Webinterface.

Thing code:

UID: http:url:Loxberry
label: Loxberry
thingTypeUID: http:url
configuration:
  authMode: DIGEST
  ignoreSSLErrors: false
  baseURL: http://192.168.1.102/plugins/smartmeter/index.php
  refresh: 5
  commandMethod: GET
  contentType: text/html
  timeout: 3000
  bufferSize: 2048
channels:
  - id: plaintext
    channelTypeUID: http:string
    label: plaintext
    description: ""
    configuration: {}

I also added the channel is configured via WebInterface as String Channel with “Read only”.
I also link to a new Item type String with Regex Transformation

.*AH0648EY:Delivery_CalculatedPower_OBIS_2.99.0:(\\d*.\\d*).*

via WebInterface. The result is an empty String.

@ hafniumzinc I do not have a thing file yet. And my items file is a copy of the oh2 items file:

//Strom

Number PV_Produktion_Aktuell "PV Produktion aktuell: [%s] W" { http="<[fronius/solar_api/v1/GetInverterRealtimeData.cgi?Scope=System:5000:JSONPATH($.Body.Data.PAC.Values.1)]" }
Number PV_Produktion_Aktuell_KW "PV Produktion aktuell: [%.2f KW]" 
Number PV_Tagesproduktion "PV Produktion pro Tag: [%.2f]"  { http="<[http://192.168.1.149/solar_api/v1/GetInverterRealtimeData.cgi?Scope=System:5000:JSONPATH($.Body.Data.DAY_ENERGY.Values.1)]" }
Number PV_Tagesproduktion_KW "PV Produktion pro Tag: [%.2f KW]" 
Number PV_Produktion_Total "PV Produktion Total: [%.2f]"  { http="<[http://192.168.1.149/solar_api/v1/GetInverterRealtimeData.cgi?Scope=System:5000:JSONPATH($.Body.Data.TOTAL_ENERGY.Values.1)]" }
Number PV_Produktion_Total_KW "PV Produktion Total: [%.2f] KW" 
Number PV_Produktion_Jahr "PV Produktion pro Jahr: [%.2f]"  { http="<[http://192.168.1.149/solar_api/v1/GetInverterRealtimeData.cgi?Scope=System:5000:JSONPATH($.Body.Data.YEAR_ENERGY.Values.1)]" }
Number PV_Produktion_Jahr_KW "PV Produktion pro Jahr: [%.2f] KW" 
Number PV_Einspeisung_aktuell_KW "PV Einspeisung Aktuell 2.99.0: [%.2f] KW" { http="<[http://192.168.1.102/plugins/smartmeter/index.php:6000:REGEX(.*AH0648EY:Delivery_CalculatedPower_OBIS_\\d.\\d\\d.\\d:(\\d+.\\d+).*)]" }
Number PV_Einspeisung_Tarif1_KW "PV Einspeisung Tarif1 2.8.1: [%.2f] KW" { http="<[http://192.168.1.102/plugins/smartmeter/index.php:6000:REGEX(.*AH0648EY:Delivery_Tarif1_OBIS_\\d.\\d.\\d:(\\d+.\\d+).*)]" }
Number PV_Einspeisung_Tarif2_KW "PV Einspeisung Tarif2 2.8.2: [%.2f] KW" { http="<[http://192.168.1.102/plugins/smartmeter/index.php:6000:REGEX(.*AH0648EY:Delivery_Tarif2_OBIS_\\d.\\d.\\d:(\\d+.\\d+).*)]" }
Number PV_Einspeisung_Total_KW "PV Einspeisung Total 2.8.0: [%.2f] KW" { http="<[http://192.168.1.102/plugins/smartmeter/index.php:6000:REGEX(.*AH0648EY:Delivery_Total_OBIS_\\d.\\d.\\d:(\\d+.\\d+).*)]" }
Number EW_Verbrauch_Total_KW "Verbrauch total 1.8.0 [%.2f] KW" { http="<[http://192.168.1.102/plugins/smartmeter/index.php:6000:REGEX(.*AH0648EY:Consumption_Total_OBIS_\\d.\\d.\\d:(\\d+.\\d+).*)]" }
Number EW_Energiebezug_aktuell_KW "Energiebzug Aktuell 1.99.0: [%.2f] KW" { http="<[http://192.168.1.102/plugins/smartmeter/index.php:6000:REGEX(.*AH0648EY:Consumption_CalculatedPower_OBIS_\\d.\\d\\d.\\d:(\\d+.\\d+).*)]" }
Number SmartPi_PH1_W "SmartPi Phasa1 [%.2f] W" 
Number SmartPi_PH2_W "SmartPi Phasa2 [%.2f] W" 
Number SmartPi_PH3_W "SmartPi Phasa3 [%.2f] W" 
Number Speise_ein
Number SmartPi_Total_KW "SmartPi Einspeisung heute [%.2f] KW heute"
Number SmartPi_Total_KW_Offset "SmartPi Offset [%.2f] KW bis gestern"
Number SmartPi_Summe_Total "SmartPi Summe Total [%.2f] KW"
Number PV_Einspeisung_Tag_KW "PV Einspeisung pro Tag [%.2f] KW" 
Number PV_Einspeisung_Vortag_KW "PV Einspeisung Vortag [%.2f] KW"
Number EW_Energiebezug_Tag_KW  "Energiebezug heute: [%.2f KW]" 
Number EW_Energiebezug_Vortag_KW  "Energiebezug Vortag: [%.2f KW]" 

Number Eigenverbrauch_Aktuell_KW "PV Eigenverbrauch aktuell: [%.2f KW]" 
Number Eigenverbrauch_Tag_KW "PV Eigenverbrauch heute: [%.2f KW]" 
Number Eigenverbrauch_Total_Prozent "PV Eigenverbrauch: [%.2f %%]" 

Number PV_Amortisierung_Eigenverbrauch "Amortisierung Eigenverbrauch: [%.2f CHF]"
Number PV_Amortisierung_Einspeisung "Amortisierung Einspeisung: [%.2f CHF]"
Number PV_Amortisierung_Total "Amortisierung Total: [%.2f CHF]"

Number Stromverbrauch_Tag_KW "Stromverbrauch heute: [%.2f KW]" 
Number Stromverbrauch_aktuell_KW "Stromverbrauch aktuell: [%.2f KW]" 
Number PV_Nettoinvestition "Netto Investition: [%.2f CHF]"

Switch MyStrom_Trocknen_Switch 	{mystromecopower="Trocknen"}
Number MyStrom_Trocknen_Number  "Waschen Verbrauch [%.2f W]"	{mystromecopower="Trocknen"}
Switch MyStrom_Spuehlen_Switch 	{mystromecopower="Spuehlen1"}
Number MyStrom_Spuehlen_Number  "Spühlen Verbrauch [%.2f W]"	{mystromecopower="Spuehlen1"}
Switch MyStrom_Waschen_Switch 	{mystromecopower="Waschen"}
Number MyStrom_Waschen_Number  "Waschen Verbrauch [%.2f W]"	{mystromecopower="Waschen"}
Switch MyStrom_Kaffee_Switch 	{mystromecopower="Kaffee"}
Number MyStrom_Kaffee_Number  "Waschen Verbrauch [%.2f W]"	{mystromecopower="Kaffee"}
Number Waescht "Wäscht an [%s]"
Number Spuehlt "Spühlt an [%s]"
Number Trocknet "Trockner an [%s]"
Number Kaffee "Kaffee an [%s]"

//Number WP_On "WP an [%s]"


Switch Amortisiere
Switch Boiler_darf

Switch WP_On_Schwitch       "Wärmepumpe darf an: "  { piface="chefpi:OUT:1" }
Switch WP_Heating     "Wärmepumpe heizt." 
Switch WP_Water     "Wärmepumpe heizt Wasser." 

String HeatPump_State   "Status [%s]"   <temperature> (gHeatpump) { novelanheatpump="state" }
String HeatPump_Extended_State   "Extended Status [%s]"   <temperature> (gHeatpump) { novelanheatpump="extended_state" }
Number HeatPump_warmwater_temperature   "Warmwasser Temperatur [%.1f]"  (gHeatpump) { novelanheatpump="warmwater_temperature" }

Number HeatPump_Temperature_1   "Wärmepumpe Außentemperatur [%.1f °C]"   <temperature> (gHeatpump) { novelanheatpump="temperature_outside" }
Number HeatPump_Temperature_2   "Rücklauf [%.1f °C]"  <temperature> (gHeatpump) { novelanheatpump="temperature_return" }
Number HeatPump_Temperature_3   "Rücklauf Soll [%.1f °C]" <temperature> (gHeatpump) { novelanheatpump="temperature_reference_return" }
Number HeatPump_Temperature_4   "Vorlauf [%.1f °C]"    <temperature> (gHeatpump) { novelanheatpump="temperature_supplay" }
//Number HeatPump_Brauchwasser_Soll   "Brauchwasser Soll [%.1f °C]"  <temperature> (gHeatpump) { novelanheatpump="temperature_servicewater_reference" }
Number HeatPump_Brauchwasser_Ist  "Brauchwasser Ist [%.1f °C]"   <temperature> (gHeatpump) { novelanheatpump="temperature_servicewater" }
//Number HeatPump_Temperature_7   "Solarkollektor [%.1f °C]" <temperature> (gHeatpump) { novelanheatpump="temperature_solar_collector" }
//Number HeatPump_Temperature_8   "Solarspeicher [%.1f °C]"  <temperature> (gHeatpump) { novelanheatpump="temperature_solar_storage" }

Number HeatPump_Retrun_External     "Rücklauf Extern [%.1f °C]"   <temperature> (gHeatpump) { novelanheatpump="temperature_out_external" } // return external
Number HeatPump_Hot_Gas     "Temperatur Heissgas [%.1f °C]"    <temperature> (gHeatpump) { novelanheatpump="temperature_hot_gas" } // return hot gas
Number HeatPump_Outside_Avg     "mittlere Aussentemperatur [%.1f °C]"  <temperature> (gHeatpump) { novelanheatpump="temperature_outside_avg" } 
Number HeatPump_Probe_in    "Sondentemperatur Eingang [%.1f °C]"   <temperature> (gHeatpump) { novelanheatpump="temperature_probe_in" } 
Number HeatPump_Probe_out   "Sondentemperatur Ausgang [%.1f °C]"   <temperature> (gHeatpump) { novelanheatpump="temperature_probe_out" } 
Number HeatPump_Mk1     "Vorlauftemperatur MK1 IST [%.1f °C]"  <temperature> (gHeatpump) { novelanheatpump="temperature_mk1" } 
Number HeatPump_Mk1_Reference   "Vorlauftemperatur MK1 SOLL [%.1f °C]" <temperature> (gHeatpump) { novelanheatpump="temperature_mk1_reference" } 
Number HeatPump_Mk2     "Vorlauftemperatur MK2 IST [%.1f °C]"  <temperature> (gHeatpump) { novelanheatpump="temperature_mk2" } 
Number HeatPump_Mk2_Reference   "Vorlauftemperatur MK2 SOLL [%.1f °C]" <temperature> (gHeatpump) { novelanheatpump="temperature_mk2_reference" } 
Number HeatPump_External_Source     "Temperatur externe Energiequelle [%.1f °C]"   <temperature> (gHeatpump) { novelanheatpump="temperature_external_source" } 
String HeatPump_Hours_Compressor1   "Betriebsstunden Verdichter1 [%s]"  <clock> (gHeatpump) { novelanheatpump="hours_compressor1" } 
Number HeatPump_Starts_Compressor1  "Verdichter 1 [%.1f]"   <clock> (gHeatpump) { novelanheatpump="starts_compressor1" } 
String HeatPump_Hours_Compressor2   "Betriebsstunden Verdichter2 [%s]"  <clock> (gHeatpump) { novelanheatpump="hours_compressor2" } 
Number HeatPump_Starts_Compressor2  "Verdichter 2 [%.1f]"   <clock> (gHeatpump) { novelanheatpump="starts_compressor2" } 
String HeatPump_Hours_Zwe1  "Betriebsstunden ZWE1 [%s]" <clock> (gHeatpump) { novelanheatpump="hours_zwe1" }
String HeatPump_Hours_Zwe2  "Betriebsstunden ZWE2 [%s]" <clock> (gHeatpump) { novelanheatpump="hours_zwe2" }
String HeatPump_Hours_Zwe3  "Betriebsstunden ZWE3 [%s]" <clock> (gHeatpump) { novelanheatpump="hours_zwe3" }
String HeatPump_Hours_Heatpump  "Betriebsstunden [%s]"  <clock> (gHeatpump) { novelanheatpump="hours_heatpump" } 
String HeatPump_Hours_Heating   "Betriebsstunden Heizung [%s]"  <clock> (gHeatpump) { novelanheatpump="hours_heating" }
String HeatPump_Hours_Warmwater "Betriebsstunden Brauchwasser [%s]" <clock> (gHeatpump) { novelanheatpump="hours_warmwater" }
String HeatPump_Hours_Cooling   "Betriebsstunden Kuehlung [%s]" <clock> (gHeatpump) { novelanheatpump="hours_cooling" }
Number HeatPump_Thermalenergy_Heating   "Waermemenge Heizung [%.1f KWh]"    <energy> (gHeatpump) { novelanheatpump="thermalenergy_heating" }
Number HeatPump_Thermalenergy_Warmwater     "Waermemenge Brauchwasser [%.1f KWh]"   <energy> (gHeatpump) { novelanheatpump="thermalenergy_warmwater" }
Number HeatPump_Thermalenergy_Pool  "Waermemenge Schwimmbad [%.1f KWh]" <energy> (gHeatpump) { novelanheatpump="thermalenergy_pool" }
Number HeatPump_Thermalenergy_Total     "Waermemenge gesamt seit Reset [%.1f KWh]"  <energy> (gHeatpump) { novelanheatpump="thermalenergy_total" }
Number HeatPump_Massflow    "Massentrom [%.1f L/h]" <energy> (gHeatpump) { novelanheatpump="massflow" }

Number HeatPump_heating_operation_mode   "Heizung Betriebsart [%.0f]"  (gHeatpump) { novelanheatpump="heating_operation_mode" }
Number HeatPump_heating_temperature   "Heizung Temperatur [%.1f]"  (gHeatpump) { novelanheatpump="heating_temperature" }
Number HeatPump_warmwater_operation_mode   "Warmwasser Betriebsart [%.0f]"  (gHeatpump) { novelanheatpump="warmwater_operation_mode" }
Number HeatPump_Cool_BA "Betriebsart" (gHeatpump) { novelanheatpump="cooling_operation_mode" }
Number HeatPump_Cooling_Release "Freigabe [%.1f °C]" (gHeatpump) { novelanheatpump="cooling_release_temperature" }
Number HeatPump_Cooling_Inlet "Vorlauf Soll [%.1f °C]" (gHeatpump) { novelanheatpump="cooling_inlet_temperature" }
Number HeatPump_Cooling_Start "AT Überschreitung[%.1f hrs]" (gHeatpump) { novelanheatpump="cooling_start_hours" }
Number HeatPump_Cooling_Stop "AT Unterschreitung[%.1f hrs]" (gHeatpump) { novelanheatpump="cooling_stop_hours" }

Number WP_On_3kw "WP_On_3kw [%.1f]" 
Number Spuehlen_On_2_5Kw "Spuehlen_On_2_5Kw [%.1f]" 
Number Waschen_On_2Kw "Waschen_On_2Kw [%.1f]" 
Number Trocken_On_1Kw "Trocken_On_1Kw [%.1f]" 
Number Verbraucher

Number   Clouds_today   "Clouds [%.0f %%]"   {weather="locationId=home, type=clouds, property=percent"}
Number   Clouds_tomorrow   "Clouds [%.0f %%]"   {weather="locationId=home, forecast=1, type=clouds, property=percent"}
String Heatpump_state_proxy   "Heatpump_state_proxy [%s]" 

Number WP_Running_minutes  "Laufzeit WP seit gestern abend [%.1f m]" 
Number WP_Running_minutes_KW  "Stromverbrauch WP seit gestern abend [%.1f Total]" 
Number WP_Running_minutes_Summe  "Stromverbrauch WP seit gestern abend [%.1f KW]"

Switch WW_PV_gesteuert "WW über PV [%.1f]" 
Number WW_PV_gesteuert_min "WW über PV seit [%.1f m]" 
Switch WW_PV_gesteuert_lief_schon
Number WW_Tage_seit "Tage seit Legionellenprogamm [%.1f Tage]" 
Switch PV_WW_ausmachen
Switch Zwangsaus_Veto "Zwangsaus Veto" 
Switch Zwangsaus_Spuehlen
Switch Zwangsaus_Waschen
Switch Zwangsaus_Trocknen
Switch WW_PV_gesteuert_60_am_tag

None of these are going to work. HTTP-1 syntax will not work with HTTP-2 Things andchannels.

How/where exactly did you do that, given you are using xxx.items files?

Link a plain String Item to your channel aswell, with no transformation, and see if you get the full result you expect. Then you’ll know better where to look for your problem.

ok, thanks for help. I finally got it, but it does not look very elegant. My things file:

Thing http:url:loxberry "MyLoxberry" [
	baseURL="http://192.168.1.102/plugins/smartmeter/index.php",
	refresh=5] {
		Channels:
			Type string : LoxberryResultPage "LoxberryResultPage" [ stateTransformation="REGEX:(.*)" ]
}

My Items File:

String PV_Einspeisung_aktuell_KW "PV Einspeisung Aktuell 2.99.0:  [%.2f]" { CHANNEL="LoxberryResultPage" }

My Sitemap:

				Text item=PV_Einspeisung_aktuell_KW

after that, I had to manually link the existing Item to the channel via WebInterface with this regex expression:

.*AH0648EY:Delivery_CalculatedPower_OBIS_2.99.0:(\d*.\d*).*

That’s just bad syntax, and will be ignored.
{ channel = "blahblah" }
lowercase
So you had to …

When you made that link, you’ll maybe have noticed that the full reference or UID for the channel was something like
http:loxberry:LoxberryResultPage
and that’s what you would need to put in the { channel = "xx" } place.
Even if you use files, the web view is useful to find out UIDs accurately.

You could do this in the actual channel instead, you’re already doing a REGEX there -
stateTransformation="REGEX:(.*)"

Applying to the channel link as a profile works of course, but you’re doing two REGEX instead of just one.

@rossko57 thx. the tip with the uid was great.

I changed the files like this:

Thing http:url:loxberry "MyLoxberry" [
	baseURL="http://192.168.1.102/plugins/smartmeter/index.php",
	refresh=15] {
		Channels:
			Type string : LoxberryResultPage "LoxberryResultPage" [ stateTransformation="REGEX:(.*)" ]
			Type string : pveinspeisungaktuell "PV_Einspeisung_aktuell" [ stateTransformation="REGEX:.*AH0648EY:Delivery_CalculatedPower_OBIS_2.99.0:(\\d*.\\d*).*" ]
			
}

Items:

Number PV_Einspeisung_aktuell_KW "PV Einspeisung Aktuell 2.99.0: [%.2f KW]" { CHANNEL="http:url:loxberry:LoxberryResultPage" }
Number NEW_Einspeisung_aktuell_KW "PV Einspeisung Aktuell 2.99.0: [%.2f KW]" { CHANNEL="http:url:loxberry:pveinspeisungaktuell" }

Sitemap:

				Text item=PV_Einspeisung_aktuell_KW
				Text item=NEW_Einspeisung_aktuell_KW

But, the new item shows no value. Also in the openhab WebGUI, the new channel does not show any value.

You’ll have to escape the colons in your regex expression (because colons are special in xx.things files)

Note that small Thing file edits may or may not not get taken into account until the binding is restarted.

Thank you @rossko57 .

When I can read “2021-06-30 14:59:14.037 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘cyberstoeckli.things’” then the changes are read and active? Anyway. I changed again and restartet the Raspi. Values are still not read.

This is my regex that I entered in the OH WebInterface and what works:

.*AH0648EY.Delivery_CalculatedPower_OBIS_2\.99\.0.(\d*.\d*).*

this is what I have in Things File:

Thing http:url:loxberry "MyLoxberry" [
	baseURL="http://192.168.1.102/plugins/smartmeter/index.php",
	refresh=15] {
		Channels:
			Type string : LoxberryResultPage "LoxberryResultPage" [ stateTransformation="REGEX:(.*)" ]
			Type string : pveinspeisungaktuell 
			"pveinspeisungaktuell" [ stateTransformation="REGEX:.*AH0648EY.Delivery_CalculatedPower_OBIS_2\\.99\\.0.(\\d*.\\d*).*" ]
			
}

items:

String NEW_Einspeisung_aktuell_KW "New Einspeisung Aktuell 2.99.0: [%s KW]" { CHANNEL="http:url:loxberry:pveinspeisungaktuell" }

Value is null. I avoided the colon with using . But its still not ok. I think I am too stupid, sorry to bother you.

No. That tells you framework has loaded your file. It does not tell you anything about bindings that may be connected to these Things, each binding must make it’s own arrangements some are better at in-flight changes than others.

I don’t know much about regex expressions, why not just escape colons in the expression that you know works as a UI entry?

this one also works as UI entry:

.*AH0648EY.Delivery_CalculatedPower_OBIS_2\.99\.0.(\d*.\d*).*

I tried to excap : like \: but this lead to errors in the log files. Thats why I replaced “:” through “.”. .=any char.

2021-06-30 15:24:54.989 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'cyberstoeckli.things' has errors, therefore ignoring it: [7,49]: mismatched character ':' expecting set null

[7,109]: no viable alternative at input '('

[7,112]: mismatched input 'd' expecting ']'

[7,117]: no viable alternative at input 'd'

[7,122]: mismatched character '<EOF>' expecting '"'

but what is wrong with this one:

Type string : pveinspeisungaktuell 
			"pveinspeisungaktuell" [ stateTransformation="REGEX:.*AH0648EY.Delivery_CalculatedPower_OBIS_2\\.99\\.0.(\\d*.\\d*).*" ]

Double backsplash for escape in things files
\\:

I think you’re getting into trouble because your expression also contains backslashes. If you want a double \\ to get passed to regex, you would need to escape each one.
\\\\

None of this applies when configuring via GUI, which takes care of it for you.

No, I do not want to pass

\\

to regex. As this following works via UI:

.*AH0648EY:Delivery_CalculatedPower_OBIS_2.99.0:(\d+.\d+).*

Only simple back slashes. Ok, tried to escap the colon like this:

			Type string : pveinspeisungaktuell 
			"pveinspeisungaktuell" [ stateTransformation="REGEX:.*AH0648EY\\:Delivery_CalculatedPower_OBIS_2.99.0\\:(\\d.\\d+).*" ]

that should pass the upper regular expression to Regex. Does not work either.

Yes, it’s all less forgiving when using xxx.things files.

Maybe I’m wrong about the double backslash for colon, but you would still need to escape the \d that you also want to pass, so
.*AH0648EY:Delivery_CalculatedPower_OBIS_2.99.0\:(\\d+.\\d+).*

after a interrupted sudo apt-get ugrade, my system is not booting anymore. So, it will take time till i came back to this point :frowning:

OH3 stable release, clean installation: It did not work.
Upgrade to latest snapshot: I worked.

Thing http:url:loxberry "MyLoxberry" [
	baseURL="http://192.168.1.102/plugins/smartmeter/index.php",
	refresh=15] {
		Channels:
			Type string : LoxberryResultPage "LoxberryResultPage" [ stateTransformation="REGEX:(.*)" ]
			Type string : pveinspeisungaktuell "PV_Einspeisung_aktuell" [stateTransformation="REGEX:.*AH0648EY:Delivery_CalculatedPower_OBIS_2.99.0:(\\d*.\\d*).*"]
}
String PV_Einspeisung_aktuell_KW "PV Einspeisung Aktuell 2.99.0: [%s KW]" { channel="http:url:loxberry:LoxberryResultPage" }
String NEW_Einspeisung_aktuell_KW "PV Einspeisung Aktuell 2.99.0: [%s KW]" { channel="http:url:loxberry:pveinspeisungaktuell" }

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.