Comments (15)
It looks like we've reached a consensus on this and are moving the media_player platforms to using a static set of supported features (only plex is left cc @ryanm101). Any objections to closing this discussion?
from architecture.
Adding current_supported_features
is fairly straight forward:
- It could be added to
Entity
and default tosupported_features
supported_features
can be updated in components that currently make it dynamic to be static e.g. apple_tvcurrent_supported_features
can be updated in components to expose current features dynamically e.g. apple_tv- The media player ui component can be updated to use
current_supported_features
- Any other components that rely on dynamic
supported_features
can also be updated
from architecture.
I wouldn't say it was a proposal from my part, it was merely an idea as part of a brainstorm.
I think that supported_features
should explain the capabilities of a device. This can be used as a guide to which services can be used with which parameters. A write up of how all of these features map to services/parameters should be added to https://dev-docs.home-assistant.io
Things that are supported_feature "worthy":
- Light that supports color (should it be type of color?)
- Light that supports brightness
Sometimes however, we see that we don't need a supported_features
flag because if something is supported can be derived from other things that are available in the state (ie if a climate entity has no swing_list
, one cannot set the swing mode).
from architecture.
I agree that supported_features
should explain the capabilities of a device.
I'm not sure I fully understand how this would work with also being able to derive features that are available in the state. Does this mean you would need to check both the supported_features
and state to determine a devices capabilities, or would supported_features
be calculated based on information on the state? Ideally we just want a single property that can be read to determine everything a device supports.
The other question is do we need a current_supported_features
or active_features
which specifies what a device supports in it's current state e.g. an idle
media player does not support play/pause so the UI component should not show the play/pause button?
Updating the documentation makes sense and would be happy to help with that. I would also like to figure out if we can start moving components to using supported_features
to describe all of the devices capabilities and what impact this has on components that expose supported_features
based on current state e.g. Apple TV Media Player
from architecture.
I've thought about it a bit more and we should go for the first implementation: supported_features
should be all of the entities supported features. We should not have our entity design be steered by the frontend.
For "active supported features" I want to make sure that we do not use the word "features" or the current flags as I don't want to conflate concerns. Maybe call it something as "player functionality" or something. It can still work with bit flags like supported features, just should be clearly differently called.
from architecture.
Sounds good to me. How do you normally manage a somewhat breaking change like this? I would like to start moving entities to ensuring supported_features
list all capabilities especially given the impact on Alexia discovery.
Iām happy to work through the media players as I already have a PR for Apple TV and understand the impact this change has on the UI component (its mostly around hiding showing controls).
The options are:
-
add the new concept of
active_player_functionality
or similar and update the UI card to hide/show controls based on this first and then update thesupported_features
-
update
supported_features
first and live with the media player card not hiding showing controls based on state (which is already the case for most of the media player implementations) and then implement the UI changes later
Similar decisions also need to be made for other entities that have cards which rely on dynamic supported_features
to decide when to hide/show elements based on the entities current state
from architecture.
I think that only the media player has the frontend depend on supported_features being dynamic.
To make the transition easier, I would expect us to indeed start with adding the new functionality attribute to the media player. We will have to look at the frontend to see what kind of checks we actually need.
Source code for media player is here
Some things can still be derived from supported_features, like turn on/turn off. I think that we just need prev track, next track, pause/play/stop (not completely sure what is going on here)
from architecture.
The UI changes look fairly straight forward:
What is the difference between state-card-media_player.html
and ha-media_player.html
?
In HA it is a case of:
- adding
active_player_functionality
(or other name) here - adding the new flags
- Implementing support for
active_player_functionality
in the different media components
Questions:
-
While I agree we should use new flags to avoid confusion, can we use the same values for the flags for the bitwise checks or do we need new values?
-
Do we need to update all media components or is there a sensible default we can use in media_player/init.py?
from architecture.
-
New values. Let's make it very clear that it's different. (also we start at 2^0 anyway)
-
I guess update. Although I don't mind to not do that all in 1 PR.
from architecture.
I've started mapping media player support_features
to services and am going to update the docs as a first step. I just got bitten by not understanding which services map to which supported_features
and have had to submit another PR for the Alexa StepSpeaker to StepVolume integration.
I also start to define active_player_functionality
. Am still a little unsure on how the bitwise values are assigned but will take a best guess and get a WIP out for feedback
from architecture.
This seems like much ado about (almost) nothing. Can we just remove the dynamic features?
It is crazy to have each individual platform add/remove a bunch of SUPPORT_PLAY
-like bits based on their current playing state. That will give a lot of corner cases with inconsistencies and bugs.
Rather than a generic framework, I think much of this could be solved by adding e.g. a first_track: True
attribute when the Previous control should be disabled.
For now, though, I propose that we just ignore the issue and have a visible no-op Previous control in that situation. My DVD remote control always worked like that.
According to a survey by @lucasweb78, only three media players use dynamic controls so it will be a simple cleanup.
from architecture.
I've been thinking about this some more and tend to agree. I'm still working on improving the documentation for the media_player component so that it's clear what flag maps to which service but I am not sure about introducing a second set of flags just for managing the UI controllers.
It would be good to figure out a path forward as right now the Apple Media Player still doesn't have all of it's capabilities correctly discovered by Alexa (unless you run my PR home-assistant/core#12167 as a custom_component).
I've been running the above PR for a few weeks and not having the media_player controls in the UI disappear when it's not in use has not caused any problems and is actually, IMO, nicer as the UI component doesn't keep shifting in size and changing the layout.
from architecture.
š for making supported_features static across Home Assistant. It follows very much the "backend should not care nor try to solve frontend issues".
from architecture.
@lucasweb78 What needs done for plex?
from architecture.
The conclusions in this issue have been reconsidered in #985, we now allow updating supported_features
.
from architecture.
Related Issues (20)
- Splitting tests files in smaller files in components/modules tests HOT 1
- Feature Request HOT 1
- Add favorite position to Cover entity HOT 10
- Add feature light distribution control to LightEntity
- Add new CURRENT_HVAC constants HOT 1
- Add Home Appliance entity
- Officially allow enities to set their entity ID not based on their names HOT 2
- Custom Device Class for Binary Sensors HOT 9
- Installed homeassistant supervised on my Linux machine; can't get it to run. HOT 1
- Expand enqueue options media player HOT 2
- Extend Rest API - unique_id HOT 3
- Add "status" as an attribute to CalendarEvents HOT 5
- Add list of (upcoming) calendar events to templating HOT 1
- Creating automations on the fly HOT 1
- Optional health check HOT 2
- Open letter for improving Home Assistant's Authentication system HOT 7
- Add device_class Heater HOT 2
- Area Units HOT 3
- New Device class for Reactive Energy (varh) HOT 1
- "Lost" device HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from architecture.