Skip to content

Commit

Permalink
feat: Add replace by date for gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerSelwyn committed Sep 21, 2023
1 parent 38af3d4 commit a53e657
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions custom_components/homelink/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ class HomeLINKEntityDescription(


SENSOR_TYPES: tuple[HomeLINKEntityDescription, ...] = (
HomeLINKEntityDescription(
key="lasttesteddate",
name="Last Tested Date",
device_class=SensorDeviceClass.TIMESTAMP,
value_fn=lambda data: _parse_timestamp(data.status.lasttesteddate),
),
HomeLINKEntityDescription(
key="replacedate",
name="Replace By Date",
device_class=SensorDeviceClass.DATE,
value_fn=lambda data: _parse_date(data.replacedate),
),
HomeLINKEntityDescription(
key="lasttesteddate",
name="Last Tested Date",
device_class=SensorDeviceClass.TIMESTAMP,
value_fn=lambda data: _parse_timestamp(data.status.lasttesteddate),
),
)


Expand All @@ -76,6 +76,10 @@ async def async_setup_entry(
HomeLINKSensor(hl_coordinator, hl_property, device, description)
for description in SENSOR_TYPES
)
else:
hl_entities.append(
HomeLINKSensor(hl_coordinator, hl_property, device, SENSOR_TYPES[0])
)

async_add_entities(hl_entities)

Expand Down

0 comments on commit a53e657

Please sign in to comment.