Hallo zusammen
Ich habe das Problem, das ich im Debug nur Fehlermeldungen bekomme,
jedoch im Dashboard werden die Werte angezeigt...
function : (error)
"TypeError: Cannot read property 'temp' of undefined"
hier der Flow:
var msg1 = { payload: msg.payload.current.temp };
var msg2 = { payload: msg.payload.current.feels_like };
var msg3 = { payload: msg.payload.current.dew_point };
var msg4 = { payload: msg.payload.daily[0].temp.min };
var msg5 = { payload: msg.payload.daily[0].temp.max };
var msg6 = { payload: msg.payload.current.humidity };
var msg7 = { payload: msg.payload.current.pressure };
var msg8 = { payload: msg.payload.current.clouds };
var msg9 = { payload: msg.payload.current.visibility };
var msg10 = { payload: msg.payload.current.uvi };
var msg11 = { payload: msg.payload.current.weather[0].description };
return [msg1, msg2, msg3, msg4, msg5, msg6, msg7, msg8, msg9, msg10, msg11 ];
Colin
2
That means that msg.payload.current does not exist. Feed what you are sending to the function node into a debug node and see what is there.
Hello @ArnoNhym, welcome to the forum
If you can speak English, please do, unfortunately, it is the main spoken language.
Clearly, payload: msg.payload.current
must be undefined
meaning when you try to access msg.payload.current.temp
you get this error.
Put a debug
node BEFORE this function node & look at what is inside msg.payload
This may be of help to you - how to use the debug panel to find the right path to any data item.
https://nodered.org/docs/user-guide/messages
Im Dashboard werden die Werte ja korrekt angezeigt!!
Nur die Debugmeldungen verursachen einen BufferĂĽberlauf und mein Raspi wird immer langsamer
Hi again, it is almost impossible for me to assist with so little information.
I have no idea where them messages came from.
Perhaps if you share your flow or a screenshot with English comments I might be able to spot your issue.
E1cid
7
What about the output from a debug node before the function, so we know whats in the payload.
1 Like
A screenshot of your function and the error message is not enough for us to help you
We already know this function throws an error "TypeError: Cannot read property 'temp' of undefined"
And as i already said...
Es sind empfangene Werte von OpenweatherMap
Wie gesagt, ans Dashboard werden die Werte ja ĂĽbergeben und auch angezeigt
Das ganze läuft auf einem Raspi Zero W
und durch die vielen Debug-Meldungen wird das Ding immer langsamer
oder kann man debug fĂĽr dieses eine Element ausschalten??
try using var msg1 = { payload: msg.payload.current.tempc };
in your function.
And if you had read the link i posted earlier, it would have helped you. Here it is again...
Working with messages : Node-RED
E1cid
11
Does not look like there is a current object either.
Es sind alle Werte vorhanden, die ich anzeigen möchte ...
wenn ich das "current" weglasse, kommt die Fehlermeldung bei der mintemp
E1cid
13
msg.payload.daily[1].temp.min
"TypeError: Cannot read property '1' of undefined"
E1cid
15
Show us the expanded debug before the error.
Is openweather map sending two different weather json's
yes
current weather and forecast
E1cid
17
then the json's will be different, You will need to have a conditional check as to which json you are working with at the time.
E1cid
19
try somthing like.
var msg1 = { payload: (msg.payload.current.temp || msg.to.other.json)};
system
Closed
20
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.