From 2265e17e24989e533e487096672de5029b0f66eb Mon Sep 17 00:00:00 2001 From: basbruss <68892092+basbruss@users.noreply.github.com> Date: Mon, 8 Apr 2024 11:43:54 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20logging=20to=20debug=20last?= =?UTF-8?q?=20state=20retrieval=20in=20async=5Fadded=5Fto=5Fhass=20method.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/adaptive_cover/switch.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/custom_components/adaptive_cover/switch.py b/custom_components/adaptive_cover/switch.py index b41087f..bf7a47f 100644 --- a/custom_components/adaptive_cover/switch.py +++ b/custom_components/adaptive_cover/switch.py @@ -1,7 +1,7 @@ """Switch platform for the Adaptive Cover integration.""" from __future__ import annotations - +import logging from typing import Any from homeassistant.components.switch import SwitchDeviceClass, SwitchEntity @@ -138,10 +138,10 @@ async def async_turn_off(self, **kwargs: Any) -> None: async def async_added_to_hass(self) -> None: """Call when entity about to be added to hass.""" last_state = await self.async_get_last_state() - # _LOGGER.debug("%s: last state is %s", self._name, last_state) + _LOGGER.debug("%s: last state is %s", self._name, last_state) if (last_state is None and self._initial_state) or ( last_state is not None and last_state.state == STATE_ON ): await self.async_turn_on() else: - await self.async_turn_off() \ No newline at end of file + await self.async_turn_off()