wizmo2 / zidoo-player

Home-assistant custom component and api wrapper for Zidoo Media Players
20 stars 4 forks source link

Added remote entity to support additional commands #22

Closed albaintor closed 5 months ago

albaintor commented 5 months ago

Hi,

I added the remote entity to support additional commands, either from a custom card or from automation/scripts such as raise menu, arrow keys....

wizmo2 commented 5 months ago

Must admit, I have not looked into Remote Entities or really understand how they are used.

I am currently working on an update to the API to migrate to asyncio and aiohttp. Its nearly ready to Beta. The rework includes a Coordinator, which I believe would make this integration a lot simpler. It may make sense to add this to the new branch rather than the current release.

Will let you know when I upload the new version. I could add your code as a template, but would be grateful for your help testing / making it work!

albaintor commented 5 months ago

Hi,

Actually remote entity lets you create a customizable remote control such as this integration : https://github.com/Nerwyn/android-tv-card But this is not the reason why I use it : I have a (physical) remote control from https://www.unfoldedcircle.com/, which is like Logitech harmony but more advanced as it lets you interacts with home assistant (including media player and remote entities)

No problem to test the upcoming version, it will be my pleasure

Thanks for the hard work Regards, Damien BT

De : wizmo2 @.> Envoyé : dimanche 21 janvier 2024 21:05 À : wizmo2/zidoo-player @.> Cc : albaintor @.>; Author @.> Objet : Re: [wizmo2/zidoo-player] Added remote entity to support additional commands (PR #22)

Must admit, I have not looked into Remote Entities or really understand how they are used.

I am currently working on an update to the API to migrate to 'asyncio' and aiohttp. Its nearly ready to Beta. The rework includes a Coordinator, which I believe would make this integration a lot simpler. It may make sense to add this to the new branch rather than the current release.

Will let you know when I upload the new version. I could add your code as a template, but would be grateful for your help testing / making it work!

- Reply to this email directly, view it on GitHubhttps://github.com/wizmo2/zidoo-player/pull/22#issuecomment-1902746060, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A4IHILDHDFF4OWCULP444ELYPVYG7AVCNFSM6AAAAABCEEZ6VWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBSG42DMMBWGA. You are receiving this because you authored the thread.Message ID: @.**@.>>

Sledgehamma commented 5 months ago

Sounds awesome guys! Happy to test with my Remote Two as well :)

albaintor commented 5 months ago

Hi,

This is a mistake it is not supported and should be removed Thanks


De : wizmo2 @.> Envoyé : Wednesday, January 24, 2024 8:55:29 PM À : wizmo2/zidoo-player @.> Cc : albaintor @.>; Author @.> Objet : Re: [wizmo2/zidoo-player] Added remote entity to support additional commands (PR #22)

@wizmo2 commented on this pull request.


In custom_components/zidoo/remote.pyhttps://github.com/wizmo2/zidoo-player/pull/22#discussion_r1465467817:

  • return self._state
  • @property
  • def current_activity(self):
  • """Return the current activity."""
  • return self._source
  • @property
  • def activity_list(self):
  • """List of available activities."""
  • return self._source_list
  • @property
  • def supported_features(self):
  • """Flag media player features that are supported."""
  • return RemoteEntityFeature.LEARN_COMMAND | RemoteEntityFeature.ACTIVITY

You have LEARN_COMMAND as a supported feature. Do you know if this is needed?

— Reply to this email directly, view it on GitHubhttps://github.com/wizmo2/zidoo-player/pull/22#pullrequestreview-1842251737, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A4IHILA3QOHSRZUZV4ER2DTYQFRLDAVCNFSM6AAAAABCEEZ6VWVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTQNBSGI2TCNZTG4. You are receiving this because you authored the thread.Message ID: @.***>

albaintor commented 5 months ago

The activity list is readonly and cannot be used to be set after retrieval. So I added the source list as in the media player entity but it is not really useful. The send command method is the most (and only) useful functionality (with the state info which is redondant to media player entity). You could list the commands indeed I didn’t think about it this is a good idea. The other implementations only documented the available commands in the readme file.

Le 24 janv. 2024 à 21:02, wizmo2 @.***> a écrit :



@wizmo2 commented on this pull request.


In custom_components/zidoo/remote.pyhttps://github.com/wizmo2/zidoo-player/pull/22#discussion_r1465474319:

+

  • @property
  • def state(self):
  • """Return the state of the device."""
  • return self._state
  • @property
  • def current_activity(self):
  • """Return the current activity."""
  • return self._source
  • @property
  • def activity_list(self):
  • """List of available activities."""
  • return self._source_list

You have the source list here. It's not clear what the intended use for activities are. The documentation talks about commands, but I see people are using them for lists of apps. Since this is already covered in the MediaPlayer Entity I am thinking we should show the command list (zidoorc.KEYS).

I haven't worked out how you get a callback from the frontend UI yet. Have you looked at this?

— Reply to this email directly, view it on GitHubhttps://github.com/wizmo2/zidoo-player/pull/22#pullrequestreview-1842263256, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A4IHILEGTJ2OU7ZDKUN36UTYQFSE7AVCNFSM6AAAAABCEEZ6VWVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTQNBSGI3DGMRVGY. You are receiving this because you authored the thread.Message ID: @.***>

albaintor commented 5 months ago

About the last point : I didn’t try to configure the remote card yet that I suggested, only the standard remote card which is not really useful. I can try it. At this point I tested it in scripts and automations and it works perfectly

Le 24 janv. 2024 à 21:21, Damien Bain-Thouverez @.***> a écrit :

 The activity list is readonly and cannot be used to be set after retrieval. So I added the source list as in the media player entity but it is not really useful. The send command method is the most (and only) useful functionality (with the state info which is redondant to media player entity). You could list the commands indeed I didn’t think about it this is a good idea. The other implementations only documented the available commands in the readme file.

Le 24 janv. 2024 à 21:02, wizmo2 @.***> a écrit :



@wizmo2 commented on this pull request.


In custom_components/zidoo/remote.pyhttps://github.com/wizmo2/zidoo-player/pull/22#discussion_r1465474319:

+

  • @property
  • def state(self):
  • """Return the state of the device."""
  • return self._state
  • @property
  • def current_activity(self):
  • """Return the current activity."""
  • return self._source
  • @property
  • def activity_list(self):
  • """List of available activities."""
  • return self._source_list

You have the source list here. It's not clear what the intended use for activities are. The documentation talks about commands, but I see people are using them for lists of apps. Since this is already covered in the MediaPlayer Entity I am thinking we should show the command list (zidoorc.KEYS).

I haven't worked out how you get a callback from the frontend UI yet. Have you looked at this?

— Reply to this email directly, view it on GitHubhttps://github.com/wizmo2/zidoo-player/pull/22#pullrequestreview-1842263256, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A4IHILEGTJ2OU7ZDKUN36UTYQFSE7AVCNFSM6AAAAABCEEZ6VWVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTQNBSGI3DGMRVGY. You are receiving this because you authored the thread.Message ID: @.***>

wizmo2 commented 5 months ago

@albaintor . Thanks for your help on this.

I added a PR to Frontend to get the activity list working. They went a slightly different direction (https://github.com/home-assistant/frontend/pull/19575), but this should start working in 2024-2 (all-be-it with a select box rather than the nicer and more user-friendly list!)

As this is now integrated into the new version (v2.0.1), I'm going to close this unmerged.