Skip to content

Commit e96c8eb

Browse files
committed
Logger changes
1 parent d39822b commit e96c8eb

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

custom_components/dirigera_platform/hub_event_listener.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
from homeassistant.const import ATTR_ENTITY_ID
1515

16-
logger = logging.getLogger("custom_components.dirigera_platform")
16+
logger = logging.getLogger("custom_components.dirigera_platform.hub_event_listener")
1717

1818
DATE_TIME_FORMAT:str = "%Y-%m-%dT%H:%M:%S.%fZ"
1919

@@ -252,8 +252,10 @@ def on_message(self, ws:Any, ws_msg:str):
252252

253253
to_process_attr = process_events_from[device_type]
254254
turn_on_off = False
255-
if "attributes" in info:
255+
256+
if "attributes" in info and info["attributes"] is not None:
256257
attributes = info["attributes"]
258+
257259
for key in attributes:
258260
if key not in to_process_attr:
259261
logger.debug(f"attribute {key} with value {attributes[key]} not in list of device type {device_type}, ignoring update...")
@@ -281,7 +283,7 @@ def on_message(self, ws:Any, ws_msg:str):
281283
except Exception as ex:
282284
logger.warn(f"Failed to set attribute key: {key} converted to {key_attr} on device: {id}")
283285
logger.warn(ex)
284-
286+
285287
# Lights behave odd with hubs when setting attribute one event is generated which
286288
# causes brightness or other to toggle so put in a hack to fix that
287289
# if its is_on attribute then ignore this routine
@@ -299,9 +301,10 @@ def on_message(self, ws:Any, ws_msg:str):
299301

300302

301303
except Exception as ex:
302-
logger.error("error processing hub event")
303-
logger.error(f"{ws_msg}")
304-
logger.error(ex)
304+
# Temp solution to not log entries
305+
logger.debug("error processing hub event")
306+
logger.debug(f"{ws_msg}")
307+
logger.debug(ex)
305308

306309
def create_listener(self):
307310
try:

0 commit comments

Comments
 (0)