quad.stateswitch
Stateswitch
Parameters
{{ quad.stateswitch(id, item_switch, type, value, pic, text, color, indicator, item_longpress, value_longpress, value_longrelease, place1, place2, linetext, columntext, item_uzsu, uzsu_attribs, item_plot, icon_plot, item_auto, extpopup, locks, item_slider, linetext_widget, place4, column_order, switch_or_select) }}
id
unique id for this widget (optional)
item_switch
an item
type
valid types: 'micro', 'mini', 'midi', 'icon', 'text' (optional, default: mini)
value
array of values (optional, default [0,1])
If the item has a value that is not part of the list, the state (icon, text, color) of the last value in the list will be shown.
pic
array of icons (optional, default just if text is empty: control_on_off)
dynamic icons can be used, e.g. icon.light('', '', value_item, min_display, max_display); please note: these must not be wrapped by apostrophs (')
text
array of texts (optional)
color
array of colors; 'icon1' or e. g. '#f00' for red (optional, default: icon0)
additionally you can use 'hidden' to not diplay at all or 'blank' to make it invisible but preserve the space that would be used.
indicator
activity indicator which is active until response (or a timeout of 3 seconds is reached); pass either a color, 'icon1' or 'blink' (optional)
item_longpress
an item to which a value on longpress is sent (optional)
value_longpress
the value to send on longpress (optional)
If this starts with a + or - sign the value is treated as offset to current stateswitch value.
value_longrelease
the value to send on releasing after a longpress (optional)
place1
placeholder attributes for future features, etc.
place2
placeholder attributes for future features, etc.
If you want to implement two state switches for one single item (e.g. on/off and timer or restart, etc.)
you can provide the following attributes as single statements without arrays.
linetext
text for the whole line (optional)
columntext
text for each column (optional)
item_uzsu
a gad/item for UZSU
uzsu_attribs
Array with standard UZSU parameters: pic_on, pic_off, valueType, valueParameterList, color_on, color_off. (optional)
item_plot
array with all plot.period attributes to show a plot in popup. Alternatively just the item to be plotted.
icon_plot
icon triggering the plot popup
item_auto
"root item" which holds stateengine information. show current state of stateengine/stateengine item. Adjust icons and states below accordingly
extpopup
Array of arrays for extended popup window. Use this to create an icon to open a popup with switches, sliders, flips or select menues.
First entry can either be "stateengine" to make the stateengine plugin icon the trigger for the popup or an icon (e.g. time_automatic).
After that you have to create an array for each line of the popup. In this array you first define the elements like switch, text, etc.,
followed by the attributes for each element as you would for the basic widget.
Possible elements are: header, text, slider, flip, switch, select
Example: ['stateengine', ['header', 'Suspendzeit'], [['switch', 'slider'], [switch_item, 'icon', [0,1], ['secur_open','secur_locked']],
[slider_item, slider_min, slider_max, slider_step, '', 'handle']]
locks
array with items for locking. You have to be aware of the order: item_lock, item_bwmlock (presence sensor), item_force (force on/off/neutral)
item_slider
additional item for changing value (e.g. timer). A slider popup will be shown
You can provide additional attributes as an array: item, min, max, step, format, value_display (handle, etc.)
linetext_widget
Widget(s) to be shown right after linetext. Can be used to show a countdown or other additional information. Example: basic.symbol('', 'licht.og.essen.sa') - don't put basic.symbol() in high commas! (optional)
place4
placeholder attributes for future features, etc.
column_order
array with element description: Reorder elements to your liking (esp. relevant for smartphones as several columns might be too much)
possible elements are: 'switch', 'stateengine', 'uzsu', 'plot', 'locks', 'slider'
For empty columns either use ' ' or a number to define the column width (e.g. '40' = 40 pixels width)
Combine elements in one column by putting them in arrays. Standard is ['locks', 'switch', 'slider', 'stateengine', 'plot', 'uzsu']
Be aware that this only works with lines containing one switch only! For multiple switches leave column_order empty and rely on the defaults.
Example
Standard column order
{{ quad.stateswitch('stateswitch11', 'this', 'icon', [0,3,155], ['edit_numeric_0.svg','edit_numeric_3.svg','edit_numeric_5.svg'], '', '', 'blink', '', '', '', '', '', 'one switch, standard order', 'Switch1', 'this.uszu', '', 'this.plot', '', 'this.stateengine', (extpopup['extra']), [['this.sperren'], 'bwm.this.sperren','this.zwangvalue']) }}
[['uzsu','switch'], '10', ['plot','stateengine'], '10', 'locks'] with extpopup
{{ quad.stateswitch('stateswitch12', 'this', 'icon', [0,3,155], ['edit_numeric_0.svg','edit_numeric_3.svg','edit_numeric_5.svg'], ['','',''], ['','#ff0','#00f'], 'blink', '', '', '', '', '', 'One item with column_order', 'Switch1', 'this.uszu', '', 'this.plot', '', 'this.stateengine', (extpopup['stateengine']), ['this.sperren'], '', '', '', [['uzsu','switch'], '10', ['plot','stateengine'], '10', 'locks']) }}
don't use column_order for multiple switches.
{{ quad.stateswitch('stateswitch14', ['this', 'that', 'theother'], ['icon','mini','midi'], [[1,0],'',[0,150]], [['edit_numeric_1.svg','edit_numeric_0.svg'],'',['edit_numeric_0.svg','edit_numeric_9.svg']], ['', ['0','1']], [['',''],'',['','']], ['blink','','blink'], '', '', '', 'place1', 'place2', 'Mixed types with one slider', ['', '', ''], ['this.uszu','','theother.uszu'], ['','',''], '', '', '', '', '', [['this.timer', 0, 10, 1, 'min', 'handle'],'','']) }}
{{ quad.stateswitch('stateswitch19', ['this', 'that', 'theother'], ['icon','icon','icon'], [[0,1],[0,1],[0,1]], [['edit_numeric_0.svg','edit_numeric_1.svg'],['edit_numeric_0.svg','edit_numeric_2.svg'],['edit_numeric_0.svg','edit_numeric_3.svg']], '', [['',''],['',''],['','']], ['blink','blink','blink'], '', '', '', '', '', '3 columns with different features', ['a', 'b', 'c'], ['this.uzsu','',''], ['','',''], ['','that.plot',''], '', 'this.automatik', ['', '', (extpopup['extra'])], ['',['that.sperren','bwm.that.sperren','that.zwangvalue'], '']) }}
Author: Niko Will, Onkel Andy