Set a timer using HA Assist

Hi @DonNL .
Ive recently updated to the newest version of your timer scripts.
The timer reached automation fails however with this error:


My config:

homeassistant:
  customize:
    script.assist_timerstart:
      settings: &settings
        ########################################################
        ### SET THE VARIABLES HERE TO CUSTOMIZE YOUR ROUTINE ###
        ########################################################
        timer_target: "Kitchen" #Which device or room should play the timer? #NOTE: If you choose a room, ALL media_players in that room will be played.
        timer_target_default: "media_player.pi-kitchen" #Which media_player entity should be used if timer_target is none? (Used when dynamic targets are null.)
        #You can also assign a sensor.entity_id or input_text to have a dynamic room or media_player assigned.
        #This can be usefull if, for example, you have a sensor monitoring where Assist is activated, to use it in that specific room or device.

        # Timer settings
        timer_tts: true #Set this to true if you want the timer to be a tts message. Default is true.
        timer_tts_service: "tts.speak" #Which TTS service to use? Default is "tts.speak".
        timer_tts_target: "tts.home_assistant_cloud" #Which TTS target to use, e.g. piper or ha cloud? Default is "tts.home_assistant_cloud".
        timer_tts_message: "A set timer has finished." #You can also assign a sensor or input_text entity_id to have a dynamic tts message.

        #If timer_tts is set to false, the media_location will automatically be used to play the target media file.
        #Use filenamer timer.mp3 to be able to stop the music as well. (For playback recognition).
        #Case sensitive (timer.mp3 vs Timer.mp3)
        timer_media_location: "/media/local/timer.mp3"

        # Timer volume
        timer_volume: 0.4 #What volume level do you want the timer to play at? Device volume level will be restored after the timer has finished.
      ########################################################

Could you have a look?

Hi @freakshock, I found the error in the script.
Line 512 had a " == ‘true’" in the template which shouldn’t be there. I think a stupid copy and paste error on my end. I updated the package or you can change that line yourself.

Nice to hear it’s working now, @celodnb

3 Likes

Thanks for your quick response and fix @DonNL :saluting_face:

1 Like

Hi @DonNL ,

many thanks for your great work. Unfortunately, your timer collides with the BuiltIn Intent HassTimer*, as the German sentences I use are more like the BuildIn sentences. I know you can avoid this by using a different sentence structure, but the system should actually adapt to the user and not the other way around. Apart from that, the BuiltIn function only gives me the error message “I didn’t understand it” and the match result is false.

Do you see a possibility to combine the two timer versions? Do you know where the error in the BuiltIn timer could lie, or can the BulitIn timer perhaps even be switched off?

Thanks for help.

I have a similair issue where i wanted to create a custom intent to create a reminder (mind you, not a timer) but the OpenAI integration still matches it up to the (currently nonfunctional) Timer intents.

Perhaps you could solve your issue by overriding the built in timer intent by renaming Don’s intents with the same names and restarting HA. I have not tried this yet.

Hi @freakshock, I have tried this but it does not work.

Pardon my noobie blunderings…I’m trying to get the timer stuff working. As far as I can tell it is setup as it should be, but I keep getting ‘Something went wrong: unable to find entity [‘timer.timer_1_minute’]’.

If I use the ‘sentences parser’ tool in the developer tools section it shows:

Start a 1 minute timer:

intent:
  name: TimerStart
slots:
  minutes: '1'
  seconds: 0
  hours: 0
details:
  minutes:
    name: minutes
    value: 1
    text: '1'
  seconds:
    name: seconds
    value: 0
    text: ''
  hours:
    name: hours
    value: 0
    text: ''
targets: {}
match: true
sentence_template: set [(a|an)] {minutes} minute[s] timer
unmatched_slots: {}
source: custom
file: en/assist_timers.yaml

start a 1 minute timer:

intent:
  name: HassStartTimer
slots:
  minutes: '1'
details:
  minutes:
    name: minutes
    value: 1
    text: '1'
targets: {}
match: false
sentence_template: <timer_set>[ a] <timer_duration> timer
unmatched_slots: {}
source: builtin

The name and source in those screenshots being different seems indicative of something, but I’m not sure what.

That might not be enough to help anyone point me in the right direction, but I’d appreciate any pointers!

Edit: sorry about the images, fixed!

Second edit: I think I may have solved my own problems. I was also toying with Extended OpenAI Conversation with the voice assist, changing the conversation agent to Home Assistant seems to have allowed the timer functionality to work fine. Bit of a bummer I can’t have both, but the timers are a non-negotiable need for certain people in the house…

Please see the pinned post on the main forum page. Post the code (correctly formatted) rather than screenshots. This will also fix you issue of not being able to post more images…