asterisk-hass-integration icon indicating copy to clipboard operation
asterisk-hass-integration copied to clipboard

Update for sensor.asterisk_extension_2004 fails

Open pergolafabio opened this issue 3 years ago • 1 comments

When PBX was down for a maintenance, seems the integration is not reconnecting anymore, log is flooded with messages like below, even when its up... HA restart is needed then


2021-12-22 10:10:53 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.asterisk_extension_2004 fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 487, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 691, in async_device_update
    raise exc
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/asterisk/sensor.py", line 141, in update
    self._astmanager.extension_state(self._extension, "")
  File "/usr/local/lib/python3.9/site-packages/asterisk/manager.py", line 637, in extension_state
    response = self.send_action(cdict)
  File "/usr/local/lib/python3.9/site-packages/asterisk/manager.py", line 259, in send_action
    raise ManagerException("Not connected")
asterisk.manager.ManagerException: Not connected

pergolafabio avatar Dec 22 '21 09:12 pergolafabio

Tried to implement a reconnect function when Asterisk shutsdown, but the AMI library (Pyst2) has a bug related to threading when reconnecting. And because pyst2 is pretty much dead it seems like, I will try to use python-ami instead.

See #57

TECH7Fox avatar May 27 '22 02:05 TECH7Fox