hn / ginlong-solis

Solis inverter ESP8266 data logger, S3 WiFi stick reverse engineering and ESPhome firmware
86 stars 14 forks source link

Beginner's guide - Appreciate some help #48

Open geedsen opened 6 days ago

geedsen commented 6 days ago

I have 2 x Solis 10.0 kW Dual MPPT (3F) . Their dataloggers (LAN) dont work. Now I am planning to buy two S3-WIFI-ST dataloggers. And hopefully they will let me integrate the inverters into HA. So I am going through the installations of the ESPHome and Solis Add-ons. Probably for lots of HA people easy to do, but I got lost in the amount of documentation in specially for ESPHome. So I hope someone is willing to help me out here. I installed ESPHome and started it. I added the two yaml files to the ESPHome directory (1 in subdir 'common') Then I need to modify the configuration:

image

The api encryption key, I can just paste any Encryption key there? The wifi ssid and pwd, I assume is off the wifi near the inverters. and the ap wifi ssid and pwd, where to they come from, do they come with the wifi dataloggers? And is it straight in like 'key': 'value' ?

and I see this: image

Do I need to add these to the secrets.yaml as well? any ota_password will do?

And in the ESPHome documentation, I see this: image

but it does not mention what configuration file, is that the secrets.yaml?

Probably more questions later. Any help appreciated.

geedsen commented 6 days ago

Found some information now how !secret refers a variable to the secrets file. That helps.

geedsen commented 6 days ago

I added the api encryption key to the secrets, restarted ESPHome, but when I ask for the key I get this: image Is it because it is 'a secret'?

geedsen commented 3 days ago

Sorry for posting my comment under "Set the MCU to UART boot mode (pull TX pin low during boot)", I thought it would make sense to keep my expererience with the same issues at the same topic.

So I am in the next phase of flashing the datalogger. Now I need to buy a usb to serial adapter. 1) Will any one do, there are so many on amazon.nl? 2) Is this one probably a good (fast) one? DSD TECH SH-U09C5 USB naar TTL UART-converterkabel met FTDI-chipondersteuning 5V 3.3V 2.5V 1.8V TTL 3) Can I do this from Windows? 4) In the installation documentation it says this: Click the three-dots button, then "Install" and "Manual Download". Wait for the compilation process to finish and download the "UF2 package"., does that mean the UF2 package is different for every installation and is generated specially for my configuration?

Thanks.

hn commented 3 days ago

1./2. The serial adapter you pasted looks good. One never can say for sure if it will work. Some serial adapters do not supply enough power for the MCU -- but you can not "see" that in advance. Also put some male-female Dupont wires in your shopping cart.

  1. I never did this but it should work.
  2. Use two config/uf2 files with different name and friendly_name, otherwise ESPHome/HomeAssistant gets confused with two adapters.

If you document everything you do here with pictures, links, screenshots so others can learn from it, I'll help you if there are problems.

geedsen commented 1 day ago

So I connected the adapter to the stick and started the ltchiptool. But some things are still unclear. image But we also have this: image So should I set the jumper on the adapter to 3.3V or 5V?
My guess would be 5.0V image And then getting it in boot mode, when and how exactly do you do this? image If I understand it correctly, I connect VCC and GND to the serial adapter, and place a jumper wire between TXD and RXD. Then I plug the adapter in the USB port , remove the jumper wire (do I need to wait for the boot to finish?) and then connect the RXD and TXD to the corresponding pins on the serial while the power is still on the UART?

I already connected and tried the flash read, without setting boot mode and VCC set to 5V. image

geedsen commented 1 day ago

I also tried jumping GND - TXD while inserting the adapter, keo that connection for around 20 seconds. No luck :( image I keep the two metal spots on the connectors connected with each other while plugging in the adapter.

And one question about the secrets.yaml. The install guide tells me to also add the AP ssid and pwd, I see this in the terminal: image So is the ssid of the AP solis001? And pwd is 'admin', which I believe is the standard password? But validation shows me this: image

hn commented 1 day ago

Set your USB serial adapter to 3.3V (not 5V).

  1. Connect GND of adapter to GND of stick
  2. Connect TX of adapter to RX of stick
  3. Connect RX of adapter to TX of stick
  4. Do not connect VCC yet
  5. Connect TX of stick to GND ("pull TX low"). TX pin of stick is already occupied by the wire which you connected in step 3. I found it convinient to connect an additional wire to the Dupont pin on the other side of the TX hole.
  6. Now connect VCC of adapter to VCC of stick, stick powers up ("pull TX low during boot")
  7. After 2 seconds remove (only!) the TX-GND wire you connected in step 5 (stick is now in flash mode). Be careful not to wiggle the other cables, otherwise the stick will restart without entering flash mode.
  8. Backup whole flash via ltchiptool
  9. Flash UF2 image via ltchiptool

secrets.yaml: wifi_ssid, wifi_password = WiFi credentials for your home network which you want the stick to connect to. wifi_ap_ssid, wifi_ap_password, = WiFi credentials for a 'rescue access point' to access the stick is not able to conect to your home network. https://esphome.io/components/wifi.html#access-point-mode api_encryption_key = 32-byte base64 encoded string, copy a random one from https://esphome.io/components/api.html ota_password = a random password for later updates. You never need to enter it manually, so choose a strong password.

All the above values are hardcoded into the UF2 file. Do not give the UF2 files to untrusted persons as they contain you WiFi password.

The screenshot you pasted ("LDO Mode BD_Info") is the boot log of the original vendor firmware.

geedsen commented 1 day ago

THe only thing I get is "Connecting to chip", Hardware reset, Software reset and this looping. How can I tell the 'pull' worked? I also found that using the Dupont pin on the other side of the stick might be too short to connect a female to it. It really is very lose. So if that does not connect the pull will fail as well. I do get garbage in the terminal window. And only the red light is flashing (slow) on the stick.

geedsen commented 1 day ago

Yep, that was the problem. I just kept two males against txd/gnd and pulled those. That worked.

geedsen commented 1 day ago

So I just made a copy of the yaml file and gave it a new name and friendly name. image

That's all, generate a new uf2 with these settings etc....?

geedsen commented 1 day ago

Hmm Flashing resulted in this: image image Is that OK?

hn commented 1 day ago

Yes, just use two different yaml files. People tend to give them descriptive names like solis-esphome-emw3080-garage.yaml. For dutch people solis-esphome-emw3080-campervan.yaml might be an option.

Just check if flashing suceeded by powering the stick without TX pulled low. If everything went ok, you should see the ESPHome boot log in terminal. If not, try to flash again.

geedsen commented 1 day ago

Hmm, maybe it did work: image But the terminal is not really helpful image

hn commented 1 day ago

Looks good. Now you never should need to connect the serial adapter again. You can update via ESPHome OTA. Press the LOGS button to see the device logs.

Your terminal uses the wrong baud rate (should be 115200).

geedsen commented 1 day ago

The logs look good. Should I already see any values for the entities? It is still just connected to the adapter. What I am really interested in is the entity that allows output limiting (like 80%) Should I see that entity in the logs?

geedsen commented 1 day ago

Thanks for all your help BTW!

hn commented 1 day ago

You'll not see any values unless the stick receives values via ModBus from a powered-on inverter (usually they power down at night). Go to HomeAssistant->Settings->Integrations->ESPHome to see the details then.

Consider to star this project if you like it.

geedsen commented 11 hours ago

The only part I am not seeing is this part: image I cannot find any of the entities in HA....

hn commented 11 hours ago

You need to add the device on the HomeAssistant->Integrations page, see my last post.