roleoroleo / yi-hack_ha_integration

Home Assistant custom integration for Yi cameras: yi-hack-MStar, yi-hack-Allwinner, yi-hack-Allwinner-v2, yi-hack-v5 and sonoff-hack
GNU General Public License v3.0
218 stars 32 forks source link

Fix Media Player unable to play sometimes #77

Closed vin-w closed 2 years ago

vin-w commented 2 years ago
  1. Fix response variable is uninitialized

    Traceback (most recent call last):
    ....
    File "/config/custom_components/yi_hack/media_player.py", line 196, in _perform_speaker
    if response is None:
    UnboundLocalError: local variable 'response' referenced before assignment
  2. Fix race condition when multiple click on tts speak at the same time (Second one will wait after first one finished)

roleoroleo commented 2 years ago

Thank you for your contribution.

vin-w commented 2 years ago

Thanks @roleoroleo

There are 2 more files need to fix as well for response variable is uninitialized.

https://github.com/roleoroleo/yi-hack_ha_integration/blob/main/custom_components/yi_hack/media_source.py#L160 https://github.com/roleoroleo/yi-hack_ha_integration/blob/main/custom_components/yi_hack/camera.py#L318

roleoroleo commented 2 years ago

I will fix it, thank you.