djansen1987 / SAJeSolar

SAJ eSolar Portal Sensors
GNU General Public License v3.0
21 stars 13 forks source link

eSolar SEC Module Issue #6

Closed LowKey88 closed 2 years ago

LowKey88 commented 2 years ago

Hi @djansen1987

Greetings,

I'm still see issue on data provided for sensor.esolar_totalloadpower , sensor.esolar_totalgridpower & sensor.esolar_totalpvgenpower.

Here example data from HA

Screenshot 2021-09-04 at 4 26 28 PM

This from App SAJ

IMAGE 2021-09-04 16:31:40

Sometime PV generation data seem swapped with Grid output data. Not sure why this happen, can you look up on this?

Thank you.

djansen1987 commented 2 years ago

Hi @LowKey88 ,

Could you see if it is fixed in the latest update ? Is switched the parameters. At creating i was not 100% sure which was which so i might have mixed the up.

djansen1987 commented 2 years ago
            if self._type == 'totalGridPower':
                if 'dataCountList' in energy:
                    if energy['dataCountList'][4][-1] is not None:
                        self._state = float(energy['dataCountList'][3][-1])
            if self._type == 'totalLoadPower':
                if 'dataCountList' in energy:
                    if energy['dataCountList'][4][-1] is not None:
                        self._state = float(energy['dataCountList'][2][-1])
            if self._type == 'totalPvgenPower':
                if 'dataCountList' in energy:
                    if energy['dataCountList'][4][-1] is not None:
                        self._state = float(energy['dataCountList'][4][-1])

This is the part there i get the data out of the api. As it is not properly labeled, and it is also an array of data i had to work with positions instead of labels. I cannot imagine they are switching the positions of this data but if they are then it might become very hard to get this right, as i only found 1 more API endpoint which is only accessible via the reseller/main login which i believe cannot be used in the component because of various reasons..

djansen1987 commented 2 years ago

Found an new API endpoint which if it has the correct info is way easier to understand for me. Could you see the bold items are the values you are looking for ? Found it the data under load monitoring - >Overview. it represents the data shown in the image below :

image

https://fop.saj-electric.com/saj/monitor/site/getPlantMeterEnergyPreviewInfo?plantuid=1234-aa-12346-fd123-123423-&moduleSn=M1234Y12345678&_=1830669656746

previewInfo: gridDirection: -1 -> gridPower: 1723 isOnline: 1 moduleSn: "M1234Y12345678" -> pvPower: 0 solarPower: 12 -> totalLoadPower: 1723 status: "success"

djansen1987 commented 2 years ago

Hi @LowKey88

Should be fixed in v1.2.4.

Please read and follow up on the instructions within the release notes. As per my findings we were on the wrong track of getting the correct sensors to make the Energy Dashboard work as it should. Therefor other sensors were needed (see release notes)

Could you confirm if my findings are correct and also work for you? If it does, we might be able te deprecate some old sensors which are not needed any more, this can make the component faster en cleaner. I think the following sensors from the SEC Module are not needed anymore after the latest update, could you confirm?

  - pvElec
  - useElec
  - buyElec
  - sellElec
  - buyRate
  - sellRate

  - totalGridPower
  - totalLoadPower
  - totalPvgenPower
djansen1987 commented 2 years ago

Fixed with above solutions