summaryrefslogtreecommitdiff
path: root/src/home
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2022-09-21 12:05:47 +0300
committerEvgeny Zinoviev <me@ch1p.io>2022-09-21 12:05:47 +0300
commit243e7804f8ef3ef6c93a163fa46a1e1adca18260 (patch)
treec8f99a9b8c31c1212216cdf752c7625fe99f801d /src/home
parentaeb5080bfe694eb7943e8871b2ba1d99caff0044 (diff)
parenta69344d91a7cb2a0121b48daf94503bbe8b390a5 (diff)
Merge branch 'master' of ch1p.io:homekit
Diffstat (limited to 'src/home')
-rw-r--r--src/home/soundsensor/node.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/home/soundsensor/node.py b/src/home/soundsensor/node.py
index b4b8fbc..292452f 100644
--- a/src/home/soundsensor/node.py
+++ b/src/home/soundsensor/node.py
@@ -16,6 +16,7 @@ class SoundSensorNode:
name: str,
pinname: str,
server_addr: Optional[Addr],
+ threshold: int = 1,
delay=0.005):
if not hasattr(gpioport, pinname):
@@ -24,6 +25,7 @@ class SoundSensorNode:
self.pin = getattr(gpioport, pinname)
self.name = name
self.delay = delay
+ self.threshold = threshold
self.server_addr = server_addr
@@ -43,7 +45,7 @@ class SoundSensorNode:
hits = self.hits
self.hits = 0
- if hits > 0:
+ if hits >= self.threshold:
try:
if self.server_addr is not None:
send_datagram(stringify([self.name, hits]), self.server_addr)