Skip to content

Instantly share code, notes, and snippets.

@MattJeanes
Created November 15, 2023 20:00
Show Gist options
  • Save MattJeanes/3d37228d17ee6b5d78f999b0af18f538 to your computer and use it in GitHub Desktop.
Save MattJeanes/3d37228d17ee6b5d78f999b0af18f538 to your computer and use it in GitHub Desktop.
My Home Assistant configuration for otti/Growatt_ShineWiFi-S project
# Energy
- state_topic: energy/solar
value_template: >
{% if (value_json['InverterStatus'] | int == 0) %}
Waiting
{% elif (value_json['InverterStatus'] | int == 1) %}
Normal
{% elif (value_json['InverterStatus'] | int == 2) %}
Fault
{% else %}
Unknown
{% endif %}
unique_id: growatt_status
name: Growatt - State
icon: mdi:power-settings
- state_topic: energy/solar
value_template: "{{ value_json['PV1InputPower'] | float / 1000 }}"
unique_id: growatt_string1_watt
device_class: power
unit_of_measurement: "kW"
name: Growatt - String 1 (kiloWatt)
icon: mdi:solar-power
- state_topic: energy/solar
value_template: "{{ value_json['PV1Voltage'] | float }}"
unique_id: growatt_string1_voltage
device_class: voltage
unit_of_measurement: "V"
name: Growatt - String 1 (Voltage)
- state_topic: energy/solar
value_template: "{{ value_json['PV1InputCurrent'] | float }}"
unique_id: growatt_string1_current
device_class: current
unit_of_measurement: "A"
name: Growatt - String 1 (Current)
- state_topic: energy/solar
value_template: "{{ value_json['InputPower'] | float / 1000 }}"
unique_id: growatt_actual_input_power
device_class: power
unit_of_measurement: "kW"
name: Growatt - Input kiloWatt (Actual)
icon: mdi:solar-power
- state_topic: energy/solar
value_template: "{{ value_json['OutputPower'] | float / 1000 }}"
unique_id: growatt_actual_output_power
device_class: power
unit_of_measurement: "kW"
name: Growatt - Output kiloWatt (Actual)
icon: mdi:solar-power
- state_topic: energy/solar
value_template: "{{ value_json['GridFrequency'] | float }}"
unique_id: growatt_grid_frequency
unit_of_measurement: "Hz"
name: Growatt - Grid frequency
icon: mdi:waveform
- state_topic: energy/solar
value_template: "{{ value_json['L1ThreePhaseGridVoltage'] | float }}"
unique_id: growatt_phase_voltage
device_class: voltage
unit_of_measurement: "V"
name: Growatt - Grid Phase voltage
- state_topic: energy/solar
value_template: "{{ value_json['L1ThreePhaseGridOutputCurrent'] | float }}"
unique_id: growatt_phase_current
device_class: current
unit_of_measurement: "A"
name: Growatt - Grid Phase current
- state_topic: energy/solar
value_template: "{{ value_json['L1ThreePhaseGridOutputPower'] | float / 1000 }}"
unique_id: growatt_phase_power
device_class: power
unit_of_measurement: "kW"
name: Growatt - Grid Phase power
- state_topic: energy/solar
value_template: "{{ value_json['TodayGenerateEnergy'] | float }}"
unique_id: growatt_generated_energy_today
device_class: energy
state_class: total_increasing
unit_of_measurement: "kWh"
name: Growatt - Generated energy (Today)
icon: mdi:solar-power
- state_topic: energy/solar
value_template: "{{ value_json['PV1EnergyToday'] | float }}"
unique_id: growatt_generated_solar_energy_today
device_class: energy
state_class: total_increasing
unit_of_measurement: "kWh"
name: Growatt - Generated solar energy (Today)
icon: mdi:solar-power
- state_topic: energy/solar
value_template: "{{ value_json['PV1EnergyToday'] | float }}"
unique_id: growatt_generated_solar_energy_epv1_today
device_class: energy
state_class: total_increasing
unit_of_measurement: "kWh"
name: Growatt - Generated solar energy (epv1) (Today)
icon: mdi:solar-power
- state_topic: energy/solar
value_template: "{{ value_json['PV2EnergyToday'] | float }}"
unique_id: growatt_generated_solar_energy_epv2_today
device_class: energy
state_class: total_increasing
unit_of_measurement: "kWh"
name: Growatt - Generated solar energy (epv2) (Today)
icon: mdi:solar-power
- state_topic: energy/solar
value_template: "{{ ((value_json['TotalGenerateEnergy'] | float) + 4597.4) | round(1) }}" # Added original inverter value
unique_id: growatt_generated_energy_total
device_class: energy
state_class: total_increasing
unit_of_measurement: "kWh"
name: Growatt - Generated energy (Total)
icon: mdi:solar-power
- state_topic: energy/solar
value_template: "{{ ((value_json['PVEnergyTotal'] | float) + 3314.4) | round(1) }}" # Added original inverter value
unique_id: growatt_generated_solar_energy_total
device_class: energy
state_class: total_increasing
unit_of_measurement: "kWh"
name: Growatt - Generated solar energy (Total)
icon: mdi:solar-power
- state_topic: energy/solar
value_template: "{{ value_json['InverterTemperature'] | float }}"
unique_id: growatt_inverter_temperature
device_class: temperature
unit_of_measurement: "°C"
name: Growatt - Inverter temperature
icon: mdi:thermometer
# The entity below is not available in all inverters.
- state_topic: energy/solar
value_template: "{{ value_json['TemperatureInsideIPM'] | float }}"
unique_id: growatt_ipm_temperature
device_class: temperature
unit_of_measurement: "°C"
name: Growatt - IPM temperature
icon: mdi:thermometer
# Battery
- state_topic: energy/solar
value_template: "{{ value_json['ACChargeEnergyToday'] | float }}"
unique_id: growatt_battery_ac_charged_today
device_class: energy
state_class: total_increasing
unit_of_measurement: "kWh"
name: Growatt - Battery ac charged (Today)
icon: mdi:battery-arrow-up
- state_topic: energy/solar
value_template: "{{ ((value_json['ACChargeEnergyTotal'] | float) + 2030.7) | round(1) }}" # Added original inverter value
unique_id: growatt_battery_ac_charged_total
device_class: energy
state_class: total_increasing
unit_of_measurement: "kWh"
name: Growatt - Battery ac charged (Total)
icon: mdi:battery-arrow-up
- state_topic: energy/solar
value_template: "{{ value_json['ChargePower'] | float / 1000 }}"
unique_id: growatt_battery_charge
device_class: power
unit_of_measurement: "kW"
name: Growatt - Battery charging (actual)
icon: mdi:battery-arrow-up
- state_topic: energy/solar
value_template: "{{ value_json['ChargeEnergyToday'] | float }}"
unique_id: growatt_battery_charged_today
device_class: energy
state_class: total_increasing
unit_of_measurement: "kWh"
name: Growatt - Battery charged (today)
icon: mdi:battery-arrow-up
- state_topic: energy/solar
value_template: "{{ ((value_json['ChargeEnergyTotal'] | float) + 2621.8) | round(1) }}" # Added original inverter value
unique_id: growatt_battery_charged_total
device_class: energy
state_class: total_increasing
unit_of_measurement: "kWh"
name: Growatt - Battery charged (total)
icon: mdi:battery-arrow-up
- state_topic: energy/solar
value_template: "{{ value_json['DischargePower'] | float / 1000 }}"
unique_id: growatt_battery_discharge
device_class: power
unit_of_measurement: "kW"
name: Growatt - Battery discharging (actual)
icon: mdi:battery-arrow-down-outline
- state_topic: energy/solar
value_template: "{{ value_json['DischargeEnergyToday'] | float }}"
unique_id: growatt_battery_discharged_today
device_class: energy
state_class: total_increasing
unit_of_measurement: "kWh"
name: Growatt - Battery discharged (today)
icon: mdi:battery-arrow-down-outline
- state_topic: energy/solar
value_template: "{{ ((value_json['DischargeEnergyTotal'] | float) + 2592.1) | round(1) }}" # Added original inverter value
unique_id: growatt_battery_discharged_total
device_class: energy
state_class: total_increasing
unit_of_measurement: "kWh"
name: Growatt - Battery discharged (total)
icon: mdi:battery-arrow-down-outline
- state_topic: energy/solar
value_template: "{{ value_json['SOC'] | int }}"
unique_id: growatt_battery_soc
device_class: battery
unit_of_measurement: "%"
name: Growatt - Battery State Of Charge
icon: mdi:battery-charging-60
- state_topic: energy/solar
value_template: "{{ value_json['BatteryTemperature'] | int }}"
unique_id: growatt_battery_temperature
name: Growatt - Battery Temperature
device_class: temperature
unit_of_measurement: "°C"
icon: mdi:thermometer
# Local load
- state_topic: energy/solar
value_template: "{{ value_json['LocalLoadEnergyToday'] | float }}"
unique_id: growatt_local_load_today
device_class: energy
state_class: total_increasing
unit_of_measurement: "kWh"
name: Growatt - Local load consumption (today)
icon: mdi:power-plug
- state_topic: energy/solar
value_template: "{{ ((value_json['LocalLoadEnergyTotal'] | float) + 8854.8) | round(1) }}" # Added original inverter value
unique_id: growatt_local_load_total
device_class: energy
state_class: total_increasing
unit_of_measurement: "kWh"
name: Growatt - Local load consumption (total)
icon: mdi:power-plug
- state_topic: energy/solar
value_template: "{{ value_json['INVPowerToLocalLoad'] | float / 1000 }}"
unique_id: growatt_local_load
device_class: power
unit_of_measurement: "kW"
name: Growatt - Local load consumption (actual)
icon: mdi:power-plug
# Import from grid
- state_topic: energy/solar
value_template: "{{ value_json['ACPowerToUser'] | float / 1000 }}"
unique_id: growatt_import_from_grid
device_class: power
unit_of_measurement: "kW"
name: Growatt - Import from grid (actual)
icon: mdi:transmission-tower-export
- state_topic: energy/solar
value_template: "{{ value_json['EnergyToUserToday'] | float }}"
unique_id: growatt_import_from_grid_today
device_class: energy
state_class: total_increasing
unit_of_measurement: "kWh"
name: Growatt - Import from grid (today)
icon: mdi:transmission-tower-export
- state_topic: energy/solar
value_template: "{{ ((value_json['EnergyToUserTotal'] | float) + 5932.5) | round(1) }}" # Added original inverter value
unique_id: growatt_import_from_grid_total
device_class: energy
state_class: total_increasing
unit_of_measurement: "kWh"
name: Growatt - Import from grid (total)
icon: mdi:transmission-tower-export
# Export to grid
- state_topic: energy/solar
value_template: "{{ value_json['ACPowerToGrid'] | float / 1000 }}"
unique_id: growatt_export_to_grid
device_class: power
unit_of_measurement: "kW"
name: Growatt - Export to grid (actual)
icon: mdi:transmission-tower-import
- state_topic: energy/solar
value_template: "{{ value_json['EnergyToGridToday'] | float }}"
unique_id: growatt_export_to_grid_today
device_class: energy
state_class: total_increasing
unit_of_measurement: "kWh"
name: Growatt - Export to grid (today)
icon: mdi:transmission-tower-import
- state_topic: energy/solar
value_template: "{{ ((value_json['EnergyToGridTotal'] | float) + 362.4) | round(1) }}" # Added original inverter value
unique_id: growatt_export_to_grid_total
device_class: energy
state_class: total_increasing
unit_of_measurement: "kWh"
name: Growatt - Export to grid (total)
icon: mdi:transmission-tower-import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment