How to add a CA cert to access a powerwall?

I’m trying to pull data from a powerwall 2 in NodeRed, but get an UNABLE_TO_VERIFY_LEAF_SIGNATURE error.

  1. Do I need to add a CA cert to my emonpi to do this?
  2. If so, how can I add a CA cert to an emonpi (file system is read-only)
  3. If not, how can I pull data from my powerwall?

Many thanks!

To answer my own question - read the text when I ssh into the pi!

Data directory is rw.

Hi @miker - I am in just the same position as you (new Powerwall2 & Gateway), but also new to NodeRed; I was starting to get my head around the latter yesterday but kept coming up against the same certificate issue - maybe because the Tesla API is https and not just http?

I get an “unable to verify leaf signature” error in the main Flow desktop, and the following errors in the Debug frame.

I am running RodeRed on a dedicated RaspberryPi at the moment whilst I experiment & learn; could you elaborate on how you solved the problem? Preferably in simple terms? :grinning:

Many thanks, Julian

While I have the cert on my pi, I’ve unchecked the box to verify it (as the cert is self signed it’s not secure, just a hurdle). I’ve only got charge working so far as there’s a problem with the aggregates json (let me know if you figure that out). Settings below for charge:

Screenshot from 2020-03-10 09-20-01 Screenshot from 2020-03-10 09-20-15 Screenshot from 2020-03-10 09-20-33 Screenshot from 2020-03-10 09-20-52 Screenshot from 2020-03-10 09-21-01

And perhaps most excitingly, data appearing in emoncms!

What does the JSON output look like?

I added the JSON bit to the emoncms NR Node. The examples / info do help :grin:.

[edit]
Worth looking at the data output from the GET as well.

Thanks for your time in doing that @miker - very helpful. I have managed to get both a graph and a “battery” to work on a tempo dashboard - woo hoo, it is so exciting when it works!

Not quite sure how or where I got around the certificate error issue, but happy that it works.

One quick question … does anyone know how I can get the green shaded area to show proportionately - on my dashboard the battery “looks” full, but I’d like it to depict (at this time) 82% rather than 100%.

TIA, Julian

Not quite sure if I understand the question, but my Node-RED debug tool shows this …

Again, not quite sure why, but the battery infill is now working as I wanted. Good news.

I think you should remove the ‘JSON’ node in your flow as you are converting a JSON object to a string.

Without an extra JSON node
image

With extra JSON node
image

Note the first is an object and the second a string.

Thanks @borpin. I’ll try that. The battery one works, but I haven’t managed to get the ‘aggregates’ (solar, demand, battery flow) to work. output looks like this: https://raw.githubusercontent.com/vloschiavo/powerwall2/master/samples/api_meters_aggregates.json

You have not been able to get that data or not been able to split out what you want?

In Node-Red, you can select the nodes then on the Hamburger menu, click export and copy to clipboard. If you post the result here (bounded by 3 backticks) I can import it and possibly have a look.

I can read the aggregate data from the powerwall, but when I try and send it to emoncms I get an error than the json has non-numeric values.

Should the export be the node red settings?

This is what the error looks like:

{ “_msgid”: “c7aac7e3.385538”, “topic”: “http response”, “payload”: { “success”: false, “message”: “Format error, json value is not numeric” }, “statusCode”: 200, “headers”: { “cache-control”: “no-store”, “content-type”: “application/json”, “date”: “Mon, 16 Mar 2020 15:06:02 GMT”, “content-length”: “1481” }, “urlsent”: "http://192.168.1.161/emoncms/input/post?json={{“site”:{“last_communication_time”:“2020-03-16T15:06:02.290497721Z”,“instant_power”:-416,“instant_reactive_power”:-351,“instant_apparent_power”:544.2949568019163,“frequency”:0,“energy_exported”:61,“energy_imported”:12,“instant_average_voltage”:71.19306169377275,“instant_total_current”:0,“i_a_current”:0,“i_b_current”:0,“i_c_current”:0,“timeout”:1500000000},“battery”:{“last_communication_time”:“2020-03-16T15:06:02.290383977Z”,“instant_power”:-3960,“instant_reactive_power”:60,“instant_apparent_power”:3960.45451937022,“frequency”:50.162,“energy_exported”:65340,"e

The problem is that the ‘time’ element needs to be a specific name for the ‘key’ (it says in the help what it needs to be) so it is not liking that.

On the node that is providing the output that goes to the emoncms node input, attach a debug node. The data being passed will then come up in the debug sidebar. there is a little icon that appear when you mouse over
image

that allows you to copy the data and then paste it here.

this guide is pretty good start Understanding and Using The Node-Red Message Object

Did you ever get this to work @miker ?

Been swamped this week juggling home schooling and work! I’ll have a quick shot this evening. I’ll reply in the other thread - I think it makes more sense there.

1 Like