#!/usr/bin/env python3
import logging
-from typing import Optional
import urllib.request
+from typing import Optional
logger = logging.getLogger()
'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(
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: