ThePheonixGuy / sunsynk-scraper-addon

MIT License
8 stars 2 forks source link

Region 2 #22

Closed Frikkie50 closed 6 months ago

Frikkie50 commented 1 year ago

Howdy

Me again. How easy would it be to hook this up to region 2?

chris2172 commented 7 months ago

I got it working for region 2 by updating endpoints.py. Have not done full testing but it logged into sunsynk and pushed some data to MQTT

login_endpoint = ('https://pv.inteless.com/oauth/token')

plants_endpoint = ('https://pv.inteless.com/api/v1/plants?page=1&limit=10&name=&status=')

energy_base_url = "https://pv.inteless.com/api/v1/plant/energy/"

login_endpoint = ('https://api.sunsynk.net/oauth/token') plants_endpoint = ('https://api.sunsynk.net/api/v1/plants?page=1&limit=10&name=&status=')
energy_base_url = "https://api.sunsynk.net/api/v1/plant/energy/" inverter_list_url = "https://api.sunsynk.net/api/v1/inverters?page=1&limit=10&status=-1&type=-1"

By changing those lines and running in debug mode I got

2023-12-17 20:45:46,817 | DEBUG | Got power data: { "custCode": 29, "meterCode": 0, "pvPower": 1, "battPower": 23, "gridOrMeterPower": 562, "loadOrEpsPower": 511, "genPower": 0, "minPower": 0, "soc": 20.0, "smartLoadPower": 0, "upsLoadPower": 0, "homeLoadPower": 0, "pvTo": true, "toLoad": true, "toGrid": false, "toBat": true, "batTo": false, "gridTo": true, "genTo": false, "minTo": false, "existsGen": false, "existsMin": false, "existsGrid": true, "genOn": false, "microOn": false, "existsMeter": false, "bmsCommFaultFlag": false, "existsThreeLoad": false, "existsSmartLoad": false, "pv": null, "existThinkPower": false }

2023-12-17 20:45:46,989 | DEBUG | Got energy data: { "pv": "3.0", "export": "0.1", "import": "12.6", "discharge": "5.6", "charge": "6.5"

ThePheonixGuy commented 6 months ago

Hello!

Yeah, just needs a minor update to the api urls. @chris2172 If you wanna open a PR for that, I'd be quite happy to merge it in!

chris2172 commented 6 months ago

If there are no more users in Region 1 it is simple to replace the URLs But if there are still users in Region 1 then it would be best to add a Region selector in the config @ThePheonixGuy

krazysh01 commented 6 months ago

resolved in https://github.com/ThePheonixGuy/sunsynk-scraper-addon/pull/24