From dafa6dcd4bb69dc13a76fa5f82c2df25c9e66eb6 Mon Sep 17 00:00:00 2001 From: trizmark Date: Wed, 1 May 2024 17:07:23 +0100 Subject: [PATCH] Added extra logging to grid charge control --- custom_components/myenergi/select.py | 4 ---- custom_components/myenergi/switch.py | 6 ++++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/custom_components/myenergi/select.py b/custom_components/myenergi/select.py index e937514..f0220d3 100644 --- a/custom_components/myenergi/select.py +++ b/custom_components/myenergi/select.py @@ -1,6 +1,4 @@ """Sensor platform for myenergi.""" -import logging - import voluptuous as vol from homeassistant.components.select import SelectEntity from homeassistant.helpers import entity_platform @@ -11,8 +9,6 @@ from .const import DOMAIN from .entity import MyenergiEntity -_LOGGER: logging.Logger = logging.getLogger(__package__) - LIBBI_MODE_NAMES = {"STOP": "Stopped", "BALANCE": "Normal", "DRAIN": "Export"} ATTR_BOOST_AMOUNT = "amount" diff --git a/custom_components/myenergi/switch.py b/custom_components/myenergi/switch.py index 7b82f77..9bd56b0 100644 --- a/custom_components/myenergi/switch.py +++ b/custom_components/myenergi/switch.py @@ -1,4 +1,5 @@ """Switch platform for myenergi.""" +import logging import operator from homeassistant.components.switch import SwitchEntity @@ -7,6 +8,8 @@ from .const import DOMAIN from .entity import MyenergiEntity +_LOGGER: logging.Logger = logging.getLogger(__package__) + async def async_setup_entry(hass, entry, async_add_devices): """Setup switch platform.""" @@ -63,10 +66,13 @@ def icon(self): async def async_turn_on(self, **kwargs): """Turn the entity on.""" + _LOGGER.debug("libbi charging from grid is now ON") + _LOGGER.debug(type(self)) await operator.methodcaller(self.meta["update_func"], True)(self.device) self.async_schedule_update_ha_state() async def async_turn_off(self, **kwargs): """Turn the entity off.""" + _LOGGER.debug("libbi charging from grid is now OFF") await operator.methodcaller(self.meta["update_func"], False)(self.device) self.async_schedule_update_ha_state()