From 231ff770e0d7a2aa211a3ab7f5f55352e02514db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraj=20Nyi=CC=81ri?= Date: Fri, 6 Oct 2023 20:33:06 +0200 Subject: [PATCH] Add: record_plan to attributes of camera --- custom_components/tapo_control/camera.py | 27 +++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/custom_components/tapo_control/camera.py b/custom_components/tapo_control/camera.py index 0745334..314bb26 100644 --- a/custom_components/tapo_control/camera.py +++ b/custom_components/tapo_control/camera.py @@ -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(