Add support for bidirectional chargers to Wallbox integration (#74313)

* Add support for the Quasar bidirectional charger to the Wallbox integration, including ability to control charger while discharging, set a negative charge rate and monitor discharged amount

* Make code more generic in order to support other bidirectional models in the future

* Updates to files to comply with HA formatting rules

* Change const file to fix black check failure

* Remove unnecessay loop in number entity
This commit is contained in:
simeon-simsoft 2022-07-09 19:41:39 +01:00 committed by GitHub
parent 2cc9db5468
commit 5b32eea3d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 6 deletions

View file

@ -25,6 +25,7 @@ from homeassistant.helpers.typing import StateType
from . import WallboxCoordinator, WallboxEntity
from .const import (
CHARGER_ADDED_DISCHARGED_ENERGY_KEY,
CHARGER_ADDED_ENERGY_KEY,
CHARGER_ADDED_RANGE_KEY,
CHARGER_CHARGING_POWER_KEY,
@ -94,6 +95,14 @@ SENSOR_TYPES: dict[str, WallboxSensorEntityDescription] = {
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
CHARGER_ADDED_DISCHARGED_ENERGY_KEY: WallboxSensorEntityDescription(
key=CHARGER_ADDED_DISCHARGED_ENERGY_KEY,
name="Discharged Energy",
precision=2,
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
CHARGER_COST_KEY: WallboxSensorEntityDescription(
key=CHARGER_COST_KEY,
icon="mdi:ev-station",