From 8fc0e2175da0afafcc43badd4d2bfda6f813c794 Mon Sep 17 00:00:00 2001 From: 0xee Date: Sat, 3 Apr 2021 14:04:20 +0200 Subject: [PATCH] Add step parameter to slider widget --- mqtt_dash/widgets.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mqtt_dash/widgets.py b/mqtt_dash/widgets.py index 686e47a..31f64a6 100644 --- a/mqtt_dash/widgets.py +++ b/mqtt_dash/widgets.py @@ -48,7 +48,8 @@ def slider_widget(label, value_path=None, unit='', min_val=0, - max_val=255): + max_val=255, + step=1): id_ = make_id() sub_topic = sub_topic or topic template = ''' @@ -58,7 +59,7 @@ def slider_widget(label, class="slider update-policy-update-value {{sub_topic}}-value" data-pub-topic="{{topic}}" {% if value_path %} data-value-path="{{value_path}}" {% endif %} - min="{{min_val}}" type="range" max="{{max_val}}" + min="{{min_val}}" type="range" max="{{max_val}}" step="{{step}}" value="{{min_val}}"/> - {{unit}} @@ -71,6 +72,7 @@ def slider_widget(label, label=label, min_val=min_val, max_val=max_val, + step=step, value_path=value_path, topic=topic, unit=unit,