From edc118a7e98894d50928a7c26caa8ef90f316c30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraj=20Nyi=CC=81ri?= Date: Sat, 20 Jul 2024 12:56:51 +0200 Subject: [PATCH] Add #457: Battery optimization for solar cameras --- custom_components/tapo_control/__init__.py | 50 ++++++++++++++++---- custom_components/tapo_control/manifest.json | 2 +- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/custom_components/tapo_control/__init__.py b/custom_components/tapo_control/__init__.py index b7e4bf2..1567d17 100644 --- a/custom_components/tapo_control/__init__.py +++ b/custom_components/tapo_control/__init__.py @@ -480,14 +480,48 @@ async def async_update_data(): if ( "basic_info" in updateDataForAllControllers[controller] - and "power" - in updateDataForAllControllers[controller][ - "basic_info" - ] - and updateDataForAllControllers[controller][ - "basic_info" - ]["power"] - == "BATTERY" + and ( + ( + "power" + in updateDataForAllControllers[controller][ + "basic_info" + ] + and ( + ( + updateDataForAllControllers[ + controller + ]["basic_info"]["power"] + == "BATTERY" + ) + or ( + updateDataForAllControllers[ + controller + ]["basic_info"]["power"] + == "SOLAR" + ) + ) + ) + or ( + "power_mode" + in updateDataForAllControllers[controller][ + "basic_info" + ] + and ( + ( + updateDataForAllControllers[ + controller + ]["basic_info"]["power_mode"] + == "BATTERY" + ) + or ( + updateDataForAllControllers[ + controller + ]["basic_info"]["power_mode"] + == "SOLAR" + ) + ) + ) + ) ) else False ) diff --git a/custom_components/tapo_control/manifest.json b/custom_components/tapo_control/manifest.json index be292ac..0a7690f 100644 --- a/custom_components/tapo_control/manifest.json +++ b/custom_components/tapo_control/manifest.json @@ -6,7 +6,7 @@ "codeowners": [ "@JurajNyiri" ], - "version": "5.4.27", + "version": "5.4.28", "requirements": [ "pytapo==3.3.23" ],