{% else %}
data-iconpos="center">
{% endif %}
{% endmacro %}
/**
* Displays a checkbox
*
* @param unique id for this widget
* @param a gad/item
* @param text printed on the checkbox
*/
{% macro checkbox(id, gad, txt) %}
{% endmacro %}
/**
* Displays a colordisc-rgb-selector
*
* @param unique id for this widget
* @param a gad/item for the r - value (0-255)
* @param a gad/item for the g - value (0-255)
* @param a gad/item for the b - value (0-255)
* @param the minimum value if the light is off (optional, for future use)
* @param the maximum value if the light is full on (optional, default 255)
* @param the granularity of the rings (optional, default 8)
* @param the number of colored segments (optional, default 10)
*
* @author Marcus Popp
*/
{% macro colordisc(id, gad_r, gad_g, gad_b, min, max, step, colors) %}
{% set uid = uid(page, id) %}
{% endmacro %}
/**
* A switch with to states displayed as a button
*
* @param unique id for this widget
* @param a gad/item
* @param the pic for the 'on' state (optional)
* @param the pic for the 'off' state (optional)
* @param value send for the 'on' state (optional, default 1)
* @param value send for the 'off' state (optional, default 0)
* @param type: 'micro', 'mini', 'midi' (optional, default: mini)
*/
{% macro dual(id, gad, pic_on, pic_off, val_on, val_off, type) %}
{% endmacro %}
/**
* Displays a flip-switch
*
* @param unique id for this widget
* @param a gad/item
* @param text for the 'on' state (optional, default 'On')
* @param text for the 'off' state (optional, default 'Off')
*/
{% macro flip(id, gad, txt_on, txt_off) %}
{% endmacro %}
/**
* Displays a value as float
*
* @param unique id for this widget
* @param a gad/item
* @param a unit, tries to get the format for that unit from the language-file (optional)
* @param the parent html-tag for the value (optional, default 'span')
*/
{% macro float(id, gad, unit, tag) %}
<{{ tag|default('span') }} id="{{ uid(page, id) }}" data-widget="basic.float" data-item="{{ gad }}"
data-unit="{{ unit }}">-.- {{ unit }}{{ tag|default('span') }}>
{% endmacro %}
/**
* calculate values and display
*
* @param unique id for this widget
* @param one or more gad(s)/item(s). More gads/items in array-form: [ item1 , item2 ]
* @param unit for displaying, if that unit is found in the language-file that formating is been used (optional)
* @param formula to use: SUM(VAR), AVG(VAR), SUB(VAR), your own, (optional, default: SUM(VAR))
*
* @see misc/fundamentals#Array-Form
* @author Raik Alber
*/
{% macro formula(id, gad, unit, formula) %}
---
{% endmacro %}
/**
* Used to glue to widgets together. Only needed if you don't use 'Realtime'!
* If you click the 'from'-widget, the 'to'-widget will be reloaded and updated after a delay.
*
* @param id from the element that is been clicked
* @param id from the element that contain a item that might be changed
*/
{% macro glue(id_from, id_to) %}
{% endmacro %}
/**
* Displays a rgb-selector
*
* @param unique id for this widget
* @param a gad/item for the r - value (0-255)
* @param a gad/item for the g - value (0-255)
* @param a gad/item for the b - value (0-255)
* @param the minimum value if the light is off (optional, for future use)
* @param the maximum value if the light is full on (optional, default 255)
* @param step (for future use)
* @param the number of colors (default 10)
*/
{% macro rgb(id, gad_r, gad_g, gad_b, min, max, step, colors) %}
{% set uid = uid(page, id) %}
{% endmacro %}
/**
* A switch, build of a series of icons. The series may be a .png-iconseries (NAME_00.png, NAME_10.png, NAME_20.png...) or may be a dynamic svg-icon (icon.NAME)
*
* @param unique id for this widget
* @param a gad/item for the switch (optional)
* @param a gad/item for the value
* @param the iconseries or dynamic icon for the 'on' state
* @param the icon for the 'off' state (optional)
* @param the minimum value if it is off (optional, for future use)
* @param the maximum value if it is on (optional, default 255)
*
* @see design/design_icons#Dynamic Icons and Static Icons
*/
{% macro shifter(id, gad_switch, gad_value, pic_on, pic_off, min, max) %}
{% import "icon.html" as icon %}
{% if pic_on|slice(0, 5) == 'icon.' %}
{{ attribute(icon, pic_on|slice(5), [id, gad_switch, gad_value]) }}
{% else %}
{% endif %}
{% endmacro %}
/**
* Displays a shutter-control
*
* @param unique id for this widget
* @param a gad/item for the actual position of the blinds
* @param a gad/item for the actual angle of the blinds (optional, readonly)
* @param the minimum value for close (optional, default 0)
* @param the maximum value for open (optional, default 255)
* @param step between two values (optional, default 5)
* @param the mode: 'half' blade turns from -1 to +1, or 'full' blade turns from 0 to +1 (optional, default 'half')
*
* @info inspired by Jörg Gutowski
*/
{% macro shutter(id, gad_pos, gad_angle, min, max, step, mode) %}
{% set uid = uid(page, id) %}
{% if gad_angle != '' %}
{% endif %}
{% for i in 1..12 %}
{% endfor %}
{% endmacro %}
/**
* Displays a slider-control
*
* @param unique id for this widget
* @param a gad/item
* @param the minimum value if the slider is moved to total left (optional, default 0)
* @param the maximum value if the slider is moved to total right (optional, default 255)
* @param step between two values (optional, default 5)
* @param the orientation ('none', 'vertical', 'bottomup', 'semicircle')
*/
{% macro slider(id, gad, min, max, step, mode) %}
{% endmacro %}
/**
* A switch, build of two pics
*
* @param unique id for this widget
* @param a gad/item
* @param the pic for the 'on' state (optional)
* @param the pic for the 'off' state (optional)
* @param value send for the 'on' state (optional, default 1)
* @param value send for the 'off' state (optional, default 0)
*/
{% macro switch(id, gad, pic_on, pic_off, val_on, val_off) %}
{% endmacro %}
/**
* A symbol, with no writing to knx, only displayed when the value of gad is equal to val. Symbols may be used in menus.
* If more than one gad is given, they will be combined with mode ('or' / 'and).
*
* @param unique id for this widget
* @param one or more gad(s)/item(s). More gads/items in array form: [ item1 , item2 ]
* @param the text, printed when gad has value val (optional)
* @param the pic, shown when gad has value val
* @param value (default 1)
* @param the mode, 'or', 'and' (default 'or')
*/
{% macro symbol(id, items, txt, pic, val, mode) %}
{{ txt }}
{% endmacro %}
/**
* Displays a (partly) filled tank
*
* @param unique id for this widget
* @param a gad/item for the actual position of filled tank
* @param the minimum value for empty (optional, default 0, for future use)
* @param the maximum value for full (optional, default 255)
* @param step between two values (optional, default 5, for future use)
* @param the mode: 'none', 'cylinder', 'water', 'pallets' (optional, default 'none')
* @param the color of the filling e. g. '#f00' for red (optional, default grey)
*/
{% macro tank(id, gad_pos, min, max, step, mode, color) %}
{% endmacro %}
/**
* A dymanic text depending on a gad/item
*
* @param unique id for this widget
* @param a gad/item
* @param the text for the 'on' state (optional)
* @param the text for the 'off' state (optional)
* @param value send for the 'on' state (optional, default 1)
* @param value send for the 'off' state (optional, default 0)
*
* @author Marco Fleischer
*/
{% macro text(id, gad, txt_on, txt_off, val_on, val_off) %}
{% endmacro %}
/**
* A widget to trigger a logic (e. g. in SmartHome.py)
*
* @param unique id for this widget
* @param the name of the trigger (logic)
* @param text printed on the button (optional)
* @param a icon or a inline pic: 'arrow-l', 'arrow-r', 'arrow-u', 'arrow-d', 'delete', 'plus', 'minus', 'check', 'gear', 'refresh', 'forward', 'back', 'grid', 'star', 'alert', 'info', 'home', 'search' (optional)
* @param value send if the button is pressed (optional, default 1)
* @param type: 'micro', 'mini', 'midi' (optional, default: mini)
*/
{% macro trigger(id, name, txt, pic, val, type) %}
{{ txt|e }}
{% elseif pic|slice(-4, 4) != '.png' and not txt %}
data-icon="{{ pic }}" data-iconpos="notext">
{% elseif pic|slice(-4, 4) != '.png' and txt %}
data-icon="{{ pic }}" data-iconpos="top">{{ txt|e }}
{% elseif type == 'midi' and txt %}
>
{% else %}
data-iconpos="center">
{% endif %}
{% endmacro %}
/**
* display a value
*
* @param unique id for this widget
* @param a gad/item
* @param a unit (optional)
* @param the parent html-tag for the value (optional, default 'span')
*/
{% macro value(id, gad, unit, tag) %}
<{{ tag|default('span') }} id="{{ uid(page, id) }}" data-widget="basic.value" data-item="{{ gad }}"
data-unit="{{ unit }}">--- {{ unit }}{{ tag|default('span') }}>
{% endmacro %}