xyboox

Sensor

Feb 4th, 2021
905
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.32 KB | None | 0 0
  1. - type: custom:button-card
  2.   name: Window
  3.   entity: binary_sensor.window_office
  4.   triggers_update:
  5.    [
  6.       'binary_sensor.window_office',
  7.       'sensor.window_office_power',
  8.     ]
  9.   style:
  10.     top: 60%
  11.     left: 44%
  12.     width: 10%
  13.   tap_action:
  14.     action: toggle
  15.   custom_fields:
  16.     icon_switch_entrance: >
  17.       [[[ const state = entity.state === 'on' ? 'animate show' : 'hide'; const rev_state = entity.state === 'on' ? 'hide': 'animate show';
  18.       return `<svg viewBox="0 0 24 24"><style>@keyframes animate{0%{transform: scale(0.85);}20%{transform: scale(1.1);}40%{transform: scale(0.95);}60%{transform: scale(1.03);}80%{transform: scale(0.97);}100%{transform: scale(1);}}.animate{animation: animate 0.8s; transform-origin: center;} .show {display: inherit;} .hide {display: none;}</style>
  19.       <path class="${rev_state}" fill="#9da0a2" d="M21 20V2H3V20H1V23H23V20M19 4V11H13V4M5 4H11V11H5M5 20V13H11V20M13 20V13H19V20Z" />
  20.      <path class="${state}" fill="var(--button-card-light-color-no-temperature)" d="M21 20V2H3V20H1V23H23V20M19 4V11H17V4M5 4H7V11H5M5 20V13H7V20M9 20V4H15V20M17 20V13H19V20Z"/></svg>`; ]]]
  21.   styles:
  22.     custom_fields:
  23.       icon_switch_entrance:
  24.        [
  25.           top: 11%,
  26.           left: 4.6%,
  27.           width: 3.05vw,
  28.           position: absolute,
  29.         ]
  30.   template: ['base']
Advertisement
Add Comment
Please, Sign In to add comment