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
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.
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
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
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