solis-sensor icon indicating copy to clipboard operation
solis-sensor copied to clipboard

Report SolisCloud connectivity issues here

Open hultenvp opened this issue 2 years ago • 144 comments

Describe the bug People report various issues with SolisCloud connectivity. Varying from not being able to configure the integration to connection errors with server.

A lot of fixes and hardening have already been introduced, but issues may remain.

Please add your issues in the comments of this issue. Before you do, make sure:

  • HA version >= 2022.12.6
  • Integration version >= 3.2.0 (released 16-dec-2022)

Note The "abnormal data bug" is not fixed, see #229

hultenvp avatar Dec 16 '22 09:12 hultenvp

Hi @hultenvp, many thanks for this add-on. Sadly it's not working for me. I've only installed this today, so this is a fresh set up. Home Assistant has been rebooted since installation. I only have one inverter in my SolisCloud account, and SolisCloud shows data.

I've got my Soliscloud login email address, secret, key ID and inverter ID and pasted them into the setup. I have also tried to extend the timeout in /config/custom_components/solis/soliscloud_api.py from 10 to 100 (line 468) but to no effect.

Any ideas based on the info below please? I'm unclear on how to use the test script, but if you can provide additional guidance I can give it a go.

Steps to reproduce

  • Add this repo to HACS
  • Install v3.2.0 via HACS
  • Go to Settings > Devices & Services
  • Click "+ Add Integration"
  • Search for "solis" and select "Solis Inverter"
  • In the "portal selection" pop up: ** Name: Solis ** PV portal URL: https://www.soliscloud.com:13333 ** PV portal version: soliscloud
  • Click submit
  • On the "Add soliscloud credentials" pop up: ** Portal username or email address: the email address I use to sign in to SolisCloud ** API Secret: *** Delete the unknown two characters that seem to be in the box to start with *** Paste in the secret received from SolisCloud ** Key ID: value from SolisCloud (19 digits) ** Station ID: 19 digits found at the end of https://www.soliscloud.com/#/station/stationdetail_1?id=
  • Click submit
  • Receive error at the top of the pop up: "Unknown error occurred"

Versions

  • Home Assistant: 2022.12.6
  • Home Assistant OS: 9.4
  • Home Assistant Supervisor: 2022.11.2
  • Ginlong Solis PV portal integration: 3.2.0
  • Hardware: Raspberry Pi 4

Logs

I reviewed the logs and note that sometimes the source is line 238, other times 242, of custom_components/solis/soliscloud_api.py.

Line 238: for record in result_json['data']['page']['records']: Line 242: elif result[STATUS_CODE] == 408:

Note that I'm not receiving any time / clock related warnings.

Logger: aiohttp.server
Source: custom_components/solis/soliscloud_api.py:242
Integration: Solis Inverter ([documentation](https://github.com/hultenvp/solis-sensor/), [issues](https://github.com/hultenvp/solis-sensor/issues))
First occurred: 16:26:10 (1 occurrences)
Last logged: 16:26:10

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 94, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 81, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 180, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 73, in wrapper
    result = await method(view, request, data, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 281, in async_configure
    result = await self._async_handle_step(
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 368, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/config/custom_components/solis/config_flow.py", line 118, in async_step_credentials_secret
    if await api.login(async_get_clientsession(self.hass)):
  File "/config/custom_components/solis/soliscloud_api.py", line 202, in login
    self._inverter_list = await self.fetch_inverter_list(self.config.plant_id)
  File "/config/custom_components/solis/soliscloud_api.py", line 242, in fetch_inverter_list
    elif result[STATUS_CODE] == 408:
KeyError: 'StatusCode'

joncojonathan avatar Dec 17 '22 16:12 joncojonathan

Since updating to latest version am having drop outs, failing on fetching the Inverter list. Was working fine until 3.2. Sample below:

Logger: homeassistant Source: custom_components/solis/soliscloud_api.py:242 Integration: Solis Inverter (documentation, issues) First occurred: 09:33:45 (1 occurrences) Last logged: 09:33:45

Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/config/custom_components/solis/service.py", line 103, in async_discover capabilities = await self._do_discover() File "/config/custom_components/solis/service.py", line 120, in _do_discover if await self._login(): File "/config/custom_components/solis/service.py", line 92, in _login if await self._api.login(async_get_clientsession(self._hass)): File "/config/custom_components/solis/soliscloud_api.py", line 202, in login self._inverter_list = await self.fetch_inverter_list(self.config.plant_id) File "/config/custom_components/solis/soliscloud_api.py", line 242, in fetch_inverter_list elif result[STATUS_CODE] == 408: KeyError: 'StatusCode'

Moondevil-ha avatar Dec 18 '22 10:12 Moondevil-ha

Hi @hultenvp Thank you for all your hard work making the Solis inverter sensor available for everyone. I have the exact same issue as described above by @joncojonathan. I have confirmed that the datalogger is sending data and the inverter is online. Solis cloud web service is providing real time data.

Trying to add integration through UI results in: image

I have also run your test script and resulting string. Regardless of witch line pair I uncomment, script returns: {"code": "1", "data": null, "msg": "\u6570\u636e\u5f02\u5e38 \u8bf7\u8054\u7cfb\u7ba1\u7406\u5458", "success": true}

HA log from attempt at adding integration is as follows: image

grlarsen avatar Dec 18 '22 12:12 grlarsen

Since updating to latest version am having drop outs, failing on fetching the Inverter list. Was working fine until 3.2. Sample below:

Logger: homeassistant Source: custom_components/solis/soliscloud_api.py:242 Integration: Solis Inverter (documentation, issues) First occurred: 09:33:45 (1 occurrences) Last logged: 09:33:45

Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/config/custom_components/solis/service.py", line 103, in async_discover capabilities = await self._do_discover() File "/config/custom_components/solis/service.py", line 120, in _do_discover if await self._login(): File "/config/custom_components/solis/service.py", line 92, in _login if await self._api.login(async_get_clientsession(self._hass)): File "/config/custom_components/solis/soliscloud_api.py", line 202, in login self._inverter_list = await self.fetch_inverter_list(self.config.plant_id) File "/config/custom_components/solis/soliscloud_api.py", line 242, in fetch_inverter_list elif result[STATUS_CODE] == 408: KeyError: 'StatusCode'

Ouch! That's a silly one from my side. Missed one path where StatusCode is not set. Fix underway.

hultenvp avatar Dec 18 '22 19:12 hultenvp

I've fixed both crashes in rel 3.2.1

hultenvp avatar Dec 18 '22 19:12 hultenvp

\u6570\u636e\u5f02\u5e38 \u8bf7\u8054\u7cfb\u7ba1\u7406\u5458

Hey @grlarsen , I fixed the crash, but it won;t help you much as the dreaded Abnormal data error will likely still haunt you. I'm trying to reproduce it, but it's a very elusive bug.

hultenvp avatar Dec 18 '22 19:12 hultenvp

Hi, with newly provided API login data from Solis, login is not possible. It just report "Cannot login with provided URL and credentials" and login data disapear. No further errormessage. In Logbook you can find this additional info `Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.solis.soliscloud_api Source: custom_components/solis/soliscloud_api.py:204 Integration: Solis Inverter (documentation, issues) First occurred: 14:12:40 (3 occurrences) Last logged: 19:45:46

No inverters found `

grafik

I do have a Solis inverter and therefore I've changed URL to https://www.soliscloud.com:13333 The 19 digit's station ID I've fetched from URL as described.

Config

` default_config:

frontend: themes: !include_dir_merge_named themes

tts:

  • platform: google_translate

my:

automation: !include automations.yaml script: !include scripts.yaml scene: !include scenes.yaml

homematic: interfaces: rf: host: 192.168.1.11 resolvenames: "json" username: "" password: "" ip: host: 192.168.1.11 port: groups: host: 192.168.1.11 port: resolvenames: "json" username: "" password: "" path: /groups hosts: ccu2: host: 192.168.1.11 port: username: "" password: "" `
logger: default: critical logs: homeassistant.core: fatal homeassistant.components.mqtt: warning homeassistant.components.python_script: warning custom_components.solis: debug homeassistant.components.smartthings.light: info custom_components.my_integration: debug

Versions HA Version : 9.4 (2022.12.8) HACS version : 20220906112053 (1.29.0) Integration version : 3.2.1 HW: Fujitsu S740 with Proxmox

Debug logs 2022-12-21 23:12:26.480 DEBUG (MainThread) [custom_components.solis.soliscloud_api] workarounds: {'correct_daily_on_grid_energy_enabled': False} 2022-12-21 23:12:27.053 DEBUG (MainThread) [custom_components.solis.soliscloud_api] Response contains unexpected data: {'success': True, 'code': '1', 'msg': '数据异常 请联系管理员', 'data': None} 2022-12-21 23:12:27.053 WARNING (MainThread) [custom_components.solis.soliscloud_api] No inverters found


![grafik](https://user-images.githubusercontent.com/117862420/208981911-5eb9d170-7166-4a29-89c5-5bc1422e7d60.png)

luftdieb avatar Dec 21 '22 22:12 luftdieb

Move to correct Bug reporting location - apologies

HI, I am also having the same issue followed documentation to the letter, tried uninstall integration and re-install.

This error originated from a custom integration.

Logger: custom_components.solis.soliscloud_api Source: custom_components/solis/soliscloud_api.py:204 Integration: Solis Inverter (documentation, issues) First occurred: 08:15:26 (1 occurrences) Last logged: 08:15:26

No inverters found

Home Assistant 2022.12.7 Supervisor 2022.11.2 Operating System 9.4 Frontend 20221213.1 - latest Ginlong Solis PV portal integration v3.2.1

Here is the debug log extract.

`2022-12-21 10:33:40.351 DEBUG (MainThread) [custom_components.solis.soliscloud_api] Response contains unexpected data: {'success': True, 'code': '1', 'msg': '数�异常 请�系管�员', 'data': None}

2022-12-21 10:33:40.351 WARNING (MainThread) [custom_components.solis.soliscloud_api] No inverters found`

spiderpigsam avatar Dec 22 '22 21:12 spiderpigsam

Tried new update still same issue with no inverter found and error code 1 returned will copy logs in for reference.

spiderpigsam avatar Dec 23 '22 16:12 spiderpigsam

v3.2.2

2022-12-23 17:07:15.697 INFO (MainThread) [custom_components.solis.soliscloud_api] /v1/api/inverterDetail responded with error: 1:数据异常 请联系管理员 <<< uncle Google says 'the data is abnormal, please contact administrator'
2022-12-23 17:07:15.697 WARNING (MainThread) [custom_components.solis.soliscloud_api] No inverters found

alienatedsec avatar Dec 23 '22 17:12 alienatedsec

Enabling debug does not bring more information:

2022-12-23 17:54:52.493 DEBUG (MainThread) [custom_components.solis.soliscloud_api] workarounds: {'correct_daily_on_grid_energy_enabled': False}
2022-12-23 17:54:52.724 INFO (MainThread) [custom_components.solis.soliscloud_api] /v1/api/inverterDetail responded with error: 1:数据异常 请联系管理员
2022-12-23 17:54:52.724 WARNING (MainThread) [custom_components.solis.soliscloud_api] No inverters found

alienatedsec avatar Dec 23 '22 17:12 alienatedsec

Hi, I've also tried newest version 3.2.2 but still no success. So I've just added some debug information in file soliscloud_api.py --> async def _post_data_json() async def _post_data_json(self, canonicalized_resource: str, params: dict[str, Any]) -> dict[str, Any]: """ Http-post data to specified domain/canonicalized_resource. """

    header: dict[str, str] = self._prepare_header(params, canonicalized_resource)
    result: dict[str, Any] = {SUCCESS: False, MESSAGE: None, STATUS_CODE: None}
    resp = None
    _LOGGER.debug("selfConfigDomain")
    _LOGGER.debug(self.config.domain)
    _LOGGER.debug("params")
    _LOGGER.debug(params)
    if self._session is None:
        return result
    try:
        async with async_timeout.timeout(20):
            url = f"{self.config.domain}{canonicalized_resource}"
            resp = await self._session.post(url, json=params, headers=header)
            result[STATUS_CODE] = resp.status
            result[CONTENT] = await resp.json()
            if resp.status == HTTPStatus.OK:
                result[SUCCESS] = True
                result[MESSAGE] = "OK"
            else:
                result[MESSAGE] = "Got http statuscode: %d" % (resp.status)
    except (asyncio.TimeoutError, ClientError) as err:
        result[MESSAGE] = f"{repr(err)}"
        _LOGGER.debug("Error from URI (%s) : %s", `canonicalized_resource,` result[MESSAGE])
    finally:
        if resp is not None:
            await resp.release()
        _LOGGER.debug("finally_Post_Data_Json")
        _LOGGER.debug(result)
        return result

This will create this kind of logentries: 2022-12-23 20:47:10.896 DEBUG (MainThread) [custom_components.solis.soliscloud_api] selfConfigDomain 2022-12-23 20:47:10.896 DEBUG (MainThread) [custom_components.solis.soliscloud_api] https://www.soliscloud.com:13333 2022-12-23 20:47:10.896 DEBUG (MainThread) [custom_components.solis.soliscloud_api] params 2022-12-23 20:47:10.896 DEBUG (MainThread) [custom_components.solis.soliscloud_api] {'stationId': '19DigitNumber'} 2022-12-23 20:47:10.905 DEBUG (MainThread) [custom_components.solis.soliscloud_api] workarounds: {'correct_daily_on_grid_energy_enabled': False} 2022-12-23 20:47:10.907 DEBUG (MainThread) [custom_components.solis.soliscloud_api] selfConfigDomain 2022-12-23 20:47:10.907 DEBUG (MainThread) [custom_components.solis.soliscloud_api] https://www.soliscloud.com:13333 2022-12-23 20:47:10.907 DEBUG (MainThread) [custom_components.solis.soliscloud_api] params 2022-12-23 20:47:10.907 DEBUG (MainThread) [custom_components.solis.soliscloud_api] {'stationId': '19DigitNumber'} 2022-12-23 20:47:17.395 DEBUG (MainThread) [custom_components.solis.soliscloud_api] finally_Post_Data_Json 2022-12-23 20:47:17.395 DEBUG (MainThread) [custom_components.solis.soliscloud_api] {'Success': True, 'Message': 'OK', 'StatusCode': 200, 'Content': {'success': True, 'code': '1', 'msg': '数据异常 请联系管理员', 'data': None}}

Maybe that helps ? I don't have too much experience in python... Have worked more with C#. If you can give me a pointer, where to add more logfile output, just let me know. Looks like the code 1 is not as expected.

luftdieb avatar Dec 23 '22 19:12 luftdieb

I can simply create the same problem by using postman grafik So i guess something is wrong with login mechanism, I've tried examples from "SolisCloud Monitoring API.pdf" which you can see in the picture. But same problem. Maybe something is wrong with signature calculation ? In manual there is encryption HmacSHA1 mentioned. grafik In soliscloud_api.py this command do the encryption "sign = base64.b64encode(hmac_obj.digest())" Is this the same ? FYI: I've add more debug information in logfile to get calculated SIGN from soliscloud_api.py , which I've used in postman with my ID ;-)

luftdieb avatar Dec 24 '22 00:12 luftdieb

v3.2.2

2022-12-23 17:07:15.697 INFO (MainThread) [custom_components.solis.soliscloud_api] /v1/api/inverterDetail responded with error: 1:数据异常 请联系管理员 <<< uncle Google says 'the data is abnormal, please contact administrator'
2022-12-23 17:07:15.697 WARNING (MainThread) [custom_components.solis.soliscloud_api] No inverters found

Aww shoot, I worked around the issue for stationDetail, but it looks like the inverterDetail also causes issues with some people.

I'm still at loss what causes these errors, I'm 95% sure it's on Solis side.

hultenvp avatar Dec 27 '22 10:12 hultenvp

Hi, I've also tried newest version 3.2.2 but still no success. So I've just added some debug information in file soliscloud_api.py --> async def _post_data_json() async def _post_data_json(self, canonicalized_resource: str, params: dict[str, Any]) -> dict[str, Any]: """ Http-post data to specified domain/canonicalized_resource. """

    header: dict[str, str] = self._prepare_header(params, canonicalized_resource)
    result: dict[str, Any] = {SUCCESS: False, MESSAGE: None, STATUS_CODE: None}
    resp = None
    _LOGGER.debug("selfConfigDomain")
    _LOGGER.debug(self.config.domain)
    _LOGGER.debug("params")
    _LOGGER.debug(params)
    if self._session is None:
        return result
    try:
        async with async_timeout.timeout(20):
            url = f"{self.config.domain}{canonicalized_resource}"
            resp = await self._session.post(url, json=params, headers=header)
            result[STATUS_CODE] = resp.status
            result[CONTENT] = await resp.json()
            if resp.status == HTTPStatus.OK:
                result[SUCCESS] = True
                result[MESSAGE] = "OK"
            else:
                result[MESSAGE] = "Got http statuscode: %d" % (resp.status)
    except (asyncio.TimeoutError, ClientError) as err:
        result[MESSAGE] = f"{repr(err)}"
        _LOGGER.debug("Error from URI (%s) : %s", `canonicalized_resource,` result[MESSAGE])
    finally:
        if resp is not None:
            await resp.release()
        _LOGGER.debug("finally_Post_Data_Json")
        _LOGGER.debug(result)
        return result

This will create this kind of logentries: 2022-12-23 20:47:10.896 DEBUG (MainThread) [custom_components.solis.soliscloud_api] selfConfigDomain 2022-12-23 20:47:10.896 DEBUG (MainThread) [custom_components.solis.soliscloud_api] https://www.soliscloud.com:13333 2022-12-23 20:47:10.896 DEBUG (MainThread) [custom_components.solis.soliscloud_api] params 2022-12-23 20:47:10.896 DEBUG (MainThread) [custom_components.solis.soliscloud_api] {'stationId': '19DigitNumber'} 2022-12-23 20:47:10.905 DEBUG (MainThread) [custom_components.solis.soliscloud_api] workarounds: {'correct_daily_on_grid_energy_enabled': False} 2022-12-23 20:47:10.907 DEBUG (MainThread) [custom_components.solis.soliscloud_api] selfConfigDomain 2022-12-23 20:47:10.907 DEBUG (MainThread) [custom_components.solis.soliscloud_api] https://www.soliscloud.com:13333 2022-12-23 20:47:10.907 DEBUG (MainThread) [custom_components.solis.soliscloud_api] params 2022-12-23 20:47:10.907 DEBUG (MainThread) [custom_components.solis.soliscloud_api] {'stationId': '19DigitNumber'} 2022-12-23 20:47:17.395 DEBUG (MainThread) [custom_components.solis.soliscloud_api] finally_Post_Data_Json 2022-12-23 20:47:17.395 DEBUG (MainThread) [custom_components.solis.soliscloud_api] {'Success': True, 'Message': 'OK', 'StatusCode': 200, 'Content': {'success': True, 'code': '1', 'msg': '数据异常 请联系管理员', 'data': None}}

Maybe that helps ? I don't have too much experience in python... Have worked more with C#. If you can give me a pointer, where to add more logfile output, just let me know. Looks like the code 1 is not as expected.

Thanks @luftdieb: It confirms what we see. For some users the API just refuses to respond with data. Now, if I read correctly, also userStationList rejects the request for you.

I'm still trying to find the root cause, and I'm still chasing 1 lead, maybe you or anyone reading along can help: 2 people have given me their credentials to test and what I see is that in all calls that fail either their sign or their MD5 has a slash ('/') in the b64 encoded string. I'm not that well informed about HTTP headers, but it might be that that confuses the server. Maybe someone knows if that's an issue or not and if it is how to escape it.

hultenvp avatar Dec 27 '22 11:12 hultenvp

Maybe something is wrong with signature calculation ? In manual there is encryption HmacSHA1 mentioned.

The code does a HmacSha1. Also it works fine for a lot of people, a significant subset does have issues however.

hultenvp avatar Dec 27 '22 11:12 hultenvp

v3.2.2

2022-12-23 17:07:15.697 INFO (MainThread) [custom_components.solis.soliscloud_api] /v1/api/inverterDetail responded with error: 1:数据异常 请联系管理员 <<< uncle Google says 'the data is abnormal, please contact administrator'
2022-12-23 17:07:15.697 WARNING (MainThread) [custom_components.solis.soliscloud_api] No inverters found

Aww shoot, I worked around the issue for stationDetail, but it looks like the inverterDetail also causes issues with some people.

I'm still at loss what causes these errors, I'm 95% sure it's on Solis side.

I have similar issues. Getting a 200 response but the data is empty. The msg in the response translates to contact the provider. I have contacted Solis about this, when they get back to me I will post it here

JJ-Joris avatar Dec 27 '22 14:12 JJ-Joris

what I see is that in all calls that fail either their sign or their MD5 has a slash ('/') in the b64 encoded string. I'm not that well informed about HTTP headers, but it might be that that confuses the server.

Aha, that rings a bell. I bet it needs to be encoded using URL encoding (use %2F instead of the '/' char). I've seen that with other API services.

jmason avatar Dec 27 '22 16:12 jmason

or it could be that this would be the right type of base64 to use: https://docs.python.org/3/library/base64.html#base64.urlsafe_b64encode

jmason avatar Dec 27 '22 16:12 jmason

I've tried it out quickly by replacing both base64.b64encode() to base64.urlsafe_b64encode(). But still same problem.

I'm trying to build a small python script, which just build the Content-MD5 Encryption and signature string to try it out by postman. Maybe that give us more hints...

luftdieb avatar Dec 27 '22 17:12 luftdieb

Maybe I'm totally wrong. But I've create a small C# application, which create the "Content-MD5" header and even the Authorization header key and make a post to the solis URL with the effect, getting the same errormessage. But interessting is, I've got an System.FormatExecption while I've added the 4 headers (Content-MD5, Content-Type, Date, Authorization) which lead me to this website https://stackoverflow.com/questions/61554970/how-to-set-content-md5-header-in-get-method-using-httpclient Here it is described, all members starting with "Content-" will be removed and have to be added in a different way.

So I've tried this also in postman, without add Content-MD5, Content-Type to my POST request and I'm getting the same returncode, compared to youre python script: image

Therefore I'm asking the question, is the format how we define the header the right way ? But it looks exactly, how it is described in solis API manual image

luftdieb avatar Dec 27 '22 21:12 luftdieb

Nice discussion and thanks for the investigation! Good (or bad..) to see confirmed that with a C# implementation t fails in the same way.

@luftdieb : It could very well be that there is an issue in the header spec, but why does it work for one set of people and not for the others? Also because the server responds with "Malformed data", that suggests the issue is on the server side?

Yesterday I found a case where the "Malformed data" also occurred with a header that did not contain any slashes, so it seems that is not the base 64 encoding causing the issue.

To summarize:

  • The issue occurs with a subset of the users
  • The issue appears to be constant per user for certain calls: some report it on stationDetail, some on inverterDetail others again on other calls. So workarounds are only partially effective.
  • The issue appears to be constant; if you suffer from it, you suffer from it always in the same way.
  • URL safe header encoding or escaping '/' with %2F do not have the desired effect.
  • People reporting the issue seem to be able to access the data normally via the web application, so the data is there and it is not corrupted.

Other than finding more confirmation for the above I do not see many leads still to follow. As said I'm getting more and more convinced this is a server side issue and it looks like the only thing we can do os make a strong case for Solis to investigate by giving them an easy reproduction scenario.

Does anyone have more ideas?

hultenvp avatar Dec 28 '22 08:12 hultenvp

Maybe I'm totally wrong. But I've create a small C# application, which create the "Content-MD5" header and even the Authorization header key and make a post to the solis URL with the effect, getting the same errormessage. But interessting is, I've got an System.FormatExecption while I've added the 4 headers (Content-MD5, Content-Type, Date, Authorization) which lead me to this website https://stackoverflow.com/questions/61554970/how-to-set-content-md5-header-in-get-method-using-httpclient Here it is described, all members starting with "Content-" will be removed and have to be added in a different way.

So I've tried this also in postman, without add Content-MD5, Content-Type to my POST request and I'm getting the same returncode, compared to youre python script: image

Therefore I'm asking the question, is the format how we define the header the right way ? But it looks exactly, how it is described in solis API manual image

Re-reading your post. This is indeed interesting. So you ay that if you leave out the Content-MD5 and Content-Type you get exactly the same error message as in Python and if you add them that you get a "system format exception".

So this tells me that we should focus on the MD5. I still think the python code does not remove the content-* fields from the header, because part of the users does get the right output, but maybe in some cases the MD5 gets messed up. Either in Base 64 or the MD5 itself.

hultenvp avatar Dec 28 '22 08:12 hultenvp

Currently, I'm just getting 408. I don't know, if they do some maintenance or if they block my IP because of too many invalid requests ...

luftdieb avatar Dec 28 '22 09:12 luftdieb

Currently, I'm just getting 408. I don't know, if they do some maintenance or if they block my IP because of too many invalid requests ...

408 means your system time deviates more than 15 mins from server time. Probably you're running in a VM.

hultenvp avatar Dec 28 '22 10:12 hultenvp

Problem with 408 was caused by opened connection of my C# code in the background.

I've tried to change the header to content part. But problem still remain //request.Content.Headers.Add("Content-MD5", contentMd5); --> This cause formerly reported system format exception request.Content.Headers.ContentMD5 = MD5.HashData(Encoding.UTF8.GetBytes(body)); /this cause no execption and header is included in request. but still same output

I will try to open a ticket at support of soliscloud.

luftdieb avatar Dec 28 '22 10:12 luftdieb

fwiw I opened support ticket #117702 the other day regarding this issue and this is their response so far (ticket is "Awaiting other's Support")

Shahbaz Khan said 2 days ago

Hello Solis,

We will check and update you.



Ticket no# 117702
[https://solis-service.solisinverters.com/helpdesk/tickets/117702 ](https://solis-service.solisinverters.com/helpdesk/tickets/117702%C2%A0)

 
Thank you for choosing Ginlong Solis!
 
Sincerely,
Shahbaz Khan
 
Ginlong Solis UK Service Team

devinmitchell avatar Dec 28 '22 11:12 devinmitchell

Last few days I've been working at cleaning up the soliscloud API. Still al lot of work to do, but oddly I just noticed the new API seems to work with key/secrets that failed before!

I didn't have much time yet to investigate. I do get the ID's from the responses, instead of coded. For the rest there are not many changes in the header encoding.

If you want to test yourself: I've dropped the current version here: https://github.com/hultenvp/solis-sensor/tree/master/test

Make sure you have both the soliscloud_api directory and its contents and the apitest_async.py file. Add your key and secret and you're good to go. If you call with -v option then the test app will also output the JSON from the responses.

hultenvp avatar Dec 28 '22 16:12 hultenvp

I've tested it... But unfortunatly, it will give the same result D:\test\solis-sensor\test>python soliscloud_test.py -v

{"code": "1", "data": null, "msg": "\u6570\u636e\u5f02\u5e38 \u8bf7\u8054\u7cfb\u7ba1\u7406\u5458", "success": true}

\u6570\u636e\u5f02\u5e38 \u8bf7\u8054\u7cfb\u7ba1\u7406\u5458 --> 数据异常 请联系管理员 --> "The data is abnormal, please contact the administrator"

There was also a typo error in line 33. But same result after fixing it and for sure I've updated line 34 and 11+12 CanonicalizedResource = "/v1/api/inveterDetail" --> CanonicalizedResource = "/v1/api/inverterDetail"

But interessting is, the output above was the same with and without typo error. Looks like, the API endpoint wasn't used and the error is show in general.

luftdieb avatar Dec 28 '22 16:12 luftdieb

Hi @luftdieb:

There was also a typo error in line 33

They fixed the endpoint typo in their v1.2. before that you had to call the typo one. Now both work.

I've tested it... But unfortunatly, it will give the same result D:\test\solis-sensor\test>python soliscloud_test.py -v

That's to be expected if you still execute the original test app :-). Use apitest_async.py. interested to learn what you see. Best to first run without -v, gives you better readable output.

hultenvp avatar Dec 28 '22 17:12 hultenvp