-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintercom.yaml
More file actions
141 lines (120 loc) · 2.77 KB
/
Copy pathintercom.yaml
File metadata and controls
141 lines (120 loc) · 2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
esphome:
name: intercom-device
friendly_name: Intercom Device
platform: ESP32
board: esp32dev
framework:
type: arduino
# WiFi Configuration
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: true
power_save_mode: none
# Enable fallback hotspot
ap:
ssid: "Intercom Fallback"
password: "intercom123"
# Enable logging
logger:
level: DEBUG
# Enable Web API for debugging
api:
encryption:
key: !secret api_encryption_key
# OTA updates
ota:
- platform: esphome
password: !secret ota_password
# Status LED (optional)
status_led:
pin:
number: GPIO2
inverted: true
# I2S Audio Configuration
i2s_audio:
i2s_lrclk_pin: GPIO25
i2s_bclk_pin: GPIO26
i2s_dout_pin: GPIO22 # Speaker output
i2s_din_pin: GPIO33 # Microphone input
mode: stereo
bits_per_sample: 16bit
sample_rate: 16000Hz
# Text Sensor for connection status
text_sensor:
- platform: wifi_info
ip_address:
name: "IP Address"
ssid:
name: "SSID"
mac_address:
name: "MAC Address"
# Binary Sensor for call state
binary_sensor:
- platform: status
name: "Intercom Status"
# Custom Intercom Component
# This uses the custom component defined in intercom_component.h/cpp
external_components:
- source: local
components: [ intercom ]
intercom:
id: intercom_device
signaling_server: "ha.shafferco.com"
signaling_port: 1880
signaling_path: "/endpoint/webrtc"
audio_port: 5004
# UDP for Audio Streaming
socket:
- platform: udp
id: audio_udp
local_port: 5004
on_data:
- lambda: |-
// Receive audio data and play via I2S
// This is a simplified example - actual implementation would need
// proper RTP packet handling
# Scripts for call management
script:
- id: start_call
then:
- lambda: |-
// Initiate a call
ESP_LOGD("intercom", "Starting call");
- id: end_call
then:
- lambda: |-
// End current call
ESP_LOGD("intercom", "Ending call");
- id: accept_call
then:
- lambda: |-
// Accept incoming call
ESP_LOGD("intercom", "Accepting call");
# Switches for call control
switch:
- platform: template
name: "Start Call"
lambda: |-
return false; // Read-only
turn_on_action:
- script.execute: start_call
- platform: template
name: "End Call"
lambda: |-
return false; // Read-only
turn_on_action:
- script.execute: end_call
- platform: template
name: "Accept Call"
lambda: |-
return false; // Read-only
turn_on_action:
- script.execute: accept_call
# Sensors for call metrics
sensor:
- platform: wifi_signal
name: "WiFi Signal"
update_interval: 60s
- platform: uptime
name: "Uptime"