A card that shows the state of a binary sensor, including an icon as an alert. Card includes battery and link levels, the time of the last state change, and a history chart (per hour of current day) that shows when alerts where detected.
sak_layout_fce2_binary1:template:type:layoutdefaults:-sak_layout_binary_icon_color:var(--theme-sys-color-primary)-sak_layout_binary_icon_color_on:var(--theme-sys-color-error#var(--theme-ref-palette-error50) #var(--theme-sys-color-error-container)-sak_layout_binary_icon_animation:flash# none, flash, spin-sak_layout_binary_history_color_on:var(--theme-sys-color-error)#var(--theme-sys-color-primary)-sak_layout_binary_history_disabled:false-sak_layout_battery_colorstops_template:sak_colorstops_battery_level-sak_layout_sensor_icon_style:colorstopslayout:aspectratio:1/1toolsets:# ==============================================================================-toolset:circle-with-iconposition:cx:20cy:20tools:# -------------------------------------------------------------type:circleposition:cx:50cy:50radius:12.5entity_index:0animations:-state:'on'styles:circle:stroke:var(--theme-sys-color-error)-state:'off'styles:circle:# stroke: var(--theme-sys-elevation-surface-neutral10)stroke:'[[sak_layout_binary_icon_color]]'styles:circle:stroke-width:2em# stroke: var(--theme-sys-elevation-surface-neutral10)stroke:'[[sak_layout_binary_icon_color]]'fill:var(--primary-background-color)# -------------------------------------------------------------type:iconposition:cx:50cy:50align:centericon_size:15entity_index:0# Define template variable for this icon tool, so it can be# processed by a piece of JavaScript ;-)# The template engine will replace the variable!variables:sak_layout_binary_icon_animation :'[[sak_layout_binary_icon_animation]]'animations:-state:'on'styles:icon:# Use template variable as the source to spin, flash or nothing# the config JavaScript parameter is this tools config...animation:>[[[ if (tool_config.variables.sak_layout_binary_icon_animation === "spin") return "spin 3s linear infinite";if (tool_config.variables.sak_layout_binary_icon_animation === "flash") return "flash 2s ease-in-out 5";return "";]]]fill:'[[sak_layout_binary_icon_color_on]]'-state:'off'styles:icon:fill:'[[sak_layout_binary_icon_color]]'styles:icon:fill:'[[sak_layout_binary_icon_color]]'# ================================================================-toolset:colomn-batteryposition:cx:87.5cy:12.5tools:# -------------------------------------------------------------type:iconposition:&icon_poscx:50cy:50align:righticon_size:10entity_index:2styles:&icon_stylesicon:fill:var(--primary-text-color)opacity:1show:style:'[[sak_layout_sensor_icon_style]]'colorlist:colors:-var(--theme-sys-color-secondary)colorstops:template:name:'[[sak_layout_battery_colorstops_template]]'# ================================================================-toolset:colomn-linkqualityposition:cx:77.5cy:12.5tools:# -------------------------------------------------------------type:iconposition:*icon_posentity_index:3styles:*icon_stylesshow:style:'[[sak_layout_sensor_icon_style]]'colorlist:colors:-var(--theme-sys-color-secondary)colorstops:template:name:'[[sak_layout_battery_colorstops_template]]'# ==============================================================================-toolset:area-nameposition:cx:7.5cy:45tools:# -------------------------------------------------------------type:areaposition:cx:50cy:50entity_index:0show:ellipsis:12styles:area:text-anchor:startfont-size:12emfont-weight:700opacity:1# -------------------------------------------------------------type:nameposition:cx:50cy:62.5entity_index:0show:ellipsis:12styles:name:text-anchor:startfont-size:10emfont-weight:400opacity:0.6# ==============================================================================-toolset:alert-time-boxesposition:cx:50cy:75tools:# -------------------------------------------------------------type:rectexposition:cx:20cy:50width:25height:18radius:left:5right:0entity_index:0animations:-state:'on'styles:rectex:fill:var(--theme-sys-color-error)-state:'off'styles:rectex:fill:var(--theme-sys-elevation-surface-neutral10)styles:rectex:fill:var(--theme-sys-elevation-surface-neutral10)# -------------------------------------------------------------type:iconposition:cx:20cy:50align:centericon_size:12.5entity_index:0animations:-state:'on'icon:mdi:clock-alert-outlinestyles:icon:fill:var(--theme-sys-color-on-error)-state:'off'icon:mdi:clock-check-outlinestyles:icon:fill:var(--primary-background-color)styles:icon:fill:'[[sak_layout_binary_icon_color]]'# -------------------------------------------------------------type:rectexposition:cx:64cy:50width:57height:18radius:left:0right:5entity_index:0animations:-state:'on'styles:rectex:fill:var(--theme-sys-elevation-surface-error4)-state:'off'styles:rectex:fill:var(--theme-sys-elevation-surface-neutral4)styles:rectex:fill:var(--theme-sys-color-on-error)# -------------------------------------------------------------type:stateposition:cx:64#92cy:50# entity_index: 1entity_indexes:-entity_index:1-entity_index:0animations:-state:'on'entity_index:0styles:state:fill:var(--theme-sys-color-error)-state:'off'entity_index:0styles:state:fill:var(--theme-sys-elevation-surface-neutral10)styles:state:# fill: var(--theme-sys-color-error-container)fill:var(--theme-sys-color-error)font-size:12emtext-anchor:middle#end# alignment-baseline: middlefont-weight:700uom:# fill: var(--theme-sys-color-error-container)fill:var(--theme-sys-color-error)alignment-baseline:hangingfont-weight:600# ==============================================================================-toolset:alert-historyposition:cx:50cy:92.5tools:# -------------------------------------------------------------type:sparkline# When disabled, SAK will not use this tooldisabled:'[[sak_layout_binary_history_disabled]]'entity_index:0position:cx:50cy:50width:85height:3margin:0period:calendar:period:dayoffset:0duration:hour:24bins:per_hour:1sparkline:show:chart_type:barcode# chart_variant: stalagmitesstate_map:template:name:sak_statemap_binary# State value settings# - set agg to max to see the binary changes# - set lower_bound to -1 to offset 'off' state# the barcode will start wider now, instead of at minimum width# - set upper_bound to 1 ('on') to fix upper scalestate_values:aggregate_func:maxlower_bound:-1upper_bound:1barcode:column_spacing:3line_width:0.1colorstops_transition:hardcolorstops:colors:-value:0color:var(--theme-sys-elevation-surface-neutral10)-value:1color:'[[sak_layout_binary_history_color_on]]'styles:tool:opacity:1barcode_graph:rx:5ry:5