increasing freedom degree precision
This commit is contained in:
1 parent
d22a26d2dc
commit
3a35f93791
1 file changed
+4
-12
+4
-12
@@ -78,14 +78,6 @@ async def _discover_device(mac: str) -> Optional[str]:
|
|||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
log.warning("Discover call timed out after %.1fs for %s", SCAN_TIMEOUT + 2.0, mac)
|
log.warning("Discover call timed out after %.1fs for %s", SCAN_TIMEOUT + 2.0, mac)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
#for d in devices:
|
|
||||||
# if d.address.lower() == mac.lower():
|
|
||||||
# log.info("Found device %s (%s)", d.name or d.address, d.address)
|
|
||||||
# return d.address
|
|
||||||
#log.warning("Device %s not found in scan", mac)
|
|
||||||
#return None
|
|
||||||
|
|
||||||
|
|
||||||
def _parse_sensor_data(raw: bytes) -> (float, int):
|
def _parse_sensor_data(raw: bytes) -> (float, int):
|
||||||
"""Parse the 3-byte Mi packet into temperature & humidity."""
|
"""Parse the 3-byte Mi packet into temperature & humidity."""
|
||||||
@@ -268,14 +260,14 @@ def test(test_count = 0) -> None:
|
|||||||
if len(mac_list) == len(passed_list):
|
if len(mac_list) == len(passed_list):
|
||||||
print(f" Test run {test_count} completed, yee-haw")
|
print(f" Test run {test_count} completed, yee-haw")
|
||||||
for sensor in sensors:
|
for sensor in sensors:
|
||||||
temp_f = (sensor['temp'] * 1.8) + 32
|
temp_f = (sensor['temp'] * 1.80) + 32.0
|
||||||
print(f" {sensor['name']} - Temp: {round(temp_f,0)} | Humidity: {sensor['humidity']}")
|
print(f" {sensor['name']} - Temp: {round(temp_f,1)} | Humidity: {sensor['humidity']}")
|
||||||
test_result = True
|
test_result = True
|
||||||
else:
|
else:
|
||||||
print(f" Test run incomplete/failed, re-running, loop {test_loop_count}. Updating test list")
|
print(f" Test run incomplete/failed, re-running, loop {test_loop_count}. Updating test list")
|
||||||
for sensor in sensors:
|
for sensor in sensors:
|
||||||
temp_f = (sensor['temp'] * 1.8) + 32
|
temp_f = (sensor['temp'] * 1.80) + 32.0
|
||||||
print(f" {sensor['name']} - Temp: {round(temp_f,0)} | Humidity: {sensor['humidity']}")
|
print(f" {sensor['name']} - Temp: {round(temp_f,1)} | Humidity: {sensor['humidity']}")
|
||||||
mac_list_new = []
|
mac_list_new = []
|
||||||
for mac in mac_list:
|
for mac in mac_list:
|
||||||
if mac not in passed_list:
|
if mac not in passed_list:
|
||||||
|
|||||||
Reference in new issue
Block a user