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
Add experimental UI #1205
Add experimental UI #1205
Conversation
Regarding the code itself: Is this a concept - i.e. discuss feature only, or something that is intended to move to "production" later, so also comment on performance, portability, etc? Regarding concrete css properties vs pre-defined themes (like in current implementation): While concrete css might be easier for users editing configs, for the future UI editor it is much more pain if I need to put the same 5 props on many entries. Maybe support both? |
There are 3 kinds of customization that I think we should support:
We said that "all" domains can have full- and state-cards. For example a full-card for air conditioners or alarm panels can be useful. How do we want to handle this? I think we need 3 types of cards in views:
We should store all configureable keys for a card in a config-key (entities-card: |
|
// stateCardType requires `hass` because we check if a service exists. | ||
// This should also be determined during runtime. | ||
function stateElement(hass, entityId, stateObj) { | ||
if (stateObj.attributes && 'custom_ui_state_card' in stateObj.attributes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stateObj
can be null
|
Imo if a user wants to customize a whole view he should use a custom panel instead. I think some restrictions for /states, like column-width, are fine |
Created a new repo for defining a schema and feature set. Let's create a new issue and PR against schema.md for each feature that we want to add. https://github.com/home-assistant/ui-schema/blob/master/schema.md |
Other things (not sure if belongs to the schema repo):
|
@andrey-git for discovery of new entities, I was thinking of taking the approach of the Android home screen. On Android, when you install an application, it is placed on your last home screen. After that it's up to the user to re-org. We can do a similar approach. When we see a new entity (based on that it's not in the entity registry yet), we will add it to one of the frontend views. We can also dynamically create a view of entities that are not specifically mentioned in any frontend config - problem there is that we don't know how cards are configured and thus can't really know which entities are shown. |
For dynamic config, that can be achieved using composition: # Example card config
type: entity-filter
filter:
domain: light
state: on
card: entities-graph . # defaults to 'entities'
card_config:
card-specific: config |
@andrey-git opened issues for the topics you raised home-assistant/ui-schema#2 |
Added a filter card as an example. views:
- cards:
- type: entities
title: Entity Example
entities:
- input_boolean.switch_ac_kitchen
- input_boolean.switch_ac_livingroom
- input_boolean.switch_tv
- type: entity-filter
filter:
state: 'on'
domain: input_boolean
card_config:
title: Filter Example
theme: yellow |
|
||
if (config.filter.domain) { | ||
const domain = config.filter.domain; | ||
filters.push(stateObj => computeStateDomain(stateObj) === domain); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
domain should be an array
Re: Discovery of new entities - following on to the Android example (I've always had Samsungs, so my idea of Android might be a bit shit!), what about a hidden 'All' view that is accessible from a menu of some sort? As the name implies, all entities would be added to this view and can be dealt with further from there. |
@SteveMacLowell that is a good idea, please share it in home-assistant/ui-schema#2 |
Done! |
This idea has not gotten the traction that I hoped it would get among developers. So I am going to go ahead and make it available to users. That way people can play with an early prototype and start giving better feedback. |
This is my take on home-assistant/architecture#14 and #1127 which has the goal to allow users to define a UI in a standalone file.
I'm really just exploring how this could work, what data structures can work and how we can simplify it a lot.
My approach:
<config>/experimental-ui.yaml
. This file is not cached so you can edit the file and refresh to see latest version. (branch for Home Assistant)/experimental-ui
<hui-*>
. These components will be used to render the new configuration format.It's currently written in Polymer but I think that the element creation can be done without it.
Feature set:
expeirmental-ui.yaml
entities
Known breaking changes with current UI:
entities
key of anentities
card should be able to contain dictionaries specifyingentity_id
and possibletype
.Example
<config>/experimental-ui.yaml
:And use
configuration.yaml
:Feel free to discuss in this PR the config format. What we should support and what not.
CC @andrey-git @c727