Use pyVoIP from git (latest fixes) and fix service registration (v2.0.6)

This commit is contained in:
2026-02-08 15:05:36 +01:00
parent ae84e1d6e9
commit a9775c0e6f
3 changed files with 15 additions and 9 deletions

View File

@@ -39,7 +39,7 @@ def register_service():
'Content-Type': 'application/json',
}
# Call Home Assistant service registration endpoint
# Register service via Supervisor API
response = requests.post(
'http://supervisor/services',
headers=headers,
@@ -53,11 +53,15 @@ def register_service():
if response.status_code in [200, 201]:
_LOGGER.info("✅ Service registered: sip_notifier.send_notification")
return True
else:
_LOGGER.warning(f"Service registration returned: {response.status_code}")
_LOGGER.warning(f"Service registration status: {response.status_code}")
_LOGGER.debug(f"Response: {response.text}")
return False
except Exception as e:
_LOGGER.error(f"Failed to register service: {e}")
return False
def download_and_convert_audio(url: str) -> str:
@@ -264,9 +268,13 @@ if __name__ == '__main__':
# Register service with Home Assistant
_LOGGER.info("Registering service with Home Assistant...")
time.sleep(2) # Wait for supervisor to be ready
register_service()
_LOGGER.info("SIP Voice Notifier ready")
if register_service():
_LOGGER.info("Service registration successful")
else:
_LOGGER.warning("Service registration failed - will be available via REST API on port 8099")
_LOGGER.info("SIP Voice Notifier ready (using pyVoIP from git)")
_LOGGER.info("Service: sip_notifier.send_notification")
_LOGGER.info("Starting Flask service on port 8099")
app.run(host='0.0.0.0', port=8099, debug=False)