asterisk-hass-integration
asterisk-hass-integration copied to clipboard
Integration started before Asterisk addon fails to connect
During a full system reboot, it happens that this integration starts before the asterisk addon, resulting in the following error.
This error originated from a custom integration.
Logger: custom_components.asterisk
Source: custom_components/asterisk/__init__.py:154
Integration: Asterisk (documentation, issues)
First occurred: 9:09:18 AM (1 occurrences)
Last logged: 9:09:18 AM
Error connecting to Asterisk: Connection refused
Would it be possible to use retry logic to overcome this?
A workaround seems to be to restart Home Assistant after the addon starts.
Yes this is a known issue, that should be fixed by retrying to connect. But the library used has a bug that makes that impossible. So I'm gonna switch to a new maintained library, just haven't got around to it.
Will be fixed by #57
For startup this got fixed. The integration now retries startup until it connects. It still crashes if it disconnects after startup, but you can manually reload it for now. Let me know if you got any issues left.
I have somewhat similar situation but since there is no other post about it I will detail it here. The add-on does not connect and the error is:
Connection error while connecting to localhost:5038: Connection refused When dumping the log I get the following:
[homeassistant.config_entries] Config entry 'localhost' for asterisk integration not ready yet: Connection error while connecting to localhost:5038: Connection refused; Retrying in background
Sometimes it works after a HA restart OK but most of the time it does not. It usually happens after an HA Core update is being performed and after the HA restart it is stuck in this state.
@niraviry are you restarting the add-on? Then it crashes and you need to manually reload the integration for now. But when restarting the entire HA, it should retry until succeeding.
Do you have the latest version of the integration?
I do have the latest version and it is true for all last 4 versions or so.
Any suggestions?
@niraviry it's weird. Normally the integration should only stop working when the add-on is restarting, not the other way around. Is there anything in the asterisk logs?
HA logs while filtering for Asterisk in the main log shows the above error twice and that's it. Don't mind the Hebrew. It is just the date. It is still in the same state for a few days. It might fix itself whenever it fills. If choosing Asterisk from the side list of integrations and add-ons, no errors at all.
Any other location to get the log?
Logger: homeassistant.config_entries Source: config_entries.py:1113 First occurred: 24 בדצמבר 2022 בשעה 19:35:07 (6 occurrences) Last logged: 26 בדצמבר 2022 בשעה 13:33:48
Config entry 'localhost' for asterisk integration not ready yet: Connection error while connecting to localhost:5038: Connection refused; Retrying in background
Just rebooted HA again due to other reseaon (LG Integration update) and now it is OK.