28 lines
1.0 KiB
Bash
28 lines
1.0 KiB
Bash
#!/usr/bin/with-contenv bashio
|
|
|
|
bashio::log.info "Starting SIP Voice Notifier..."
|
|
|
|
# Get config from add-on options
|
|
SIP_SERVER=$(bashio::config 'sip_server')
|
|
SIP_USER=$(bashio::config 'sip_user')
|
|
SIP_PASSWORD=$(bashio::config 'sip_password')
|
|
DEFAULT_DURATION=$(bashio::config 'default_duration')
|
|
|
|
bashio::log.info "SIP Server: ${SIP_SERVER}"
|
|
bashio::log.info "SIP User: ${SIP_USER}"
|
|
bashio::log.info "Default Duration: ${DEFAULT_DURATION}s"
|
|
|
|
bashio::log.info "Add-on ready - listening on port 8099"
|
|
bashio::log.info "To use from Home Assistant, add this to your configuration.yaml:"
|
|
bashio::log.info ""
|
|
bashio::log.info "rest_command:"
|
|
bashio::log.info " sip_notification:"
|
|
bashio::log.info " url: http://088d3b92-sip-notifier:8099/send_notification"
|
|
bashio::log.info " method: POST"
|
|
bashio::log.info " content_type: application/json"
|
|
bashio::log.info " payload: '{\"destination\": \"{{ destination }}\", \"message\": \"{{ message }}\", \"duration\": {{ duration | default(30) }}}'"
|
|
bashio::log.info ""
|
|
|
|
# Start the service
|
|
exec python3 /app/sip_service.py
|