summaryrefslogtreecommitdiff
path: root/smart_home/registry.py
diff options
context:
space:
mode:
authorScott <[email protected]>2022-01-11 13:33:24 -0800
committerScott <[email protected]>2022-01-11 13:33:24 -0800
commitb454ad295eb3024a238d32bf2aef1ebc3c496b44 (patch)
tree89368a7cdad571da9e2c7297190fdce48eb3feb9 /smart_home/registry.py
parentd2478310649d51e14f8ece57651ca9d925d98793 (diff)
Start using warnings from stdlib.
Diffstat (limited to 'smart_home/registry.py')
-rw-r--r--smart_home/registry.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/smart_home/registry.py b/smart_home/registry.py
index 23584e1..20fb3f4 100644
--- a/smart_home/registry.py
+++ b/smart_home/registry.py
@@ -3,6 +3,7 @@
import logging
import re
from typing import List, Optional, Set
+import warnings
import argparse_utils
import config
@@ -63,7 +64,9 @@ class SmartHomeRegistry(object):
try:
(mac, name, keywords) = line.split(",")
except ValueError:
- logger.warning(f'SH-CONFIG> {line} is malformed?!')
+ msg = f'SH-CONFIG> {line} is malformed?!'
+ logger.warning(msg)
+ warnings.warn(msg)
continue
mac = mac.strip()
name = name.strip()
@@ -183,11 +186,11 @@ class SmartHomeRegistry(object):
logger.debug(' ...an unknown device (should this be here?)')
return device.Device(name, mac, kws)
except Exception as e:
- logger.warning(
- f'Got exception {e} while trying to communicate with device {name}/{mac}.'
- )
+ logger.exception(e)
return device.Device(name, mac, kws)
- logger.warning(f'{mac} is not a known smart home device, returning None')
+ msg = f'{mac} is not a known smart home device, returning None'
+ logger.warning(msg)
+ warnings.warn(msg)
return None
def query(self, query: str) -> List[device.Device]: