JSONDecodeError to catch when response cannot be received
2022-06-20 17:17:39 ERROR (MainThread) [custom_components.intex_spa] Error fetching intex_spa data:
2022-06-20 17:18:09 ERROR (MainThread) [homeassistant.core] Error executing service: <ServiceCall switch.turn_on (c:01G611X014FMMB0MVRR50BTW7K): entity_id=['switch.spa_power']>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/core.py", line 1722, in catch_exceptions
await coro_or_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1741, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 680, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 964, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 717, in _handle_entity_call
await result
File "/config/custom_components/intex_spa/switch.py", line 86, in async_turn_on
status = await self.coordinator.api.async_set(self._switch_type, True)
File "/usr/local/lib/python3.9/site-packages/intex_spa/intex_spa.py", line 152, in async_set
return await self._async_handle_intent(parameter, expected_state)
File "/usr/local/lib/python3.9/site-packages/intex_spa/intex_spa.py", line 83, in _async_handle_intent
await self.async_update_status()
File "/usr/local/lib/python3.9/site-packages/intex_spa/intex_spa.py", line 139, in async_update_status
return await self._async_handle_intent("status")
File "/usr/local/lib/python3.9/site-packages/intex_spa/intex_spa.py", line 106, in _async_handle_intent
query.render_response_status(received_bytes)
File "/usr/local/lib/python3.9/site-packages/intex_spa/intex_spa_query.py", line 87, in render_response_status
response = json.loads(received_bytes.decode())
File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.9/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
I added firewall rule between my dev host and SPA. Then switched the power switch. First line of log pops up almost instatly, exception shows after 30s timeout. My firewall is set to REJECT packets, not to DROP
JSONDecodeError to catch when response cannot be received
I added firewall rule between my dev host and SPA. Then switched the power switch. First line of log pops up almost instatly, exception shows after 30s timeout. My firewall is set to REJECT packets, not to DROP
Originally posted by @Elkropac in https://github.com/mathieu-mp/homeassistant-intex-spa/issues/10#issuecomment-1160686641