Dymerz / SMA-SunnyBoy

A simple data retrieving from SMA SunnyBoy
https://sma-sunnyboy.readthedocs.io/en/latest/sma_sunnyboy.html
MIT License
39 stars 9 forks source link

SUNNY TRIPOWER 8.0 not connect #2

Open g6pl opened 4 years ago

g6pl commented 4 years ago

Hello I have SMA SUNNY TRIPOWER 8.0 and trying to use your library to connect to my inverter ... unfortunately it doesn't connect. Permission denied message. I have SSL conection. I connect via WLAN (not LAN) Firmware is: 3.00.05.R

Dymerz commented 4 years ago

I'm sorry I can help you cause I don't own a SMA SUNNY TRIPOWER

k-sartor commented 4 years ago

Some changes must be done to acheive connected.

First in each requests verify=False need to be added depending of your python version Moreover in the beginning of the file i add the last line

if self.useSSL:
            self.__url ='https://'+self.ip
            port = 443

Edit beware the tags need to be added while in tripower there are not the same. Use get all values to determine them and add them in the KEYS definition

Dymerz commented 4 years ago

Thanks for your contribution @k-sartor I will integrate the verify=False 👍

You can pass the port in the constructor instead of editing: WebConnect('127.0.0.1', 'strongPassword', 443, True)

k-sartor commented 4 years ago

Ok for passing port in constructor (but from my point of vue, default SSL port could be added). Contrary to i previously said, getallvalues() does not work for tripower to determine the new KEY. I think that i could add a "procedure" to determine them if you want. Finally, we could determine generic profile of keys depending of the inverter type if you want

Dymerz commented 4 years ago

I prefer to be more flexible and don't force the HTTPS port since I don't know all SMA types and what the user can do or not (maybe the SSL port can be arbitrary chosen).

Yeah you can fork and contribute, a feature like that could be very useful!

k-sartor commented 4 years ago

Ok for the port. To be honest i don't use git. However, there are some tags for a STP50-40 inverter: Total Power: 6100_40263F00 Frequency : 6100_00465700 Type surexcitation 6180_08465A00 I L1 6100_40465300 I L2 6100_40465400 I L3 6100_40465500 U L1 6100_00464800 U L2 6100_40464100 U L3 6100_00464A00 U 12 6100_00464B00 U 23 6100_00464C00 U 31 6100_00464D00 P L1 6100_40464000 P L2 6100_40464100 P L3 6100_40464200 Total Energy 6400_00260100 Service time 6400_00462E00 Injection time 6400_00462F00 (i think it is the production time value while in our case there is not injection of electricy on network)

Production PV 6100_0046C200 (i think it is similar to Total Energy but i don't know the difference Etat du compteur de production pv v6400_0046C300

k-sartor commented 4 years ago

To add into wiki for example: To determine a tag for a particular inverter:

  1. Log in into the web interface
  2. Go to on "instantaneous Values" and select the wished value
  3. On firefox, clic on Ctrl+ MAJ + K to open Web Console
  4. Click on Ctrl + Shift + C to select an element on the web page
  5. Select the element et note the span id (beginning by a "v", here v6100_40263F00). See capture firefox_4Q1F8SsGib
  6. remove the "v" and add the tag in the list to be able to call it in the main software
Dymerz commented 4 years ago

It's particularly interesting, I didn't know tags was in the HTML, it changes a lot of stuff! I've take a look on the javascript script of my SMA Dashboard and after few hours I've successfully retrieve all tags and match them with a friendly label directly from the internal SMA script.

I'm not sure and need some work but I think it could be possible to retrieve these tags whatever the inverter your using without changing the code, but I need to know if the file scripts.xxxx.js I'm using is basically the same on all types of inverters.

Can you, please, send me your scripts.xxxx.js? You can find it easily: image

k-sartor commented 4 years ago

Here is the required file (for SMA STP50-40). I'va also access to a sunny boy, do you need it? scripts.015adc2a.zip

Dymerz commented 4 years ago

Yeah the more samples I have better it is. Ok, it looks good, I need others files to "emulate" your inverter, can you send me these files for each inverters?

Thanks for your contribution.

k-sartor commented 4 years ago

Notice getlogger works for sunny boy but no for STA50-40 (its returns nothing) => Solved: i add verify=false in your new code and it works I will try to send you this data

k-sartor commented 4 years ago

So please find the required files. Note i notice one issues with getlogger (do you want i open other(s) ticket(s)?):

Dymerz commented 4 years ago

Thanks I will take a look 👍