{{# we may be built from a status update, so the device is passed to us through the query}} {{if d==null}} {{d=device_by_ref queries['ref']}} {{end}} {{if d==null}} Bad ref {{queries['ref']}} {{else}} {{have_important_ref=0}} {{# check if we an important feature selected, if not, we are displaying the auto selected primary feature and we need to not display that in the features bar}} {{auto_primary = (find_best_primary_feature d.ref)}} {{ for dp in d.display_priority }} {{if dp.display_type == 'DISPLAY_IMPORTANT'}} {{have_important_ref=dp.ref}} {{end}} {{end}}
{{if (get_setting_bool 'gHideFeaturesBar')!='checked'}}
0}} onclick="show_children({{ d.primary_ref }})" {{end}} data-toggle="modal" data-target="#childcontrol" class="fa-point text-right col mr-2 devices_children_icon d-xl-inline-block float-xl-none border border-top-0 border-right-0 border-left-0 pb-1"> {{ for c in d.children }} {{if (user_has_access_for_display c.ref user)=='checked'}} {{# see if feature is hidden, hide if so, also hide if we are trying to show the primary ref (ignore as it will be displayed as the primary)}} {{dp = device_display_priority_by_feature d.ref c.ref}} {{if (have_important_ref==0 && auto_primary==c.ref) || dp=='DISPLAY_HIDDEN' || dp=='DISPLAY_IMPORTANT' || (c.marked_hidden && ((get_setting_bool 'gHideDevices')=='checked'))}} {{else}} {{ if c.status_suffix=='%' || c.status_suffix=='@S@' }} {{ status_text_no_html c.ref }} {{ end }} {{end}} {{end}} {{ end }} {{ if d.child_count == 0 }} {{ end }}
{{end}}
{{if location1_display_first}} {{d.location}} {{if use_location2}} | {{d.location2}} {{end}} {{else}} {{if use_location2}}{{d.location2}} | {{end}}{{d.location}} {{end}}
{{d.name}}
{{normal_count=0 #feature is normal (no controls) and is displayed}} {{important_count=0 #feature is important}} {{feature_count=0}} {{important_with_controls=0 #feature is important and has controls and is displayed}} {{important_without_controls=0 #feature is important and does not have any controls (status only) and is displayed}} {{# d.display_priority is list of FeatureDisplayPriorityCard in feature display order}} {{ for dp in d.display_priority }} {{# dp is type FeatureDisplayPriorityCard}} {{dvp=feature_by_device d.ref dp.ref}} {{# dvp is device of type child}} {{if dvp==null}} {{display_ref = d.ref}} {{else}} {{display_ref = dvp.ref}} {{end}} {{feature_count = feature_count+1}} {{show=false}} {{if (dp.display_type == 'DISPLAY_HIDDEN') || (dvp.marked_hidden && ((get_setting_bool 'gHideDevices')=='checked'))}} {{show=false}} {{else if dp.display_type == 'DISPLAY_IMPORTANT'}} {{show=true}} {{else}} {{# must be NORMAL, auto pick a feature to show if NONE of the features are IMPORTANT}} {{if (important_count == 0) && (feature_count == d.display_priority_count)}} {{# we are at the last item and no features are set as important, auto pick a feature to display}} {{display_ref = auto_primary}} {{if display_ref != 0}} {{show=true}} {{else}} {{show=false}} {{end}} {{end}} {{end}} {{last_change_ref = 0}} {{if show && display_ref != 0}} {{if last_change_ref == 0}} {{last_change_ref = display_ref}} {{end}} {{important_count = important_count+1}} {{if important_with_controls==2 || (important_with_controls==1 && important_without_controls==3) || (important_with_controls==0 && important_without_controls==5)}} {{# FULL no more room for features}} {{else}} {{# max of 2 features with controls of 2 rows and 1 feature with 3 rows of controls}}
{{if d.child_count > 0}} {{device_prop display_ref 'Name'}} {{end}}
{{ status_text display_ref }}
{{row1 = controls_row display_ref 1 }} {{if row1 != ''}} {{important_with_controls = important_with_controls+1}}
{{row1}}
{{end}}
{{row2 = controls_row display_ref 2}} {{row2}}
{{row3 = controls_row display_ref 3}} {{if row3 != ''}} {{if important_with_controls == 0}}
{{row3}}
{{# we can only display 3 rows of controls if this is the only feature. If we already displayed a feature with controls, we have to leave this feature with 2 rows}} {{end}} {{end}} {{if row1=='' && row2=='' && row3==''}} {{# displayed a feature that does not have any controls (status only)}} {{important_without_controls = important_without_controls+1}} {{end}} {{end}} {{end}} {{end}}
{{ last_change last_change_ref }}
   {{ if (device_misc_check d.primary_ref 8388608) || (device_misc_check d.primary_ref 4194304) }} {{# amazon discovery or google discovery }} {{else if device_misc_check d.primary_ref 512}} {{end}}
{{end}}