Skip to content

Commit

Permalink
Add additional sensors (#381)
Browse files Browse the repository at this point in the history
* Add Last Audio Self Test and Last Manual Self Test

Adding two more datetime sensors for test times.

* Add Removed from Base sensor

I have chosen tray-remove as icon, as it looks similar to the protect being removed.
  • Loading branch information
GSzabados authored Dec 8, 2024
1 parent 556ab3e commit 4916c44
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions custom_components/nest_protect/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ class NestProtectBinarySensorDescription(
icon="mdi:water-percent",
value_fn=lambda state: not state,
),
NestProtectBinarySensorDescription(
key="removed_from_base",
name="Removed from Base",
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
icon="mdi:tray-remove",
value_fn=lambda state: state,
),
NestProtectBinarySensorDescription(
key="auto_away",
name="Occupancy",
Expand Down
14 changes: 14 additions & 0 deletions custom_components/nest_protect/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,20 @@ class NestProtectSensorDescription(SensorEntityDescription):
device_class=SensorDeviceClass.DATE,
entity_category=EntityCategory.DIAGNOSTIC,
),
NestProtectSensorDescription(
name="Last Audio Self Test",
key="last_audio_self_test_end_utc_secs",
value_fn=lambda state: datetime.datetime.utcfromtimestamp(state),
device_class=SensorDeviceClass.DATE,
entity_category=EntityCategory.DIAGNOSTIC,
),
NestProtectSensorDescription(
name="Last Manual Test",
key="latest_manual_test_end_utc_secs",
value_fn=lambda state: datetime.datetime.utcfromtimestamp(state),
device_class=SensorDeviceClass.DATE,
entity_category=EntityCategory.DIAGNOSTIC,
),
NestProtectSensorDescription(
name="Temperature",
key="current_temperature",
Expand Down

0 comments on commit 4916c44

Please sign in to comment.