Beginner - Exec Binding does not Save Output Value

Hi,

i am new to openHAB2 and have a little problem. I have a script running called temp.py which returns me the value of my room-temperature from an arduino.

It’s working fine, but the Output-Value does not get saved. After a refresh of the PaperUI my Output is back to NaN.

My Item:
Number Wohnzimmer_Temp1 "Raumtemperatur [%.1f °C]" <temperature> (RoomTemp) { channel="exec:command:temp1:output" }

My Sitemap:

Frame label=“Wohnzimmer” {
Text item=Wohnzimmer_Temp1
Text label=“HDMI-Switch” icon=“television” {
Switch item=HDMI1 label=“Switch to HDMI 1” icon=“television-off” mappings=[ON=“GO”]
Switch item=HDMI2 label=“Switch to HDMI 2” icon=“television-off” mappings=[ON=“GO”]
Switch item=HDMI3 label=“Switch to HDMI 3” icon=“television-off” mappings=[ON=“GO”]
Switch item=HDMI4 label=“Switch to HDMI 4” icon=“television-off” mappings=[ON=“GO”]
Switch item=HDMI5 label=“Switch to HDMI 5” icon=“television-off” mappings=[ON=“GO”]
}
}

My Thing
Thing exec:command:temp1 [command="python /home/osmc/script/temp.py", interval=60, timeout=5, autorun=true]

PS: If I look in the PaperUI, my last Execution gets saved, but not the output value. After refreshing the page it’s gone

According to the documentation, the output channel support the item type String, try to change from Number to String.

Thanks. Now it works.

Didn’t think of that, because i got a result, but it was just gone after a refresh.

Hmm,

I am having the same issue. Only thing is, if my execution code is invalid, I get some text back, but if my code is valid, it fails to post a value?

sample input code:

    wget -q "https://www.accuweather.com/en/gb/manchester/m15-6/minute-weather-forecast/329260" -O - |tr '\n\r' ' '| sed 's|.*<div class="mc-summary">[[:blank:]]\+<p>\(.*\)</p>[[:blank:]]\+</div>.*|\1|'

If I run this in a shell, I get:


[15:26:03] openhabian@openHABianPi:~$    wget -q "https://www.accuweather.com/en/gb/manchester/m15-6/minute-weather-forecast/329260" -O - |tr '\n\r' ' '| sed 's|.*<div class="mc-summary">[[:blank:]]\+<p>\(.*\)</p>[[:blank:]]\+</div>.*|\1|'
No precipitation for at least 120 min[15:26:08] openhabian@openHABianPi:~$

Any guesses?

My Command is set to the text above,
Transform is set to Regex.

I don;t quite understand how to use the transform, since I could simply in theiry have used the wget and a regex pattern to pull the same group text?

I have tried using

wget -q "https://www.accuweather.com/en/gb/london/sw20-9/minute-weather-forecast/52766_pc" -O -

as my command and

REGEX(<div class="mc-summary">\s*<p>(.*)<\/p>)

as my transform, but same problem.
Incidentally, yes regex transform is installed.

Output values

openhab> smarthome:items list | grep GetRain
GetRainUpdate_Output (Type=StringItem, State=null, Label=Output, Category=null)
GetRainUpdate_LastExecution (Type=DateTimeItem, State=2018-05-24T15:44:10.732+0100, Label=Last Execution, Category=null)
GetRainUpdate_ExitValue (Type=NumberItem, State=1, Label=Exit Value, Category=null)
openhab>

and yes - out value is a string.

Finally, code exe3cution at cmdline says:

[15:45:15] openhabian@openHABianPi:~$ wget -q "https://www.accuweather.com/en/gb/london/sw20-9/minute-weather-forecast/52766_pc" -O - |tr '\n\r' ' '| sed 's|.*<div class="mc-summary">[[:blank:]]\+<p>\(.*\)</p>[[:blank:]]\+</div>.*|\1|' -u
Rain starting in 21 min[15:45:22] openhabian@openHABianPi:~$

OK,

I am able to grab the full website using the exec binding now, but the regex does not work.
If I use the default REGEX((.*)) - my items updates with the full page content.

If I modify the regex to parse that info I get null.

I have tested my regex, here is what WORKs and has been tried:

https://regex101.com/r/wvwy7C/1
https://regex101.com/r/wvwy7C/2
https://regex101.com/r/wvwy7C/3

I am configuring Exec via PaperUI at the moment, but happy to change

Anyone?
Bueller?