DiedB / Homey-SolarPanels

Connects production statistics of a wide range of PV inverters to Homey
https://apps.athom.com/app/it.diederik.solar
GNU General Public License v3.0
48 stars 35 forks source link

Solax support #18

Closed TijnBe closed 3 years ago

TijnBe commented 5 years ago

I have a Homey and a Solax inverter ZDNY-TLX3 and would like to use it through Homey. Do you have any plans for the Solax?

Groet Tijn

DiedB commented 5 years ago

There sure are! A pull request (#16) has been submitted for implementing Solax. Could you help testing it with your system? Do you know how to run apps in debug mode on Homey?

TijnBe commented 5 years ago

Hi Diederik, Leuk! Ik weet niet hoe ik in de debug mode kan maar dat zal vast niet ingewikkeld zijn. Prima om mijn systeem te gebruiken. Wat heb je nodig?

Verstuurd vanaf mijn iPhone Goede groet Tijn Bettink

Op 17 jul. 2018 om 15:39 heeft Diederik Bakker notifications@github.com het volgende geschreven:

There sure are! A pull request (#16) has been submitted for implementing Solax. Could you help testing it with your system? Do you know how to run apps in debug mode on Homey?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

DiedB commented 5 years ago

The idea is that you run a version of the Solar Panels app that has not been released yet. Someone has written the code to integrate it into the app, but before I release it, I would like to know whether it works with other Solax systems, like yours.

Do you have some technical knowledge? You need to clone the source repository of the pull request using Git. Then, navigate to the folder, open a command prompt, and follow the steps in this guide, except for the fourth one. Install NodeJS if you do not have it yet.

Let me know if you run into any problems.

TijnBe commented 5 years ago

I am not in to programming. I have some technical knowledge and would like to try. Can you tell me step by step what to do. So I can clone.. For your info I know Solax is working with two different websites for the info. solax-portal.com and www.solaxcloud.com (the one I use)

DiedB commented 5 years ago

Install NodeJS (LTS) and Git.

git clone https://github.com/Willybits/SolarPanels.git cd SolarPanels

Then follow the steps in the Athom guide I referred to in my previous comment, except for the fourth one.

TijnBe commented 5 years ago

I get to this

Last login: Wed Jul 18 11:44:32 on ttys000 MACBOOK-TIJN:~ admin$ cd solarpanels-master MACBOOK-TIJN:solarpanels-master admin$ npm install athom-cli npm WARN SolarPanels@ No license field.

DiedB commented 5 years ago

npm install -g athom-cli should work!

TijnBe commented 5 years ago

npm ERR! A complete log of this run can be found in: npm ERR! /Users/admin/.npm/_logs/2018-07-18T10_17_37_050Z-debug.log MACBOOK-TIJN:solarpanels-master admin$

I did trie also

MACBOOK-TIJN:~ admin$ sudo install -g athom-cli usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode] [-o owner] file1 file2 install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode] [-o owner] file1 ... fileN directory install -d [-v] [-g group] [-m mode] [-o owner] directory ...

I am not into Linux so no idee what to do

DiedB commented 5 years ago

Hmm, that's strange. Try sudo athom login?

DiedB commented 5 years ago

Never mind, I read that wrong.

Easiest option then is running athom-cli locally. $(npm bin)/athom login?

TijnBe commented 5 years ago

Locally what do you mean by that? And what with $(npm bin)/athom login ? thanks

DiedB commented 5 years ago

You first installed athom-cli locally, by using npm install athom-cli. Then globally, using the -g flag. When installed globally, you can use the command everywhere, but there is some issue with permissions which is probably not present in the local version.

By using the command $(npm bin)/athom login in the SolarPanels folder, you should be able to use the Athom CLI.

TijnBe commented 5 years ago

This worked after searching the internet and I am in.. sudo chown -R $(whoami) /usr/local/lib/node_modules

Skip step 4 but what to do at step 5 not clear to me

TijnBe commented 5 years ago

All done.... as requested. What is the next step?

DiedB commented 5 years ago

So, the Solar Panels app is installed on your Homey? Can you add your Solax inverter now?

TijnBe commented 5 years ago

Yes just installed and no the Solax is not visible.

DiedB commented 5 years ago

As in, you cannot choose Solax in the pairing wizard?

TijnBe commented 5 years ago

Installed version v2.1.0 I can choose the next brands PVoutput, Solaredge,enphase,omnik,tigo,solarman,trannergy,sungrow

homey zonnepanelen zonnepanelen homey

DiedB commented 5 years ago

Strange, seems like you are not on the latest version. Can you paste the output of the git status command, when running it inside the SolarPanels folder?

TijnBe commented 5 years ago

I removed the complete folder an reinstalled it again. No difference. This is what I get macbook-tijn:solarpanels-master admin$ git status fatal: not a git repository (or any of the parent directories): .git macbook-tijn:solarpanels-master admin$

TijnBe commented 5 years ago

I reinstalled again and now it is working i can choose the Solax. No idee why it is possible now. You have to give 'gebruikersnaam', 'wachtwoord', 'site-id' for the portal https://www.solax-portal.com/. This portal is working for some Solax inverters and for others it is https://www.solaxcloud.com/ This is different and not working with an site-ID.

DiedB commented 5 years ago

Can you send me your login details (d@iederik.nl)? I will look into implementing the alternative Solax portal.

Willybits commented 5 years ago

Hi Tijn, What Inverter do you have? (type) ?

Do you know which inverters use the solaxcloud and which use the solax-portal? When browsing the solax website and manuals I see no mention of this cloud yet? Nothing mentioned on Youtube as well? Really curious to know for which inverters this is (or for what wifi/Lan module)

I sent them an email as well asking if I should update my firmware as I cannot use the Cloud, the Serialnumber is not recognised so I cannot signup there.

TijnBe commented 5 years ago

Hi Willybits,

I have the ZDNY-TLX3-7.0. What they told me at Solax is that the solaxcloud is there own portal and that solax-portal.com is not. The wifi module I have is version 2.0. I had first the 1.0 version but that did not work with the inverter no data was transmitted. It seems that the 1.0 is working with solax-portal.com and the 2.0 with the solaxcloud.com

I don't know which inverters are working with which portal. Curious what they will respond.

Willybits commented 5 years ago

Hey, Thanks for the info.

Aha, so for now it's safe to assume that WIFI version 1 uses Solax-Portal and wifi version 2 uses solaxcloud. Thats also the reason then why I cannot add my system as my SN from the WIFI module is recognised as a V1 module.

I hope they will reply as well to tell what their plans are.

For Solax support in Homey this would mean we will have 2 portals to support.

DiedB commented 5 years ago

I think we will need to support both portals, indeed. The question that currently needs answering is whether Solax Cloud has an API, and action is being taken into getting the documentation if there is. Keep me up to date about the progress.

TijnBe commented 5 years ago

I have direct response from Solax. Diederik is in cc.

Willybits commented 5 years ago

Could you post the resonse here as well, I'm curious :)

TijnBe commented 5 years ago

Wat is de communicatie methode. Welke informatie wil je uitlezen van de omvormer en hoe. (bekabeld wifi, of wil je de informatie via het portaal uitlezen.)

legalr commented 5 years ago

Hello i am curious, what is the status of implementing the SolaxCloud website. I just installed a Solax inverter connected to the solax cloud website, and i like to see it working with the Homey App.

DiedB commented 5 years ago

Just sent Solax a reminder, I need their documentation to do anything.

TijnBe commented 5 years ago

Already some reaction from Solax?

DiedB commented 5 years ago

Nothing, unfortunately. I'll be abroad for the next 8 weeks so I will be unable to do any development on this app.

bossan commented 5 years ago

Hello all, I just got it working to retrieve data from SolaxCloud. I did it in Python, here is my code:

            # Starting a session in which we will store a JSESSIONID Cookie
            s = requests.Session()
            # Logging in to get the Cookie
            s.post(
                url='https://solaxcloud.com/login/login.do', 
                data={
                    "username": self._username, 
                    "userpwd": self._password, 
                    "roletype": 5
                }, 
                verify=False
            )
            # We can now make a request to get all data from a specific date
            r = s.post(
                url='https://solaxcloud.com/export/getReportData.do', 
                data={
                    "type": 1,
                    "siteId": int(self._siteId), # Formatted as: "yyyy-mm-dd"
                    "inverterSn": "xxxxxxxxxxxx" # Optional, I don't use it but it might be necessary if you have multiple inverters on one site. 
                    "time": date_str
                },
                verify=False
            )

            data = r.json()

The result will look like this:

[
{
        "inverterSn": "xxxxxxxxxx",
        "wsn": "xxxxxxxxxxx",
        "moduleName": "xxxxxxx",
        "userId": "xxxxxxxxxx",
        "siteId": "xxxxxxxxxxx",
        "firmId": "xxxxxxxxxxx",
        "firmwareVer": "7",
        "ratedPower": 5,
        "idc1": 0.2,
        "idc2": 0.4,
        "idc3": null,
        "idc4": null,
        "vdc1": 236.5,
        "vdc2": 292.8,
        "vdc3": null,
        "vdc4": null,
        "iac1": 0.6,
        "vac1": 230.4,
        "gridpower": 136,
        "temperature": 27,
        "todayyield": null,
        "yieldtoday": 0,
        "yieldtotal": 24.2,
        "feedinpower": 0,
        "powerdc1": 45,
        "powerdc2": 91,
        "powerdc3": null,
        "powerdc4": null,
        "pac1": 47,
        "pac2": 43,
        "pac3": 46,
        "iac2": 0.6,
        "iac3": 0.6,
        "vac2": 230.9,
        "vac3": 225.6,
        "fac1": 50,
        "fac2": 50,
        "fac3": 50.01,
        "feedinenergy": 0,
        "consumeenergy": 0,
        "uploadTime": 1546998717045,
        "uploadTimeValue": "2019-01-09 09:51:57",
        "type": "X3-MIC",
        "status": null,
        "version": "2.06.5",
        "batVoltage1": 0,
        "batCurrent1": 0,
        "batPower1": 0,
        "temperBoard1": 0,
        "surplusEnergy1": 0,
        "inputEnergy1": null,
        "outputEnergy1": null,
        "batteryStatus": "0.00",
        "batteryCapacity": 0,
        "chargecutVoltage": 0,
        "disChargecutVoltage": 0,
        "batVoltage2": null,
        "batCurrent2": null,
        "batPower2": null,
        "temperBoard2": null,
        "surplusEnergy2": null,
        "inputEnergy2": null,
        "outputEnergy2": null,
        "batVoltage3": null,
        "batCurrent3": null,
        "batPower3": null,
        "temperBoard3": null,
        "surplusEnergy3": null,
        "inputEnergy3": null,
        "outputEnergy3": null,
        "batVoltage4": null,
        "batCurrent4": null,
        "batPower4": null,
        "temperBoard4": null,
        "surplusEnergy4": null,
        "inputEnergy4": null,
        "outputEnergy4": null,
        "relay1Status": 0,
        "relay1Power": 0,
        "relay1Energy": 0,
        "relay1Signal": 0,
        "relay1answer": 0,
        "relay2Status": 0,
        "relay2Power": 0,
        "relay2Energy": 0,
        "relay2Signal": 0,
        "relay2answer": 0,
        "inverterStatus": 2,
        "inverterStatusValue": null,
        "systemSwitch": 0,
        "safety": "0",
        "powerFactor": 0,
        "exportControl": 0,
        "powerLimit": 0,
        "yl1": null,
        "yl2": null,
        "yl3": null,
        "yl4": null,
        "yl5": null,
        "yl6": null,
        "yl7": null,
        "yl8": null,
        "yl9": null,
        "yl10": null,
        "inverterType": "7",
        "userName": "xxxxxxxx",
        "firmName": "xxxxxxxxx",
        "currentYieldIncome": null,
        "totalYieldIncome": null,
        "faultType": "0",
        "wMachineStyle": "",
        "epsVoltageB": 0,
        "epsCurrentB": 0,
        "epsBpowerActive": 0,
        "epsVoltageC": 0,
        "epsCurrentC": 0,
        "epsCpowerActive": 0,
        "epsApowerS": 0,
        "epsBpowerS": 0,
        "epsCpowerS": 0,
        "feedinPowerMeter2": 0,
        "feedinEnergyMeter2": 0,
        "consumeEnergyMeter2": 0,
        "managerBootloaderVersion": "1.02",
        "seller": null,
        "batteryBrand": null,
        "batteryMasterVer": null,
        "batterySlaveNum": null,
        "batterySlaveVer1": null,
        "batterySlaveVer2": null,
        "batterySlaveVer3": null,
        "batterySlaveVer4": null,
        "batterySlaveVer5": null,
        "batterySlaveVer6": null,
        "batterySlaveVer7": null,
        "batterySlaveVer8": null,
        "batterySlaveType1": null,
        "batterySlaveType2": null,
        "batterySlaveType3": null,
        "batterySlaveType4": null,
        "batterySlaveType5": null,
        "batterySlaveType6": null,
        "batterySlaveType7": null,
        "batterySlaveType8": null,
        "iacL1N": null,
        "vacL1N": null,
        "iacL2N": null,
        "vacL2N": null,
        "genFreq": null,
        "genPower": null,
        "genL1Vol": null,
        "genL2Vol": null,
        "loadCurrentL1N": null,
        "loadCurrentL2N": null,
        "loadVoltL1N": null,
        "loadVoltL2N": null,
        "batteryType": "",
        "epsvoltage": 0,
        "epscurrent": 0,
        "epspower": 0,
        "epsfrequency": 0,
        "bmslost": 0,
        "bmsdisChargemaxCurrent": 0,
        "batteryCellTemperatureHigh": 0,
        "batteryCellTemperatureLow": 0,
        "batteryCellVoltageHigh": 0,
        "batteryCellVoltageLow": 0,
        "batteryHealth": "0",
        "bmscommunication": "0",
        "minCapacity": 0,
        "userChargemaxCurrent": 0,
        "userDischargemaxCurrent": 0,
        "workMode": 0,
        "inverterError": 0,
        "bmserror": 0,
        "managerRrror": 0,
        "bmschargemaxCurrent": 0,
        "meterFunction": 0,
        "meter1ComState": 0,
        "meter2ComState": 0
    },
   {...} #All other measurements of that day
]

I only use the value "gridpower" which is the total amount of generated power at that point in time (in Watt).

Please note, I had some problems with verifying their SSL Certificates, hence the verify=False.

I hope it answered your question :)

DiedB commented 5 years ago

We could do this, but it is not as robust as using an API. No one knows when they will change their login handler, and I do not have time to fix constant issues with the app breaking.

loopezz commented 5 years ago

Is there any progress for Solax Cloud support? I'm willing to help with testing

DiedB commented 5 years ago

I will not have time for this in the foreseeable future. Maybe @bossan wants to try and create an implementation for Homey?

bossan commented 5 years ago

@loopezz @DiedB Unfortunately I do not own a Homey device, so I am not sure if I will be able to add support for it.

magcb commented 4 years ago

Hi, can you please add Solax cloud support in the app? Thanks

Willybits commented 4 years ago

Could you all try this on your Solax inverters and paste the result? http://INVERTERIP/api/realTimeData.htm

The result should be something like: {“method”:“uploadsn”,“version”:“Solax_SI_CH_2nd_00000000_DE02”,“type”:“AL_SE”,“SN”:“12345678”,“Data”:[0.0,0.0,0.0,0.0,1.8,228.9,348,34,0.6,31.5,-40,0,0,51.87,-7.99,-416,19,58,0.0,10.9,0.00,0.00,50.01,0.0,0.0,0,0.00,0,0,0,0.00,0,8,0,0,0.00,0,8],“Status”:“2”}

Curious if all solax inverters present their data there. Mine does, so perhaps its easier to use the local API.

oliviervb commented 4 years ago

hello any progress?

DiedB commented 4 years ago

@oliviervb I do not have enough data or documentation to add support currently, but maybe you can try the suggestion of @Willybits if you want support for it?

oliviervb commented 4 years ago

Mine is the solax x3-hybrid inverter, that uses the cloud.

DiedB commented 4 years ago

@oliviervb So you are sure the local API @Willybits describes does not work?

I could create an implementation that scrapes the Solax Cloud but I doubt whether it will be stable in the long term. Can you send me account details at diederik@outlook.com? I will have a look at implementing it.

Selfie21 commented 4 years ago

Hey I did a really bad and hacky way that scrapes the Solax Cloud. Definetly not recommended to be used, I am still working on it. If used too often it slows down a lot... If you want to try anyways it's the SolaxCrawler: https://github.com/Selfie21/SolaxCloudApi

pieterzen commented 4 years ago

Hi, I'm hailing from the Home Assistant community and found this thread. I have 1 X1 Boost since yesterday (which uses the Solax Cloud) and can use the following API calls: http://47.254.152.24:6080/proxy/login/login?password=&userName= -> Returns token http://47.254.152.24:6080/proxy/inverter/getDailyInfo?inverterSn=&wifiSn=<WifiSerial/hostname>&tokenId=&today=2020-01-11 -> Returns all records for given day.

i hope this might help someone

DiedB commented 4 years ago

@pieterzen Is that your inverter IP address or an API IP address? Does this work for all Solax inverters?

pieterzen commented 4 years ago

That's the IP of the Solax Cloud server; Currently I'm aware of the following callouts: http://www.solaxcloud.com:6080/proxy/inverter/getSiteTotalPower?tokenId=&today=2020-05-05&siteId= http://www.solaxcloud.com:6080/proxy/mysite/getInverterInfo?siteId=&tokenId=

Especially the latter is interesting because it contains the running value's.

This should work for all inverters that use Solax Cloud. Not Solax Portal. More technical details you could look here: https://github.com/thomascys/solaxcloud

DiedB commented 4 years ago

@pieterzen Could you send me your Solax Cloud login credentials (change the password, if you want)? I'll look into implementing it. My e-mail is diederik@outlook.com.

timengaby commented 4 years ago

Hi Diederik.

As per message and your request: Model X1 - 2.0-S-D Can use solax cloud, did not do that yet. Also some issues to find my serial number..... Also with the idea to use it with homey.

20200518_113445