1 """Support for Goal Zero Yeti Sensors."""
3 from __future__
import annotations
5 from typing
import cast
10 SensorEntityDescription,
15 SIGNAL_STRENGTH_DECIBELS,
17 UnitOfElectricCurrent,
18 UnitOfElectricPotential,
28 from .coordinator
import GoalZeroConfigEntry
29 from .entity
import GoalZeroEntity
31 SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
34 translation_key=
"watts_in",
35 device_class=SensorDeviceClass.POWER,
36 native_unit_of_measurement=UnitOfPower.WATT,
37 state_class=SensorStateClass.MEASUREMENT,
41 translation_key=
"amps_in",
42 device_class=SensorDeviceClass.CURRENT,
43 native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
44 state_class=SensorStateClass.MEASUREMENT,
45 entity_registry_enabled_default=
False,
49 translation_key=
"watts_out",
50 device_class=SensorDeviceClass.POWER,
51 native_unit_of_measurement=UnitOfPower.WATT,
52 state_class=SensorStateClass.MEASUREMENT,
56 translation_key=
"amps_out",
57 device_class=SensorDeviceClass.CURRENT,
58 native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
59 state_class=SensorStateClass.MEASUREMENT,
60 entity_registry_enabled_default=
False,
64 translation_key=
"wh_out",
65 device_class=SensorDeviceClass.ENERGY,
66 native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
67 state_class=SensorStateClass.TOTAL_INCREASING,
68 entity_registry_enabled_default=
False,
72 translation_key=
"wh_stored",
73 device_class=SensorDeviceClass.ENERGY,
74 native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
75 state_class=SensorStateClass.TOTAL,
79 device_class=SensorDeviceClass.VOLTAGE,
80 native_unit_of_measurement=UnitOfElectricPotential.VOLT,
81 entity_registry_enabled_default=
False,
85 translation_key=
"soc_percent",
86 device_class=SensorDeviceClass.BATTERY,
87 native_unit_of_measurement=PERCENTAGE,
90 key=
"timeToEmptyFull",
91 translation_key=
"time_to_empty_full",
92 device_class=SensorDeviceClass.DURATION,
93 native_unit_of_measurement=UnitOfTime.MINUTES,
97 device_class=SensorDeviceClass.TEMPERATURE,
98 native_unit_of_measurement=UnitOfTemperature.CELSIUS,
99 entity_category=EntityCategory.DIAGNOSTIC,
103 translation_key=
"wifi_strength",
104 device_class=SensorDeviceClass.SIGNAL_STRENGTH,
105 native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS,
106 entity_registry_enabled_default=
False,
107 entity_category=EntityCategory.DIAGNOSTIC,
111 translation_key=
"timestamp",
112 native_unit_of_measurement=UnitOfTime.SECONDS,
113 entity_registry_enabled_default=
False,
114 entity_category=EntityCategory.DIAGNOSTIC,
118 translation_key=
"ssid",
119 entity_registry_enabled_default=
False,
120 entity_category=EntityCategory.DIAGNOSTIC,
124 translation_key=
"ip_addr",
125 entity_registry_enabled_default=
False,
126 entity_category=EntityCategory.DIAGNOSTIC,
133 entry: GoalZeroConfigEntry,
134 async_add_entities: AddEntitiesCallback,
136 """Set up the Goal Zero Yeti sensor."""
138 GoalZeroSensor(entry.runtime_data, description)
for description
in SENSOR_TYPES
143 """Representation of a Goal Zero Yeti sensor."""
147 """Return the state."""
StateType native_value(self)
None async_setup_entry(HomeAssistant hass, GoalZeroConfigEntry entry, AddEntitiesCallback async_add_entities)