Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrying setup: 'peakPower' #6

Open
absorbo opened this issue Mar 16, 2023 Discussed in #5 · 23 comments
Open

Retrying setup: 'peakPower' #6

absorbo opened this issue Mar 16, 2023 Discussed in #5 · 23 comments
Assignees
Labels
bug Something isn't working

Comments

@absorbo
Copy link

absorbo commented Mar 16, 2023

Discussed in #5

Originally posted by absorbo March 16, 2023
Hello, first of all, thank you for the effort at creating this HACS integration.
Today, I tried to install it and followed the ReadMe. Instead of the choice of installation, it just says "Configuration successfully created".
The integration constantly tries to: Retrying setup: 'peakPower' and I get no devices or entities.

Please advise.
Thank you for the support.

@absorbo
Copy link
Author

absorbo commented Mar 16, 2023

`This error originated from a custom integration.

Logger: custom_components.saj_esolar_air
Source: custom_components/saj_esolar_air/esolar.py:247
Integration: eSolar (documentation, issues)
First occurred: 17:10:56 (45 occurrences)
Last logged: 17:57:08

Unexpected error fetching saj_esolar_air data: 'peakPower'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 239, in _async_refresh
self.data = await self._async_update_data()
File "/config/custom_components/saj_esolar_air/init.py", line 456, in _async_update_data
data = await self.hass.async_add_executor_job(
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/saj_esolar_air/init.py", line 500, in get_data
plant_info = get_esolar_data(username, password, plants, use_pv_grid_attributes)
File "/config/custom_components/saj_esolar_air/esolar.py", line 56, in get_esolar_data
web_get_plant_detailed_chart(session, plant_info)
File "/config/custom_components/saj_esolar_air/esolar.py", line 247, in web_get_plant_detailed_chart
tmp.update({"peakPower": plant_chart["peakPower"]})
KeyError: 'peakPower'
`

@faanskit faanskit self-assigned this Mar 16, 2023
@faanskit faanskit added the bug Something isn't working label Mar 16, 2023
@faanskit
Copy link
Owner

Hi,

I will need some additional information. Can you please describe your set-up.

System: E.g. Solar inverter, Battery Module, SEC Module
System details: SAJ R5, H1, SEC, etc.

I have only tested it with SAJ R5 and another user with H1. SEC is not supported.

Likely I will need you to run a few tests for me as I cannot replicate the issue.

Two options:
1a.) If you have python and some basic knowledge, I will give you a few files which you run and send/upload the logs from.
1b.) Upon request, you share some information from Chrome inspection function
2.) You share your secret credentials (username & password) with me to this temporary mail: [email protected]

If you edit this line in esolar.py and enable logging, I will likely be able to see more.
VERBOSE_DEBUG = False ==>
VERBOSE_DEBUG = True
Since line 246 works (tmp.update({"devicesn": inverter})) my first speculation is that you have a system never tested before which does not provide the required information.

Meanwhile, have you tried @djansen1987 integration? Maybe it works better for you while we find this bug..
I.e. this https://github.com/djansen1987/SAJeSolar

/Marcus

@djansen1987
Copy link
Collaborator

@faanskit they seem to have changed the api on peakpower for some models it seems. This can be fixed by removing the device serial number in de post to plant2 api

@djansen1987
Copy link
Collaborator

@absorbo
Copy link
Author

absorbo commented Mar 16, 2023

image

Credentials to my installation sent to: [email protected]

@faanskit
Copy link
Owner

For a quick test following the advice from @djansen1987, change this line in esolar.py:

From:
url = f"{BASE_URL_WEB}/monitor/site/getPlantDetailChart2?plantuid={plant['plantuid']}&chartDateType=1&energyType=0&clientDate={client_date}&deviceSnArr={inverter}&chartCountType=2&previousChartDay={previous_chart_day}&nextChartDay={next_chart_day}&chartDay={chart_day}&previousChartMonth={previous_chart_month}&nextChartMonth={next_chart_month}&chartMonth={chart_month}&previousChartYear={previous_chart_year}&nextChartYear={next_chart_year}&chartYear={chart_year}&elecDevicesn=&_={epochmilliseconds}"

To:
url = f"{BASE_URL_WEB}/monitor/site/getPlantDetailChart2?plantuid={plant['plantuid']}&chartDateType=1&energyType=0&clientDate={client_date}&deviceSnArr=&chartCountType=2&previousChartDay={previous_chart_day}&nextChartDay={next_chart_day}&chartDay={chart_day}&previousChartMonth={previous_chart_month}&nextChartMonth={next_chart_month}&chartMonth={chart_month}&previousChartYear={previous_chart_year}&nextChartYear={next_chart_year}&chartYear={chart_year}&elecDevicesn=&_={epochmilliseconds}"

I'll try this myself in a virtual system tomorrow.

/Marcus

@absorbo
Copy link
Author

absorbo commented Mar 16, 2023

same result, sorry :)

@absorbo
Copy link
Author

absorbo commented Mar 16, 2023

Tried @djansen1987 integration: https://github.com/djansen1987/SAJeSolar and it created all the sensors with the values.

@faanskit
Copy link
Owner

It appears as if the root cause of is simply that this integration does not support a SEC module and from the appearance of the login page, there is a SEC module installed.
image

A quick removal of the problematic line (247) installs the system ok:
image

But, PV power is not updated. For this system, I think I need to pick power from viewBean instead of peakPower which is not available.

image

What is very strange is that when I log in as your guest, the inverter tab is empty:

image

Glad that you are up and running with the integration from @djansen1987, which support SEC.

I'll see if I can free up some time to fix this properly. From the looks of it, some refactoring is needed.

@Nexus-77
Copy link

hello, after an update also i have error “peakPower” i tried to install again but no success. who can help me? thanks

@Nexus-77
Copy link

Nexus-77 commented Aug 30, 2024 via email

@walkjivefly
Copy link

Do you have an inverter with a battery? I encountered a "peakPower" error last weekend in an installation which had been running (slightly modded https://github.com/djansen1987/SAJeSolar) fine for months. It turned out SAJ have changed the plant type from 3 to 1 for battery systems.

@djansen1987
Copy link
Collaborator

Are you using ha-esolar from @faanskit or esolar custom integration from @djansen1987
?

@djansen1987
Copy link
Collaborator

Do you have an inverter with a battery? I encountered a "peakPower" error last weekend in an installation which had been running (slightly modded https://github.com/djansen1987/SAJeSolar) fine for months. It turned out SAJ have changed the plant type from 3 to 1 for battery systems.

Could you maybe share your findings with @jaesbit in djansen1987/SAJeSolar#86

@walkjivefly
Copy link

walkjivefly commented Aug 30, 2024

Yes, I'm updating that issue now. I made my changes outside of Git, and on closer inspection of what I'm running, it's actually slightly modded version of the faanskit code.

@walkjivefly
Copy link

Are you using ha-esolar from @faanskit or esolar custom integration from @djansen1987 ?

My integration lives in custom_components/saj_esolar_air, so it's the faanskit one. But I messed something up at install time because it keeps offering me the djansen version upgrade(s).
image

@djansen1987
Copy link
Collaborator

Okay strange, can't help with that unfortunately. Thank you for sharing your findings!

@Nexus-77
Copy link

Hai un inverter con una batteria? Ho riscontrato un errore "peakPower" lo scorso weekend in un'installazione che funzionava (leggermente modificata https://github.com/djansen1987/SAJeSolar ) bene da mesi. Si è scoperto che SAJ ha cambiato il tipo di impianto da 3 a 1 per i sistemi a batteria.

hello, yes i have a H1-6K-S2 inverter with 3 batteries (B1-5.1-48). do you have any suggestions???

@walkjivefly
Copy link

Okay strange, can't help with that unfortunately. Thank you for sharing your findings!

No problem. I almost never install upgrades on the basis "if it ain't broken, don't fix it" and especially not in this case since my integration has been tweaked from the github vanilla version.

@walkjivefly
Copy link

Hai un inverter con una batteria? Ho riscontrato un errore "peakPower" lo scorso weekend in un'installazione che funzionava (leggermente modificata https://github.com/djansen1987/SAJeSolar ) bene da mesi. Si è scoperto che SAJ ha cambiato il tipo di impianto da 3 a 1 per i sistemi a batteria.

hello, yes i have a H1-6K-S2 inverter with 3 batteries (B1-5.1-48). do you have any suggestions???

To get my integration working again last weekend I had to change one line in esolar.py, changing the test for

    if plant["type"] == 3:

to

    if plant["type"] == 1:

around line 229 in esolar.py.

@Nexus-77
Copy link

Hai un inverter con una batteria? Ho riscontrato un errore "peakPower" lo scorso weekend in un'installazione che funzionava (leggermente modificata https://github.com/djansen1987/SAJeSolar ) bene da mesi. Si è scoperto che SAJ ha cambiato il tipo di impianto da 3 a 1 per i sistemi a batteria.

hello, yes i have a H1-6K-S2 inverter with 3 batteries (B1-5.1-48). do you have any suggestions???

To get my integration working again last weekend I had to change one line in esolar.py, changing the test for

    if plant["type"] == 3:

to

    if plant["type"] == 1:

around line 229 in esolar.py.

it's work!!!
thanks!!!

@walkjivefly
Copy link

it's work!!! thanks!!!

Great, you're welcome.

@jaesbit
Copy link

jaesbit commented Sep 1, 2024

try to fill elecDevicesn with the battery SN, it will work. If you don't fill with battery SN, no viewBean will come in the response.

Here you can check how to get the battery SN, and deviceSNArr could be Inverter or Battery doesn't have any effect. I hope it help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants