bouwew / sems2mqtt

GoodWe SEMS MQTT-componenent for Home Assistant
MIT License
10 stars 9 forks source link

Fix detected I/O inside the event loop issue #2

Closed ovid-io closed 3 years ago

ovid-io commented 4 years ago

This PR fixes the below issue with HA 0.109+

2020-05-04 11:24:21 WARNING (MainThread) [homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sems2mqtt doing I/O at custom_components/sems2mqtt/__init__.py, line 116: r = requests.post(base_url + url, headers=headers, data=payload, timeout=20)

2020-05-04 11:24:21 WARNING (MainThread) [homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sems2mqtt doing I/O at custom_components/sems2mqtt/__init__.py, line 124: r = requests.post(global_url + 'v1/Common/CrossLogin', headers=headers, data=loginPayload, timeout=20)
UnrealKazu commented 3 years ago

Can confirm that this indeed fixes the issue. Would be great if it can be merged.

GLD-NL commented 3 years ago

I can also confirm that this fixed the issue. Great work!

Thanks a lot.

bouwew commented 3 years ago

@ovid-io @GLD-NL Thanks guys! I had not noticed this PR for some reason. I will follow the changes that are proposed, plus a few more, they will be released in version 0.2.0.

bouwew commented 3 years ago

@ovid-io @GLD-NL I see that another user of a fork is using SEMS API v2. I wonder if that is an update that I should include.

Could you test the v2 API? Also, would you mind testing the latest sems2mqtt beta version v0.2.0b6?

ovid-io commented 3 years ago

Hi @bouwew, I'm unsure about v2 api, if you can point me to the right direction happy to test

bouwew commented 3 years ago

@ovid-io I got the idea from here https://github.com/videgro/sems2mqtt/commit/a98458963b222fca3a114fe45ac5bb8a47c502a2 I think the v2 API shows more sensors, look at the other changes in the newer commits: https://github.com/videgro/sems2mqtt/commits/master

But, I'm also thinking this new API could be related to newer types of GoodWe solar inverters.

Anyway, please try the v0.2.0b6 version first and let me know if that version works OK. If OK, please change the API version to 2 in the code and let me know what that does for you.