1 """Support for controlling juicenet/juicepoint/juicebox based EVSE numbers."""
3 from __future__
import annotations
5 from dataclasses
import dataclass
7 from pyjuicenet
import Api, Charger
12 NumberEntityDescription,
19 from .const
import DOMAIN, JUICENET_API, JUICENET_COORDINATOR
20 from .entity
import JuiceNetDevice
23 @dataclass(frozen=True, kw_only=True)
25 """An entity description for a JuiceNetNumber."""
28 native_max_value_key: str |
None =
None
31 NUMBER_TYPES: tuple[JuiceNetNumberEntityDescription, ...] = (
33 translation_key=
"amperage_limit",
34 key=
"current_charging_amperage_limit",
36 native_max_value_key=
"max_charging_amperage",
38 setter_key=
"set_charging_amperage_limit",
45 config_entry: ConfigEntry,
46 async_add_entities: AddEntitiesCallback,
48 """Set up the JuiceNet Numbers."""
49 juicenet_data = hass.data[DOMAIN][config_entry.entry_id]
50 api: Api = juicenet_data[JUICENET_API]
51 coordinator = juicenet_data[JUICENET_COORDINATOR]
55 for device
in api.devices
56 for description
in NUMBER_TYPES
62 """Implementation of a JuiceNet number."""
64 entity_description: JuiceNetNumberEntityDescription
69 description: JuiceNetNumberEntityDescription,
70 coordinator: DataUpdateCoordinator,
72 """Initialise the number."""
73 super().
__init__(device, description.key, coordinator)
78 """Return the value of the entity."""
83 """Return the maximum value."""
88 return DEFAULT_MAX_VALUE
91 """Update the current value."""
float native_max_value(self)
float|None native_value(self)
None __init__(self, Charger device, JuiceNetNumberEntityDescription description, DataUpdateCoordinator coordinator)
None async_set_native_value(self, float value)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)