device.dimmer
Standard dimmer with switching and dimming function
Parameters
{{ device.dimmer(id, txt, item_switch, item_value, min, max, step, pic_on, pic_off, color_on, color_off, value_display, min_display, max_display, picpos, live, type) }}
id
unique id for this widget (optional)
txt
name of the dimmer
item_switch
an item for switching
item_value
an item for dimming
min
the minimum value if the slider is moved to total left (optional, default: 0)
max
the maximum value if the slider is moved to total right (optional, default: 255)
step
step between two values (optional, default: 5)
pic_on
the pic for the 'on' state (optional)
pic_off
the pic for the 'off' state (optional)
color_on
the color for the 'on' state (optional)
color_off
the color for the 'off' state (optional)
value_display
how should the value be shown; possible options: 'input', 'handle', 'both', 'none' (optional, default 'none')
min_display
the minimum value to display if the slider is moved to total left if this should differ from sent/received value (optional, default like min)
max_display
the maximum value to display if the slider is moved to total right if this should differ from sent/received value (optional, default like max)
picpos
position of the switch: left (default) or right
live
'live mode': if enabled, values will be sent during sliding. '0' sends values only when sliding is stopped, after click into track or if value is edited in input field. (optional, default = 1)
type
icon or button type. Valid types: 'micro', 'mini', 'midi', 'icon' (optional, default: icon)
Example
Dimmer with left or right alignment of the switch
{{ device.dimmer('', 'Dimmer', 'bath.light.switch', 'bath.light.value') }}
{{ device.dimmer('', 'Dimmer', 'bath.light.switch', 'bath.light.value', '', '', '', '', '', '', '', '', '', '', 'right') }}
Dimmer with a minimal value of 20 but which is displayed as 0.
{{ device.dimmer('', '', 'bath.light.switch', 'bath.light.value', 20, 100, 10, icon.light('', '','bath.light.value',20,100), icon.light(), 'green', '#ff0000', 'handle', 0 ) }}
Dimmer with a button-styled switch
{{ device.dimmer('', 'Dimmer', 'bath.light.switch', 'bath.light.value', '', '', '', '', '', '', '', '', '', '', 'left', 0, 'mini') }}
While the dimmer text is normally aligned left it is centered if the dimmer resides in a block. To align it left again, use the following code in your visu.css on a dimmer with icon on the left side:
.block .dimmer-left p {
text-align: left;
}
Use the class ".dimmer-right" for dimmers with icon on the right side. A margin definition can be added for additional fine-positioning of the text.
Author: Martin Gleiß and others