Skip to content

Add number entity support#7876

Merged
bramkragten merged 4 commits intohome-assistant:devfrom
Shulyaka:number
Jan 26, 2021
Merged

Add number entity support#7876
bramkragten merged 4 commits intohome-assistant:devfrom
Shulyaka:number

Conversation

@Shulyaka
Copy link
Copy Markdown
Contributor

@Shulyaka Shulyaka commented Dec 2, 2020

Breaking change

N/A

Proposed change

Add frontend support for the new number entity.

number entities

Currently it is shown as a box because it is the default for the input_number which we are re-using. But I will raise a PR to core to allow slider mode, which will be supported automatically.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

demo:

Additional information

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

@thomasloven
Copy link
Copy Markdown
Contributor

Does this consider the more-info dialog?

@Shulyaka
Copy link
Copy Markdown
Contributor Author

Shulyaka commented Jan 8, 2021

There is no more-info dialog, which is same as with input_number.

"input_text",
"lock",
"media_player",
"number",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means you would need to add a specific state card for this domain, like the input_number also has:
https://github.com/home-assistant/frontend/blob/dev/src/state-summary/state-card-input_number.js#L26

@thomasloven
Copy link
Copy Markdown
Contributor

There is a more-info dialog for input_number. I believe it uses the state card from the states interface in some way
image

@bramkragten
Copy link
Copy Markdown
Member

Yes, that is the state card I linked above.

@Shulyaka
Copy link
Copy Markdown
Contributor Author

Ok, got it. Is stateCardType() the correct way to do it (please see last commit), or I'd better inherit on StateCardInputNumber?

@bramkragten
Copy link
Copy Markdown
Member

Ok, got it. Is stateCardType() the correct way to do it (please see last commit), or I'd better inherit on StateCardInputNumber?

It is pretty dangerous to use the UI of Input Number everywhere, it means we always have to check if the 2 are in sync when changes are made.

I think we should just copy them

@Shulyaka
Copy link
Copy Markdown
Contributor Author

It is pretty dangerous to use the UI of Input Number everywhere, it means we always have to check if the 2 are in sync when changes are made.

I think we should just copy them

Copied state-card-input_number. Should I copy hui-input-number-entity-row as well?

@bramkragten
Copy link
Copy Markdown
Member

Yes please :-)

@Shulyaka
Copy link
Copy Markdown
Contributor Author

Done.
But now when we fix one of them, we must remember to fix the other.

@bramkragten bramkragten merged commit 46b3836 into home-assistant:dev Jan 26, 2021
@bramkragten bramkragten mentioned this pull request Jan 27, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jan 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants