1
mirror of https://github.com/home-assistant/core synced 2024-09-12 15:16:21 +02:00
ha-core/homeassistant/components/sunweg/sensor_types/string.py
Lucas Mindêllo de Andrade f567bf6dfe
Sun WEG integration (#88272)
* feat(sunweg): initial support

* chore: removed commented out code

* chore: removed warning

* fix: set never_resets for total sensors

* test: some tests

* fix(sunweg): default plantid type

* fix(sunweg): return first plant id

* test(sunweg): improved code coverage

* chore(sunweg): missing FlowResult return type

* chore(sunweg): removed unused strings

* perf(sunweg): using only one api instance

* chore(sunweg): removed uneeded atribute

* refact(sunweg): small refactoring

* refact(sunweg): typing

* chore(sunweg): comments

* chore(sunweg): bump version

* chore(sunweg): bump lib version

* test(sunweg): different mocking and coverage

* test: fixed setup component parameter

* feat: dynamic metrics

* fix(sunweg): ruff

* fix(sunweg): mypy

* refact(sunweg): codereview suggestions

* chore(sunweg): removed unused string

* chore(sunweg): typehint and code formatting
2023-12-09 09:45:40 +01:00

27 lines
929 B
Python

"""SunWEG Sensor definitions for the String type."""
from __future__ import annotations
from homeassistant.components.sensor import SensorDeviceClass
from homeassistant.const import UnitOfElectricCurrent, UnitOfElectricPotential
from .sensor_entity_description import SunWEGSensorEntityDescription
STRING_SENSOR_TYPES: tuple[SunWEGSensorEntityDescription, ...] = (
SunWEGSensorEntityDescription(
key="voltage",
name="Voltage",
api_variable_key="_voltage",
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
device_class=SensorDeviceClass.VOLTAGE,
suggested_display_precision=2,
),
SunWEGSensorEntityDescription(
key="amperage",
name="Amperage",
api_variable_key="_amperage",
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
suggested_display_precision=1,
),
)