Improvements, add switch

This commit is contained in:
Andre Basche
2023-03-05 00:54:57 +01:00
parent 136a1810fc
commit 16eafff169
6 changed files with 165 additions and 22 deletions

View File

@ -9,7 +9,7 @@ from homeassistant.components.sensor import (
SensorEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import UnitOfEnergy, UnitOfVolume, UnitOfMass
from homeassistant.const import UnitOfEnergy, UnitOfVolume, UnitOfMass, UnitOfPower
from homeassistant.core import callback
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.typing import StateType
@ -45,6 +45,8 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
key="currentElectricityUsed",
name="Current Electricity Used",
state_class=SensorStateClass.MEASUREMENT,
device_class=SensorDeviceClass.POWER,
native_unit_of_measurement=UnitOfPower.KILO_WATT,
icon="mdi:lightning-bolt"
),
SensorEntityDescription(
@ -61,6 +63,16 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
native_unit_of_measurement=UnitOfMass.KILOGRAMS,
icon="mdi:weight-kilogram"
),
SensorEntityDescription(
key="machMode",
name="Mode",
translation_key="mode"
),
SensorEntityDescription(
key="errors",
name="Last Error",
translation_key="errors"
),
)
}