resoai / TileBoard

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

fix(SLIDER): update value in real-time on change #652

Closed timota closed 3 years ago

timota commented 3 years ago

Makes Slider Tile Value more dynamic.

Currently Value for Slider Tile not changing during slider movement. It changes only if slider released. With this change value become dynamic - it changes during slider move, and doesnt wait slider released, so it means you can see actual slider value.

Also, it saves ability to use filter that applied to Value.

Example:

                  {
                     position: [2, 0],
                     height: 2,
                     id: 'light.f1_r2_light_tv_wall',
                     type: TYPES.SLIDER,
                     unit: '%',
                     title: '',
                     state: false,
                     bottom: true,
                     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',
                        request: {
                           type: "call_service",
                           domain: "light",
                           service: "turn_on",
                           field: "brightness"
                        },
                     },
                  },
rchl commented 3 years ago

Looks good. Thanks.

Will release a new version in not too long.