Use pyVoIP from git (latest fixes) and fix service registration (v2.0.6)
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
name: "SIP Voice Notifier"
|
name: "SIP Voice Notifier"
|
||||||
version: "2.0.5"
|
version: "2.0.6"
|
||||||
slug: "sip-notifier"
|
slug: "sip-notifier"
|
||||||
description: "Send voice notifications via SIP phone calls (includes integration)"
|
description: "Send voice notifications via SIP phone calls"
|
||||||
arch:
|
arch:
|
||||||
- aarch64
|
- aarch64
|
||||||
- amd64
|
- amd64
|
||||||
@@ -14,8 +14,6 @@ boot: auto
|
|||||||
homeassistant_api: true
|
homeassistant_api: true
|
||||||
hassio_api: true
|
hassio_api: true
|
||||||
hassio_role: default
|
hassio_role: default
|
||||||
services:
|
|
||||||
- sip_notifier.send_notification:sip_notifier
|
|
||||||
ports:
|
ports:
|
||||||
8099/tcp: null
|
8099/tcp: null
|
||||||
options:
|
options:
|
||||||
|
|||||||
@@ -2,4 +2,4 @@ flask==3.0.0
|
|||||||
requests==2.31.0
|
requests==2.31.0
|
||||||
pydub==0.25.1
|
pydub==0.25.1
|
||||||
gtts==2.5.0
|
gtts==2.5.0
|
||||||
pyVoIP==1.6.6
|
git+https://github.com/tayler6000/pyVoIP.git
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ def register_service():
|
|||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
}
|
}
|
||||||
|
|
||||||
# Call Home Assistant service registration endpoint
|
# Register service via Supervisor API
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
'http://supervisor/services',
|
'http://supervisor/services',
|
||||||
headers=headers,
|
headers=headers,
|
||||||
@@ -53,11 +53,15 @@ def register_service():
|
|||||||
|
|
||||||
if response.status_code in [200, 201]:
|
if response.status_code in [200, 201]:
|
||||||
_LOGGER.info("✅ Service registered: sip_notifier.send_notification")
|
_LOGGER.info("✅ Service registered: sip_notifier.send_notification")
|
||||||
|
return True
|
||||||
else:
|
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:
|
except Exception as e:
|
||||||
_LOGGER.error(f"Failed to register service: {e}")
|
_LOGGER.error(f"Failed to register service: {e}")
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def download_and_convert_audio(url: str) -> str:
|
def download_and_convert_audio(url: str) -> str:
|
||||||
@@ -264,9 +268,13 @@ if __name__ == '__main__':
|
|||||||
# Register service with Home Assistant
|
# Register service with Home Assistant
|
||||||
_LOGGER.info("Registering service with Home Assistant...")
|
_LOGGER.info("Registering service with Home Assistant...")
|
||||||
time.sleep(2) # Wait for supervisor to be ready
|
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("Service: sip_notifier.send_notification")
|
||||||
_LOGGER.info("Starting Flask service on port 8099")
|
_LOGGER.info("Starting Flask service on port 8099")
|
||||||
app.run(host='0.0.0.0', port=8099, debug=False)
|
app.run(host='0.0.0.0', port=8099, debug=False)
|
||||||
|
|||||||
Reference in New Issue
Block a user