Advertisement
p33j4y

HA: button+popup NO-CARDMOD

May 29th, 2021 (edited)
1,354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ###################################################################################
  2. ###################################################### SZABLONY CUSTOM-BUTTON-CARD:
  3.  
  4. button_card_templates:
  5.     #################### wspólne
  6.     default:
  7.       styles:
  8.         card:
  9.         - background-color: var(--card-background-color)
  10.         - background-size: cover
  11.         - border: none
  12.         - margin: none
  13.         - box-shadow: none 
  14.  
  15.     #################### sensor pojedyńczy
  16.     single_sensor:
  17.       show_label: true
  18.       styles:
  19.         card:
  20.         - padding: 4px
  21.         - font-size: 1em
  22.         grid:
  23.         - grid-template-areas: '"n n" "i l"'
  24.         - grid-template-columns: 35% 65%
  25.         - grid-template-rows: 1fr 1fr
  26.         name:
  27.         - align-self: center
  28.         - justify-self: center
  29.         - color: var(--secondary-text-color)
  30.         - padding-bottom: 5px
  31.         icon:
  32.         - color: var(--state-icon-color)
  33.         - width: 50%
  34.         label:
  35.         - align-self: middle
  36.         - justify-self: start
  37.         - font-size: 1.2em
  38.       label: >
  39.         [[[
  40.           var temps = `${entity.state}`;
  41.           var tempu = `${entity.attributes.unit_of_measurement}`;
  42.           return `<span>` + (isNaN(temps) ? '?' : temps) + ` ` + tempu + `</span>`;
  43.         ]]]
  44.  
  45.     #################### sensor podwójny z dużą ikoną główną
  46.     double_sensor_icon:
  47.       template: single_sensor
  48.       show_label: false
  49.       styles:
  50.         grid:
  51.         - grid-template-areas: '"n n" "i asensor" "i bsensor"'
  52.         - grid-template-columns: 40% 60%
  53.         - grid-template-rows: 1fr 1fr 1fr
  54.         icon:
  55.         - width: 50%
  56.         custom_fields:
  57.           asensor:
  58.           - align-self: start
  59.           - justify-self: start
  60.           - font-size: 1em
  61.           bsensor:
  62.           - align-self: start
  63.           - justify-self: start
  64.       custom_fields:
  65.         asensor: >
  66.           [[[
  67.             var temps = `${entity.state}`;
  68.             var tempu = `${entity.attributes.unit_of_measurement}`;
  69.             var tempi = `${entity.attributes.icon}`;
  70.             return `<ha-icon icon="` + tempi + `" style="width: 1.5em; color: var(--state-icon-color)"></ha-icon> <span>` + ` ` + (isNaN(temps) ? '?' : temps) + (tempu ? tempu : '') + `</span>`;
  71.           ]]]
  72.  
  73.     #################### sensor podwójny z popupem
  74.     double_sensor_popup:
  75.       template: double_sensor_icon
  76.       tap_action:
  77.         action: fire-dom-event
  78.         browser_mod:
  79.           command: popup
  80.           card:
  81.             type: vertical-stack
  82.  
  83. ###################################################################################
  84. ############################################## KOD NA BUTTON Z POPUPEM W LOWELASIE:
  85.  
  86. #################### gabinet
  87.    - name: Gabinet
  88.      type: custom:button-card
  89.      template: double_sensor_popup
  90.      entity: sensor.2_off_temperature
  91.      icon: mdi:remote-desktop
  92.      aspect_ratio: 2/1
  93.      custom_fields:
  94.        bsensor: >
  95.          [[[
  96.            var temph = states["sensor.2_off_humidity"].state;
  97.            var prefix = `<ha-icon icon="mdi:water-percent" style="width: 1.5em; color: var(`;
  98.             var suffix = `);"></ha-icon> ` + (isNaN(temph) ? '?' : temph) + `%</span>`;
  99.             if (temph >= 40 && temph <= 60) return prefix + `--label-badge-green` + suffix;
  100.             if (temph >= 0 && temph < 40) return prefix + `--label-badge-yellow` + suffix;
  101.             else return prefix + `--label-badge-red` + suffix;
  102.           ]]]
  103.       tap_action:
  104.         browser_mod:
  105.           title: Gabinet
  106.           card:
  107.             cards:
  108.             - type: custom:mini-graph-card
  109.               name: "Temperatura"
  110.               entities:
  111.              - sensor.2_off_temperature
  112.               - entity: sensor.0_cfg_nightime
  113.                 color: "#444444"
  114.                 show_line: false
  115.                 show_points: false
  116.                 show_legend: false
  117.                 y_axis: secondary
  118.               group: true
  119.               hours_to_show: 48
  120.               points_per_hour: 1
  121.               hour24: true
  122.               decimals: 1
  123.               animate: true
  124.               show:
  125.                 points: false
  126.                 extrema: true
  127.                 fill: fade
  128.               color_thresholds_transition: smooth
  129.               color_thresholds:
  130.               - value: 17
  131.                 color: "#00d9d9"
  132.               - value: 22
  133.                 color: "#ff8000"
  134.               - value: 27
  135.                 color: "#ff2626"
  136.             - type: custom:mini-graph-card
  137.               name: "Wilgotność"
  138.               entities:
  139.              - sensor.2_off_humidity
  140.               - entity: sensor.0_cfg_nightime
  141.                 color: "#444444"
  142.                 show_line: false
  143.                 show_points: false
  144.                 show_legend: false
  145.                 y_axis: secondary
  146.               group: true
  147.               hours_to_show: 48
  148.               points_per_hour: 1
  149.               hour24: true
  150.               decimals: 1
  151.               animate: true
  152.               show:
  153.                 points: false
  154.                 extrema: true
  155.                 icon_adaptive_color: true
  156.                 fill: fade
  157.               color_thresholds_transition: hard
  158.               color_thresholds:
  159.               - value: 0
  160.                 color: "#f4b400"
  161.               - value: 40
  162.                 color: "#0DA035"
  163.               - value: 60
  164.                 color: "#DF4C1E"
  165.  
  166.  
  167. ###################################################################################
  168. ###################################### DODATKOWA KARTA Z WYKRESEM TEMP. NA ZEWNĄTRZ
  169.   - type: horizontal-stack
  170.     cards:
  171.     - name: Na dworze
  172.       type: custom:mini-graph-card
  173.       entities:
  174.       - entity: sensor.0_out_feel_temperature
  175.         name: Odczuwalna
  176.       - entity: sensor.0_out_average_temperature
  177.         name: Temperatura
  178.         show_state: true
  179.         show_graph: false
  180.       - entity: sensor.4_out_humidity
  181.         name: Wilgotność
  182.         show_state: true
  183.         show_graph: false
  184.       - entity: sensor.0_cfg_nightime
  185.         color: "#444444"
  186.         show_line: false
  187.         show_points: false
  188.         show_legend: false
  189.         y_axis: secondary
  190.       show:
  191.         legend: false
  192.         points: false
  193.       tap_action:
  194.         action: fire-dom-event
  195.         browser_mod:
  196.           command: popup
  197.           title: Pogoda
  198.           card:
  199.            #################### pogoda popup
  200.             type: vertical-stack
  201.             cards:
  202.             - type: custom:weather-card
  203.               entity: weather.0_wth_summary
  204.               current: true
  205.               details: true
  206.               forecast: true
  207.               hourly_forecast: false
  208.               number_of_forecasts: 5
  209.             - name: "Średnia 3-dniowa"
  210.               type: custom:mini-graph-card
  211.               entities:
  212.              - sensor.0_out_average_3d_temperature
  213.               - entity: sensor.0_cfg_nightime
  214.                 color: "#444444"
  215.                 show_line: false
  216.                 show_points: false
  217.                 show_legend: false
  218.                 y_axis: secondary
  219.               group: true
  220.               hours_to_show: 168
  221.               height: 100
  222.               points_per_hour: 1
  223.               hour24: true
  224.               decimals: 1
  225.               animate: true
  226.               show:
  227.                 points: false
  228.                 extrema: false
  229.                 fill: fade
  230.               color_thresholds_transition: smooth
  231.               color_thresholds:
  232.               - value: 13
  233.                 color: "#00d9d9"
  234.               - value: 18
  235.                 color: "#ff8000"
  236.               - value: 20
  237.                 color: "#ff2626"
  238.             - type: custom:sun-card
  239.               language: pl
  240.             - type: entities
  241.               show_header_toggle: false
  242.               entities:
  243.              - sensor.0_out_season
  244.               - binary_sensor.0_out_heating
  245.               - sensor.0_out_max_24h_temperature
  246.               - sensor.0_out_min_24h_temperature
  247.       font_size: 80
  248.       align_icon: left
  249.       icon: mdi:home-group
  250.       hours_to_show: 24
  251.       hour24: true
  252.       decimals: 1
  253.       animate: true
  254.       color_thresholds:
  255.       - value: -10
  256.         color: "#2a4a96"
  257.       - value: -5
  258.         color: "#057ac2"
  259.       - value: 0
  260.         color: "#13aaec"
  261.       - value: 5
  262.         color: "#85c8f3"
  263.       - value: 10
  264.         color: "#d1e18d"
  265.       - value: 15
  266.         color: "#ffe700"
  267.       - value: 20
  268.         color: "#eab856"
  269.       - value: 25
  270.         color: "#df915d"
  271.       - value: 30
  272.         color: "#d2694b"
  273.       - value: 35
  274.         color: "#ad352e"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement