Advertisement
abeksis

template

Jan 3rd, 2022
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.24 KB | None | 0 0
  1. vacuum:
  2. variables:
  3. entity: vacuum.default
  4. name: Default name
  5. styles:
  6. card:
  7. - border-radius: 20px
  8. - box-shadow: var(--box-shadow)
  9. - padding: 12px
  10. grid:
  11. - grid-template-areas: '"item1" "item2"'
  12. - grid-template-columns: 1fr
  13. - grid-template-rows: min-content min-content
  14. - row-gap: 12px
  15. custom_fields:
  16. item1:
  17. card:
  18. template: list_items_only_one
  19. type: custom:button-card
  20. custom_fields:
  21. item1:
  22. card:
  23. entity: '[[[ return variables.entity ]]]'
  24. name: '[[[ return variables.name ]]]'
  25. tap_action:
  26. action: more-info
  27. template:
  28. - icon_info
  29. # - vacuum_info
  30. type: custom:button-card
  31. item2:
  32. card:
  33. template: list_items
  34. type: custom:button-card
  35. custom_fields:
  36. item1:
  37. card:
  38. icon: mdi:pause
  39. tap_action:
  40. action: call-service
  41. service: script.turn_on
  42. service_data:
  43. entity_id: script.aspiro_stop
  44. type: custom:button-card
  45. template: widget_icon
  46. item2:
  47. card:
  48. icon: mdi:battery-charging
  49. tap_action:
  50. action: call-service
  51. service: script.turn_on
  52. service_data:
  53. entity_id: script.aspiro_charge
  54. type: custom:button-card
  55. template: widget_icon
  56. item3:
  57. card:
  58. icon: mdi:map-marker-path
  59. tap_action:
  60. action: call-service
  61. service: persistent_notification.create
  62. service_data:
  63. message: 2nd line - 3rd button
  64. title: Debug Vacuum Card
  65. notification_id: '{{ (range(1, 9999)|random) }}'
  66. type: custom:button-card
  67. template: widget_icon
  68.  
  69. list_items_only_one:
  70. styles:
  71. card:
  72. - box-shadow: none
  73. - padding: 0px
  74. grid:
  75. - grid-template-areas: '"item1"'
  76. - grid-template-columns: 1fr
  77. - grid-template-rows: min-content
  78. - column-gap: 7px
  79.  
  80.  
  81.  
  82.  
  83. vacuum_info:
  84. tap_action:
  85. action: none
  86. icon: mdi:robot-vacuum
  87. label: |-
  88. [[[
  89. if (entity.state == 'docked' && entity.attributes.battery_level == '100'){
  90. return 'on its base';
  91. }
  92. else if (entity.attributes.status.toUpperCase() == 'charging'){
  93. return 'in charge';
  94. }
  95. else if (entity.state.toUpperCase() == 'cleaning'){
  96. return 'cleaning in progress';
  97. }
  98. else if (entity.state == 'docked' && 'retuning home'){
  99. return 'back to its base';
  100. }
  101. else if (entity.attributes.status.toUpperCase() == 'pause'){
  102. return 'on break';
  103. }
  104. else{
  105. return '❓ unknown ❓' ;
  106. }
  107. ]]]
  108. styles:
  109. icon:
  110. - color: |-
  111. [[[
  112. if (entity.state == 'docked' && entity.attributes.battery_level == '100'){
  113. return 'rgba(var(--couleur-gris),1)';
  114. }
  115. else if (entity.attributes.status.toUpperCase() == 'charging'){
  116. return 'rgba(var(--couleur-vert),1)';
  117. }
  118. else if (entity.state.toUpperCase() == 'cleaning'){
  119. return 'rgba(var(--couleur-jaune),1)';
  120. }
  121. else if (entity.attributes.status.toUpperCase() == 'retuning home'){
  122. return 'rgba(var(--couleur-violet),1)';
  123. }
  124. else if (entity.attributes.status.toUpperCase() == 'pause'){
  125. return 'rgba(var(--couleur-bleu),1)';
  126. }
  127. else{
  128. return 'rgba(var(--couleur-gris),1)';
  129. }
  130. ]]]
  131. img_cell:
  132. - background-color: |-
  133. [[[
  134. if (entity.state == 'docked' && entity.attributes.battery_level == '100'){
  135. return 'rgba(var(--couleur-gris),0.2)';
  136. }
  137. else if (entity.attributes.status.toUpperCase() == 'charging'){
  138. return 'rgba(var(--couleur-vert),0.2)';
  139. }
  140. else if (entity.state.toUpperCase() == 'cleaning'){
  141. return 'rgba(var(--couleur-jaune),0.2)';
  142. }
  143. else if (entity.attributes.status.toUpperCase() == 'retuning home'){
  144. return 'rgba(var(--couleur-violet),0.2)';
  145. }
  146. else if (entity.attributes.status.toUpperCase() == 'pause'){
  147. return 'rgba(var(--couleur-bleu),0.2)';
  148. }
  149. else{
  150. return 'rgba(var(--couleur-gris),0.2)';
  151. }
  152. ]]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement