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

feat(input-number-card) #676

Merged
merged 5 commits into from
Feb 27, 2023
Merged

Conversation

RonNabuurs
Copy link
Contributor

@RonNabuurs RonNabuurs commented Aug 2, 2022

Description

This pull request will add an input-number card.

image

image

Related Issue

#230

Motivation and Context

I needed this for my automation of sprinklers. I have an input_number card for the time the sprinklers will turn on.

How Has This Been Tested

I have tested this on my own Home Assistant installation and locally with a docker container

Types of changes

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • 🚀 New feature (non-breaking change which adds functionality)
  • 🌎 Translation (addition or update a translation)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have tested the change locally.

@Misiu
Copy link
Contributor

Misiu commented Aug 31, 2022

@RonNabuurs can you add a screenshot showing the card like in similar PR's?

@RonNabuurs
Copy link
Contributor Author

@Misiu I've added a few images. Though I found out that there was already a number-input module. So maybe I need to update this MR to reuse a lot of that code.

Copy link
Owner

@piitaya piitaya left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution. I was a little busy so I didn't take time for review 😅

Can you add number support ? I think it can be nice to have it too 🙂
And the component can be renamed number-card instead of input_number-card.

You can also add example in the showcase yaml file.


export const INPUT_NUMBER_CARD_NAME = `${PREFIX_NAME}-input-number-card`;
export const INPUT_NUMBER_CARD_EDITOR_NAME = `${INPUT_NUMBER_CARD_NAME}-editor`;
export const INPUT_NUMBER_ENTITY_DOMAINS = ["input_number"];
Copy link
Owner

Choose a reason for hiding this comment

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

number domain should be supported as well

Copy link

Choose a reason for hiding this comment

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

It would be nice that this card works not just for input_number domain, but for setting other numeric values. For example appliances like sous vide and air fryer target temperature/time.

Copy link
Owner

Choose a reason for hiding this comment

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

@spuljko What's the type of the entities you want to add support ?

Copy link

Choose a reason for hiding this comment

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

@spuljko What's the type of the entities you want to add support ?

I was thinking about it, and came to counlusion that it would be better to add slider as option in template card. I will create new feature request for that.

Copy link
Owner

@piitaya piitaya Nov 13, 2022

Choose a reason for hiding this comment

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

We can't add the slider to template card. It will add too much fields on the template card editor. Why people would need to build a custom slider ?

Copy link

Choose a reason for hiding this comment

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

As I've said, appliances like air fryer, kettle, rice cooker, sous vide. There are two numbers that can be set: cooking time and temperature. Then there is humidity for dehumidifiers, watering time for splinkers, position for smart bed, and lots of other uses. Making separate card for all of that would take lot of time, but having slider that can call some service would do the job.

@AndrewSpec
Copy link

Why it's still not merged?

@piitaya
Copy link
Owner

piitaya commented Nov 23, 2022

Because changes have been requested.

@DannyFeliz
Copy link

@piitaya, why don't you take over and fix the requested change?

@PaoloTK
Copy link
Contributor

PaoloTK commented Dec 6, 2022

I hope I didn't step on any toes by doing this but since I needed the number card myself I implemented the requested fixes here:
https://github.com/piitaya/lovelace-mushroom/tree/21e7545fead0bb7213d687084fcacfdb693a207e

Also, since number and input_number are generic entities I thought it useful to add the ability to set a custom slider color. The ability to set a custom icon and slider color is here:
https://github.com/piitaya/lovelace-mushroom/tree/d4d66736de0bc395058f03eec90865b519760d09

@tungmeister
Copy link

Any progress on this one? It's the last thing I need to replace with a mushroom card on my mobile UI.

@Daniel-dev22
Copy link

@piitaya any idea if this will ever be merged?

@piitaya piitaya force-pushed the feat/input-number-card branch from b4b7761 to 9729400 Compare February 27, 2023 11:29
@piitaya piitaya merged commit fdab27f into piitaya:main Feb 27, 2023
@piitaya
Copy link
Owner

piitaya commented Feb 27, 2023

@DannyFeliz I suggested some changes but the author didn't respond. Each contributor is responsible for his/her PR. It's not my job to fix others work.

For this one, I fixed the missing points (documentation, yaml showcase example, number domain supports) because of the high demand. I also added icon color and display mode (slider or buttons).

@piitaya piitaya added the enhancement New feature or request label Feb 27, 2023
@RonNabuurs
Copy link
Contributor Author

Sorry I did not respond to the suggestions you've made, but I haven't find the time to implement your suggestions. Thanks for implementing them and closing this issue/PR

@bobloadmire
Copy link

does this have the ability to change step sizes? i'd like to be able to snap to 5% increments for example.

@piitaya
Copy link
Owner

piitaya commented Mar 1, 2023

It uses the step of your number entity.

@bobloadmire
Copy link

Well that sucks because I can't change that. The Number Box card on HACS allows for this and works great but doesn't match the theme

@RonNabuurs
Copy link
Contributor Author

You can define the number in the configuration yaml of home-assistant

input_number:
  slider:
    name: Your number
    initial: 30
    step: 30
    min: 0
    max: 240
    unit_of_measurement: Minutes

That would solve your problem right?

@gbcatrinoiu
Copy link

does anyone have any idea why I do not see this card after updating the mushroom integration?

bryan-stewart pushed a commit to bryan-stewart/lovelace-mushroom that referenced this pull request Apr 5, 2023
* feat(input-number-card)

* Add number domain support

* Add doc and icon color support

* Add display mode option

* Update config

---------

Co-authored-by: Paul Bottein <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.