Closed marzzed closed 1 week ago
Hi,
same here, have you been able to narrow the problem down ?
thank you
Nope :(
Hi again, I have fixed this warning on my side (I forked the repo) but this isn't the rootcause of the problem. I think that Toshiba servers are down sometimes and if you restart HA while the servers are down this is dead I have the following traces, where the API returns HTML instead of JSON, so probably a server error. Which is strange is that the mobile app seems to work correctly in parallel (not sure about that though because I may not have checked the app at the exact same time as HA was restarting).
I think retry has to be done on the integration until it gets a connection
2024-06-14 12:01:09.723 ERROR (MainThread) [homeassistant.components.climate] Error while setting up toshiba_ac platform for climate
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 366, in _async_setup_platform
await asyncio.shield(awaitable)
File "/config/custom_components/toshiba_ac/climate.py", line 50, in async_setup_entry
devices = await device_manager.get_devices()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/toshiba_ac/device_manager.py", line 185, in get_devices
await asyncio.gather(*connects)
File "/usr/local/lib/python3.12/site-packages/toshiba_ac/device/__init__.py", line 112, in connect
await self.load_additional_device_info()
File "/usr/local/lib/python3.12/site-packages/toshiba_ac/device/__init__.py", line 120, in load_additional_device_info
additional_info = await self.http_api.get_device_additional_info(self.ac_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/toshiba_ac/utils/http_api.py", line 173, in get_device_additional_info
res = await self.request_api(self.AC_STATE_PATH, get=get)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/toshiba_ac/utils/http_api.py", line 98, in request_api
json = await response.json()
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1176, in json
raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('https://mobileapi.toshibahomeaccontrols.com/api/AC/GetCurrentACState?ACId=XXXXXXXXXXXXXXXXX')```
I am on it.... trying to investigate and fix this Apparently the credentials are rejected. I suspect the SAS token (generated at 1st request) is not valid or expires
Ok nevermind, I forked an old revision, @h4de5 is already on it and fixed it : the problem was the sas token that becomes invalid and he added a renewal. On my fork I just removed it from the init (generated at each startup). Anyway it works again on my side with my modifications : https://github.com/albaintor/home-assistant-toshiba_ac I guess it will also with @h4de5 's upcoming release
Also @h4de5 you can grab some of my modifications on climate.py : I added 3 missing methods and features that raise warning on HASS start Basically : add those 2 features line 77
| ClimateEntityFeature.TURN_ON
| ClimateEntityFeature.TURN_OFF
And those 3 methods :
async def async_turn_on(self) -> None:
await self._device.set_ac_status(ToshibaAcStatus.ON)
async def async_turn_off(self) -> None:
await self._device.set_ac_status(ToshibaAcStatus.OFF)
async def async_toggle(self) -> None:
state = self._device.ac_status
if state == ToshibaAcStatus.OFF:
await self.async_turn_on()
else:
await self.async_turn_off()
The message: "Attempt to decode JSON with unexpected mimetype: text/html" indicates that the (rather instable) toshiba API returned something unstable. In most cases it is enough to reload the the integration. it could be possible, that they implemented some kind of rate limiting, so at some point too many requests could prevent it from working for a while.
the warning has been fixed and released thanks to another great contribution!!
The integration becomes unresponsive almost immediately after restart. Some times it helpes to restart the integration but its 50/50.
Error: Logger: homeassistant.components.climate Source: components/climate/init.py:363 integration: Climate (documentation, issues) First occurred: 20:34:26 (1 occurrences) Last logged: 20:34:26
Entity None (<class 'custom_components.toshiba_ac.climate.ToshibaClimate'>) implements HVACMode(s): off, auto, cool, heat, dry, fan_only and therefore implicitly supports the turn_on/turn_off methods without setting the proper ClimateEntityFeature. Please create a bug report at https://github.com/h4de5/home-assistant-toshiba_ac/issues