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

Timers on box #210

Merged
merged 11 commits into from
Jun 26, 2024
Merged

Timers on box #210

merged 11 commits into from
Jun 26, 2024

Conversation

jlpouffier
Copy link
Contributor

@jlpouffier jlpouffier commented Jun 24, 2024

FONCTIONALITIES

Timers on the S3 Boxes, only the micro-wake-word variations, we will deprecate the non-micro-wake-word soon.
The Split was initially done to avoid long compilation times of the micro-wake-word component on a low-powered machine.
OTA fixes that, we do not need to support both variations.

Timer timeline

A timeline will be visible to represent the state of the timer
CleanShot 2024-06-24 at 18 16 01

Where?

  • The Idle screen
  • The mute screen
  • The listening screen
  • The thinking screen
  • The replying screen

How does the timeline work?

  • If at least one timer is active
    • The timeline will show a graphical representation of the time remaining until it rings in GREEN
    • The timeline will only show the timer that will finish first if more than one timer is active.
  • If no timer is active but at least one timer is paused
    • The timeline will show a graphical representation of the time remaining until it rings in BLUE
    • The timeline will only show the timer that will finish first if more than one timer is paused.
  • If no timer is active and no timer is paused
    • The timeline will not be displayed

Q&A

  • Can a user change anything related to the timeline? (Location, colors)
    • No. The timeline will be green or blue on white. There is no substitutions for that (yet)

Timer Widget

CleanShot 2024-06-24 at 18 20 56

Where

  • The Idle screen
  • The mute screen

How does the widget work?

  • If at least one timer is active
    • The widget shows the remaining time of the time in the following format
      • If the timer finishes in more than one hour: HH:MM
      • If the timer finishes in less than one hour: MM:SS
    • The widget will only show the timer that will finish first if more than one timer is active.
  • If no timer is active
    • The widget will not be displayed

Q&A

  • Can a user change anything related to the timeline? (Location, colors)
    • No.
  • Is the display of the timer widget linked to the master switch "Display conversation"
    • No. It will always be displayed if a timer is running.

Timer end behavior

When a timer ends, many things happen

  • A new screen is displayed. For now, the default illustration is the replying screen, but this will change very soon
  • A sound is played in a loop until:
    • On the S3-BOX and the S3-BOX-3: The screen is touched
    • On the S3-BOX-Lite: Any of the 3 front buttons is pressed

Q&A

  • Can a user change the illustration when the timer rings?
    • Yep, it's a new substitution: timer_finished_illustration_file
  • Can a user change the beep sound?
    • Not in this version, I needed to know the length of the .wav file to loop it. If I can find a way to circumvent that, I may allow users to change sounds.
  • If a user ignores the end of the timer, will the box ring forever?
    • No, it will ring for 15 minutes then stop. We built that guardrail in the firmware.

TODO LIST FOR THIS PR

  • @jesserockz : The file component used does not support remote paths. For now, this PR references local paths for the sound file but this will cause issues when adopting and customizing the firmware
file:
  - id: timer_finished_wave_file
    #path: https://github.com/esphome/firmware/raw/main/voice-assistant/sounds/timer_finished.wav TO BE FIXED ONCE `file` SUPPORTS REMOTE PATH
    path: ..//voice-assistant/sounds/timer_finished.wav
  • @jesserockz or @kbx81 : On the S3-BOX-3, the touch event to end the "beep loop" is clean.
    I use the interrupt_pin as such:
touchscreen:
  platform: gt911
  display: s3_box_lcd
  id: s3_box_touchscreen
  interrupt_pin: GPIO3
  on_touch:
    - switch.turn_off: timer_ringing

However, on the original box, the interupt_pin was working only once, and the touch even was never registered again.
So I fell back to a more dirty approach: I used the update_interval and updated the touchscreen component every 50ms. If any of you can find out why the inputerp_pin is not working on the original S3-BOX, that would be great

touchscreen:
  platform: tt21100
  display: s3_box_lcd
  id: s3_box_touchscreen
  update_interval: 50ms
  on_touch:
    - switch.turn_off: timer_ringing

@jlpouffier jlpouffier marked this pull request as ready for review June 25, 2024 10:06
@jesserockz jesserockz merged commit d125927 into esphome:main Jun 26, 2024
12 of 16 checks passed
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

Successfully merging this pull request may close these issues.

3 participants