I hope I’m explaining this right:
I’ve got an Item which when updated, sends the new value over MQTT to a remote unit.
If another Item changes to a a particular value over incoming MQTT (from the remote unit), I want the first Item to include a mapping file in subsequent updates over MQTT.
I was thinking of having three items (four if you include the one dealing with incoming MQTT) - one including the mapping file in the item definition and the other not and the last being the one that sends out MQTT commmands
When a rule is triggered (via the incoming MQTT), it would update the outgoing MQTT item to accept either the Item value of the item with the mapping or the one without, depending on the state of the incoming item value.
To explain what this is - it’s an LCD panel that gives information pertinent to that day and when a switch is pressed, it changes the language from English to German (hence the mapping file).
It all works apart from the mapping transformation.
What I basically need to know is how to change the value of a string item to that of another string item with mapping so the mapping is included in the first string file.
This is a rough idea of my files
String ItemWithoutMapping
String ItemWithMapping "[MAP(de.map):%s]"
String OutgoingItem {mqtt=">[broker:house/LCD1:command:*:default]" }
rule "Mapping test"
when
Item TestSwitch2 changed
then
if(TestSwitch2.state == ON) {
OutgoingItem.sendCommand(ItemWithMapping.state.toString)
}
else {
OutgoingItem.sendCommand(ItemWithoutMapping.state.toString)
}
end
I’ve tried with variables in the rules instead and I think this is the way to do it but I couldn’t get it to work.
Any ideas?
Thanks!