StreamAssist icon indicating copy to clipboard operation
StreamAssist copied to clipboard

Request for timer support - register a timer event handler

Open dinki opened this issue 1 year ago • 3 comments

Hey @AlexxIT back again with a request. As you may have heard, HA has added disposable timers for voice satellites. I asked Mike about what it would take to extend these timers beyond the Wyoming/ESPHome devices and specifically for Stream Assist. He told me:

It sounds like StreamAssist may need a patch to tell HA it supports timers. It just needs to register a timer event handler.

I asked if he could share an example and he provided this:

https://github.com/home-assistant/core/blob/5f088e0501403a546df70167bcfd082852e94b50/homeassistant/components/wyoming/satellite.py#L90

I'm not sure how involved this would be but it would be of great benefit to the growing number of folks using SA to take advantage of this new feature. Is this something you would consider?

Thanks!

dinki avatar Jul 08 '24 16:07 dinki

I got my tablet all setup and tried the timer :-(. My last step to de google.

ikolsteren avatar Dec 21 '24 15:12 ikolsteren

@AlexxIT It seems like the way these work is that you register a timer event handler for the StreamAssist integration with Hass Core, and then you'll receive timer events from HA for Started, Cancelled, Updated, and Finished events, and then it's up to StreamAssist to determine what happens in each of those circumstances. I actually think it's simpler than all that, since unless I'm misunderstanding most of them we just would discard and ignore, except for Finished events which would need to trigger audio playback on the output media_player of an audio file, so we'd need another configuration field for Timer Complete sound.

I can't think of anything else we'd want to do within the StreamAssist integration when timers are started, updated or cancelled unless maybe if we wanted to update the attributes on a StreamAssist entity listing all active timers for visibility, but given that esphome devices do no such thing, that seems optional for now.

(Not an active developer on StreamAssist, just dug into the code a little bit when I wanted to add support to AssistMicrophone for timers with that addon, but it just relies on the existing support in the wyoming satellite project). Overall I think we could just ripoff the handler from the wyoming satellite HA integration and throw away or log to an attribute the timer events we don't care about, and then play to the media players the timer-finished sound we'd add a config field for.

mr-ransel avatar Feb 21 '25 20:02 mr-ransel

I've seen these timers inside the wyoming satellite project. I don't understand why they are needed or how to use them in real life.

AlexxIT avatar Feb 22 '25 08:02 AlexxIT