Update Yale Smart Alarm Client

I’ve given it the thumbs up.

Thanks for your support

Hi
Is anyone having timeout issues since the new update?

The PR has not been merged yet so nothing has been updated.

Unless you mean the actual PR, that timed out a while ago :laughing:

Sorry
I thought this might have changed something.

Hi,
Since the latest update after a couple of days I see the following error.
It seems it fails to fetch a new token

Logger: homeassistant.helpers.entity
Source: components/yale_smart_alarm/alarm_control_panel.py:97
First occurred: 5 July 2021, 23:06:16 (191 occurrences)
Last logged: 6:58:40

Update for alarm_control_panel.yale_smart_alarm fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 350, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 566, in async_device_update
    await task
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/yale_smart_alarm/alarm_control_panel.py", line 97, in update
    armed_status = self._client.get_armed_status()
  File "/usr/local/lib/python3.8/site-packages/yalesmartalarmclient/client.py", line 140, in get_armed_status
    alarm_state = self.auth.get_authenticated(self._ENDPOINT_GET_MODE)
  File "/usr/local/lib/python3.8/site-packages/backoff/_sync.py", line 94, in retry
    ret = target(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/yalesmartalarmclient/auth.py", line 60, in get_authenticated
    self._authorize()
  File "/usr/local/lib/python3.8/site-packages/backoff/_sync.py", line 94, in retry
    ret = target(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/yalesmartalarmclient/auth.py", line 118, in _authorize
    response.raise_for_status()
  File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 943, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://mob.yalehomesystem.co.uk/yapi/yapi/o/token/

The error goes only once I’ve restarted HA

Is the yale integration not working or just throwing the error on start ?

I’m running the latest ha version and not seeing any issues with the integration itself. I will admit I have not checked the logs as I had no need to ha.

@ha_irish
It works fine once I restart HA then 3-4days later it starts throwing up this error every few seconds

Hmm not too sure. My logs seem clean and I’m not having issues with the yale integration itself.

I’m seeing the same behaviour. Integration stops working with token error after a few days. Restarting HA fixes it. Very annoying!

the below pull request seems to have stalled, maybe this could fix our current issue

Would love to see the pr approved but I don’t see it fixing this issue.

Not sure why it’s working for some people and not others.

Some logs after one of these occasions where the integration has broken after a few days:

Logger: backoff
Source: /usr/local/lib/python3.9/site-packages/backoff/_common.py:119
First occurred: 28 July 2021, 21:40:41 (1700occurrences)
Last logged: 18:22:21


sor.netatmo
2021-07-29 18:26:11 INFO (SyncWorker_40) [backoff] Backing off _authorize(...) for 13.7s (requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://mob.yalehomesystem.co.uk/yapi/yapi/o/token/)
2021-07-29 18:26:18 WARNING (MainThread) [homeassistant.components.alarm_control_panel] Updating yale_smart_alarm alarm_control_panel took longer than the scheduled update interval 0:00:30
2021-07-29 18:26:25 ERROR (SyncWorker_40) [backoff] Giving up _authorize(...) after 8 tries (requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://mob.yalehomesystem.co.uk/yapi/yapi/o/token/)
2021-07-29 18:26:25 INFO (SyncWorker_40) [backoff] Backing off get_authenticated(...) for 0.0s (requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://mob.yalehomesystem.co.uk/yapi/yapi/o/token/)
2021-07-29 18:26:25 INFO (SyncWorker_40) [backoff] Backing off _authorize(...) for 0.4s (requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://mob.yalehomesystem.co.uk/yapi/yapi/o/token/)
2021-07-29 18:26:26 INFO (SyncWorker_40) [backoff] Backing off _authorize(...) for 0.5s (requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://mob.yalehomesystem.co.uk/yapi/yapi/o/token/)
2021-07-29 18:26:26 INFO (SyncWorker_40) [backoff] Backing off _authorize(...) for 1.7s (requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://mob.yalehomesystem.co.uk/yapi/yapi/o/token/)
2021-07-29 18:26:28 INFO (SyncWorker_40) [backoff] Backing off _authorize(...) for 2.2s (requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://mob.yalehomesystem.co.uk/yapi/yapi/o/token/)
2021-07-29 18:26:31 INFO (SyncWorker_40) [backoff] Backing off _authorize(...) for 14.2s (requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://mob.yalehomesystem.co.uk/yapi/yapi/o/token/)


Hey,
I logged the issue on github and was told the new version that can be integrated into HA will be on the next upgrade.

Does the new integration improve the response times at all? I think the current integration I’m using for door contacts only polls the api every 60 seconds.

Does anyone know if this new version will allow you to trigger the panic button?

After updating to Home Assistant 2021.8.1 the integration failed to load.
Was in my config.yaml, but release notes say that the integration should still load and can then just remove config.yaml entry.

That didn’t work. So removed the config entry and integration and installed via the integrations panel and still not working.
Error in log:

Error setting up entry *email_address* for yale_smart_alarm
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 293, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/usr/src/homeassistant/homeassistant/components/yale_smart_alarm/__init__.py", line 19, in async_setup_entry
    if not await hass.async_add_executor_job(coordinator.get_updates):
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/yale_smart_alarm/coordinator.py", line 119, in get_updates
    cycle = self.yale.get_cycle()
AttributeError: 'YaleSmartAlarmClient' object has no attribute 'get_cycle'

Any suggestions?

Thanks.

Same experience here but on 2021.8.2

Rolling back to 2021.7.x build fixes it.