+
{{ linetext|e }}
+ {% set runs = item is iterable ? max((item|length-1),0 ) : 0 %}
+ {% set scriptcolumns = 0 %}
+ {% for i in 0..runs %}
+ {% if format[i] != 'script' %}
+ {% set column_order = column_order[i]|default(i+1) - scriptcolumns %}
+
+ {% else %}
+
+ {% set scriptcolumns = scriptcolumns + 1 %}
+ {% endif %}
+ {% if item is iterable and item[i] == ' ' %}
+ {% elseif runs > 0 %}
+ {{ columntext[i] }}
+ {% if item[i] == '' %}
+
{{ formula[i]|e }}
+ {% else %}
+ {{ basic.print(id~'list_print'~i, item[i], format[i], formula[i], threshold[i], color[i]) }}
+ {% endif %}
+ {% if item_plot[i] %}
+
+ {{ basic.icon(icon_plot[i]|deficon('measure_power_meter'), 'icon0') }}
+
+
+ {% endif %}
+ {% else %}
+ {{ columntext }} {{ basic.print(id~'list_print', item, format, formula, threshold, color) }}
+ {% if item_plot %}
+
+ {{ basic.icon(icon_plot|deficon('measure_power_meter'), 'icon0') }}
+
+
+ {% endif %}
+ {% endif %}
+
+ {% endfor %}
+
+
+
+{% endmacro %}
+
+/**
+ * RTR to control heating. This widget only shows two values: the actual temperature and the set temperature. Clicking on the latter opens a popup.
+ *
+ * @param {id=} unique id for this widget
+ * @param {text=} name of the rtr
+ * @param {item(num)} an item for the actual temperature
+ * @param {item(num)} an item for the set temperature
+ * @param {item(bool,num)=} an item for comfort / standby (3x bit or 1x byte, optional)
+ * @param {item(bool,num)=} an item for night (3x bit or 1x byte, optional)
+ * @param {item(bool,num)=} an item for frost (3x bit or 1x byte, optional)
+ * @param {item(bool,num)=} an item for the current state of the actor (optional)
+ * @param {item(str)=} an item for a text (some rtr have a text-display), (optional)
+ * @param {value=0.5} step for plus/minus buttons (optional, default: 0.5)
+ * @param {item(num)=} an item for the offset temperature (optional, if provided set temperature changes will be written to this item instead of 'item_set')
+ * @param {text[]=} list of additional widgets / content to display
+ * @param {color=} color for the popup icon
+ * @param {text=} activity indicator for the plot icon which is active until response (or a timeout of 3 seconds is reached); pass either a color, 'icon1' or 'blink' (optional)
+ * @param {unspecified[?]=} array with all plot.period attributes to show a plot in popup. Alternatively just the item to be plotted.
+ * @param {image=measure_power_meter} icon triggering the plot popup
+ * @param {item(num)=} an item for the current setpoint (e.g. valve 0..100%)
+ * @param {unspecified=} placeholder attributes for future features, etc.
+ * @param {value[](1,2,3,4,5)=} array with numbers from 1 to 5: Reorder elements to your liking (esp. relevant for smartphones as 5 columns might be too much)
+ * to reverse the complete order, use [5, 4, 3, 2, 1], to reverse the last two, use [1, 2, 3, 5, 4], etc.
+ */
+{% macro rtr(id, linetext, item_actual, item_set, item_comfort, item_night, item_frost, item_state, item_txt, step, item_offset, supplements, color, indicator, item_plot, icon_plot, item_setpoint, place4, column_order) %}
+ {% import "basic.html" as basic %}
+ {% import "plot.html" as plot %}
+ {% import "device.html" as device %}
+ {% set id = id is empty ? item_actual|replace('.', '_') : id %}
+
+
+
{{ linetext|e }}
+
+
+
+ {% if item_setpoint != '' %}
+
+ {{ basic.print(id~'_setpoint', item_setpoint, '%') }}
+
+ {% endif %}
+
+
+
+{% endmacro %}
+
+/**
+ * Dimmer with switching and dimming function. Be aware that the attributes differ from the basic dimmer widget!
+ *
+ * @param {id=} unique id for this widget
+ * @param {text=} text for the whole line
+ * @param {item(bool,num)} an item for switching
+ * @param {item(num)} an item for dimming
+ * @param {value=0} the minimum value if the slider is moved to total left (optional, default 0)
+ * @param {value=255} the maximum value if the slider is moved to total right (optional, default 255)
+ * @param {value=5} step between two values (optional, default 5)
+ * @param {image=light_light} icon for 'on' state, can also be dynamic (optional, default is light_light)
+ * @param {image=light_light} icon for 'off' state, can also be dynamic (optional, default is light_light)
+ * @param {color=icon1} color for 'on' state (optional)
+ * @param {color=icon0} color for 'off' state (optional)
+ * @param {text(input,handle,both,none)=none} how should the value be shown; possible options: 'input', 'handle', 'both', 'none' (optional, default 'input')
+ * @param {value=} 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)
+ * @param {value=} 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)
+ * @param {text='left'} position of the switch: left (default) or right
+ * @param {text=} activity indicator which is active until response (or a timeout is reached)
+ * @param {text(horizontal,vertical,bottomup,semicircle,popup)=horizontal} if the dimmer slider should be implemented in the column directly.
+ * possible options: 'horizontal', 'vertical', 'bottomup', 'semicircle'. 'popup' or empty for popup.
+ * @param {item(dict)=} a gad/item for UZSU
+ * @param {unspecified[]=} Array with standard UZSU parameters: pic_on, pic_off, valueType, valueParameterList, color_on, color_off. (optional)
+ * @param {text=} value type: '%' to recalculate 0-255 values to 0-100% (e.g. for lights) or any formula
+ - VAR1, VAR2, ... represent the corresponding item's value, VAR is an array of all item values
+ - SUM(VAR), AVG(VAR), SUB(VAR), MIN(VAR) and MAX(VAR) aggregate the values
+ * @param {unspecified[?]=} array with all plot.period attributes to show a plot in popup. Alternatively just the item to be plotted.
+ * @param {image=measure_power_meter} icon triggering the plot popup
+ * @param {item(foo)=} "root item" which holds stateengine information. show current state of stateengine/stateengine item. Adjust icons and states below accordingly
+ * @param {unspecified[]=} 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']]
+ * @param {item[](bool,num)=} 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)
+ * @param {unspecified[?]=} 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)
+ * @param {unspecified=} placeholder attributes for future features, etc.
+ * @param {text[](switch,value_popup,value_slider,locks,uzsu,stateengine,plot,scenes,extpopup,anynumber)=[['locks', 'switch'], 'value_popup', 'stateengine', 'uzsu', 'plot']} array with element description: Reorder elements to your liking (esp. relevant for smartphones as several columns might be too much)
+ possible elements are: 'switch', 'value_popup', 'value_slider', 'locks', 'uzsu', 'stateengine', 'plot', 'scenes', 'extpopup'
+ 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'], 'value_popup', 'stateengine', 'uzsu', 'plot']
+ *
+ * @see stateengine/stateengine
+ *
+ */
+{% macro dimmer(id, linetext, item_switch, item_value, min, max, step, pic_on, pic_off, color_on, color_off, value_display, min_display, max_display, picpos, indicator, slider_orientation, item_uzsu, uzsu_attribs, formula, item_plot, icon_plot, item_auto, extpopup, locks, linetext_widget, place4, column_order) %}
+ {% import "basic.html" as basic %}
+ {% import "device.html" as device %}
+ {% import "plot.html" as plot %}
+ {% import "popup.html" as popup %}
+ {% import "clock.html" as clock %}
+ {% if asset_exists('stateengine.html') %}
+ {% import "stateengine.html" as stateengine %}
+ {% endif %}
+
+/** {# most of the following code provides some dummy proofing concerning the column_order. Elements are only added when relevant items exist #} */
+ {% set elements = {} %}
+ {% for key,item in column_order %}
+ {% set written = 0 %}
+ {% if item is not iterable %}
+ {% if item == 'switch' and item_switch %}
+ {% set elements = elements|merge({(key):(item)}) %}
+ {% set written = 1 %}
+ {% elseif (item == 'value_popup' or item == 'value_slider') and item_value %}
+ {% set elements = elements|merge({(key):(item)}) %}
+ {% set written = 1 %}
+ {% elseif item == 'uzsu' and item_uzsu %}
+ {% set elements = elements|merge({(key):(item)}) %}
+ {% set written = 1 %}
+ {% elseif item == 'locks' and locks %}
+ {% set elements = elements|merge({(key):(item)}) %}
+ {% set written = 1 %}
+ {% elseif item == 'extpopup' and extpopup and extpopup[0] != 'stateengine' %}
+ {% set elements = elements|merge({(key):(item)}) %}
+ {% set written = 1 %}
+ {% elseif item == 'stateengine' and item_auto and stateengine is defined %}
+ {% set elements = elements|merge({(key):(item)}) %}
+ {% set written = 1 %}
+ {% elseif item == 'plot' and item_plot %}
+ {% set elements = elements|merge({(key):(item)}) %}
+ {% set written = 1 %}
+ {% elseif item == '' or item == ' ' %}
+ {% set elements = elements|merge({(key):('empty')}) %}
+ {% set written = 1 %}
+ {% elseif item matches '/^[\\d\\.]+$/' %}
+ {% set elements = elements|merge({(key):('empty_'~item)}) %}
+ {% set written = 1 %}
+ {% endif %}
+ {% else %}
+ {% set elements = elements|merge({(key):('multi')}) %}
+ {% for key,arrayitem in item %}
+ {% if arrayitem == 'switch' and item_switch %}
+ {% set elements = elements|merge({(key):(arrayitem)}) %}
+ {% set written = 1 %}
+ {% elseif (arrayitem == 'value_popup' or arrayitem == 'value_slider') and item_value %}
+ {% set elements = elements|merge({(key):(arrayitem)}) %}
+ {% set written = 1 %}
+ {% elseif arrayitem == 'uzsu' and item_uzsu %}
+ {% set elements = elements|merge({(key):(arrayitem)}) %}
+ {% set written = 1 %}
+ {% elseif arrayitem == 'locks' and locks %}
+ {% set elements = elements|merge({(key):(arrayitem)}) %}
+ {% set written = 1 %}
+ {% elseif arrayitem == 'extpopup' and extpopup and extpopup[0] != 'stateengine' %}
+ {% set elements = elements|merge({(key):(arrayitem)}) %}
+ {% set written = 1 %}
+ {% elseif arrayitem == 'stateengine' and item_auto and stateengine is defined %}
+ {% set elements = elements|merge({(key):(arrayitem)}) %}
+ {% set written = 1 %}
+ {% elseif arrayitem == 'plot' and item_plot %}
+ {% set elements = elements|merge({(key):(arrayitem)}) %}
+ {% set written = 1 %}
+ {% elseif arrayitem == '' or arrayitem == ' ' %}
+ {% set elements = elements|merge({(key):(arrayitem)}) %}
+ {% set written = 1 %}
+ {% endif %}
+ {% endfor %}
+ {% endif %}
+ {% if column_order[key+1] is iterable %}
+ {% if (column_order[key+1][0] starts with 'empty') or (column_order[key+1][0] matches '/^[\\d\\.]+$/') or (column_order[key+1][0] == ' ') %}
+ {% elseif written == 1 %}
+ {% set elements = elements|merge({(key):('div')}) %}
+ {% endif %}
+ {% else %}
+ {% if (column_order[key+1] starts with 'empty') or (column_order[key+1] matches '/^[\\d\\.]+$/') or (column_order[key+1] == ' ') %}
+ {% elseif written == 1 %}
+ {% set elements = elements|merge({(key):('div')}) %}
+ {% endif %}
+ {% endif %}
+ {% endfor %}
+
+/** {# most of the following code provides some dummy proofing concerning the column_order. Standard elements are only shown when relevant items exist #} */
+ {% if elements is empty %}
+ {% set elements = { 0:'ignore' } %}
+ {% set multi = 0 %}
+ {% for i in 1..8 %}
+ {% if locks and 'locks' not in elements %}
+ {% set multi = multi+1 %}
+ {% set elements = elements|merge({(i):('locks')}) %}
+ {% elseif item_switch and 'switch' not in elements %}
+ {% set multi = multi+1 %}
+ {% set elements = elements|merge({(i):('switch')}) %}
+ {% elseif item_value and 'value_popup' not in elements %}
+ {% set elements = elements|merge({(i):('div')}) %}
+ {% set elements = elements|merge({(i+1):('value_popup')}) %}
+ {% elseif extpopup and 'extpopup' not in elements and extpopup[0] != 'stateengine' %}
+ {% set elements = elements|merge({(i):('div')}) %}
+ {% set elements = elements|merge({(i+1):('extpopup')}) %}
+ {% elseif item_plot and 'plot' not in elements %}
+ {% set elements = elements|merge({(i):('div')}) %}
+ {% set elements = elements|merge({(i+1):('plot')}) %}
+ {% elseif item_auto and 'stateengine' not in elements and stateengine is defined %}
+ {% set elements = elements|merge({(i):('div')}) %}
+ {% set elements = elements|merge({(i+1):('stateengine')}) %}
+ {% elseif item_uzsu and 'uzsu' not in elements %}
+ {% set elements = elements|merge({(i):('div')}) %}
+ {% set elements = elements|merge({(i+1):('uzsu')}) %}
+
+ {% endif %}
+ {% endfor %}
+ {% set elements = elements|merge({(elements|length):('div')}) %}
+ {% if multi >= 2 %}
+ {% set elements = {0:'multi'}|merge(elements|slice(1)) %}
+ {% set multi = 0 %}
+ {% endif %}
+ {% endif %}
+ {% if elements[0] == 'ignore' %}
+ {% set elements = elements|slice(1) %}
+ {% endif %}
+ {% set columnnumber = {} %}
+
+{% set ext_elements = [] %}
+{% for id, string in elements %}
+ {% set ext_elements = ext_elements|merge([(string)]) %}
+{% endfor %}
+
+{% set id = id is empty ? item_switch|replace('.', '_') : id %}
+
+/**
+
+{% for column in elements %}
+ {{ column }},
+{% endfor %}
+
+*/
+
+
+
+
{{ linetext|e }}
+ {% if linetext_widget != '' %}
+ {% if linetext_widget is iterable %}
+ {% for widget in linetext_widget %}
+ {{ widget }}
+ {% endfor %}
+ {% else %}
+ {{ _context['linetext_widget'] }}
+ {% endif %}
+ {% elseif item_auto and stateengine is defined and (not column_order or 'stateengine' in column_order) %}
+ {{ clock.countdown('', item_auto~'.suspend.visu', item_auto~'.suspend_start.unix_timestamp', item_auto~'.settings.suspendduration.duration_format', '1', '', ' ') }}
+ /**
+ {{ basic.print(id~'dimmerprint', item_auto~'.suspend_end', 'text') }}
+ */
+ {% endif %}
+
+
+ {% for column in elements %}
+ {% if (column starts with 'empty' and not loop.last) or (column == 'div' and not loop.last) %}
+ {% if loop.first %}
+ {% if column == 'empty' %}
+
+ {% else %}
+
+ {% endif %}
+ {% elseif column == 'empty' %}
+ {% set columnnumber = columnnumber|merge({(loop.index):(loop.index)}) %}
+
+
+ {% elseif column starts with 'empty' %}
+ {% set columnnumber = columnnumber|merge({(loop.index):(loop.index)}) %}
+
+
+ {% elseif column == 'div' %}
+ {% set columnnumber = columnnumber|merge({(loop.index):(loop.index)}) %}
+
+ {% endif %}
+ {% elseif loop.first %}
+
+ {% endif %}
+
+ {% if column == 'locks' %}
+ {% if locks is not iterable %}
+ {% set item_lock = locks|default('') %}
+ {% else %}
+ {% set item_lock = locks[0]|default('') %}
+ {% set item_bwmlock = locks[1]|default('') %}
+ {% set item_force = locks[2]|default('') %}
+ {% endif %}
+
+ {% if (item_lock and item_bwmlock) or item_force %}
+
+ {{ basic.symbol(id~'list_lockpop_on', [item_lock, item_bwmlock, item_force], '', 'secur_locked', 1, 'min', color_on) }}
+ {{ basic.symbol(id~'list_lockpop_off', [item_lock, item_bwmlock, item_force], '', 'secur_open', 0, 'and', color_off) }}
+
+ {{ popup.locks(uid(page, id)~'_list_locks_popup', [item_lock|default(''), [color_off|default('icon0'), color_on|default('icon1')]], [item_bwmlock|default(''), [color_off|default('icon0'), color_on|default('icon1')]], [item_force|default(''), color_on|default('icon1')]) }}
+ {% elseif item_lock %}
+ {{ basic.stateswitch(id~'list_lock', item_lock, 'icon', [0,1], ['secur_open', 'secur_locked'], '', [color_off, color_on], indicator) }}
+ {% elseif item_bwmlock %}
+ {{ basic.stateswitch(id~'list_lock', item_bwmlock, 'icon', [0,1], ['presence_unlocked', 'presence_locked'], '', [color_off, color_on], indicator) }}
+ {% endif %}
+ {% if elements[loop.index] == 'div' %}
+
+ {% endif %}
+ {% endif %}
+
+ {% if column == 'switch' and item_switch %}
+
+ {{ basic.stateswitch(id~'_list_dimmer_dynicon', item_switch, 'icon', [0,1], [pic_off|default('light_light'), pic_on|default('light_light')], '', [color_off, color_on], indicator) }}
+ {% if elements[loop.index] == 'div' %}
+
+ {% endif %}
+ {% endif %}
+
+ {% if column == 'value_slider' and item_value %}
+ {{ basic.slider(id~'_slider_inline', item_value, min, max, step, slider_orientation, value_display, min_display, max_display) }}
+ {% if elements[loop.index] == 'div' %}
+
+ {% endif %}
+ {% endif %}
+
+ {% if column == 'value_popup' and item_value %}
+
+ {% if formula == '%' %}
+ {{ basic.print(id~'_list_dimmer_actual', item_value, '%', 'VAR1/255*100', '', [color_off|default('icon0'), color_on|default('icon1')]) }}
+ {% else %}
+ {{ basic.print(id~'_list_dimmer_actual', item_value, 'int', formula, '', [color_off|default('icon0'), color_on|default('icon1')]) }}
+ {% endif %}
+
+
+ {% endif %}
+ {% endif %}
+
+ {% if column == 'extpopup' and extpopup %}
+ {% if extpopup[0] not in ext_elements %}
+
+ {{ basic.symbol(id~'extpopupicon', '', '', extpopup[0], '', '', icon_color[0]|default('icon0')) }}
+
+ {{ popup.extpopup(uid(page, id)~'list_extpopup', extpopup[0], color_off|default('icon0'), extpopup[1], extpopup[2], extpopup[3], extpopup[4], extpopup[5], extpopup[6], extpopup[7], extpopup[8], extpopup[9], extpopup[10], extpopup[11], extpopup[12], extpopup[13], extpopup[14], extpopup[15], extpopup[16], extpopup[17], extpopup[18], extpopup[19], extpopup[20]) }}
+ {% endif %}
+ {% if elements[loop.index] == 'div' %}
+
+ {% endif %}
+ {% endif %}
+
+
+ {% if column == 'stateengine' and item_auto %}
+ {% if extpopup[0] == 'stateengine' and stateengine is defined %}
+ {{ stateengine.state(id~'_state', item_auto~'.state_name', item_auto~'.lock', item_auto~'.release', config_stateengine_icons, config_stateengine_values, uid(page, id)~'list_extpopup') }}
+ {{ popup.extpopup(uid(page, id)~'list_extpopup', extpopup[1], extpopup[2], extpopup[3], extpopup[4], extpopup[5], extpopup[6], extpopup[7], extpopup[8], extpopup[9], extpopup[10], extpopup[11], extpopup[12], extpopup[13], extpopup[14], extpopup[15], extpopup[16], extpopup[17], extpopup[18], extpopup[19], extpopup[20]) }}
+ {% elseif stateengine is defined %}
+ {{ stateengine.state(id~'_state', item_auto~'.state_name', item_auto~'.lock', item_auto~'.release', config_stateengine_icons, config_stateengine_values) }}
+ {% endif %}
+
+ {% if elements[loop.index] == 'div' %}
+
+ {% endif %}
+ {% endif %}
+
+ {% if column == 'uzsu' and item_uzsu %}
+ {% if uzsu_attribs is not iterable %}
+ {% set uzsu_value = '' %}
+ {% set uzsu_coloron = '' %}
+ {% set uzsu_coloroff = '' %}
+ {% set uzsu_params = '' %}
+ {% set uzsu_picon = '' %}
+ {% set uzsu_picoff = '' %}
+ {% else %}
+ {% set uzsu_picon = uzsu_attribs[0]|default('') %}
+ {% set uzsu_picoff = uzsu_attribs[1]|default('') %}
+ {% set uzsu_value = uzsu_attribs[2]|default('') %}
+ {% set uzsu_params = uzsu_attribs[3]|default('') %}
+ {% set uzsu_coloron = uzsu_attribs[4]|default('') %}
+ {% set uzsu_coloroff = uzsu_attribs[5]|default('') %}
+ {% endif %}
+ {{ device.uzsuicon(id~'list_uzsu', item_uzsu, linetext, uzsu_picon, uzsu_picoff, uzsu_value == 'percent' ? 'num' : uzsu_value, uzsu_params, uzsu_coloron, uzsu_coloroff) }}
+ {% if elements[loop.index] == 'div' %}
+
+ {% endif %}
+ {% endif %}
+
+ {% if column == 'plot' and item_plot %}
+