curaco desk: Be less noisy

This commit is contained in:
Geoffrey Frogeye 2024-12-25 19:02:00 +01:00
parent 0ddcdc4aeb
commit 6f8f877fb5
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
2 changed files with 12 additions and 7 deletions

View file

@ -1,7 +1,5 @@
{
pkgs,
lib,
config,
...
}:
let
@ -53,7 +51,7 @@ in
SystemCallFilter = [
"@system-service"
"~@privileged"
"~@resouces"
"~@resources"
];
UMask = "0077";
};

View file

@ -33,7 +33,7 @@ class Desk:
# https://www.linak.nl/technische-ondersteuning/#/cbd4-cbd6s-configurator
# Connects, and settings can be changed.
# Don't think there's much that would help with our problem.
# Decompiled with Ghidra (hard), didn't go super far
# Tried to decompile with Ghidra (hard), didn't go super far
VEND = 0x12D3
PROD = 0x0002
@ -265,7 +265,7 @@ class Desk:
if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG)
logging.basicConfig()
log = logging.getLogger(__name__)
desk = Desk()
@ -344,10 +344,17 @@ if __name__ == "__main__":
)
height_min = ha_mqtt_discoverable.sensors.Sensor(height_min_settings)
last_published_state = None
def fetch_callback(desk: Desk) -> None:
log.debug("Received state, sending")
hcur = desk.get_height()
hmin, hmax = desk.get_height_bounds()
global last_published_state
state = hcur, hmin, hmax
if state == last_published_state:
return
last_published_state = state
# If none this will set as unknown
# Also readings can be a bit outside the boundaries,