Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Voice Assistant still responses with Timers which have been just canceled #252

Open
HowlingCoder opened this issue Dec 29, 2024 · 0 comments

Comments

@HowlingCoder
Copy link

Hey there :)!
I'm currently tinkering with the Timers of Voice PE and my goal would be to control them directly from HomeAssistant. Therefore I created the following service:

 services:
    - service: stop_timer
      variables:
        timer_id: string
      then:
        - lambda:  |-
            api::VoiceAssistantTimerEventResponse msg;
            msg.timer_id = timer_id;
            msg.event_type = api::enums::VOICE_ASSISTANT_TIMER_CANCELLED;
            msg.total_seconds = 0;
            msg.seconds_left = 0;
            msg.is_active = false;
            id(va).on_timer_event(msg);

            ESP_LOGW("main", "Timer Active %d",id(is_timer_active)); // Always shows 0

            if (id(is_timer_active)){
              id(fetch_first_active_timer).execute();
            } else {
              id(first_active_timer) = {
                  .id = "invalid",
                  .name = "",
                  .total_seconds = 0,
                  .seconds_left = 0,
                  .is_active = false,
              };
              
            }

Everything seems to work, but the Assist seems to be not in sync with the data.

Things I checked:

  1. Everything gets called, timers get removed from the timers_ map
  2. LEDs stop and no alarm occur, the Assistant will insist on the timer existing until the timer normally would've ended
  3. I forked the repository with additional logging messages to make sure I'm not insane
[18:40:16][D][voice_assistant:860]: Before cancellation - Number of timers: 1
[18:40:16][D][voice_assistant:861]: Attempting to cancel timer with ID: '01JG9R22J15SQQQ2A8GFRFC00M'
[18:40:16][D][voice_assistant:865]: Existing timer ID: '01JG9R22J15SQQQ2A8GFRFC00M'
[18:40:16][D][light:036]: 'voice_assistant_leds' Setting:
[18:40:16][D][light:047]:   State: OFF
[18:40:16][D][light:109]:   Effect: 'None'
[18:40:16][D][voice_assistant:871]: After cancellation - Number of timers: 0
[18:40:16][D][voice_assistant:882]: Are the timer ticks running?: 0
[18:40:16][W][main:069]: Timer Active 0
...
[18:40:28][D][voice_assistant:669]: Speech recognised as: "Läuft ein Timer?" # (Is a timer running?)
[18:40:34][D][voice_assistant:697]: Response: "Ja, ein Timer läuft noch. Er hat noch 2 Minuten und 39 Sekunden übrig.  # (Yes, 2:39 remaining)"

I'm not sure if this is a bug or if I'm just missing something. I really appreciate your time and effort. Thank you!
Max

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant