Closed fouram closed 3 months ago
Interestingly, the AC unit I'm trying to control is now responding, but I still receive the error every time...
@fouram can you include the full error log and stack trace? This only includes the request and not the response
This is what I'm seeing with debug logging turned on:
2024-06-19 23:38:21.422 ERROR (SyncWorker_30) [root] Expecting value: line 1 column 1 (char 0)
2024-06-19 23:38:21.423 WARNING (SyncWorker_30) [root] Received an unexpected response:
b''
2024-06-19 23:38:21.423 WARNING (SyncWorker_30) [root] Error processing request:
PUT https://api.us.ocp.electrolux.one/appliance/api/v2/appliances/950133022_00:65219839-6C0B84C76C11/command
headers={'x-api-key': '<key redacted>', 'Authorization': 'Bearer <bearer redacted>', 'Accept': 'application/json', 'Accept-Charset': 'UTF-8', 'User-Agent': 'Ktor client', 'Content-Type': 'application/json'}
payload={"mode": "COOL"}
2024-06-19 23:38:23.588 ERROR (SyncWorker_30) [root] Expecting value: line 1 column 1 (char 0)
2024-06-19 23:38:23.588 WARNING (SyncWorker_30) [root] Received an unexpected response:
b''
2024-06-19 23:38:23.588 WARNING (SyncWorker_30) [root] Error processing request:
PUT https://api.us.ocp.electrolux.one/appliance/api/v2/appliances/950133022_00:65219839-6C0B84C76C11/command
headers={'x-api-key': '<key redacted>', 'Authorization': 'Bearer <bearer redacted>', 'Accept': 'application/json', 'Accept-Charset': 'UTF-8', 'User-Agent': 'Ktor client', 'Content-Type': 'application/json'}
payload={"mode": "COOL"}
2024-06-19 23:38:23.590 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140371977003232] Unexpected exception
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/requests/models.py", line 974, in json
return complexjson.loads(self.text, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/simplejson/__init__.py", line 514, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/simplejson/decoder.py", line 386, in decode
obj, end = self.raw_decode(s)
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/simplejson/decoder.py", line 416, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/frigidaire/__init__.py", line 504, in parse_response
response_dict = response.json()
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/requests/models.py", line 978, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/frigidaire/__init__.py", line 564, in put_request
return self.parse_response(response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/frigidaire/__init__.py", line 507, in parse_response
raise FrigidaireException(f'Received an unexpected response:\n{response.content}')
frigidaire.FrigidaireException: Received an unexpected response:
b''
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/frigidaire/__init__.py", line 475, in execute_action
self.put_request(self.regional_base_url,
File "/usr/local/lib/python3.12/site-packages/frigidaire/__init__.py", line 566, in put_request
self.handle_request_exception(e, "PUT", f'{url}{path}', headers, encoded_data)
File "/usr/local/lib/python3.12/site-packages/frigidaire/__init__.py", line 517, in handle_request_exception
raise FrigidaireException(error_str)
frigidaire.FrigidaireException: Error processing request:
PUT https://api.us.ocp.electrolux.one/appliance/api/v2/appliances/950133022_00:65219839-6C0B84C76C11/command
headers={'x-api-key': '<key redacted>', 'Authorization': 'Bearer <bearer redacted>', 'Accept': 'application/json', 'Accept-Charset': 'UTF-8', 'User-Agent': 'Ktor client', 'Content-Type': 'application/json'}
payload={"mode": "COOL"}
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/requests/models.py", line 974, in json
return complexjson.loads(self.text, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/simplejson/__init__.py", line 514, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/simplejson/decoder.py", line 386, in decode
obj, end = self.raw_decode(s)
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/simplejson/decoder.py", line 416, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/frigidaire/__init__.py", line 504, in parse_response
response_dict = response.json()
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/requests/models.py", line 978, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/frigidaire/__init__.py", line 564, in put_request
return self.parse_response(response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/frigidaire/__init__.py", line 507, in parse_response
raise FrigidaireException(f'Received an unexpected response:\n{response.content}')
frigidaire.FrigidaireException: Received an unexpected response:
b''
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 241, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2741, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2784, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 977, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1049, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 754, in async_set_hvac_mode
await self.hass.async_add_executor_job(self.set_hvac_mode, hvac_mode)
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/frigidaire/climate.py", line 263, in set_hvac_mode
self._client.execute_action(
File "/usr/local/lib/python3.12/site-packages/frigidaire/__init__.py", line 480, in execute_action
self.put_request(self.regional_base_url,
File "/usr/local/lib/python3.12/site-packages/frigidaire/__init__.py", line 566, in put_request
self.handle_request_exception(e, "PUT", f'{url}{path}', headers, encoded_data)
File "/usr/local/lib/python3.12/site-packages/frigidaire/__init__.py", line 517, in handle_request_exception
raise FrigidaireException(error_str)
frigidaire.FrigidaireException: Error processing request:
PUT https://api.us.ocp.electrolux.one/appliance/api/v2/appliances/950133022_00:65219839-6C0B84C76C11/command
headers={'x-api-key': '<key redacted>', 'Authorization': 'Bearer <bearer redacted>', 'Accept': 'application/json', 'Accept-Charset': 'UTF-8', 'User-Agent': 'Ktor client', 'Content-Type': 'application/json'}
payload={"mode": "COOL"}
Am i just getting empty responses that the json parser doesn't like?
I too have this issue where i get an error message but the AC still functions as expected.
Same
Any thoughts on resolution? Roll back perhaps? My devices are not functional after the PUT error occurs.
If rollback is the right answer, do we know ow a hash ID of it last working?
If rollback is the right answer, do we know ow a hash ID of it last working?
I reverted my code to https://github.com/bm1549/home-assistant-frigidaire/tree/d85d58a9222af0fb95814a611126eebdfc669d6f and it seems to be holding up. Works better than the current HEAD.
I had the same issue, rolling back to d85d58a like amaisano fixed it for me.
Also can confirm that rolling back worked for me. If you cloned the repo, you can go into the main home-assistant-frigidare directory and do git reset --hard d85d58a
and then copy the folder contents into your homeassistant/custom_components/frigidaire directory (delete the old files first, or back up the frigidaire directory first, just in case)
I do wonder if this is just putting a band-aid on a bigger problem though; the most recent commit says it's showing error message more clearly; i wonder if this error has been happening the whole time and we're only noticing it because of the recently added error notification. So, I am interested to follow this further and if there is any more detail you need from me, please do let me know!
Also: Is it normal for anyone else when making control changes in HomeAssistant to have the dashboard react, then revert to the previous settings; but the AC unit actually does change, and then the Lovelace cards once again catch up after a minute or two? It sounds like the control requests aren't being acknowledged, the UI rolls it back because of that, but the AC is still changing and the next time it's polled for status it reports successfully. This has been happening to me as long as I've been using this integration, and I always chalked it up to Frigidaire being generally janky (and you've seen their apps...yikes), but now I'm wondering if this is something weird about my account/session causing an unexpected edge case with the integration?
I do wonder if this is just putting a band-aid on a bigger problem though; the most recent commit says it's showing error message more clearly; i wonder if this error has been happening the whole time and we're only noticing it because of the recently added error notification. So, I am interested to follow this further and if there is any more detail you need from me, please do let me know!
to be clear, the integration did not work for me when I checked out HEAD - I would get the error messages and the AC itself didn't change temp/whatever. So this is definitely an improvement for me, not just hiding an error message.
Also: Is it normal for anyone else when making control changes in HomeAssistant to have the dashboard react, then revert to the previous settings; but the AC unit actually does change, and then the Lovelace cards once again catch up after a minute or two? It sounds like the control requests aren't being acknowledged, the UI rolls it back because of that, but the AC is still changing and the next time it's polled for status it reports successfully. This has been happening to me as long as I've been using this integration, and I always chalked it up to Frigidaire being generally janky (and you've seen their apps...yikes), but now I'm wondering if this is something weird about my account/session causing an unexpected edge case with the integration?
Yep, I see this behavior too - not every time, but more often than not.
Is that behavior normal for non-optimistic entities? I think the default polling for this integration is 30 seconds. So you click COOL, it will briefly stick, then immediately revert to the previous state... then between 1 and 30 seconds later it will move to the intended position.
You might be able to get around this by customizing the entity to be optimistic? I've never tried. I just increased my polling frequency to 10 (YMMV with API lockouts).
Hey folks, can y'all try #62 and let me know if it helps?
@amaisano - When I wrote the home bridge plugin long ago for Frigidaire, you had to update both the HAP object when issuing the command to avoid this issue.
After upgrading to the latest version, I receive this error (or similar) anytime I attempt to do anything from HomeAssistant:
Failed to call service climate/set_temperature. Error processing request: PUT https://api.us.ocp.electrolux.one/appliance/api/v2/appliances/950133022_00:65219839-6C0B84C76C11/command headers={'x-api-key': '<redacted>', 'Authorization': 'Bearer <redacted>', 'Accept': 'application/json', 'Accept-Charset': 'UTF-8', 'User-Agent': 'Ktor client', 'Content-Type': 'application/json'} payload={"temperatureRepresentation": "FAHRENHEIT"}