Commit 0e06683
committed
v3.5b1: Volume timing fixes, TTS cache improvements, diagnostics
## Bug Fixes
### Volume Restoration Timing
- Fixed volume being restored too early when using chime or normalize features
- Volume restoration now correctly waits for full playback duration
- Improved detection of non-streaming audio mode (chime/normalize enabled)
- Added platform-specific timing buffers (Sonos: 500ms, Cast: 700ms)
### Chime Configuration
- Fixed chime settings not being applied from entity configuration
- Service now reads chime/normalize settings from TTS entity subentry config
- Settings from service call properly override entity defaults
### Voice Change Bug
- Added `default_options` property to TTS entity
- Voice/model/speed changes in config now properly invalidate HA's TTS cache
- HA's cache key now includes current voice configuration
## New Features
### Duration Metadata with Mutagen
- Added reliable MP3 metadata embedding using mutagen library
- Duration stored in ID3 TXXX:duration_ms tag
- Works across streaming and non-streaming modes
- Survives HA's TTS cache operations
### In-Memory Duration Cache
- Added MESSAGE_DURATIONS_KEY for fast duration lookups
- Shared cache across all TTS entities
- Reduces ffprobe calls for repeated messages
### Diagnostics Support
- New diagnostics.py for troubleshooting
- Exports config entry data (API key redacted)
- Shows subentry configurations
- Lists TTS entity states
## Code Quality
- Fixed deprecated `asyncio.get_event_loop()` calls
- Replaced with `asyncio.get_running_loop()`
- Fixed bare `except:` clauses
- Removed duplicate CONF_PROFILE_NAME definitions
- Added ConfigEntryAuthFailed and ConfigEntryNotReady imports
- Added type annotations to config flow classes1 parent baa7d21 commit 0e06683
File tree
10 files changed
+1100
-209
lines changed- custom_components/openai_tts
- translations
10 files changed
+1100
-209
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
44 | | - | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
445 | 445 | | |
446 | 446 | | |
447 | 447 | | |
448 | | - | |
| 448 | + | |
| 449 | + | |
449 | 450 | | |
450 | | - | |
451 | | - | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
452 | 482 | | |
453 | 483 | | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
454 | 491 | | |
455 | 492 | | |
456 | 493 | | |
457 | 494 | | |
458 | | - | |
459 | | - | |
460 | | - | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
461 | 498 | | |
462 | | - | |
| 499 | + | |
463 | 500 | | |
464 | 501 | | |
465 | 502 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | | - | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | | - | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
49 | 57 | | |
50 | 58 | | |
51 | 59 | | |
52 | | - | |
| 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 | + | |
53 | 119 | | |
54 | 120 | | |
55 | 121 | | |
| |||
89 | 155 | | |
90 | 156 | | |
91 | 157 | | |
92 | | - | |
| 158 | + | |
93 | 159 | | |
94 | 160 | | |
| 161 | + | |
| 162 | + | |
95 | 163 | | |
96 | 164 | | |
97 | 165 | | |
| |||
102 | 170 | | |
103 | 171 | | |
104 | 172 | | |
105 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
106 | 177 | | |
107 | 178 | | |
108 | 179 | | |
| |||
116 | 187 | | |
117 | 188 | | |
118 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
119 | 194 | | |
120 | 195 | | |
121 | 196 | | |
| |||
171 | 246 | | |
172 | 247 | | |
173 | 248 | | |
174 | | - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
175 | 296 | | |
176 | 297 | | |
177 | 298 | | |
| |||
456 | 577 | | |
457 | 578 | | |
458 | 579 | | |
459 | | - | |
460 | | - | |
| 580 | + | |
| 581 | + | |
461 | 582 | | |
462 | 583 | | |
463 | | - | |
464 | | - | |
| 584 | + | |
| 585 | + | |
465 | 586 | | |
466 | 587 | | |
467 | 588 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
14 | 14 | | |
0 commit comments