{{ if (device_view_format current_session)=="Grid" }}
{{device_count_root=0}} {{devices_local = (devices sort_mode_current true)}} {{~ for d in devices_local ~}} {{if d == null}} {{else}} {{match=false}} {{if d.filter_match_root}} {{match=true}} {{end}} {{if !match}} {{for c in d.children}} {{if c.filter_match_child}} {{match=true}} {{end}} {{end}} {{end}} {{if (d.marked_hidden && ((get_setting_bool 'gHideDevices')=='checked'))}} {{match=false}} {{end}} {{if !((user_has_access_for_display d.ref user)=='checked')}} {{match=false}} {{end}} {{if match}} {{device_count_root=device_count_root+1}}
{{if d.device_api==512 && d.edevice_type==10}} {{includefileraw includes\devices_grid_media.html}} {{else if (d.device_api==512 && d.edevice_type==8) }} {{includefileraw includes\devices_grid_thermostat.html}} {{else}} {{includefileraw includes\devices_grid_default.html}} {{end}}
{{end}} {{if device_count_root > (get_setting_int 'gMaxDevicesForDisplay')}} {{limit_reached=true}} {{break}} {{end}} {{end}} {{~ end ~}}
{{ else }} {{limit_reached=false}} {{device_count=0}} {{devices_local = (devices sort_mode_current false)}} {{-for d in devices_local-}} {{if d == null}} {{else}} {{if d.marked_hidden && ((get_setting_bool 'gHideDevices')=='checked') && ((get_setting_bool 'gHideFeaturesWhenRootIsHidden')=='checked')}} {{continue}} {{end}} {{if !((user_has_access_for_display d.ref user)=='checked')}} {{continue}} {{end}} {{if !d.filter_match_root}} {{continue}} {{end}} {{-device_count=device_count+1-}}
{{includefileraw includes\devices_list.html}}
{{if device_count > (get_setting_int 'gMaxDevicesForDisplay')}} {{limit_reached=true}} {{break}} {{end}} {{end}} {{~end~}} {{end}} {{ if (device_view_format current_session)=="Grid" }}
Showing {{device_count_root}} of {{array.size devices_local}} Devices
{{else}}
Showing {{device_count}} of {{total_devices_features current_session}} Devices/Features
{{end}} {{if limit_reached}}
Not all devices are shown; change the display limit in Setup-Custom.
{{end}}
{{if (bulk_edit_enabled current_session)}} {{end}}