As I don’t see you config I can’t help you, but earlier you used
states('sensor.sun2000')
Now in your template I see
state_attr('sensor.sun2000_5ktl_l1_hv2150011134'
I can share my current template config, maybe it will help somebody.
In configuration.yaml I have:
template: !include template.yaml
In template.yaml
sensor:
- name: "String 1 napięcie"
unique_id: pv_01_voltage
unit_of_measurement: 'V'
icon: mdi:flash-alert-outline
state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'pv_string_01_voltage') | float(0) }}"
- name: "String 2 napięcie"
unique_id: pv_02_voltage
unit_of_measurement: 'V'
icon: mdi:flash-alert-outline
state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'pv_string_02_voltage') | float(0) }}"
- name: "String 1 natężenie"
unique_id: pv_01_current
unit_of_measurement: 'A'
icon: mdi:current-dc
state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'pv_string_01_current') | float(0) }}"
- name: "String 2 natężenie"
unique_id: pv_02_current
unit_of_measurement: 'A'
icon: mdi:current-dc
state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'pv_string_02_current') | float(0) }}"
- name: "Faza 1 V (f)"
unique_id: phase_a_voltage
unit_of_measurement: 'V'
icon: mdi:flash-alert-outline
state: >
{% if state_attr('sensor.sun2000_8ktl_m0', 'phase_A_voltage') | float(0) > 180 and state_attr('sensor.sun2000_8ktl_m0', 'phase_A_voltage')|float(0) < 264 %}
{{ state_attr('sensor.sun2000_8ktl_m0', 'phase_A_voltage') }}
{% else %}
{{ state_attr('sensor.sun2000_8ktl_m0', 'grid_A_voltage') }}
{% endif %}
- name: "Faza 2 V (f)"
unique_id: phase_b_voltage
unit_of_measurement: 'V'
icon: mdi:flash-alert-outline
state: >
{% if state_attr('sensor.sun2000_8ktl_m0', 'phase_B_voltage') | float(0) > 180 and state_attr('sensor.sun2000_8ktl_m0', 'phase_B_voltage')|float(0) < 264 %}
{{ state_attr('sensor.sun2000_8ktl_m0', 'phase_B_voltage') }}
{% else %}
{{ state_attr('sensor.sun2000_8ktl_m0', 'grid_B_voltage') }}
{% endif %}
- name: "Faza 3 V (f)"
unique_id: phase_c_voltage
unit_of_measurement: 'V'
icon: mdi:flash-alert-outline
state: >
{% if state_attr('sensor.sun2000_8ktl_m0', 'phase_C_voltage') | float(0) > 180 and state_attr('sensor.sun2000_8ktl_m0', 'phase_C_voltage')|float(0) < 264 %}
{{ state_attr('sensor.sun2000_8ktl_m0', 'phase_C_voltage') }}
{% else %}
{{ state_attr('sensor.sun2000_8ktl_m0', 'grid_C_voltage') }}
{% endif %}
- name: "Faza 1 V (m)"
unique_id: m_grid_a_voltage
unit_of_measurement: 'V'
icon: mdi:flash-alert-outline
state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'grid_A_voltage') | float(0) }}"
- name: "Faza 2 V (m)"
unique_id: m_grid_b_voltage
unit_of_measurement: 'V'
icon: mdi:flash-alert-outline
state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'grid_B_voltage') | float(0) }}"
- name: "Faza 3 V (m)"
unique_id: m_grid_c_voltage
unit_of_measurement: 'V'
icon: mdi:flash-alert-outline
state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'grid_C_voltage') | float(0) }}"
- name: "Faza 1 A (f)"
unique_id: phase_a_current
unit_of_measurement: 'A'
icon: mdi:current-ac
state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'phase_A_current') | float(0) }}"
- name: "Faza 2 A (f)"
unique_id: phase_b_current
unit_of_measurement: 'A'
icon: mdi:current-ac
state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'phase_B_current') | float(0) }}"
- name: "Faza 3 A (f)"
unique_id: phase_c_current
unit_of_measurement: 'A'
icon: mdi:current-ac
state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'phase_C_current') | float(0) }}"
- name: "Produkcja DC"
unique_id: pv_input_power
unit_of_measurement: 'W'
icon: mdi:solar-power
state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'input_power') | float(0) }}"
- name: "Zużycie prądu"
unique_id: power_meter_active_power
unit_of_measurement: 'W'
icon: mdi:transmission-tower
state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'power_meter_active_power') | float(0) }}"
- name: "Zużycie A"
unique_id: active_grid_a_power
unit_of_measurement: 'W'
icon: mdi:transmission-tower
state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'active_grid_A_power') | float(0) }}"
- name: "Zużycie B"
unique_id: active_grid_b_power
unit_of_measurement: 'W'
icon: mdi:transmission-tower
state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'active_grid_B_power') | float(0) }}"
- name: "Zużycie C"
unique_id: active_grid_c_power
unit_of_measurement: 'W'
icon: mdi:transmission-tower
state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'active_grid_C_power') | float(0) }}"
- name: "Prąd oddany do sieci"
unique_id: m_grid_exporterd_energy
unit_of_measurement: 'kWh'
icon: mdi:transmission-tower
state: >
{% if state_attr('sensor.sun2000_8ktl_m0','grid_exported_energy') | float(0) > 0 %}
{{ state_attr('sensor.sun2000_8ktl_m0','grid_exported_energy') | float(0) }}
{% endif %}
device_class: energy
state_class: total_increasing
- name: "Prąd pobrany z sieci"
unique_id: m_grid_accumulated_energy
unit_of_measurement: 'kWh'
icon: mdi:transmission-tower
state: >
{% if state_attr('sensor.sun2000_8ktl_m0','grid_accumulated_energy') | float(0) > 0 %}
{{ state_attr('sensor.sun2000_8ktl_m0', 'grid_accumulated_energy') | float(0) }}
{% endif %}
device_class: energy
state_class: total_increasing
- name: "Temperatura falownika"
unique_id: pv_temperatura
unit_of_measurement: '°C'
state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'internal_temperature') | float(0) }}"
- name: "Efetywność Falownika"
unique_id: pv_efficiency
unit_of_measurement: '%'
state: >
{% if state_attr('sensor.sun2000_8ktl_m0', 'efficiency') | float(0) < 100 %}
{{ state_attr('sensor.sun2000_8ktl_m0', 'efficiency') }}
{% else %}
0
{% endif %}
- name: "Zużycie prądu dom"
unique_id: energy_used
unit_of_measurement: 'kWh'
state: >
{% if states('sensor.total_yield') | float(0) > 0 and state_attr('sensor.sun2000_8ktl_m0','grid_exported_energy') | float(0) > 0 and state_attr('sensor.sun2000_8ktl_m0','grid_accumulated_energy') | float(0) > 0 %}
{{ '%0.2f' | format(states('sensor.total_yield') | float(0) -
state_attr('sensor.sun2000_8ktl_m0','grid_exported_energy') | float(0) +
state_attr('sensor.sun2000_8ktl_m0','grid_accumulated_energy') | float(0)) }}
{% endif %}
device_class: energy
state_class: total_increasing