Skip to content

Commit

Permalink
fix: Add in missing get_property_insights
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerSelwyn committed Dec 11, 2023
1 parent e3e3bf8 commit 7231a1d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pyhomelink/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,19 @@ async def async_get_property_alerts(self, propertyreference) -> List[Alert]:
check_status(resp)
return [Alert(alert_data) for alert_data in (await resp.json())[ATTR_RESULTS]]

async def async_get_property_insights(self, propertyreference) -> List[Insight]:
"""Return the Property Insightss."""
resp = await self.auth.request(
"get",
HomeLINKEndpoint.PROPERTY_INSIGHTS.format(
propertyreference=propertyreference
),
)
check_status(resp)
return [
Insight(insight_data) for insight_data in (await resp.json())[ATTR_RESULTS]
]

async def async_get_property_readings(
self, propertyreference, readingdate
) -> List[DeviceReading]:
Expand Down
4 changes: 4 additions & 0 deletions tests/bash_homelink.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ async def _test():
print(f"Property Devices: {hl_property.address} - {devices[0].serialnumber}")
alerts = await homelink_api.async_get_property_alerts(properties[0].reference)
print(f"Property Alerts: {hl_property.address} - {alerts}")
insights = await homelink_api.async_get_property_insights(
properties[0].reference
)
print(f"Property Insights: {hl_property.address} - {insights}")

tags = ["PROPERTY_JUNK"]
tagso = await homelink_api.async_add_property_tags(hl_property.reference, tags)
Expand Down

0 comments on commit 7231a1d

Please sign in to comment.