Wrong unit in history-graph

Hey guys,

iam new at home assistant and got an unexpected view.

My config:

sensor Solar: !include solar.yaml

My solar.yaml:

- platform: mqtt
  state_topic: "sbfspot/2001299256"
  name: "solar_yeld_1"
  value_template: "{{ value_json.EToday }}"
  unit_of_measurement: 'kWh'
  icon: mdi:solar-power
  unique_id: "solar_yeld_1"

- platform: mqtt
  state_topic: "sbfspot/2001278292"
  name: "solar_yeld_2"
  value_template: "{{ value_json.EToday }}"
  unit_of_measurement: 'kWh'
  icon: mdi:solar-power
  unique_id: "solar_yeld_2"

- platform: mqtt
  state_topic: "sbfspot/2100204985"
  name: "solar_yeld_3"
  value_template: "{{ value_json.EToday }}"
  unit_of_measurement: 'kWh'
  icon: mdi:solar-power
  unique_id: "solar_yeld_3"

- platform: mqtt
  state_topic: "sbfspot/2001299256"
  name: "solar_current_1"
  value_template: "{{ value_json.PACTot | int }}"
  unit_of_measurement: 'W'
  device_class: power
  icon: mdi:solar-power
  unique_id: "solar_current_1"

- platform: mqtt
  state_topic: "sbfspot/2001278292"
  name: "solar_current_2"
  value_template: "{{ value_json.PACTot | int }}"
  unit_of_measurement: 'W'
  device_class: power
  icon: mdi:solar-power
  unique_id: "solar_current_2"

- platform: mqtt
  state_topic: "sbfspot/2100204985"
  name: "solar_current_3"
  value_template: "{{ value_json.PACTot | int }}"
  unit_of_measurement: 'W'
  device_class: power
  icon: mdi:solar-power
  unique_id: "solar_current_3"

- platform: template
  sensors:
    solar_power:
      friendly_name: "Solar Power"
      unit_of_measurement: "W"
      value_template: "{{ states('sensor.solar_current_1')|int + states('sensor.solar_current_2')|int + states('sensor.solar_current_3')|int}}"

- platform: template
  sensors:
    solar_yeld:
      friendly_name: "Solar Yeld"
      unit_of_measurement: "kWh"
      value_template: "{{ states('sensor.solar_yeld_1')|float + states('sensor.solar_yeld_2')|float + states('sensor.solar_yeld_3')|float}}"

But, if i add solar power to my dashboard (with gui) the graph always got “kwh” as his unit.

anyone got an idea? may my way isn the correct way?

thanks pad

ps: sorry 4 my englisch :smiley: