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

[Bug]: Max does not work #60

Open
briodan opened this issue Oct 26, 2024 · 2 comments
Open

[Bug]: Max does not work #60

briodan opened this issue Oct 26, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@briodan
Copy link

briodan commented Oct 26, 2024

Current Behavior

when setting the max option in the card config, the card allows the value to be set higher then max value.

Expected Behavior

when sliding up i expect the value to stop at what was set under the max setting.
in my case TV volume can not be set above 20.

Steps To Reproduce

add the following card code

type: custom:my-slider-v2
entity: media_player.living_room_tv_2
vertical: true
styles:
  card:
    - height: 182px
    - width: 110px
  min: 1
  max: 20
  showMin: true
  disableScroll: true
layout_options:
  grid_columns: 1
  grid_rows: 3

slide volume and observe setting change on the device

Environment

- OS: HAOS 12.1
- Node:
- Version: current
- Hassio: 2024.9.3

Anything else?

No response

@briodan briodan added the bug Something isn't working label Oct 26, 2024
@AnthonMS
Copy link
Owner

AnthonMS commented Oct 27, 2024

I haven't tested if it is because of this, but pretty sure it because you set the min and max in the styles. You need to put those config keys in the root of the slider config.
The same is true with the showMin and disableScroll. You should only add css styling inside the styles key.
So your example should look like:

type: custom:my-slider-v2
entity: media_player.living_room_tv_2
vertical: true
min: 1
max: 20
showMin: true
disableScroll: true
styles:
  card:
    - height: 182px
    - width: 110px
layout_options:
  grid_columns: 1
  grid_rows: 3

Let me know if this works so we can close the issue. If not, then I will try to find some time to look at it soon.

@Jonny-T-cyber
Copy link

Hi, this solution seems to work only if the card is in the "normal" yaml flow of the page.
But it no longer works if I open the card in a popup with browser_mod.
In this case, while maintaining the directions you gave, the max does not lock at the level set in the code.

I specify that this anomaly occurs only for the MAX value and not for the MIN...
There is that a reason?

Off-topic:
I anticipate that there are other anomalies with "my-card.js" that you can already see in yellow color in the image I am about to provide you. For which I will open a specific issue. (I have verified that these additional anomalies always occur, even without using browser_mod)

Anyway, returning to the topic, an error appears on the page and, moreover, in the console it reads:

connection-mixin.ts:156 Uncaught (in promise) 
{code: 'invalid_format', message: 'Invalid value for input_number.slider_intensity: 6.0 (range 1.0 - 5.0)'}
code
: 
"invalid_format"
message
: 
"Invalid value for input_number.slider_intensity: 6.0 (range 1.0 - 5.0)"

image

Thanks for the support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants