[SOLVED] Mapping Transformations for Nest items

Hi,

Another day… another (probably silly) question.

I have some Nest devices pulling data in OH2.4 on my QNAP NAS. The Nest protect returns a value for the UI_Color channel in lower case e.g. “green” which I would like to transform into “Green” or “Blue” or whatever. I have followed the guides online but just cannot get it to work.

Items:

String   Upstairs_Smoke_UI_Colortr            "UI Color [MAP(windows.map):%s]"                                            { channel="nest:smoke_detector:demo_account:landing_smoke:ui_color_state" }
String   Upstairs_Smoke_UI_Colorno            "UI Color [%s]"                                            { channel="nest:smoke_detector:demo_account:landing_smoke:ui_color_state" }

Sitemap:

		Frame item=testframe label="Map test" {
				Text item=Upstairs_Smoke_UI_Colortr label="Transformed"
				Text item=Upstairs_Smoke_UI_Colorno label="Normal"
			}![map|690x81](upload://vEzCDXBIxMjvtHXhiQdkKgqy2I4.jpeg) 

Windows.map (in the conf\transform folder:

green=Blue
ok=OK

As you can see, it just doesn’t work. The value on the left has the mapping, the value on the right doesn’t.

Any ideas? I’m sure I am doing something obviously wrong but I can’t see it. As you can see, not only does it not transform the value, it doesn’t even display the original value.

I have the Map transformation installed as shown below

Many Thanks!

		Frame item=testframe label="Map test" {
				Text item=Upstairs_Smoke_UI_Colortr
				Text item=Upstairs_Smoke_UI_Colorno
                }

Sadly not helped

Frame item=testframe label="Map test" {
				Text item=Upstairs_Smoke_UI_Colortr
				Text item=Upstairs_Smoke_UI_Colorno
                }

or windows.map no capitals?

It’s all lowercase. Also lower case in the items file.

Any further thoughts? Maybe this one wasn’t as silly as I thought.

My only thought was that the UI_Color value isn’t actually “green” and that it’s slightly different. When I get home i’ll try applying some dynamic icons to it to see if that works. I will also try mapping on a completely different item to rule out the Nest binding.

Thanks for your help so far

Maybe add a rule and check the value of the item:

rule "test string"
when
    Item String   Upstairs_Smoke_UI_Colortr changed
then
    // Add strings before and after to expose any hidden characters
    logInfo("TEST", "TEST" + Upstairs_Smoke_UI_Colortr.state.toString + "TEST")
end

Then change the colour and check the log

Solved it!!!

I added the rule and went to look in the logfile only to find:

2019-01-16 19:41:00.397 [WARN ] [rm.AbstractFileTransformationService] - Could not transform 'GREEN' with the file 'windows.map' : Target value not found in map for 'GREEN'

Strange that OH was displaying “green” but it was recieving “GREEN” from the item

Thank you for your help. The loginfo command is going to be very useful I suspect.

I have just tested on another value from Nest. Showing “ok” in basic UI but it’s actually sending “OK” so I have setup the map as:

OK=OK

Now it displays as “OK”.

Very weird!!

What did @vzorglub test show for actual Item.state?
Strikes me there are still vagaries about UI or MAP involvement. Might be useful to see what Classic UI shows.

It think these are binding level mapping. There was some confusion about the strings returned by the nest api being in lowercase and the oh states being in upper case. This was resolved by adding binding level mappings in the v2 version of the binding