MKANET

Custom Tesla Powerwall Card - MKANET

Jan 20th, 2024
1,130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 7.21 KB | None | 0 0
  1. type: custom:stack-in-card
  2. mode: vertical
  3. cards:
  4.   - type: markdown
  5.     content: >
  6.      ## Tesla Powerwall{% if is_state('binary_sensor.grid_status', 'off')
  7.       %}<small><font color="red">&nbsp;&nbsp;⚠️&nbsp;Power Outage:
  8.       &nbsp;&nbsp;~{{ states('sensor.estimated_battery_life_hours_remaining') }}
  9.       battery hours remaining</font></small>{% endif %}
  10.     card_mod:
  11.       style: |
  12.        ha-card {
  13.           margin: 0;
  14.           padding-left: 10px;
  15.           padding-right: 10px;
  16.           background: var(--card-background-color);
  17.           box-shadow: none;
  18.           border: none;
  19.         }
  20.         ha-markdown {
  21.           font-size: 10px;
  22.           color: var(--primary-text-color);
  23.           margin-bottom: -8px;
  24.         }
  25.   - type: custom:power-flow-card-plus
  26.     entities:
  27.       grid:
  28.         name: PG&E
  29.         entity: sensor.powerwall_site_now_mod
  30.         secondary_info:
  31.           entity: sensor.pge_electric_cost_to_date
  32.           unit_of_measurement: $
  33.           unit_white_space: false
  34.           color_value: true
  35.         display_state: one_way
  36.         color_circle: true
  37.         color_icon: true
  38.         color_value: true
  39.         power_outage:
  40.           entity: binary_sensor.grid_status
  41.           state_alert: 'off'
  42.       solar:
  43.         entity: sensor.powerwall_solar_now
  44.         display_zero_tolerance: 30
  45.         icon: mdi:solar-panel-large
  46.         secondary_info:
  47.           entity: sensor.openweathermap_forecast_cloud_coverage
  48.           unit_of_measurement: '%'
  49.           unit_white_space: false
  50.           color_value: true
  51.         color_icon: true
  52.         color_value: true
  53.       battery:
  54.         entity: sensor.powerwall_battery_now
  55.         state_of_charge: sensor.powerwall_charge_actual
  56.         state_of_charge_unit: '%'
  57.         state_of_charge_unit_white_space: false
  58.         display_state: one_way
  59.         color_state_of_charge_value: true
  60.         color_icon: true
  61.         color_circle: true
  62.       home:
  63.         entity: sensor.powerwall_load_now
  64.         color_icon: true
  65.         color_value: true
  66.     watt_threshold: 999
  67.     calculate_flow_rate: true
  68.     w_decimals: 1
  69.     kw_decimals: 1
  70.     min_flow_rate: 2.2
  71.     max_flow_rate: 6
  72.     display_zero_lines:
  73.       mode: hide
  74.     clickable_entities: true
  75.     use_new_flow_rate_model: true
  76.     max_expected_power: 5000
  77.     card_mod:
  78.       style: |
  79.        @keyframes blink {
  80.           0% { opacity: 1; }
  81.           50% { opacity: 0; }
  82.           100% { opacity: 1; }
  83.         }
  84.         ha-card {
  85.           zoom: 1.2 !important;
  86.           box-shadow: none !important;
  87.           border: none !important;
  88.           padding-left: 10px;
  89.           padding-right: 10px;
  90.         }
  91.         .circle-container .grid.power-outage {
  92.           color: #FF403D !important;
  93.           animation: blink 2.475s linear infinite;
  94.         }
  95.         .label {
  96.           font-weight: 700 !important;
  97.         }
  98.         .circle ha-icon {
  99.           --mdc-icon-size: 36px;
  100.         }
  101.   - type: markdown
  102.     content:
  103.     card_mod:
  104.       style: |
  105.        ha-card {
  106.           box-shadow: none;
  107.           border: none;
  108.           margin-bottom: -48px;
  109.         }
  110.   - type: custom:bar-card
  111.     height: 31px
  112.     direction: right
  113.     positions:
  114.       icon: 'off'
  115.       indicator: 'off'
  116.       title: 'off'
  117.     severity:
  118.       - hide: false
  119.         from: '0'
  120.         to: '19'
  121.         color: '#C41400'
  122.       - from: '20'
  123.         to: '49'
  124.         color: '#EA9000'
  125.       - from: '50'
  126.         to: '100'
  127.         color: '#007A00'
  128.     card_mod:
  129.       style: |
  130.        ha-card {
  131.           border: none;
  132.           padding-left: 14px;
  133.           padding-right: 14px;
  134.           background: var(--card-background-color);
  135.           box-shadow: none;
  136.         }
  137.     entities:
  138.       - entity: sensor.powerwall_charge_actual
  139.         name: Powerwall Charge
  140.   - type: custom:button-card
  141.     entity: binary_sensor.powerwall_charging
  142.     show_name: false
  143.     show_icon: false
  144.     show_label: true
  145.     label: |-
  146.       [[[
  147.         var charge = states['sensor.powerwall_charge_actual'].state;
  148.         var batteryStatus = parseFloat(states['sensor.apf_battery_entity'].state);
  149.         var state = states['binary_sensor.powerwall_charging'].state;
  150.         var icon = '';
  151.         if (charge <= 19) icon = 'mdi:battery-charging-10';
  152.         else if (charge <= 49) icon = 'mdi:battery-charging-30';
  153.         else if (charge <= 100) icon = 'mdi:battery-charging-90';
  154.         var label = (state == 'off') ? 'Standby' : 'Charging';
  155.         if (batteryStatus < 0) label = 'Discharging';
  156.         var textAnimationStyle = '';
  157.         if (state == 'on') {
  158.           textAnimationStyle = 'animation: blink 2.475s linear infinite;';
  159.         }
  160.         var iconHtml = '';
  161.         if (state == 'on') {
  162.           iconHtml = `<ha-icon icon='${icon}' style='color: #FFCC00; width: 20px; height: 20px;'></ha-icon>`;
  163.         }
  164.         return `<div style='text-align: center; display: inline-block; width: 100%; padding-bottom: 11px;'>
  165.               ${iconHtml}
  166.               <span style='margin-left: 6px; position: relative; top: 1.5px; font-size: 14px; font-weight: 700; color: #bbb; ${textAnimationStyle}'>${label}</span>
  167.             </div>`;
  168.       ]]]
  169.     styles:
  170.       card:
  171.         - background-color: linear-gradient(rgba(105, 105, 105, 0.1), rgba(34, 34, 34, 0.95))
  172.         - margin-top: '-9px'
  173.         - border-top: none
  174.         - border-top-left-radius: 0px
  175.         - border-top-right-radius: 0px
  176.         - box-shadow: none
  177.       label:
  178.         - justify-self: center
  179.         - align-self: center
  180.         - width: 100%
  181.         - font-size: 14px
  182.         - font-weight: 600
  183.         - margin-top: '-8px'
  184.     card_mod:
  185.       style: |
  186.        ha-card {
  187.           border: none;
  188.           background: var(--card-background-color);
  189.           box-shadow: none;
  190.           margin-bottom: 0px !important;
  191.         }
  192.   - type: custom:button-card
  193.     entity: sensor.estimated_battery_life_hours_remaining
  194.     tap_action:
  195.       action: more-info
  196.     layout: icon-label
  197.     size: 20%
  198.     color_type: card
  199.     show_name: true
  200.     show_state: true
  201.     show_icon: false
  202.     show_units: true
  203.     card_mod:
  204.       style: |
  205.        ha-card {
  206.           height: auto;
  207.           padding-bottom: 25px !important;
  208.           padding-left: 7px !important;
  209.           background: transparent !important;
  210.           box-shadow: none;
  211.           border-top: none;
  212.           margin: 0;
  213.         }
  214.     styles:
  215.       grid:
  216.         - grid-template-areas: '"n s"'
  217.         - grid-template-columns: max-content min-content
  218.         - grid-template-rows: 1fr
  219.       name:
  220.         - font-size: 14px
  221.         - font-weight: 400
  222.         - justify-self: start
  223.         - padding-left: 22px
  224.         - margin-right: 10px
  225.         - white-space: nowrap
  226.         - color: '#838383'
  227.       state:
  228.         - font-size: 14px
  229.         - font-weight: 400
  230.         - justify-self: start
  231.         - padding-left: 0
  232.         - color: '#B7A064'
  233.         - margin-top: 1.8px
  234.     name: 'Estimated outage battery runtime:'
  235.     state_display: >
  236.      [[[ return states['sensor.outage_battery_runtime_estimate'].state +
  237.       '&nbsp; (' + states['sensor.estimated_battery_life_hours_remaining'].state
  238.       + ' hours)' ]]]
  239.  
Advertisement
Add Comment
Please, Sign In to add comment