kellerza / pysma

Async library for SMA Solar's WebConnect interface
MIT License
59 stars 51 forks source link

New "Sunny Tripower Smart Energy" #105

Closed Toooias closed 1 year ago

Toooias commented 2 years ago

The new SMA Sunny Tripower Smart Energy do not seem to be supported yet. Is this the case and can the devices be added?

Thanks a lot!

FindusK commented 2 years ago

Hi there,

I also have the new SMA Sunny Tripower SE. I'm currently working on additions to the library.

There seem to be multiple differences to the other devices:

I think the best option would be to add a new device-class for the Tripower SE and to switch the URL_VALUES after detecting this new device class.
I hope this can help to implement the new inverter.

I attach the two json-documents to make the discussion about the new inverter easier
(we don't have a battery yet, so these values are zero): getAllOnlValues.json.txt getValues.json.txt

FindusK commented 2 years ago

I'm a few steps further into the additions and have to revise my statement about the changed URL:

I used a browser to get the json-documents and in the browser the website uses getAllOnlValues.json for all values and getValues.json is nearly empty. The values in getValues.json change depending on the website you visit. Pysma initializes the website correctly and can gather all values over getValues.json (different behavior compared to Firefox)

I have now added new JMESPATHs for the inverter and can receive nearly all values (Inverter and energy-meter via Inverter), when I change the device class to battery, I can also receive nearly all values there.

kellerza commented 2 years ago

Thanks @FindusK ! It would be great if you can do a PR with the suggested changes...

I don't have a SMA inverter anymore, but there are several unit tests and @rklomp can check that these changes do not affect his inverter

FindusK commented 2 years ago

Sure, I'm currently testing the additions in my home-assistant instance, the unit-tests all work.

I also fixed the async-unit-tests, that didn't run correctly in the github actions.

I think I will have the PR ready tomorrow.

rklomp commented 2 years ago

Thanks @FindusK ! Looking forward to it.

Sonusss commented 1 year ago

@FindusK I have a SUNNY TRIPOWER 10.0 SE and like to test your code.

I changed files in python libs of my HA 2022.9.6 but now when trying to add SMA integration I got the following message: This integration does not support configuration via the UI. If you followed this link from the Home Assistant website, make sure you run the latest version of Home Assistant.

How can I get your code to work ?

rklomp commented 1 year ago

@Sonusss,

I think the easiest way is to just install the custom lib. Below command should install the branch containing the changes by @FindusK and my additional changes as per #109. The command should be run inside the home assistant docker container or venv. pip install git+https://github.com/rklomp/pysma.git@dynamic-sensors

Note: I have not tested this command

Sonusss commented 1 year ago

@rklomp Your command worked without error in my docker container but it looks like the code is not active. Adding SMA integration works but without any sensor...

rklomp commented 1 year ago

Did you restart HA after running the pip command?

Sonusss commented 1 year ago

Indeed

Sonusss commented 1 year ago

I got a lot of data in the HA log file for SMA and pysma. Looks like the connection is well established but no sensors reported to HA.

Logging settings :

logger:
  default: info
  logs:
    homeassistant.components.sma: debug
    pysma: debug
rklomp commented 1 year ago

Can you share the logging in a file?

Sonusss commented 1 year ago

@rklomp Here is the log pysma.zip

rklomp commented 1 year ago

Looks like it is still running the old pysma code

rklomp commented 1 year ago

Try this command instead: pip install -e git+https://github.com/rklomp/pysma.git@dynamic-sensors#egg=pysma

Sonusss commented 1 year ago

@rklomp It did it ;-)

I have 1 device and 46 entities...

You're a Master !

rklomp commented 1 year ago

Good to hear it is working! Can you share the logging again?

Sonusss commented 1 year ago

@rklomp

Here you are... pysma.zip

rklomp commented 1 year ago

Thanks! I added your device data in the test data

phdelodder commented 1 year ago

When will the this version/fix be included in HA?

rklomp commented 1 year ago

When will the this version/fix be included in HA?

I hope to get this included in HA 2022.11

phdelodder commented 1 year ago

How is the progress going? Do you need any help with testing?

lucaberti commented 1 year ago

Try this command instead: pip install -e git+https://github.com/rklomp/pysma.git@dynamic-sensors#egg=pysma

Hello @rklomp I have the same problem. I'm currently running HA in HA OS. Is there any canche to implement this fix on HA OS or should switch my congiguration, running HA on a container?

ReinoutW commented 1 year ago

I have tried the updated pysma as well on my home-assistant core instance, to see if everything works on my smart energy invertor.

Steps:

  1. Running the command (inside the docker container) to install the updated pysma pip install -e git+https://github.com/kellerza/pysma.git#egg=pysma
  2. Confirm version 0.7.1 is installed pip show pysma
  3. Restart / don't restart home-assistant (I tried both)
  4. Add the SMA Solar integration in home-assistant
  5. This takes a bit of time, so I went back to the console in the docker container, I requested the version of pysma once again as I thought it was just reverting this. And indeed, it was reverted to 0.6.12
  6. Upgrade pysma again did not change the behaviour of the SMA integration in home-assistant.

In the logs, I can see 0.6.12 is used and not 0.7.1, no matter what I have tried.

2022-10-21 14:27:14.949 DEBUG (MainThread) [pysma.sensor] Sensor serial_number: Will be decoded with "9"[0].val from {'9': [{'low': 0, 'high': 4294967294, 'val': 3012392310}]}

2022-10-21 14:27:14.949 DEBUG (MainThread) [pysma.sensor] Sensor device_name: Will be decoded with "9"[0].val from {'9': [{'val': 'SN: 3012392310'}]}

2022-10-21 14:27:14.949 DEBUG (MainThread) [pysma.sensor] Sensor device_type: Will be decoded with "9"[0].val[0].tag from {'9': [{'validVals': [19048, 19049, 19050, 19051], 'val': [{'tag': 19051}]}]}

2022-10-21 14:27:14.950 DEBUG (MainThread) [pysma.sensor] Sensor device_manufacturer: Will be decoded with "9"[0].val[0].tag from {'9': [{'validVals': [461], 'val': [{'tag': 461}]}]}

rklomp commented 1 year ago

This will be included in HA 2022.11. Beta version will be release the 26th of october.