Skip to content

Commit

Permalink
Add: record_plan to attributes of camera
Browse files Browse the repository at this point in the history
  • Loading branch information
JurajNyiri committed Oct 6, 2023
1 parent a71afc0 commit 231ff77
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion custom_components/tapo_control/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,36 @@ def updateTapo(self, camData):
self._attr_extra_state_attributes[attr] = value
self._attr_extra_state_attributes["alarm"] = camData["alarm"]
self._attr_extra_state_attributes["user"] = camData["user"]
self._attr_extra_state_attributes["presets"] = camData["presets"]
# Disable incorrect location report by camera
self._attr_extra_state_attributes["longitude"] = 0
self._attr_extra_state_attributes["latitude"] = 0
self._attr_extra_state_attributes["has_set_location_info"] = 0
# lists below
self._attr_extra_state_attributes["presets"] = camData["presets"]
if camData["recordPlan"]:
self._attr_extra_state_attributes["record_plan"] = {
"sunday": camData["recordPlan"]["sunday"]
if "sunday" in camData["recordPlan"]
else None,
"monday": camData["recordPlan"]["monday"]
if "monday" in camData["recordPlan"]
else None,
"tuesday": camData["recordPlan"]["tuesday"]
if "tuesday" in camData["recordPlan"]
else None,
"wednesday": camData["recordPlan"]["wednesday"]
if "wednesday" in camData["recordPlan"]
else None,
"thursday": camData["recordPlan"]["thursday"]
if "thursday" in camData["recordPlan"]
else None,
"friday": camData["recordPlan"]["friday"]
if "friday" in camData["recordPlan"]
else None,
"saturday": camData["recordPlan"]["saturday"]
if "saturday" in camData["recordPlan"]
else None,
}

async def async_enable_motion_detection(self):
await self.hass.async_add_executor_job(
Expand Down

0 comments on commit 231ff77

Please sign in to comment.