change code to allow floats when sensor data is uneven
This commit is contained in:
@@ -64,14 +64,14 @@ class Transform:
|
||||
on_state = len(sensor_data[date]["on"])
|
||||
off_state = len(sensor_data[date]["off"])
|
||||
activations = (on_state + off_state) / 2
|
||||
|
||||
if on_state != off_state:
|
||||
# print("Error: On and off states are not equal", name, date)
|
||||
tmp[name]["x"].append(date)
|
||||
tmp[name]["y"].append(activations if activations > 1 else 0)
|
||||
tmp[name]["y"].append(activations)
|
||||
else:
|
||||
|
||||
# add the date to the tmp dictionary as x and the number of activations, divided by two as y
|
||||
activations = (on_state + off_state) / 2
|
||||
tmp[name]["x"].append(date)
|
||||
tmp[name]["y"].append(activations if activations > 1 else 0)
|
||||
# print(tmp)
|
||||
|
||||
Reference in New Issue
Block a user