Advertisement
Guest User

Untitled

a guest
Mar 7th, 2024
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 3.34 KB | None | 0 0
  1. type: custom:button-card
  2. entity: person.daniel
  3. aspect_ratio: 1.1/1.02
  4. name: Person
  5. show_entity_picture: true
  6. show_name: false
  7. tap_action:
  8.   action: call-service
  9.   service: script.find_xiaomi_k20
  10. styles:
  11.   card:
  12.     - background-color: rgba(15,15,18,0.4)
  13.     - border-radius: 5%
  14.     - padding: 5%
  15.     - font-size: 10px
  16.     - text-shadow: 0px 0px 0px black
  17.     - text-transform: capitalize
  18.     - justify-self: end
  19.     - align-self: middle
  20.   grid:
  21.     - grid-template-areas: '"icon icon" "n n" "battery status"'
  22.     - grid-template-columns: 1fr
  23.     - grid-template-rows: 1fr min-content min-content min-content min-content
  24.   name:
  25.     - font-size: 15px
  26.     - align-self: middle
  27.     - justify-self: start
  28.     - padding-bottom: 10px
  29.   custom_fields:
  30.     icon:
  31.       - clip-path: circle()
  32.       - width: 80%
  33.       - pointer-events: none
  34.       - display: grid
  35.       - border: 5px solid
  36.       - border-color: |-
  37.           [[[
  38.             if (states['binary_sensor.uptimekuma_dani_telefon'].state =='off') {
  39.             return "#888888";
  40.             } else {
  41.             return "#00CC66";}
  42.           ]]]
  43.       - border-radius: 500px
  44.       - margin: 0 +7% 0 0
  45.       - justify-self: end
  46.       - opacity: |-
  47.           [[[
  48.             if (states['binary_sensor.uptimekuma_dani_telefon'].state =='off') {
  49.             return 0.5;
  50.             } else {
  51.             return 1;}
  52.           ]]]
  53.     status:
  54.       - justify-self: end
  55.       - color: white
  56.       - margin-bottom: '-5px'
  57.       - font-size: 15px
  58.     battery:
  59.       - margin-bottom: '-5px'
  60.       - align-self: middle
  61.       - justify-self: start
  62.       - font-size: 15px
  63.       - color: white
  64.       - '--text-color-sensor': >-
  65.           [[[ if (states["sensor.redmi_k20_pro_battery_level"].state < 20)
  66.           return "#EF4F1A"; ]]]
  67. custom_fields:
  68.   icon: >
  69.     [[[ return entity === undefined ? null : `<img
  70.     src="${states[entity.entity_id].attributes.entity_picture}" width="100%">`;
  71.     ]]]
  72.   status: |
  73.    [[[
  74.       if (states['binary_sensor.uptimekuma_dani_telefon'].state =='off') {
  75.       return `<ha-icon icon="mdi:home-export-outline"
  76.         style="width: 26px; height: 26px; margin: 0 5px 0 0; color: '#888888';">
  77.         </ha-icon><span>Távol</span>`;
  78.       }
  79.       if (states['binary_sensor.uptimekuma_dani_telefon'].state =='on') {
  80.       return `<ha-icon
  81.         icon="mdi:home"
  82.         style="width: 26px; height: 26px; margin: 0 5px 0 0; color: 888888;">
  83.         </ha-icon><span>Itthon</span>`;
  84.       } else {
  85.       return `<ha-icon
  86.         icon="mdi:map-marker-radius"
  87.         style="width: 26px; height: 26px; margin: 0 5px 0 0; color: 888888;">
  88.         </ha-icon><span>Ismeretlen</span>`;
  89.       }
  90.     ]]]
  91.   battery: |
  92.    [[[
  93.       if (states['sensor.redmi_k20_pro_battery_state'].state =='charging') {
  94.         return `<ha-icon
  95.         icon="mdi:battery-charging"
  96.         style="width: 24px; height: 24px; color: #fff;">
  97.         </ha-icon> <span><span style="color: var(--text-color-sensor);">${states['sensor.redmi_k20_pro_battery_level'].state}%</span></span>`;
  98.       } else {
  99.         return `<ha-icon
  100.         icon="mdi:battery"
  101.         style="width: 24px; height: 24px; color: #fff;">
  102.         </ha-icon> <span><span style="color: var(--text-color-sensor);">${states['sensor.redmi_k20_pro_battery_level'].state}%</span></span>`;
  103.       }
  104.     ]]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement