180 lines
3.6 KiB
Markdown
180 lines
3.6 KiB
Markdown
# SIP Voice Notifier for Home Assistant
|
|
|
|
Send voice notifications via SIP phone calls from Home Assistant.
|
|
|
|
## Features
|
|
|
|
- 📞 Place SIP calls from automations
|
|
- 🔊 Play audio from HTTP/HTTPS URLs (MP3, WAV, etc.)
|
|
- 🗣️ Text-to-speech support
|
|
- 🔧 Configurable call duration
|
|
|
|
## Installation
|
|
|
|
### 1. Add this repository to Home Assistant
|
|
|
|
Settings → Add-ons → Add-on Store → ⋮ (menu) → Repositories
|
|
|
|
Add URL:
|
|
```
|
|
https://git.aymerick.fr/Aymerick/ha-sip-notifier
|
|
```
|
|
|
|
### 2. Install the "SIP Voice Notifier" add-on
|
|
|
|
Find it in the add-on store and click Install.
|
|
|
|
### 3. Configure
|
|
|
|
Settings → Add-ons → SIP Voice Notifier → Configuration
|
|
|
|
```yaml
|
|
sip_server: "sip.yourprovider.com"
|
|
sip_user: "your_username"
|
|
sip_password: "your_password"
|
|
default_duration: 30
|
|
```
|
|
|
|
**Twilio example:**
|
|
```yaml
|
|
sip_server: "ACXXXXX.pstn.twilio.com"
|
|
sip_user: "ACXXXXX"
|
|
sip_password: "your_auth_token"
|
|
default_duration: 30
|
|
```
|
|
|
|
### 4. Start the add-on
|
|
|
|
Click Start.
|
|
|
|
### 5. Add the service to Home Assistant
|
|
|
|
**IMPORTANT:** Add this to your `/config/configuration.yaml`:
|
|
|
|
```yaml
|
|
rest_command:
|
|
sip_notification:
|
|
url: "http://088d3b92-sip-notifier:8099/send_notification"
|
|
method: POST
|
|
content_type: "application/json"
|
|
payload: >
|
|
{
|
|
"destination": "{{ destination }}",
|
|
{% if audio_url is defined %}"audio_url": "{{ audio_url }}",{% endif %}
|
|
{% if message is defined %}"message": "{{ message }}",{% endif %}
|
|
"duration": {{ duration | default(30) }}
|
|
}
|
|
```
|
|
|
|
### 6. Restart Home Assistant
|
|
|
|
Settings → System → Restart
|
|
|
|
## Usage
|
|
|
|
### Play Audio from URL
|
|
|
|
```yaml
|
|
service: rest_command.sip_notification
|
|
data:
|
|
destination: "+15551234567"
|
|
audio_url: "https://example.com/alert.mp3"
|
|
duration: 30
|
|
```
|
|
|
|
### Text-to-Speech
|
|
|
|
```yaml
|
|
service: rest_command.sip_notification
|
|
data:
|
|
destination: "+15551234567"
|
|
message: "Emergency! Water leak detected!"
|
|
duration: 40
|
|
```
|
|
|
|
## Example Automation
|
|
|
|
```yaml
|
|
automation:
|
|
- alias: "Water Leak Alert"
|
|
trigger:
|
|
platform: state
|
|
entity_id: binary_sensor.water_leak
|
|
to: "on"
|
|
action:
|
|
- service: rest_command.sip_notification
|
|
data:
|
|
destination: "+15551234567"
|
|
message: "EMERGENCY! Water leak detected in basement!"
|
|
duration: 45
|
|
```
|
|
|
|
## Optional: Friendlier Service Name
|
|
|
|
Add a script to make it easier to use:
|
|
|
|
```yaml
|
|
script:
|
|
sip_voice_notification:
|
|
alias: "Send Voice Notification"
|
|
fields:
|
|
destination:
|
|
description: "Phone number"
|
|
required: true
|
|
audio_url:
|
|
description: "Audio URL"
|
|
required: false
|
|
message:
|
|
description: "TTS message"
|
|
required: false
|
|
duration:
|
|
description: "Duration"
|
|
default: 30
|
|
sequence:
|
|
- service: rest_command.sip_notification
|
|
data:
|
|
destination: "{{ destination }}"
|
|
audio_url: "{{ audio_url | default('') }}"
|
|
message: "{{ message | default('') }}"
|
|
duration: "{{ duration }}"
|
|
```
|
|
|
|
Then use:
|
|
```yaml
|
|
service: script.sip_voice_notification
|
|
data:
|
|
destination: "+15551234567"
|
|
message: "Test message"
|
|
```
|
|
|
|
## SIP Providers
|
|
|
|
### Twilio
|
|
- Cost: ~$0.013/min
|
|
- Easy setup, reliable
|
|
|
|
### VoIP.ms
|
|
- Cost: ~$0.009/min
|
|
- Canadian provider, good value
|
|
|
|
## Troubleshooting
|
|
|
|
### Service not found
|
|
|
|
1. Check you added `rest_command` to configuration.yaml
|
|
2. Restart Home Assistant
|
|
3. Check for syntax errors in configuration.yaml
|
|
|
|
### Call fails
|
|
|
|
Check add-on logs:
|
|
Settings → Add-ons → SIP Voice Notifier → Log
|
|
|
|
## Support
|
|
|
|
Repository: https://git.aymerick.fr/Aymerick/ha-sip-notifier
|
|
|
|
## License
|
|
|
|
MIT
|