`simplipy` should remove request retries on known-to-be-fatal errors
Closed this issue · 2 comments
FlyingDiver commented
Code is:
async def _async_set_pin(self, system, label, pin):
self.logger.threaddebug(f"_async_set_pin: system = {system.system_id}, label = {label}, pin = {pin}")
try:
await system.async_set_pin(label, pin)
except Exception as e:
self.logger.error(f"_set_pin: {e}")
Console output is:
Giving up _async_api_request(...) after 4 tries (aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url=URL('https://api.simplisafe.com/v1/ss3/subscriptions/XXX/settings/pins'))
Any ideas?
bachya commented
I just tried this via Home Assistant, which uses that exact same idea: https://github.com/home-assistant/core/blob/08c5c6ca1c2cf4ece207697ba1e8ca10b843cddd/homeassistant/components/simplisafe/__init__.py#L361-L365
...and everything worked as expected:
Maybe try setting your logs to DEBUG
and see if that gives you any clues?
FlyingDiver commented
Hah. SimpliSafe refuses to allow '1234' for a PIN. The library should probably catch this error and raise it instead of failing in the backoff retry.
2022-06-27 18:58:30.510 DEBUG simplipy._async_api_request Data received from /ss3/subscriptions/XXX/settings/pins: {'type': 'PinError', 'message': 'Pins cannot be set to "1234"', 'code': '206', 'statusCode': 400, 'props': {}}