I have a problem with mapping a string from an enigma2 receiver.
2017-02-28 15:02:22.451 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '
true ' with the file 'tv.map' : Target value not found in map for '
true '
My tv.map file looks like this:
false=Aus
true=An
How can I get this to work ? I think the problem is the spaces before and behing the string
Any Idea ?
Regards
Kobelka
I did not use this before, but maybe a REGEXP transformation would work? Something like: transform(“REGEX”, “.true.”, “Ok”) ? Or you could use a Javascript transformation which returns “An” or “Aus” depending on if the input string contains “true”.
rule "wozitv"
when
Item wozitv_power_orig changed
then
if (wozitv_power_orig.state.toString.deleteWhitespace == "true"){
sendCommand(wozitv_power, "OFF")
}
if (wozitv_power_orig.state.toString.deleteWhitespace == "false"){
sendCommand(wozitv_power, "ON")
}
end
Your .map file can have keys with spaces, if they are escaped. See this description. Or, in the alternative, the enigma2 binding author might consider stripping whitespace as a convenience to the binding user.