Filtering message from Tesla Node

Hi, I'm new to Node Red, and have a question.

How do i filter the msg.payload output from a Tesla Node. So that I have only the output "battery_level" value that I can send with a Mqtt node to a Domoticz Device with IDX 1

msg.payload : Object
object
battery_heater_on: false
battery_level: 84
battery_range: 249.64
charge_current_request: 6
charge_current_request_max: 6
charge_enable_request: true
charge_energy_added: 10.29
charge_limit_soc: 80
charge_limit_soc_max: 100
charge_limit_soc_min: 50
charge_limit_soc_std: 90
charge_miles_added_ideal: 42

Regards Robin

Hi Robin and welcome to the forum.

On this particular question (getting values from a message) - there’s a great page in the docs that will explain how to use the debug panel to find the right path to any data item.

https://nodered.org/docs/user-guide/messages

To answer your immediate question, i would use a change node to set msg.payload to msg.payload.battery_level then connect the change node to an MQTT out node (with appropriate topic set).

As you are new to node-red - I highly recommend watching this playlist: Node-RED Essentials. It is by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in less than an hour. A small investment for a lot of gain.

Hi, thanks for info.

A node red flow example would be welcome

Thanks Robin

Hi again,

Its covered in that first link i posted under the heading changing-message-properties

And it really is as simple as I said: Attach a change node to your MQTT in, set msg.payload to msg.payload.battery_level link that to an MQTT out node

image

image

TBH, this is one of the most basic and fundamentals of node-red. You would do yourself a great favour watching that playlist (and perhaps work your way through the cookbook)

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