Closed jova1971 closed 7 months ago
Thanks for asking about that. That information is hidden away in the app so I should have been clearer where to find it. My instructions here are based on the VictronConnect app running on an Apple iOS device.
To get the device's encryption key, you'll need to pair/configure your SmartSolar controller so it's fully visible in the VictronConnect app. Once you've done that, connect to the controller, touch the gear icon at the upper right to get to a Settings page. Touch the three-vertical-dot icon to get a popup menu, and then "Product info". Scroll to the bottom of the Product info page and you'll see "Encryption data". While you're here, btw, make sure "Instant readout via Bluetooth" is enabled.
Touch the Encryption data's "SHOW" button. That'll give an "Instant readout encryption data" popup with the encryption key you need.
You can transfer it by hand into your source code, but on the iOS app (maybe others?) you can touch the Encryption Key field to copy the (long) hex string into your paste buffer. You can then put it into an email/text/note to help you get it to where you can paste it into your ESP32 source code.
The example code here requires that you manually convert the hex string into an ESP32/C byte array by splitting it into two-character pairs, adding in commas and '0x' as appropriate, etc. That's not too hard to do if you only have one SmartSolar device to deal with and you never change the Bluetooth PIN (which changes the encryption key).
My own next-generation code - which I might post on here as a more comprehensive example - lets me paste that in directly as a quoted character string that gets split into a byte array during setup(). For now, I suggest you do this by hand while you're trying to get the minimal example working and worry about coding a conversion routine later. One complication at a time!
you mention : "Here's a key for a SmartSolar as obtained from the Victron app:" Where abouts in the app do you get the key?
Thanks