{{#Name=Gauge}} {{#Description=Displays a gauge with a pointer}} {{#Version=1.0}} {{#Author=HomeSeer}} {{dbs=dashboards_ref}} {{widget_id=queries['widget_id']}} {{if widget_id==null}} {{widget_id=var1}} {{end}} {{w=widget_by_id widget_id}} {{id_unique=string.replace w.id '-' ''}} {{# To simplify custom controls, the settings dialog that holds settings is auto generated }} {{# To have your persistent settings saved and restored automatically, add them below in the section that calls "get_value" }} {{# storage arrays for saved value, save name, dialog label, control type }} {{# value: The value that is saved for a particular item, such as a display label, color, font size, etc. }} {{# save name: The name used to save the persistent value. All saved names must start with "save_" }} {{# dialog label: The dialog for saving values is auto generated so this is the label that is displayed for the item such as "Color"}} {{# control_type: The type of control used to configure the item. Control types supported here are: }} {{# text: a simple text box for entering text such as a label }} {{# color: allows for entry of a specific HTML color like #000000 and also displays a button that displays a color picker }} {{# toggle: displays a toggle switch for items that support "enabled/disabled" or On/Off }} {{# arrays that hold settings for the autogenerated settings dialog. These are filled by calling get_value }} {{current_values=[]}} {{save_names=[]}} {{titles=[]}} {{control_types=[]}} {{# function to get a saved value and return the value or the default value}} {{# function parameters: $0=save name, $1=default value, $2=control name for settings dialog, $3=control type }} {{index=0}} {{func get_value v=get_saved_value $0 widget_id if v=='' v=$1 end current_values[index]=v save_names[index]=$0 titles[index]=$2 control_types[index]=$3 index=index+1 ret v end}} {{save_width_height=false}} {{if w.width==0}} {{#first time loading, force a save of the card width and height}} {{save_width_height=true}} {{end}} {{#get settings that will also be used in the autogenerate settings dialog. This fills the arrays above}} {{display_text=get_value 'save_display_text' 'Change Me' 'Title' 'text'}} {{text_size=get_value 'save_name_size' '16' 'Title Font Size' 'text'}} {{text_color=get_value 'save_text_color' 'black' 'Title Font Color' 'color'}} {{text_bold=get_value 'save_text_bold' 'on' 'Font Bold' 'toggle'}} {{min_value=get_value 'save_min_value' '0' 'Min Value' 'text'}} {{max_value=get_value 'save_max_value' '100' 'Max Value' 'text'}} {{stroke_width=get_value 'save_stroke_width' '10' 'Stroke Width' 'text'}} {{value_font_size=get_value 'save_value_font_size' '16' 'Value Font Size' 'text'}} {{value_font_color=get_value 'save_value_font_color' 'white' 'Value Font Color' 'color'}} {{color_1=get_value 'save_color_1' 'gray' 'Color 0-25%' 'text'}} {{color_2=get_value 'save_color_2' 'orange' 'Color 25%-50%' 'text'}} {{color_3=get_value 'save_color_3' 'darkorange' 'Color 50%-75%' 'text'}} {{color_4=get_value 'save_color_4' 'yellow' 'Color 75%-100%' 'text'}} {{#get settings that will not be configured with the settings dialog}} {{# these are values that may or may not be displayed in the setings dialog but need to be displayed with custom HTML that the autogen code cannot handle }} {{feature_item_ref=get_saved_value 'save_feature_item' widget_id}} {{if feature_item_ref=='' feature_item_ref='0' end}} {{# normal display HTML is here. This is what is displayed when viewing the card in non-edit mode}} {{# get the value of the device }} {{device_val = device_value feature_item_ref}}
{{display_text}}
{{#if we are not in edit mode, don't bother including the edit mode content}} {{if dbs.edit_mode}} {{# card settings dialog, the second tab autogenerates settings based on values added to the settings arrays. Custom settings HTML can be added}} {{#this dialog has 2 tabs, one for formatting the card, the other for card content}} {{# w=widget class, dashboard=dashboard name, d=device}} {{#pop-up dialog to select an HS device feature}} {{else}} {{end}}