my-slider-v2

February 5, 2024 ยท View on GitHub

Back

my-slider-v2

Description

My Slider V2 is a customizable card for light, input_number, covers, fans, switches, locks & media_player volume_level entity sliders, for the Home Assistant Lovelace frontend.

It is completely customizable now and fully templatable.

Features

  • Fully customizable slider card for lights, input_numbers, media_players, covers, fans, switches, and locks
  • Templating
  • Styles can be fully customized easily within the card itself
  • Vertical
  • Flipped
  • Inverse

Future features (Maybe)

  • Text inside slider (Should be easily done with this new slider)
  • If user is not actively changing the slider, then it should animate between states.
  • If you would like something made or fixed, please feel free to create an issue asking about it.

Options

NameTypeDefaultDescription
typestringRequiredcustom:my-slider-v2
entitystringRequiredlight.livingroom
stepstring"1"Number of steps to take (For input number, if step is not specified, it will use step from attributes.) (For media_player, if step is not specified it will step by 0.01. (It will actually step by 1, but it will convert 27 to 0.27. So if you set a custom step, set it between 0 and 100.))
colorMode (Deprecated: Use 'mode' instead)stringbrightnessCan be brightness, temperature, hue, saturation
coverMode (Deprecated: Use 'mode' instead)stringpositionCan be position or tilt
modestringcover:position, light:brightnessCan be position, tilt, brightness, temperature, hue, saturation, volume & seekbar
verticalbooleanfalseThis will set the slider to be vertical and handled from bottom to top. Default on covers
flippedbooleanfalseThis will just flip the slider to go from right to left or top to bottom. Default on covers
inversebooleanfalseWill inverse how far the slider has progressed compared to value. so if brightness is 75%, then it will only be 25% progressed. This is useful for cover, where it is Default.
intermediatebooleanfalseIf set to true the slider sends immediate updates while sliding. Not recommended by default, since it may generate too many updates.
disableScrollbooleantrueDisable scrolling on touch devices when starting the touchmove from within the slider. Default true on covers.
allowTappingbooleantrueAllow tapping on slider track to activate. If false only dragging by thumb will activate it.
marginOfErrornumber10Pixel distance the input can be from the thumb if allowTapping is set to false
allowSlidingbooleanfalseAllow sliding on slider track to activate. This works well in conjuction with allowTapping false. It will only trigger when sliding in direction of slider or if sliding from thumb.
slideDistancenumber10Distance input has to travel in slider direction for allowSliding to take effect
showMinbooleanfalseShow the minimum on the slider. If false, the min will be far left (if not flipped or vertical)
minThresholdnumber15Only used for determining how much progress should be shown on a switch or lock
maxThresholdnumber75Only used to determine how far users have to slide to activate toggle commands for switch and lock
minnumber0Minimum value you can set the entity state
maxnumber100Maximum value you can set the entity state
sliderMinnumber0The minimum percentage progress to show always
stylesobjectDefault stylesStyle each component used in the card.

Examples

Examples

- type: custom:my-slider-v2
  entity: light.bar_spots
  allowTapping: false
  styles:
    card: 
      - height: 50px
    track:
      - background: >
          [[[
            if (entity.state == "off") return "red";
            else return "green";
          ]]]
      
- type: custom:my-slider-v2
  entity: light.bar_spots
  flipped: true
  styles:
    card: 
      - height: 50px

- type: custom:my-slider-v2
  entity: light.bar_spots
  inverse: true
  styles:
    card: 
      - height: 50px

- type: horizontal-stack
  cards:
    - type: custom:my-slider-v2
      entity: cover.livingroom_blind_1
      styles:
        card: 
          - height: 200px
          - width: 50px
          
    - type: custom:my-slider-v2
      entity: light.bar_spots
      vertical: true
      styles:
        card: 
          - height: 200px
          - width: 50px

  - type: custom:my-slider-v2
    entity: input_number.test_6
    vertical: true
    styles:
      card: 
        - height: 200px
        - width: 50px

  - type: custom:my-slider-v2
    entity: input_number.test_6
    vertical: true
    showMin: true
    styles:
      card: 
        - height: 200px
        - width: 50px