bettwaage-sidequest #2

Merged
m.giller merged 38 commits from bettwaage-sidequest into master 2024-06-07 23:38:56 +02:00
Showing only changes of commit ab5a192524 - Show all commits

View file

@ -16,7 +16,7 @@ matrix_clock_api: str = "http://192.168.178.84:8000"
empty_weight: Optional[float] = None
local_history = []
history_max_length: int = 24 * 60 * 60 # 24 hours
min_noticable_difference: float= 25 # In kg
min_noticable_difference: float = 25 # In kg
show_scale_countdown: int = 0 # Number of updates for the scale, until return to clock
average_person_weight: float = 75
@ -29,7 +29,6 @@ leg_capacity_limit_patterns = [
]
def get_clusters(data: list[float], min_delta: float) -> dict:
clusters = {}
for point in data:
@ -40,13 +39,13 @@ def get_clusters(data: list[float], min_delta: float) -> dict:
clusters[point] = [point]
return clusters
def show_time():
r.post(f"{matrix_clock_api}/time")
def show_scale(weight:float):
r.post(f"{matrix_clock_api}/message", json={
"message": f"{weight:3.1f}kg"
})
def show_scale(weight: float):
r.post(f"{matrix_clock_api}/message", json={"message": f"{weight:3.1f}kg"})
def is_capacity_reached() -> bool:
@ -67,7 +66,10 @@ def is_capacity_reached() -> bool:
return
is_warning_active = True
r.post(f"{matrix_clock_api}/pattern?pattern={highest_limit["pattern"]}&step_ms={highest_limit["duration"]}&contrast=255")
r.post(
f"{matrix_clock_api}/pattern?pattern={highest_limit['pattern']}&step_ms={highest_limit['duration']}&contrast=255"
)
def check_for_change():
# Check for capicity limits