resoai / TileBoard

A simple yet highly configurable Dashboard for HomeAssistant
MIT License
1.63k stars 278 forks source link

Vertical Slider Tile #673

Closed timota closed 3 years ago

timota commented 3 years ago

Add Vertical Slider tile.

Tile doesn't require any input from user, width and height will be calculated automatically based on Tile size. Best to use with tile height > 1. Also, some other options are available for user: sliderHeight and sliderWidth. If they are defined inside slider - they will be used in first place and take precedence via automated calculation. Also, Tile supports icon. If icon doesn't defined it will be taken to consideration in case of automatic calculation.

Example:

{
    position: [0, 0],
    height: 3,
    id: 'light.entity',
    type: TYPES.SLIDER_VERTICAL,
    unit: '%',
    title: 'Slider',
    icon: 'mdi-lightbulb',
    state: false,
    filter: function (value) {
       var num = parseFloat(value) / 2.55 ;
       return num && !isNaN(num) ? num.toFixed() : 0;
    },
    value: '@attributes.brightness',
    slider: {
       max: 255,
       min: 0,
       step: 5,
       field: 'brightness',
       // sliderWidth: '60',
       // sliderHeight: '270',
       request: {
          type: "call_service",
          domain: "light",
          service: "turn_on",
          field: "brightness"
       },
    },
}
Screenshot 2021-03-22 at 01 36 06

@rchl Can you please take a look on PR Thanks in advance.

timota commented 3 years ago

merged: https://github.com/resoai/TileBoard/pull/672

Thanks