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

Multiple instances of the card in same view not working #67

Closed
2 tasks done
LucaLa2001 opened this issue Mar 7, 2024 · 18 comments
Closed
2 tasks done

Multiple instances of the card in same view not working #67

LucaLa2001 opened this issue Mar 7, 2024 · 18 comments
Labels
bug Something isn't working

Comments

@LucaLa2001
Copy link

Checklist:

  • I updated to the latest version available
  • I cleared the cache of my browser

Release with the issue:
3.4.0

Last working release (if known):

Browser and Operating System:

Chrome on Windows 11, but the same issue occurs also on companion app on android

Description of problem:

When in the same view there are multiple instances of android-tv-card with different media players all volume's sliders of all card in the view control the volume of the entity defined in the last card.

Javascript errors shown in the web inspector (if applicable):
In web inspector shows no errors

Your Full Remote Config

Additional information:
I have a tv and a speaker, so I'm using one instance of the card for the tv and another one for the speaker with only the volume slider. I noticed this issue with the volume, but maybe it occurs also with other commands, like the touchapd, unfortunately I can't verify this at the moment.

@LucaLa2001 LucaLa2001 added the bug Something isn't working label Mar 7, 2024
@Nerwyn
Copy link
Owner

Nerwyn commented Mar 7, 2024

That almost sounds like a bug with Home Assistant itself, I'm not sure how that is even possible.

You didn't post your remote configs. I'll need them to evaluate what's going on. I'm not seeing this bug on my remote test view.

@LucaLa2001
Copy link
Author

LucaLa2001 commented Mar 8, 2024

Sorry I forgot, here is the code of my view

  - title: test
    path: test
    badges: []
    cards:
      - type: custom:android-tv-card
        slider_id: media_player.luca
        rows:
          - - volume_slider
      - type: custom:android-tv-card
        remote_id: remote.tv_luca
        slider_id: media_player.tv_luca
        keyboard_id: media_player.tv_luca_adb
        rows:
          - - volume_mute
            - volume_down
            - volume_up
          - - touchpad
          - - back
            - play_pause
            - home
            - keyboard

@LucaLa2001
Copy link
Author

I've done some more testing, maybe it is not useful, but I discovered that if the card of the speaker is placed before the card of tv I can change tv's volume but when i try to set speaker's volume i get the error "Entity media_player.tv_luca does not support this service" (my tv support only rising or lowering the volume, not setting a specific value), while if the speaker's card is placed after the tv's one then everything is working fine.

@Nerwyn
Copy link
Owner

Nerwyn commented Mar 8, 2024

Well this is really weird, I can recreate it. I do not understand how this is possible if these are two different cards. Home Assistant should be isolating them. This has to be a bug in Home Assistant, right? I don't even know if I can fix this.

@Nerwyn
Copy link
Owner

Nerwyn commented Mar 8, 2024

I am seeing this error when the slider is on top but not on bottom and I remove slider_id from the second remote.

{
    "code": "invalid_format",
    "message": "not a valid value for dictionary value @ data['entity_id']"
}

Which means that the slider ID is not correctly auto-populating the default key for slider. What I think is happening is that one global defaultKeys object is being used for all remotes on a page, but since I was adding the slider ID to this default keys service data it was getting overwritten by subsequent remotes with slider_id. I'll work on a possible fix later today.

@Nerwyn
Copy link
Owner

Nerwyn commented Mar 8, 2024

@LucaLa2001 can you try the latest beta? I think the issue should be fixed. It was some not great slider ID setting logic I had which was overwriting the default slider action for all cards on a page. I've also ported over my slider tooltip code from my other project and plan to work on some more fixes for both simultaneously.

@LucaLa2001
Copy link
Author

The issue seems to be resolved, but now when I try to chenge player's volume from the slider the volume is always set to 50% and no sound comes out of the speaker and when I set player's volume with a service call the slider is not updated.

@Nerwyn
Copy link
Owner

Nerwyn commented Mar 9, 2024

That doesn't sound good. So it's not working when you set it using the service call tool either?

@LucaLa2001
Copy link
Author

Sorry for the confusion, I can change player’s volume with a service call or from the default Home Assistant UI, but when I change it the slider is not updated to represent the new value, in addition when I try to change volume from the slider the speaker’s volume seems to go to zero (no sound coming out) and the volume in default more info dialog is reported to be 50% (while the slider reports the volume that I try to set with it).

@Nerwyn
Copy link
Owner

Nerwyn commented Mar 9, 2024

Do you know if it's 50% or 0.50? By default the slider in this card has a range from 0-1 with step size 0.01. You may have to set slider_range to min and max volume of the media players.

@Nerwyn
Copy link
Owner

Nerwyn commented Mar 9, 2024

Wait no I think I broke something

@Nerwyn
Copy link
Owner

Nerwyn commented Mar 9, 2024

There was a line of code I forgot to save before committing. Try the latest beta now, it should work.

@LucaLa2001
Copy link
Author

Now it's working thank you. I noticed that the slider does not update when the volume is changed with a service call or from another device, is it the intended behaviour?

@Nerwyn
Copy link
Owner

Nerwyn commented Mar 9, 2024

I think that's a visual bug with the input range element itself, which I can't fix recently learned how to fix and should implement in the next minor/patch version. If you don't touch the slider but update it from another device or service call, it does update. But once you touch it it doesn't visually update despite it's value changes.

@Nerwyn
Copy link
Owner

Nerwyn commented Mar 10, 2024

I've done a massive refactor of the slider code in the latest beta. I'm probably going to work on adding parts of #25 into this release too since I'm on a roll unifying the sliders between my two projects.

@LucaLa2001
Copy link
Author

Since the slider not updating is not a bug related with this project I closed this bug.
@Nerwyn thank you very much for all the work and the time dedicated to the community.

@Nerwyn
Copy link
Owner

Nerwyn commented Mar 11, 2024

Gonna keep this open until I actually release the changes.

@Nerwyn Nerwyn reopened this Mar 11, 2024
@Nerwyn
Copy link
Owner

Nerwyn commented Mar 13, 2024

Fixed in 3.5.0

@Nerwyn Nerwyn closed this as completed Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants