openHAB 1.x: items file: http, XSLT and MAP chained: GUI vs. REST

Tags: #<Tag:0x00007f6182de2700> #<Tag:0x00007f6182de25e8> #<Tag:0x00007f6182de2430>

I am using this items snippet that retrieves a weather code for now and the next 3 days and maps it to German, and directly retrieves the weather text:

		String Weather_Day0_Text_DE		"Wetterbedingung Tag 0 DE @Yahoo [MAP(yahoo_weather_code_de.map):%s]" { http="<[http://www.smartgart.com/rss/weather-73037-goeppingen-germany.rss:300000:XSLT(yahoo_weather_day0_code.xsl)]" }
		String Weather_Day0_Text_EN		"Wetterbedingung Tag 0 EN @Yahoo [%s]" { http="<[http://www.smartgart.com/rss/weather-73037-goeppingen-germany.rss:300000:XSLT(yahoo_weather_day0_text.xsl)]" }
		String Weather_Day1_Text_DE		"Wetterbedingung Tag 1 DE @Yahoo [MAP(yahoo_weather_code_de.map):%s]" { http="<[http://www.smartgart.com/rss/weather-73037-goeppingen-germany.rss:300000:XSLT(yahoo_weather_day1_code.xsl)]" }
		String Weather_Day1_Text_EN		"Wetterbedingung Tag 1 EN @Yahoo [%s]" { http="<[http://www.smartgart.com/rss/weather-73037-goeppingen-germany.rss:300000:XSLT(yahoo_weather_day1_text.xsl)]" }
		...

The sitemap shows me the correct values; sitemap snippet:

		Text item=Weather_Day0_Text_DE
		Text item=Weather_Day0_Text_EN
		Text item=Weather_Day1_Text_DE
		Text item=Weather_Day1_Text_EN
		...

Output is like (there might be a glitch but for now I do not care):

		Wetterbedingung Tag 0 EN: Mostly Cloudy
		Wetterbedingung Tag 0 DE: stellenweise stürmisch
		Wetterbedingung Tag 1 DE: Scattered Showers
		Wetterbedingung Tag 1 EN: meist bewölkt (Tag)
		...

Now, if I request these data values via REST, …

		http://192.168.1.27/rest/items/Weather_Day0_Text_DE/state
		http://192.168.1.27/rest/items/Weather_Day0_Text_EN/state
		...

… then the English version retrieves me the text, whilst the German version retrieves me the number codes. Obviously, the MAP transformation is only for the GUI view, not for REST. Same applies e. g. for formatted DateTime objects.

Is there a way to move the MAP function from the left side (affecting the view only) to the right (piping it in deeper), as in:

		String Weather_Day0_Text_DE		"Wetterbedingung Tag 0 DE @Yahoo [%s]" { http="<[http://www.smartgart.com/rss/weather-73037-goeppingen-germany.rss:300000:XSLT(yahoo_weather_day0_code.xsl):MAP(yahoo_weather_code_de.map):]" }

The latter does not work but returns me the whole XML.

This seems related

Thanks - time to upgrade to openHAB 2.

Also found that poor workaround of applying the transformation again on a copy of the items:

rule "transformed"
when
	Item Weather_Day0_Text_DE changed or
	Item Weather_Day1_Text_DE changed or
...
then
	Weather_Day0_Trans_DE.postUpdate(transform("MAP", "yahoo_weather_code_de.map", Weather_Day0_Text_DE.state.toString))
	Weather_Day1_Trans_DE.postUpdate(transform("MAP", "yahoo_weather_code_de.map", Weather_Day1_Text_DE.state.toString))
...