Add debug logging to Bond fireplace entity (#40318)

* Add logging to Bond fireplace entity for troubleshooting turn off problem

* Update homeassistant/components/bond/light.py

Co-authored-by: Chris Talkington <chris@talkingtontech.com>

* Update homeassistant/components/bond/light.py

Co-authored-by: Chris Talkington <chris@talkingtontech.com>

Co-authored-by: Chris Talkington <chris@talkingtontech.com>
This commit is contained in:
Eugene Prystupa 2020-09-21 22:38:43 -04:00 committed by GitHub
parent b3691d5d90
commit f34455b6c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,5 @@
"""Support for Bond lights."""
import logging
from typing import Any, Callable, List, Optional
from bond_api import Action, DeviceType
@ -17,6 +18,8 @@ from .const import DOMAIN
from .entity import BondEntity
from .utils import BondDevice
_LOGGER = logging.getLogger(__name__)
async def async_setup_entry(
hass: HomeAssistant,
@ -96,7 +99,7 @@ class BondFireplace(BondEntity, LightEntity):
"""Representation of a Bond-controlled fireplace."""
def __init__(self, hub: BondHub, device: BondDevice):
"""Create HA entity representing Bond fan."""
"""Create HA entity representing Bond fireplace."""
super().__init__(hub, device)
self._power: Optional[bool] = None
@ -119,6 +122,8 @@ class BondFireplace(BondEntity, LightEntity):
async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn the fireplace on."""
_LOGGER.debug("fireplace async_turn_on called with: %s", kwargs)
brightness = kwargs.get(ATTR_BRIGHTNESS)
if brightness:
flame = round((brightness * 100) / 255)
@ -128,6 +133,8 @@ class BondFireplace(BondEntity, LightEntity):
async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn the fireplace off."""
_LOGGER.debug("fireplace async_turn_off called with: %s", kwargs)
await self._hub.bond.action(self._device.device_id, Action.turn_off())
@property