{{#Name=Multi Feature}} {{#Description=Displays features from multiple devices}} {{#Version=1.0}} {{#Author=HomeSeer}} {{#CanBeDeleted=False}} {{#SaveList=save_title_size,save_title_color,save_title_background_color,save_title_bold,save_feature_size,save_feature_color,save_feature_bold,save_display_on_off_only,save_use_switch,save_include_location,save_include_device,save_include_feature,save_include_status_icon}} {{includefileraw Dashboards/Cards/Custom/Common/CommonHeader.html}} {{#get all saved values for easy reference}} {{sections[index]="Title"}} {{title=get_value 'save_title' 'Change Me' 'Name' 'text'}} {{title_size=get_value 'save_title_size' '18' 'Size' 'text'}} {{title_color=get_value 'save_title_color' '#000000' 'Color' 'color'}} {{title_bold=get_value 'save_title_bold' '' 'Bold' 'toggle'}} {{title_background_color=get_value 'save_title_background_color' '#FFFFFF' 'Background Color' 'color'}} {{sections[index]="Feature"}} {{icon_width=get_value 'save_icon_width' '32' 'Icon Width' 'text'}} {{icon_height=get_value 'save_icon_height' '32' 'Icon Height' 'text'}} {{feature_size=get_value 'save_feature_size' '14' 'Size' 'text'}} {{feature_color=get_value 'save_feature_color' '#000000' 'Color' 'color'}} {{feature_bold=get_value 'save_feature_bold' '' 'Bold' 'toggle'}} {{include_location_val=get_value 'save_include_location' '' 'Include Location' 'toggle'}} {{include_device_val=get_value 'save_include_device' '' 'Include Device Name' 'toggle'}} {{include_feature_val=get_value 'save_include_feature' 'on' 'Include Feature Name' 'toggle'}} {{include_status_icon_val=get_value 'save_include_status_icon' '' 'Include Status Icon' 'toggle'}} {{sections[index]="Control Options"}} {{hide_controls_val=get_value 'save_hide_controls' 'on' 'Hide Controls' 'toggle'}} {{include_all_control_val=get_value 'save_include_all_control' '' 'Include All Control' 'toggle'}} {{on_off_only_val=get_value 'save_display_on_off_only' 'on' 'On/Off Only' 'toggle'}} {{use_switch_val=get_value 'save_use_switch' 'on' 'Use Switch' 'toggle'}} {{# this section is not neccessay, it just makes the code cleaner by converting toggle values to boolean}} {{# toggle values can still be checked by checking if the saved value is the text "on"}} {{if hide_controls_val=='on' hide_controls=true else hide_controls=false end}} {{if on_off_only_val=='on' on_off_only=true else on_off_only=false end}} {{if use_switch_val=='on' use_switch=true else use_switch=false end}} {{if include_location_val=='on' include_location=true else include_location=false end}} {{if include_device_val=='on' include_device=true else include_device=false end}} {{if include_feature_val=='on' include_feature=true else include_feature=false end}} {{if include_all_control_val=='on' include_all_control=true else include_all_control=false end}} {{if include_status_icon_val=='on' include_status_icon=true else include_status_icon=false end}} {{#get all the reference ID's used on this card, returns a dictionary of saved_value_name,value}} {{ values=get_saved_values widget_id }} {{refs=''}} {{refsarray=[]}} {{index=0}} {{for key in values if key.key | string.starts_with 'save_feature_item' value = key.value # check if a dup ref if value | string.contains ',' karray = value | string.split ',' value = karray[0] end refsarray[index]=value index=index+1 refs=refs | string.append value | string.append ',' end end}} {{#See if all the controls are ON}} {{#key.value is device ref}} {{#key.key is the name of the saved variable, always starts with "save_"}} {{all_on_checked='checked'}} {{#assume all are on}} {{for ref in refsarray if is_off ref all_on_checked='' end end}}
{{title}}
{{if include_all_control}}
{{end}}
{{for ref in refsarray}} {{#the saved feature refs are saved under the name 'save_feature_itemREF}} {{dev=device_by_ref ref}} {{dev_primary=device_by_ref dev.primary_ref}} {{primary_name=dev_primary.name}} {{if include_location}} {{if location1_display_first}} {{loc=dev.location | string.append '-' | string.append dev.location2}} {{else}} {{loc=dev.location2 | string.append '-' | string.append dev.location}} {{end}} {{loc=loc | string.append "-"}} {{else}} {{loc=''}} {{end}} {{if include_status_icon}} {{img_file = status_image_file dev.ref}} {{end}}
{{if use_switch && dev.has_controls && !hide_controls}}
{{if img_file != '' && include_status_icon}} {{end}}
{{loc}}{{if include_device}}{{primary_name}}{{end}}{{if include_feature}}{{if include_device || include_location}}-{{end}}{{dev.name}}{{end}}
{{else}}
{{if img_file != '' && include_status_icon}} {{end}}
{{loc}}{{if include_device}}{{primary_name}}{{end}}{{if include_feature}}{{if include_device || include_location}}-{{end}}{{dev.name}}{{end}}
{{status_text dev.ref }}
{{end}}
{{if on_off_only || hide_controls}} {{else}} {{row1 = controls_row ref 1 use_switch }} {{if row1 != ''}}
{{row1}}
{{end}} {{row2 = controls_row ref 2 use_switch}} {{if row2 != ''}}
{{row2}}
{{end}} {{row3 = controls_row ref 3 use_switch}} {{if row3 != ''}}
{{row3}}
{{end}} {{end}} {{end}}
{{#if we are not in edit mode, don't bother including the edit mode content}} {{if dbs.edit_mode}} {{# card settings dialog}} {{#this dialog has 2 tabs, one for formatting the card, the other for card content}} {{# w=widget class, dashboard=dashboard name}} {{# w=widget class, dashboard=dashboard name, d=device}}
{{includefileraw Dashboards/Cards/Custom/Common/CommonScript.html}} {{else}} {{# non edit mode script (runtime)}} {{end}}