Change of variable name

I got stucked!

I use a TopicJson payload:
{"220":"0","XXX":"255","SOC":"98.8","SOH":"82","B-T":"18.14","M-T":"23","Tun":"","kWh":"4.9","Amp":"-0","RPM":"470","Nm ":"-1","FW ":"","C01":"4.11","C02":"4.11","C03":"4.11","C04":"4.11","C05":"4.11","C06":"4.11","C07":"4.12","C08":"4.11","C09":"4.11","C10":"4.11","C11":"4.11","C12":"4.11","C13":"4.11","C14":"4.11","Pac":"57.6","T01":"19","T02":"18","T03":"18","T04":"18","T05":"18","T06":"18","T07":"18","Reg":"","ECO":"","Nor":"","CSt":"0","tAY":"0.00","B12":"13.88","PN1":"1","PN2":"0","KmT":"410666","KmR":"57","KmH":"5.1","SeT":"14","tKT":"282","tKR":"51","tTM":"3298","tKW":"2.7","t10":"9.5","t01":"0.09","tMN":"0.05","tKH":"30.7","kW ":"-0.02","CEt":"","CdK":"","C-T":"40","CKw":"","Min":" 30","T-T":"19.86","Acc":"0.63","AnX":"-2.53","AnY":"-3.78","AnZ":"-36.44"}
where I easily can extract values, like: T07
Node 'Function':
var Inhalt = msg.payload
node.log(typeof Inhalt)
msg.payload = Inhalt.T07
msg.payload = Number(msg.payload)
msg.topic = "BattT07"
return msg;
Result = 18

but if the varialbe name is: C-T , I'm in trouble:
grafik

In line 3 a red tile is below T, thus the functions "thinks" T must be deducted from "Inhalt.C" <- which is wrong !

The varaible name is "T-C".

Does someone has an "easy" solution / fix ?

Thanks in advance

Try Inhalt["T-C"]

An easy way to find this is send the msg.payload to a debug node. Then you can look at the data and see to the side how you can copy the path to it. In this case it would show payload["C-T"] so you would want to call it Inhalt["C-T"]

There’s a great page in the docs (Working with messages : Node-RED) that will explain how to use the debug panel to find the right path to any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

BX00Cy7yHi

In addition it is nice to provide the actual code instead of an image of it.

Thanks and thanks to jbudd, too.

Change done, w/o red triangle :ok_hand:

I'll check out for functioning next time Twizy is connected for charging. :+1:

@zenofmud: I pasted the picture to see easily the "red tile".

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