1 """The FiveM sensor platform."""
3 from dataclasses
import dataclass
22 from .entity
import FiveMEntity, FiveMEntityDescription
25 @dataclass(frozen=True)
27 """Describes FiveM sensor entity."""
30 SENSORS: tuple[FiveMSensorEntityDescription, ...] = (
33 translation_key=
"max_players",
34 native_unit_of_measurement=UNIT_PLAYERS_MAX,
37 key=NAME_PLAYERS_ONLINE,
38 translation_key=
"online_players",
39 native_unit_of_measurement=UNIT_PLAYERS_ONLINE,
40 extra_attrs=[ATTR_PLAYERS_LIST],
44 translation_key=
"resources",
45 native_unit_of_measurement=UNIT_RESOURCES,
46 extra_attrs=[ATTR_RESOURCES_LIST],
54 async_add_entities: AddEntitiesCallback,
56 """Set up the FiveM sensor platform."""
57 coordinator = hass.data[DOMAIN][entry.entry_id]
66 """Representation of a FiveM sensor base entity."""
68 entity_description: FiveMSensorEntityDescription
72 """Return the state of the sensor."""
StateType native_value(self)
None async_setup_entry(HomeAssistant hass, ConfigEntry entry, AddEntitiesCallback async_add_entities)