Fockaert / rika-firenet-custom-component

MIT License
20 stars 17 forks source link

Unable To log with my credentials #13

Closed ppailleaud closed 2 years ago

ppailleaud commented 3 years ago

Hello,

I installed your add on on my home assistant. However when I try to log in with my credentials used on the url https://www.rika-firenet.com/web/login. This tells me Username / Password is wrong. So I don't understand. Do you have an idea ? I analyzed logs and i found


 File "/usr/src/homeassistant/homeassistant/util/async_.py", line 140, in check_loop
    raise RuntimeError(
RuntimeError: I/O must be done in the executor; Use `await hass.async_add_executor_job()` at custom_components/rika_firenet/core.py, line 64: postResponse = self._client.post('https://www.rika-firenet.com/web/login', data)

Do you have an idea ? My version of home assitant is Home Assistant 2021.6.2 Thank by advance for your response

Fockaert commented 3 years ago

Hi @ppailleaud ,

Could be that HA became more strict on this async cases, I'll later this week. Did you had other error messages related to this?

Thanks, Jan

ppailleaud commented 3 years ago

Hello, Thanks for your reply. No i only have this error. I can send you a full stack if you want ?

Pierrick

AHE63 commented 3 years ago

2021-06-17 19:25:58 INFO (MainThread) [custom_components.rikafirenet.core] setup() 2021-06-17 19:25:58 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 rika_firenet doing I/O at custom_components/rika_firenet/core.py, line 64: postResponse = self._client.post('https://www.rika-firenet.com/web/login', data) 2021-06-17 19:25:58 ERROR (MainThread) [custom_components.rika_firenet.config_flow] test_credentials_exception Traceback (most recent call last): File "/config/custom_components/rika_firenet/config_flow.py", line 68, in _test_credentials coordinator.setup() File "/config/custom_components/rika_firenet/core.py", line 47, in setup self._stoves = self.setup_stoves() File "/config/custom_components/rika_firenet/core.py", line 92, in setup_stoves self.connect() File "/config/custom_components/rika_firenet/core.py", line 64, in connect postResponse = self._client.post('https://www.rika-firenet.com/web/login', data) File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 590, in post return self.request('POST', url, data=data, json=json, kwargs) File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 542, in request resp = self.send(prep, send_kwargs) File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 655, in send r = adapter.send(request, kwargs) File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 439, in send resp = conn.urlopen( File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen httplib_response = self._make_request( File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 394, in _make_request conn.request(method, url, httplib_request_kw) File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 234, in request super(HTTPConnection, self).request(method, url, body=body, headers=headers) File "/usr/local/lib/python3.8/http/client.py", line 1252, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/local/lib/python3.8/http/client.py", line 1263, in _send_request self.putrequest(method, url, *skips) File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 214, in putrequest return _HTTPConnection.putrequest(self, method, url, args, **kwargs) File "/usr/src/homeassistant/homeassistant/util/async_.py", line 151, in protected_loop_func checkloop() File "/usr/src/homeassistant/homeassistant/util/async.py", line 140, in check_loop raise RuntimeError( RuntimeError: I/O must be done in the executor; Use await hass.async_add_executor_job() at custom_components/rika_firenet/core.py, line 64: postResponse = self._client.post('https://www.rika-firenet.com/web/login', data)

cobwash commented 3 years ago

I had the same issue. I altered the config_flow.py file lines 27-36 to be as follows (note, this bypasses the credential check so be sure that the username and password are correct, also note, I had to alter the indentation of various lines in this group to prevent an error about incorrect indenting): image screenshot to show indenting

Fockaert commented 3 years ago

Thanks @cobwash , feel free to create PR with the changes (not the bypass of credential check :-) ).

Some methods needs to be updated to be async, as HA is becoming more strict on this. I created #4 already for this.

cobwash commented 3 years ago

Hi @Fockaert.

Alas, I don't actually know python nor how to actually fix the issue properly. I can read and understand what it does, I also grasp the concept of what the fix is, but how to implement is far outside my area of competence. I was kind of hoping you would be able to fix it if I pointed out where the issue was. The prior comment's error indicated what the fix is. I do note that you use that await hass.async_add_executor_job() method elsewhere so guess you know how to implement it.

Fockaert commented 3 years ago

@cobwash that's fine, no worries. I've committed a fix on master for this, please try again @ppailleaud

Thanks, Jan

cobwash commented 3 years ago

@Fockaert for me at least, after another complete reinstall with this latest version I can install and configure everything correctly without any modifications. temps etc are working. Looks like that has sorted it till HA change something else their end.

Cheers.