mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Add sentry mode sensor to Teslemetry (#143855)
* Add sentry mode sensor * Fix state handler
This commit is contained in:
parent
d8d6decb38
commit
835cdad0a9
@ -372,6 +372,17 @@
|
||||
},
|
||||
"consumer_energy_imported_from_generator": {
|
||||
"default": "mdi:generator-stationary"
|
||||
},
|
||||
"sentry_mode": {
|
||||
"default": "mdi:shield-car",
|
||||
"state": {
|
||||
"off": "mdi:shield-off-outline",
|
||||
"idle": "mdi:shield-outline",
|
||||
"armed": "mdi:shield-check",
|
||||
"aware": "mdi:shield-alert",
|
||||
"panic": "mdi:shield-alert-outline",
|
||||
"quiet": "mdi:shield-half-full"
|
||||
}
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
|
@ -60,6 +60,15 @@ CHARGE_STATES = {
|
||||
|
||||
SHIFT_STATES = {"P": "p", "D": "d", "R": "r", "N": "n"}
|
||||
|
||||
SENTRY_MODE_STATES = {
|
||||
"Off": "off",
|
||||
"Idle": "idle",
|
||||
"Armed": "armed",
|
||||
"Aware": "aware",
|
||||
"Panic": "panic",
|
||||
"Quiet": "quiet",
|
||||
}
|
||||
|
||||
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class TeslemetryVehicleSensorEntityDescription(SensorEntityDescription):
|
||||
@ -350,6 +359,14 @@ VEHICLE_DESCRIPTIONS: tuple[TeslemetryVehicleSensorEntityDescription, ...] = (
|
||||
native_unit_of_measurement=UnitOfLength.MILES,
|
||||
device_class=SensorDeviceClass.DISTANCE,
|
||||
),
|
||||
TeslemetryVehicleSensorEntityDescription(
|
||||
key="sentry_mode",
|
||||
streaming_listener=lambda x, y: x.listen_SentryMode(
|
||||
lambda z: None if z is None else y(SENTRY_MODE_STATES.get(z))
|
||||
),
|
||||
options=list(SENTRY_MODE_STATES.values()),
|
||||
device_class=SensorDeviceClass.ENUM,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
|
@ -644,6 +644,17 @@
|
||||
},
|
||||
"total_grid_energy_exported": {
|
||||
"name": "Grid exported"
|
||||
},
|
||||
"sentry_mode": {
|
||||
"name": "Sentry mode",
|
||||
"state": {
|
||||
"off": "Off",
|
||||
"idle": "Idle",
|
||||
"armed": "Armed",
|
||||
"aware": "Aware",
|
||||
"panic": "Panic",
|
||||
"quiet": "Quiet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user