Template Sensor für PV Eigenverbrauch

HORSE-SHOE, MUSHROOM und CARD-MOD…

type: custom:flex-horseshoe-card
card_mod: null
style: |
  ha-card {
  left: -31%;
  width: 132%;
  } 
entities:
  - entity: sensor.sunny_boy_grid_power
    decimals: 0
    icon: mdi:solar-power-variant
    name: Solaranlage
    area: Solarstrom
  - entity: sensor.sma_strom_eigenverbrauch_prozent
    decimals: 0
    name: Eigenverbrauch
  - entity: sensor.sma_strom_autarkie_prozent
    decimals: 0
    name: Autargie
show:
  scale_tickmarks: true
  horseshoe_style: lineargradient
layout:
  hlines:
    - id: 0
      xpos: 50
      ypos: 41
      length: 70
      styles:
        - stroke: var(--primary-text-color);
        - stroke-width: 2;
        - opacity: 0.5;
        - stroke-linecap: round;
      color: '#FFF6E3'
  vlines:
    - id: 0
      xpos: 50
      ypos: 56
      length: 20
      styles:
        - stroke: var(--primary-text-color);
        - opacity: 0.5;
        - stroke-width: 2;
        - stroke-linecap: round;
  states:
    - id: 0
      entity_index: 0
      xpos: 50
      ypos: 36
      styles:
        - font-size: 2.8em;
    - id: 1
      entity_index: 1
      xpos: 48
      ypos: 56
      styles:
        - font-size: 2.2em;
        - text-anchor: end;
        - font-style: normal;
        - opacity: 0.7;
    - id: 2
      entity_index: 2
      xpos: 52
      ypos: 56
      styles:
        - font-size: 2.2em;
        - text-anchor: start;
        - font-style: normal;
        - opacity: 0.7;
  names:
    - id: 0
      entity_index: 0
      xpos: 50
      ypos: 94
      styles:
        - font-size: 1.5em;
        - text-transform: capitalize;
    - id: 1
      entity_index: 1
      xpos: 46
      ypos: 62
      styles:
        - font-size: 0.6em;
        - text-anchor: end;
        - opacity: 0.5;
        - text-transform: capitalize;
    - id: 2
      entity_index: 2
      xpos: 54
      ypos: 62
      styles:
        - font-size: 0.6em;
        - text-anchor: start;
        - opacity: 0.5;
        - text-transform: capitalize;
  areas:
    - id: 0
      entity_index: 0
      xpos: 50
      ypos: 76
      styles:
        - font-size: 1.0em;
        - opacity: 0.4;
horseshoe_state:
  color: '#43a047'
horseshoe_scale:
  min: 0
  max: 5000
  color: '#2e7031'
  width: 2
color_stops:
  '1000': '#43a047'
  '2000': '#32CD32'
  '3100': '#ADFF2F'

Sieht dann so aus…

Ich habe es so gemacht. Hoffe es hilft weiter!

####################################################
#                                                  #
#     Autarkie in %                                #
#                                                  #
####################################################
- sensor:
  - name: sma_strom_autarkie_prozent
    unit_of_measurement: "%"
    icon: mdi:percent
    unique_id: 1cc3b7d4-bc80-425c-8ce2-90a1a3ab6b3a
    state: >
      {% set sun_generated = states('sensor.sunny_boy_grid_power') | float(0) %} 
      {% if sun_generated == 0 %}
        0            
      {% else %}  
        {% set electricity_get = states('sensor.sunny_boy_metering_current_consumption') | float(0) %} 
        {% set electricity_percent = (( sun_generated * 100 ) / electricity_get ) | round(0) %} 
        {% if electricity_percent <= 0 %}
          0
        {% elif electricity_percent > 100 %}
          100 
        {% else %}   
          {{ electricity_percent }}
        {% endif %}  
      {% endif %}

####################################################
#                                                  #
#     Eigenverbrauch in %                          #
#                                                  #
####################################################
- sensor:
  - name: sma_strom_eigenverbrauch_prozent
    unit_of_measurement: "%"
    icon: mdi:transmission-tower-import  
    unique_id: 89526d8d-ce87-44b5-a071-33cb25472761
    state: >
      {% set sun_generated = states('sensor.sunny_boy_grid_power') | float(0) %} 
        {% if sun_generated == 0 %}
          0            
        {% else %}  
          {% set electricity_get = states('sensor.sunny_boy_metering_current_consumption') | float(0) %} 
          {% set electricity_percent = (( electricity_get * 100 ) / sun_generated ) | round(0) %} 
          {% if electricity_percent <= 0 %}
            0
          {% elif electricity_percent > 100 %}
            100 
          {% else %}   
            {{ electricity_percent }}
          {% endif %}  
      {% endif %}

2 „Gefällt mir“