thanks, it worked … kind of
…
I guess issue with OH in this case is the fact that in MQTT there is a information as “Data”:“44C20A” and then OH tries to find this string in ALL files defined by the thing
Type contact : door_main "Main Door" [ stateTopic="home/rfbridge/tele/RESULT", transformationPattern="JSONPATH:$.RfReceived.Data∩MAP:contact_door_main.map" ]
Type contact : door_side "Back Door" [ stateTopic="home/rfbridge/tele/RESULT", transformationPattern="JSONPATH:$.RfReceived.Data∩MAP:contact_door_side.map" ]
Type contact : door_terrace "Terrace Door" [ stateTopic="home/rfbridge/tele/RESULT", transformationPattern="JSONPATH:$.RfReceived.Data∩MAP:contact_door_terrace.map" ]
Type contact : window_kitchen "Kitchen Window" [ stateTopic="home/rfbridge/tele/RESULT", transformationPattern="jSONPATH:$.RfReceived.Data∩MAP:contact_window_kitchen.map" ]
Type contact : window_guestroom "Guestroom Window" [ stateTopic="home/rfbridge/tele/RESULT", transformationPattern="jSONPATH:$.RfReceived.Data∩MAP:contact_window_guest.map" ]
at first it might look like valid approach, as indeed OH can’t know if there isn’t defined same string somewhere else.
As per logs
2020-02-12 00:09:32.833 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '44C20E' with the file 'contact_door_side.map' : Target value not found in map for '44C20E'
2020-02-12 00:09:32.834 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '' not supported by type 'OpenCloseValue': No enum constant org.eclipse.smarthome.core.library.types.OpenClosedType.
2020-02-12 00:09:32.838 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '44C20E' with the file 'contact_window_kitchen.map' : Target value not found in map for '44C20E'
2020-02-12 00:09:32.839 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '' not supported by type 'OpenCloseValue': No enum constant org.eclipse.smarthome.core.library.types.OpenClosedType.
2020-02-12 00:09:32.840 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '44C20E' with the file 'contact_door_terrace.map' : Target value not found in map for '44C20E'
2020-02-12 00:09:32.840 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '' not supported by type 'OpenCloseValue': No enum constant org.eclipse.smarthome.core.library.types.OpenClosedType.
2020-02-12 00:09:32.841 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '44C20E' with the file 'contact_window_guests.map' : Target value not found in map for '44C20E'
2020-02-12 00:09:32.852 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '' not supported by type 'OpenCloseValue': No enum constant org.eclipse.smarthome.core.library.types.OpenClosedType.
you can see I do have 5 contacts defined, but only 4 errors. That’s because in one of the files there is 44C20E defined.
Thing is, I need to have it defined like that as then I wouldn’t know which contact gets opened or closed if they will be defined in one file, eg. one thing eg. all states defined in all files.
Any idea how to solve this?
I mean … I can write a rule which will take the Data string and then trigger DummyItem accordingly, but it seems bit overengeneered as I should be able to map string into Thing directly, or is that the only way?
another approach (working one) is to define this directly as here:
Type contact : door_main "Main Door" [ stateTopic="home/rfbridge/tele/RESULT", transformationPattern="JSONPATH:$.RfReceived.Data", on="44C20A", off="44C20E" ]
Type contact : door_side "Back Door" [ stateTopic="home/rfbridge/tele/RESULT", transformationPattern="JSONPATH:$.RfReceived.Data", on="D9AA0A", off="D9AA0E" ]
Type contact : door_terrace "Terrace Door" [ stateTopic="home/rfbridge/tele/RESULT", transformationPattern="JSONPATH:$.RfReceived.Data", on="45550A", off="45550E" ]
Type contact : window_kitchen "Kitchen Window" [ stateTopic="home/rfbridge/tele/RESULT", transformationPattern="jSONPATH:$.RfReceived.Data", on="41E00A", off="41E00E" ]
Type contact : window_guestroom "Guestroom Window" [ stateTopic="home/rfbridge/tele/RESULT", transformationPattern="jSONPATH:$.RfReceived.Data", on="4EA80A", off="4EA80E" ]
Only downside is log warn complans about
Command '44C20E' not supported by type 'OpenCloseValue': No enum constant org.eclipse.smarthome.core.library.types.OpenClosedType.44C20E
On the other hand, that’s quite acceptable as I mentioned in my first post.