projects
/
python_utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Change settings in flake8 and black.
[python_utils.git]
/
smart_home
/
thermometers.py
diff --git
a/smart_home/thermometers.py
b/smart_home/thermometers.py
index fe5eed18d28ef2851f9bbc6589ff528bfd2060f5..dff84f6250dfb410f11ed6dd81ef42d87fd54148 100644
(file)
--- a/
smart_home/thermometers.py
+++ b/
smart_home/thermometers.py
@@
-1,8
+1,8
@@
#!/usr/bin/env python3
import logging
#!/usr/bin/env python3
import logging
-from typing import Optional
import urllib.request
import urllib.request
+from typing import Optional
logger = logging.getLogger()
logger = logging.getLogger()
@@
-21,9
+21,7
@@
class ThermometerRegistry(object):
'cabin_hottub': ('192.168.0.107', 'hottub_temp'),
}
'cabin_hottub': ('192.168.0.107', 'hottub_temp'),
}
- def read_temperature(
- self, location: str, *, convert_to_fahrenheit=False
- ) -> Optional[float]:
+ def read_temperature(self, location: str, *, convert_to_fahrenheit=False) -> Optional[float]:
record = self.thermometers.get(location, None)
if record is None:
logger.error(
record = self.thermometers.get(location, None)
if record is None:
logger.error(
@@
-37,7
+35,7
@@
class ThermometerRegistry(object):
temp = www.read().decode('utf-8')
temp = float(temp)
if convert_to_fahrenheit:
temp = www.read().decode('utf-8')
temp = float(temp)
if convert_to_fahrenheit:
- temp *=
(9/5)
+ temp *=
9 / 5
temp += 32.0
temp = round(temp)
except Exception as e:
temp += 32.0
temp = round(temp)
except Exception as e: