on opening PaperUI or HABPanel I get These WARNINGs in my openhab.log:
i combed through my items-config and opened every page in my BasicUI - I can’t get to the items to which These WARNings refer to… Some idea how to approach these?
2018-01-14 15:10:08.362 [WARN ] [.core.transform.TransformationHelper] - Cannot format state '1' to format '%d': d != java.lang.String
2018-01-14 15:10:08.385 [WARN ] [.core.transform.TransformationHelper] - Cannot format state '2' to format '%d': d != java.lang.String
2018-01-14 15:10:08.396 [WARN ] [.core.transform.TransformationHelper] - Cannot format state '2' to format '%d': d != java.lang.String
2018-01-14 15:10:08.408 [WARN ] [.core.transform.TransformationHelper] - Cannot format state '1' to format '%d': d != java.lang.String
2018-01-14 15:10:08.419 [WARN ] [.core.transform.TransformationHelper] - Cannot format state '1' to format '%d': d != java.lang.String
2018-01-14 15:10:08.945 [WARN ] [.core.transform.TransformationHelper] - Cannot format state '1' to format '%d': d != java.lang.String
2018-01-14 15:10:08.958 [WARN ] [.core.transform.TransformationHelper] - Cannot format state '2' to format '%d': d != java.lang.String
2018-01-14 15:10:08.971 [WARN ] [.core.transform.TransformationHelper] - Cannot format state '2' to format '%d': d != java.lang.String
2018-01-14 15:10:08.981 [WARN ] [.core.transform.TransformationHelper] - Cannot format state '1' to format '%d': d != java.lang.String
2018-01-14 15:10:08.991 [WARN ] [.core.transform.TransformationHelper] - Cannot format state '1' to format '%d': d != java.lang.String
at present, these are the only items, which states are 2 (or better ‘2’):
2018-02-01 08:04:58.505 [WARN ] [.core.transform.TransformationHelper] - Cannot format state '2' to format '%d': d != java.lang.String
2018-02-01 08:04:58.525 [WARN ] [.core.transform.TransformationHelper] - Cannot format state '2' to format '%d': d != java.lang.String
2018-02-01 08:04:58.539 [WARN ] [.core.transform.TransformationHelper] - Cannot format state '2' to format '%d': d != java.lang.String
2018-02-01 08:04:58.553 [WARN ] [.core.transform.TransformationHelper] - Cannot format state '2' to format '%d': d != java.lang.String
2018-02-01 08:04:58.568 [WARN ] [.core.transform.TransformationHelper] - Cannot format state '2' to format '%d': d != java.lang.String
2018-02-01 08:04:58.581 [WARN ] [.core.transform.TransformationHelper] - Cannot format state '2' to format '%d': d != java.lang.String
Is there a way to see the items’ values including their type? I assume, since they’re “Number”, it shouldn’t be String…?
This part of the error message indicates you are trying to format a String as a decimal number, so it looks like your understanding of the problem is correct - the item state is actually a String with a character representing a number, not an actual Number variable.
What happens if you use this instead for your label:
I’d rather have my KNX values put in openHAB correctly. In this case, it’s just a key value for heating status in my rooms, which I don’t need for some kind of calculation (as of yet)…
But yes, of course this one works; before this log excerpt I changed 'RTR_EG_WoZi_HVAC_mode' for %s and left 'RTR_OG_Schlafen_HVAC_mode' with %d:
2018-02-02 08:05:24.710 [ome.event.ItemCommandEvent] - Item 'RTR_EG_WoZi_HVAC_mode' received command 1
2018-02-02 08:05:25.038 [vent.ItemStateChangedEvent] - RTR_EG_WoZi_HVAC_mode changed from 2 to 1
2018-02-02 08:05:25.049 [vent.ItemStateChangedEvent] - RTR_EG_WoZi_setTemp changed from 19.0 to 21.1
2018-02-02 08:05:32.037 [ome.event.ItemCommandEvent] - Item 'RTR_OG_Schlafen_HVAC_mode' received command 1
2018-02-02 08:05:32.409 [vent.ItemStateChangedEvent] - RTR_OG_Schlafen_setTemp changed from 19.29 to 20.29
==> /var/log/openhab2/openhab.log <==
2018-02-02 08:05:32.435 [WARN ] [.core.transform.TransformationHelper] - Cannot format state '1' to format '%d': d != java.lang.String
==> /var/log/openhab2/events.log <==
2018-02-02 08:05:32.442 [vent.ItemStateChangedEvent] - RTR_OG_Schlafen_HVAC_mode changed from 2 to 1
2018-02-02 08:05:37.994 [ome.event.ItemCommandEvent] - Item 'RTR_EG_WoZi_HVAC_mode' received command 2
2018-02-02 08:05:38.541 [vent.ItemStateChangedEvent] - RTR_EG_WoZi_HVAC_mode changed from 1 to 2
2018-02-02 08:05:38.725 [vent.ItemStateChangedEvent] - RTR_EG_WoZi_setTemp changed from 21.1 to 19.0
2018-02-02 08:05:38.733 [ome.event.ItemCommandEvent] - Item 'RTR_OG_Schlafen_HVAC_mode' received command 2
2018-02-02 08:05:39.208 [vent.ItemStateChangedEvent] - RTR_OG_Schlafen_setTemp changed from 20.29 to 19.29
==> /var/log/openhab2/openhab.log <==
2018-02-02 08:05:39.235 [WARN ] [.core.transform.TransformationHelper] - Cannot format state '2' to format '%d': d != java.lang.String
==> /var/log/openhab2/events.log <==
2018-02-02 08:05:39.246 [vent.ItemStateChangedEvent] - RTR_OG_Schlafen_HVAC_mode changed from 1 to 2
But that’s not exactly what I am hoping for. This one is just a quick&dirty Workaround, I’d like to understand:
@Udo_Hartmann, if the map transformation only takes String as an input, but many bindings may return Number (such as this one), perhaps it would be interesting to create a feature request so the transform starts support at least numeric input?
Why to do that? There is no reason to send a number to the transform service. You could use another service (Scale) which makes use of number input (e.g. 0 to 25 -> low 26 to 50 -> medium 50 to 100 -> high) but for map transformation there is no reason to use numbers as input.
The Scale transformation is better suited for converting continuous input (e.g. temperature) into discreet values (cold, warm, hot).
In this case, it looks like the input is already a discreet mode value (Betriebsart), so the purpose is just to convert from a numerical/fixed code into a String representation. This probably can be done with Scale too, but it looks clumsier than the Map transform in this case.
at least I don’t!
as i could use the Number-items’ states for calculation and use MAP with %s - everything’s fine for me!
and i also can’t think of a scenario, where a MAP-Transformation via numbers will be better suited as string?