faanskit / ha-esolar

Custom Integration of SAJ eSOLAR
https://github.com/faanskit/ha-checkwatt
GNU General Public License v3.0
6 stars 5 forks source link

Retrying setup: 'peakPower' #6

Open absorbo opened 1 year ago

absorbo commented 1 year ago

Discussed in https://github.com/faanskit/ha-esolar/discussions/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 commented 1 year ago

`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 commented 1 year ago

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: apskaft-saj@usa.net

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 commented 1 year ago

@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 commented 1 year ago

https://github.com/djansen1987/SAJeSolar/releases/tag/v1.4.4

absorbo commented 1 year ago
image

Credentials to my installation sent to: apskaft-saj@usa.net

faanskit commented 1 year ago

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 commented 1 year ago

same result, sorry :)

absorbo commented 1 year ago

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

faanskit commented 1 year ago

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 commented 1 month ago

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

Nexus-77 commented 1 month ago

hello, I have had problems since the last HA update in August, not having backups I can't go back unfortunately

Il giorno ven 30 ago 2024 alle ore 16:03 Daniel Jansen < @.***> ha scritto:

This is an old thread, after which update do you have problems?

— Reply to this email directly, view it on GitHub https://github.com/faanskit/ha-esolar/issues/6#issuecomment-2321367387, or unsubscribe https://github.com/notifications/unsubscribe-auth/APGYWUOKQANVMDLZ7SL3OSLZUB3UJAVCNFSM6AAAAABNMNX3T2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRRGM3DOMZYG4 . You are receiving this because you commented.Message ID: @.***>

walkjivefly commented 1 month ago

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 commented 1 month ago

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

djansen1987 commented 1 month ago

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 https://github.com/djansen1987/SAJeSolar/issues/86

walkjivefly commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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

Nexus-77 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

it's work!!! thanks!!!

Great, you're welcome.

jaesbit commented 1 month ago

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