# Home Assistant

Source: https://docs.evcc.io/en/meters/home-assistant

Home Assistant instances in your network will be auto-discovered and suitable entities (e.g. `sensor.*`) will be suggested.

## Parameters

| Name | Description | Default / example | |
| --- | --- | --- | --- |
| uri | Home Assistant URI | http://homeassistant.local:8123 |  |
| power | Power Entity Entity ID for instantaneous power measurement in watts. The entity must provide numeric values only (e.g., "1234", not "1234 W"). | sensor.house_power |  |
| capacity | Battery capacity | 50 kWh |  |
| minsoc | Minimum charge Lower limit as configured on the battery system. Used by optimizer. | 0 % |  |
| maxsoc | Maximum charge Upper limit as configured on the battery system. Used by optimizer and for grid charging. | 100 % |  |
| energy | Energy Entity Entity ID for total energy in kWh (e.g. grid import or battery charging). No daily or interval values. | sensor.house_energy | advanced |
| returnEnergy | Return Energy Entity Entity ID for total energy in reverse direction in kWh (e.g. grid export or battery discharging). No daily or interval values. | sensor.house_return_energy | advanced |
| currentL1 | L1 Current Entity Entity ID for L1 current measurement in amperes | sensor.house_current_l1 | advanced |
| currentL2 | L2 Current Entity Entity ID for L2 current measurement in amperes | sensor.house_current_l2 | advanced |
| currentL3 | L3 Current Entity Entity ID for L3 current measurement in amperes | sensor.house_current_l3 | advanced |
| voltageL1 | L1 Voltage Entity Entity ID for L1 voltage measurement in volts | sensor.house_voltage_l1 | advanced |
| voltageL2 | L2 Voltage Entity Entity ID for L2 voltage measurement in volts | sensor.house_voltage_l2 | advanced |
| voltageL3 | L3 Voltage Entity Entity ID for L3 voltage measurement in volts | sensor.house_voltage_l3 | advanced |
| soc | Battery State of Charge Entity ID for battery state of charge in percent | sensor.battery_soc | advanced |
| modeNormal | Normal Mode Script Script to put home battery to normal operation. Required when any other mode script is set. The script is responsible for any necessary state changes on the HA side. | script.battery_normal | advanced |
| modeHold | Hold Mode Script Optional script to prevent the home battery from discharging. | script.battery_hold | advanced |
| modeCharge | Grid Charge Mode Script Optional script to grid-charge the home battery. | script.battery_grid_charge | advanced |
| modeHoldCharge | Hold Charge Mode Script Optional script to prevent the home battery from charging while discharging to cover the house load remains allowed. | script.battery_hold_charge | advanced |
| modeDischarge | Grid Discharge Mode Script Optional script to force-discharge the home battery to the grid. | script.battery_grid_discharge | advanced |
| insecure | Accept self-signed certificates |  | advanced |
| maxacpower | Maximum AC power of the hybrid inverter | 0 W | advanced |
| maxchargepower | Maximum charge power For forced charging of the battery. |  W | advanced |
| maxdischargepower | Maximum discharge power Maximum discharge power of the storage. |  W | advanced |

## Configuration example for evcc.yaml

```yaml
meters:
    - name: my_grid
      type: template
      template: homeassistant
      usage: grid
      uri: http://homeassistant.local:8123 # Home Assistant URI
      power: sensor.house_power # Power Entity, Entity ID for instantaneous power measurement in watts. The entity must provide numeric values only (e.g., "1234", not "1234 W").
      energy: sensor.house_energy # Energy Entity, Entity ID for total energy in kWh (e.g. grid import or battery charging). No daily or interval values. (optional)
      returnEnergy: sensor.house_return_energy # Return Energy Entity, Entity ID for total energy in reverse direction in kWh (e.g. grid export or battery discharging). No daily or interval values. (optional)
      currentL1: sensor.house_current_l1 # L1 Current Entity, Entity ID for L1 current measurement in amperes (optional)
      currentL2: sensor.house_current_l2 # L2 Current Entity, Entity ID for L2 current measurement in amperes (optional)
      currentL3: sensor.house_current_l3 # L3 Current Entity, Entity ID for L3 current measurement in amperes (optional)
      voltageL1: sensor.house_voltage_l1 # L1 Voltage Entity, Entity ID for L1 voltage measurement in volts (optional)
      voltageL2: sensor.house_voltage_l2 # L2 Voltage Entity, Entity ID for L2 voltage measurement in volts (optional)
      voltageL3: sensor.house_voltage_l3 # L3 Voltage Entity, Entity ID for L3 voltage measurement in volts (optional)
      insecure: # Accept self-signed certificates, optional
```

```yaml
meters:
    - name: my_pv
      type: template
      template: homeassistant
      usage: pv
      uri: http://homeassistant.local:8123 # Home Assistant URI
      power: sensor.house_power # Power Entity, Entity ID for instantaneous power measurement in watts. The entity must provide numeric values only (e.g., "1234", not "1234 W").
      energy: sensor.house_energy # Energy Entity, Entity ID for total energy in kWh (e.g. grid import or battery charging). No daily or interval values. (optional)
      returnEnergy: sensor.house_return_energy # Return Energy Entity, Entity ID for total energy in reverse direction in kWh (e.g. grid export or battery discharging). No daily or interval values. (optional)
      currentL1: sensor.house_current_l1 # L1 Current Entity, Entity ID for L1 current measurement in amperes (optional)
      currentL2: sensor.house_current_l2 # L2 Current Entity, Entity ID for L2 current measurement in amperes (optional)
      currentL3: sensor.house_current_l3 # L3 Current Entity, Entity ID for L3 current measurement in amperes (optional)
      voltageL1: sensor.house_voltage_l1 # L1 Voltage Entity, Entity ID for L1 voltage measurement in volts (optional)
      voltageL2: sensor.house_voltage_l2 # L2 Voltage Entity, Entity ID for L2 voltage measurement in volts (optional)
      voltageL3: sensor.house_voltage_l3 # L3 Voltage Entity, Entity ID for L3 voltage measurement in volts (optional)
      insecure: # Accept self-signed certificates, optional
      maxacpower: 0 # Maximum AC power of the hybrid inverter (W), optional
```

```yaml
meters:
    - name: my_battery
      type: template
      template: homeassistant
      usage: battery
      uri: http://homeassistant.local:8123 # Home Assistant URI
      power: sensor.house_power # Power Entity, Entity ID for instantaneous power measurement in watts. The entity must provide numeric values only (e.g., "1234", not "1234 W").
      capacity: 50 # Battery capacity (kWh), optional
      minsoc: 0 # Minimum charge (%), Lower limit as configured on the battery system. Used by optimizer. (optional)
      maxsoc: 100 # Maximum charge (%), Upper limit as configured on the battery system. Used by optimizer and for grid charging. (optional)
      energy: sensor.house_energy # Energy Entity, Entity ID for total energy in kWh (e.g. grid import or battery charging). No daily or interval values. (optional)
      returnEnergy: sensor.house_return_energy # Return Energy Entity, Entity ID for total energy in reverse direction in kWh (e.g. grid export or battery discharging). No daily or interval values. (optional)
      currentL1: sensor.house_current_l1 # L1 Current Entity, Entity ID for L1 current measurement in amperes (optional)
      currentL2: sensor.house_current_l2 # L2 Current Entity, Entity ID for L2 current measurement in amperes (optional)
      currentL3: sensor.house_current_l3 # L3 Current Entity, Entity ID for L3 current measurement in amperes (optional)
      voltageL1: sensor.house_voltage_l1 # L1 Voltage Entity, Entity ID for L1 voltage measurement in volts (optional)
      voltageL2: sensor.house_voltage_l2 # L2 Voltage Entity, Entity ID for L2 voltage measurement in volts (optional)
      voltageL3: sensor.house_voltage_l3 # L3 Voltage Entity, Entity ID for L3 voltage measurement in volts (optional)
      soc: sensor.battery_soc # Battery State of Charge, Entity ID for battery state of charge in percent (optional)
      modeNormal: script.battery_normal # Normal Mode Script, Script to put home battery to normal operation. Required when any other mode script is set. The script is responsible for any necessary state changes on the HA side. (optional)
      modeHold: script.battery_hold # Hold Mode Script, Optional script to prevent the home battery from discharging. (optional)
      modeCharge: script.battery_grid_charge # Grid Charge Mode Script, Optional script to grid-charge the home battery. (optional)
      modeHoldCharge: script.battery_hold_charge # Hold Charge Mode Script, Optional script to prevent the home battery from charging while discharging to cover the house load remains allowed. (optional)
      modeDischarge: script.battery_grid_discharge # Grid Discharge Mode Script, Optional script to force-discharge the home battery to the grid. (optional)
      insecure: # Accept self-signed certificates, optional
      maxchargepower: # Maximum charge power (W), For forced charging of the battery. (optional)
      maxdischargepower: # Maximum discharge power (W), Maximum discharge power of the storage. (optional)
```

```yaml
meters:
    - name: my_aux
      type: template
      template: homeassistant
      usage: aux
      uri: http://homeassistant.local:8123 # Home Assistant URI
      power: sensor.house_power # Power Entity, Entity ID for instantaneous power measurement in watts. The entity must provide numeric values only (e.g., "1234", not "1234 W").
      energy: sensor.house_energy # Energy Entity, Entity ID for total energy in kWh (e.g. grid import or battery charging). No daily or interval values. (optional)
      returnEnergy: sensor.house_return_energy # Return Energy Entity, Entity ID for total energy in reverse direction in kWh (e.g. grid export or battery discharging). No daily or interval values. (optional)
      currentL1: sensor.house_current_l1 # L1 Current Entity, Entity ID for L1 current measurement in amperes (optional)
      currentL2: sensor.house_current_l2 # L2 Current Entity, Entity ID for L2 current measurement in amperes (optional)
      currentL3: sensor.house_current_l3 # L3 Current Entity, Entity ID for L3 current measurement in amperes (optional)
      voltageL1: sensor.house_voltage_l1 # L1 Voltage Entity, Entity ID for L1 voltage measurement in volts (optional)
      voltageL2: sensor.house_voltage_l2 # L2 Voltage Entity, Entity ID for L2 voltage measurement in volts (optional)
      voltageL3: sensor.house_voltage_l3 # L3 Voltage Entity, Entity ID for L3 voltage measurement in volts (optional)
      insecure: # Accept self-signed certificates, optional
```

```yaml
meters:
    - name: my_charger
      type: template
      template: homeassistant
      usage: charge
      uri: http://homeassistant.local:8123 # Home Assistant URI
      power: sensor.house_power # Power Entity, Entity ID for instantaneous power measurement in watts. The entity must provide numeric values only (e.g., "1234", not "1234 W").
      energy: sensor.house_energy # Energy Entity, Entity ID for total energy in kWh (e.g. grid import or battery charging). No daily or interval values. (optional)
      returnEnergy: sensor.house_return_energy # Return Energy Entity, Entity ID for total energy in reverse direction in kWh (e.g. grid export or battery discharging). No daily or interval values. (optional)
      currentL1: sensor.house_current_l1 # L1 Current Entity, Entity ID for L1 current measurement in amperes (optional)
      currentL2: sensor.house_current_l2 # L2 Current Entity, Entity ID for L2 current measurement in amperes (optional)
      currentL3: sensor.house_current_l3 # L3 Current Entity, Entity ID for L3 current measurement in amperes (optional)
      voltageL1: sensor.house_voltage_l1 # L1 Voltage Entity, Entity ID for L1 voltage measurement in volts (optional)
      voltageL2: sensor.house_voltage_l2 # L2 Voltage Entity, Entity ID for L2 voltage measurement in volts (optional)
      voltageL3: sensor.house_voltage_l3 # L3 Voltage Entity, Entity ID for L3 voltage measurement in volts (optional)
      insecure: # Accept self-signed certificates, optional
```
