How to handle payload names with blank space

Hi,
I´m using a module (node-red-contrib-luxtronik2-ws) to read data from my heat pump controller.
Target is to share the info on the dashboard.

Related to that there are a few questions:

  1. Some of the output payload contains blanks, like "STB E-Stab" with it´s values.

I guess that payload have to be without any blank. Anyway, the text-node is not shown in the dashboard

  1. Some of the payload contain german Umlauts, how to handle them?
    Example: "Außentemperatur"
    I´ve already tried several methods, like copying the original one (from debug) or translating via unicode-esacpe, but no success so far

  2. Some of the values return "" if there is no action ongoing. If already tried to handle it with the change node as well as the function node - see example:

if (msg.payload.Informationen.Anlagenstatus.Betriebszustand === "")
    msg.payload.Informationen.Anlagenstatus.Betriebszustand = "Keine Anforderung"
if (msg.payload.Informationen.Anlagenstatus.Betriebszustand === "WW")
    msg.payload.Informationen.Anlagenstatus.Betriebszustand = "Warmwasser"
if (msg.payload.Informationen.Anlagenstatus.Betriebszustand === "ww")
    msg.payload.Informationen.Anlagenstatus.Betriebszustand = "Warmwasser"
else msg.payload.Informationen.Anlagenstatus.Betriebszustand = "Nicht erfasst"

In this case the condition is not working, even I copied the value directly from the debug message. Even the condition with "WW" does not work.

Here some impression how it looks:

Thanks in advance - and let me know if there is something missing

Although I am not entirely sure what you are trying to accomplish, assuming you want to "translate" the "Betriebzustand" to something else, you could use a lookup object, which should work with German characters too, something like:

const input = msg.payload.Informationen.Anlagenstatus?.Betriebszustand
const convert = { 'Außentemperatur': 'temperature', 'WW': 'Warmwasser', 'ww':"Warmwasser" }
const payload = (convert[input] == undefined) ? 'Keine Anforderung' : convert[input] 

msg.payload.Informationen.Anlagenstatus.Betriebszustand = payload


return msg;
1 Like

Thank you for the support.

As mentioned, in general my idea is to provide the values in the dashboard.

Regarding the "Anlagenstatus": The output contains not human readable information, such as "WW" for warm water heating or even worse the "" for no action.

Not sure if your solution respects that "Außentemperatur" is a variable/payload name, not a value

for the value conversion, you should use a switch/case statement.
For ther Umlaut: payload["Außentemperatur"] could be working.

Not sure if your solution respects that "Außentemperatur" is a variable/payload name, not a value

I am not sure what you mean, your function+example does not reflect a realworld object, so it is a bit hard to reverse engineer.

If i input this:

image
this will be the result:

image

Of course you´re right, its not shown. Thats why I did a separate point and didn´t mention that its about a value. As I´m quite new please let me know how to be more precise in the naming, also what you mean with "realworld object".

Nevertheless, here is what I mentioned:
grafik

Ok could you explain the question ?

keys with spaces and/or other characters can be read like:

msg.payload.Informationen.Anlagenstatus["Außentemperatur"]

1 Like

This is really strange, I thought I already tested this spelling - but obviously I did not. It works, thank you for your support!

Also the lookup object solved the issue

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.