thlucas1 / homeassistantcomponent_soundtouchplus

Home Assistant integration for Bose SoundTouch speakers
MIT License
14 stars 1 forks source link

Error when setting the dialogue mode #21

Closed GunterAv closed 3 months ago

GunterAv commented 3 months ago

System Health details

Core: 2024.8.2 Supervisor: 2024.08.0 Operating System: 13.0 Frontend: 20240809.0 Bose SoundTouchPlus: 1.0.59

Checklist

Describe the issue

Hello,

If I set the dialogue mode using the following script, switching to dialogue mode works:

alias: Soundtouch300-Dialog
sequence:
  - action: media_player.select_sound_mode
    data:
      sound_mode: Dialog
    target:
      entity_id: media_player.soundtouch_300_3
description: Stellt den Dialogmodus ein
icon: ave:bose-soundbar

Switching back to normal mode also works as expected.

However, once I have switched dialogue mode on or off with the original Bose Remote control, the script no longer works.

Error message: The action script/soundtouch300_dialog could not be executed. argument of type 'NoneType' is not iterable

I first have to restart the HA, then I can set the mode again via HA.

Error

Thanks and best regards Gunter

Reproduction steps

  1. Set the Dialogmodus via HA
  2. Press Dialogmodus on the Bose Remote control
  3. Try to set the Dialogmodus via HA

Debug logs

...

Diagnostics dump

No response

thlucas1 commented 3 months ago

Is there an entry in the Settings \ System \ Logs for that error message? The System log entry will contain more details, and possibly a detailed exception trace for the error.

GunterAv commented 3 months ago

Hello,

Logger: homeassistant.helpers.script.bose_soundbar_300_dialogmodus Quelle: helpers/script.py:2030 Erstmals aufgetreten: 20:56:26 (6 Vorkommnisse) Zuletzt protokolliert: 22:51:58

Bose Soundbar 300 Dialogmodus: Error executing script. Error for call_service at pos 1: argument of type 'NoneType' is not iterable

Logger: homeassistant.helpers.script.bose_soundbar_300_dialogmodus Quelle: helpers/script.py:2030 Erstmals aufgetreten: 20:56:26 (5 Vorkommnisse) Zuletzt protokolliert: 22:50:39

Bose Soundbar 300 Dialogmodus: Error executing script. Error for call_service at pos 1: argument of type 'NoneType' is not iterable

Best regards Gunter

thlucas1 commented 3 months ago

Thank you.

What do you have listed for your sound_mode_list in the Developer Tools \ States display? For example, for my ST-300 the sound_mode_list is Dialog and Normal.

image

Do you have the same?

GunterAv commented 3 months ago

Hello,

for me too...

see: Bose_Normal_ok Best regards Gunter

thlucas1 commented 3 months ago

Ok, I found the problem.

The Bose AudioDspControls update event does not contain the supported audio modes in some circumstances. This is causing the SupportedAudioModes property to be set to None, which in turn raises the argument of type 'NoneType' is not iterable.

I did not catch this in my testing, as it appears to only happen when the update event occurs which is driven by a change from the device (e.g. clicking the dialog mode button on the remote).

I should have a fix available within the hour.

Thanks for bringing this to my attention.

thlucas1 commented 3 months ago

FYI - just released a new version of the SoundTouchPlus integration

Note - If you are using the SpotifyPlus integration, you will also need to update it as well since it uses the underlying Spotify Web API Python library.

[ 1.0.60 ] - 2024/08/20

Give the v1.0.60 release a try, and let me know how it goes.

Thanks

GunterAv commented 3 months ago

Hello,

no more error messages. but unfortunately the dialogue mode cannot be queried if the dialogue mode was switched via the remote control:

  - platform: template
    switches:
      soundtouchdialog:
        friendly_name: "Bose Soundbar 300 Dialogmodus"
        value_template: "{{ is_state_attr('media_player.soundtouch_300_3', 'soundtouchplus_sound_mode', 'AUDIO_MODE_DIALOG') }}"
        turn_on:
          - service: script.soundtouch300_dialog
        turn_off:
          - service: script.soundtouch300_normal
        icon_template: >-
          {% if is_state_attr('media_player.soundtouch_300_3', 'soundtouchplus_sound_mode', 'AUDIO_MODE_DIALOG') %}
             ave:bose-soundbar-dialog
          {% else %}
             ave:bose-soundbar
          {% endif %}

Thanks!

Best regards Gunter

thlucas1 commented 3 months ago

The mode is switching correctly for me in my testing, using both the set_sound_mode service and toggling via the remote. I can also verify this through the developer tools template tester. Note that you have to query the soundtouchplus_sound_mode attribute and not the HA sound_mode attribute.

I ran portions of your script (from the previous reply) via template tester, and the soundtouchplus_sound_mode value changed appropriately ...

Normal mode, set via Bose remote control: image

Dialog mode, set via Bose remote control: image

GunterAv commented 3 months ago

Hello,

Thank you for your feedback!

Sometimes the button press of the Bose remote control is not returned to HA. The ST300 LED lights up green, but ‘Audio_Mode_Normal’ is returned in HA.

Never mind, I rarely use the Bose remote control.

Nice Work !!!

Best regards Gunter

thlucas1 commented 3 months ago

Hi Gunter -

I found a small bug in the 1.0.60 release I just pushed out. I corrected that, as well as added the update of media_player.sound_mode property to hold the same value as the soundtouchplus_sound_mode attribute.

Give the v1.0.61 a try, and let me know if it fixes your script process or not.

Apologies for the frequent updates, but bugs like these are hard to track down and test. Thank you for your patience.

FYI - just released a new version of the SoundTouchPlus integration

Note - If you are using the SpotifyPlus integration, you will also need to update it as well since it uses the underlying Spotify Web API Python library.

[ 1.0.61 ] - 2024/08/21

GunterAv commented 3 months ago

Hello,

perfekt! Thanks.

Best regards Gunter

GunterAv commented 3 months ago

Hello,

thats my Bose Dasboard with Bose SoundtouchPlus: Screenshot 2024-08-21 201254

Thanks! Best Regards Gunter

thlucas1 commented 3 months ago

Hi Gunter - Nice looking dashboard.

Did the v1.0.61 release fix your issue? If so, I will close the issue.

GunterAv commented 3 months ago

Hello,

yes. All ok.

Thanks! Gunter