Skip to content

Commit 145fb05

Browse files
committed
Add logging of supervisor hostname resolution. Remove unsupported architectures.
1 parent bb3c8c0 commit 145fb05

6 files changed

Lines changed: 20 additions & 87 deletions

File tree

.github/workflows/build-armhf.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/build-armv7.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/build-i386.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

ha-sip/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ If you find ha-sip useful, consider starring ⭐ the [GitHub repo](https://githu
77
- Fix not able to jump to certain menu IDs (thanks nbe95@github for the fix!)
88
- Allow use of MQTT also inside supervisor mode
99
- Update pjsip to latest version
10+
- Remove unsupported architectures i386, armhf and armv7
1011

1112
#### Backward incompatible changes for stand-alone mode: use `GLOBAL_OPTIONS` instead of individual environment variables to configure MQTT.
1213

ha-sip/config.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
"description": "Home-Assistant SIP Gateway",
77
"arch": [
88
"aarch64",
9-
"amd64",
10-
"armhf",
11-
"armv7",
12-
"i386"
9+
"amd64"
1310
],
1411
"image": "agellhaus/{arch}-ha-sip",
1512
"init": "false",

ha-sip/src/main.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
import asyncio
33
import faulthandler
44
import os
5+
import socket
56
import sys
67
from typing import Optional, Any
8+
from urllib.parse import urlparse
79

810
import yaml
911

@@ -55,6 +57,20 @@ def get_name_server(raw_name_server: str):
5557
return name_server_without_empty
5658

5759

60+
def log_hostname_resolution(label: str, url: str) -> None:
61+
if not url:
62+
return
63+
hostname = urlparse(url).hostname
64+
if not hostname:
65+
log(None, f'Error: could not extract hostname from {label}: {url}')
66+
return
67+
try:
68+
ip = socket.gethostbyname(hostname)
69+
log(None, f'{label} hostname {hostname} resolves to {ip}')
70+
except socket.gaierror as e:
71+
log(None, f'Error: could not resolve {label} hostname {hostname}: {e}')
72+
73+
5874
def get_cache_dir(raw_cache_dir: str) -> Optional[str]:
5975
if not raw_cache_dir:
6076
log(None, 'No cache directory configured.')
@@ -127,6 +143,8 @@ def main():
127143
'voice': config.TTS_VOICE,
128144
'debug_print': config.TTS_DEBUG_PRINT,
129145
}
146+
log_hostname_resolution('HA_BASE_URL', config.HA_BASE_URL)
147+
log_hostname_resolution('HA_WEBSOCKET_URL', config.HA_WEBSOCKET_URL)
130148
ha_config = ha.HaConfig(config.HA_BASE_URL, config.HA_WEBSOCKET_URL, config.HA_TOKEN, tts_config_from_env, config.HA_WEBHOOK_ID, cache_dir)
131149
if ha_config.tts_config['debug_print']:
132150
asyncio.run(ha.print_tts_providers(ha_config))

0 commit comments

Comments
 (0)