I hope you can help me. I am an absolut beginner with Raspberry PI, Linux and especially Node Red.
My situation:
I have an Raspberry PI 4 with Raspberry OS, running "Home Assistant" with mosquitto (MQTT), influxdb and Grafana.
What I want is to log my electricity usage from my whole house and get the data to Home Assistant / InfluxDB / MQTT.
So I bought an IR-Diode (Optokopf by weidmann) to read the SML-Data from my Smartmeter at the basement.
The last few days I tryed a lot and nothing works, so "finaly" discovered "node red".
I installed the "Optokopf" at my Raspberry and installed Node Red.
I tried now to get the data to MQTT or alternatively to influxdb.
At Node Red i installed the addon "node-red-contrib-smartmeter".
I managed to get the data from the smartmeter to Node Red.
As you can see, the data I need is shown at the right side (marked yellow).
My first question:
I get a lot of error messages between the data-logs from the smart meter.
What can I do, to solve this problem?
My second and more important question:
What have I to do, to get the data to my MQTT-Server?
I googled at lot and I think I have to put an "function" between the Smartmeter-Input- and MQTT-Output field, to get the yellow marked numbers.
As you can see, I already try it with an MQTT-Out and it says "connected". So this looks good in my opinion. But what I have to set as "message" (2. Screenshot).
Sorry for my bad english, I hope you get, what I want to do.
Thank you in advance.
To obtain that value, if you look to the right hand side of the debug panel, alongside value: which you have highlighted in yellow, click the 'Copy path' button
and then and paste it into a change node, so that you are changing the payload to the path of the value.
In my example, it would be msg.payload.volume
If you want to filter out the errors, you could use a function node, and insert something like the following;
Thank you very much for your reply!!!
The change node works very well. Now I get the values i wanted. Thank you!
Unfortunatelly the "function node" doesn't work to filter out the errors.
My first value "Counter_total" has the path: payload["1-0:1.8.0255"].values[0].value
The second value "Watts" has the path: payload["1-0:16.7.0255"].values[0].value
The error you have highlighted is coming from the smartmeter-obis package, which I assume is pulled in the smartmeter contrib node. See SML message parsing errors - githubmemory