summaryrefslogtreecommitdiff
path: root/site_config.py
diff options
context:
space:
mode:
Diffstat (limited to 'site_config.py')
-rw-r--r--site_config.py29
1 files changed, 24 insertions, 5 deletions
diff --git a/site_config.py b/site_config.py
index 5604de6..eb7d884 100644
--- a/site_config.py
+++ b/site_config.py
@@ -34,17 +34,36 @@ class SiteConfig(object):
"""The set of information specific to where the program is running."""
location_name: str
+ """Either "HOUSE" or "CABIN" depending on where we're running"""
+
location: Location
+ """Same as above but as an enum value instead of a string"""
+
network: str
+ """The local network specification, e.g. 192.168.0.0/24."""
+
network_netmask: str
+ """The netmask of the local network, e.g. 255.255.255.0."""
+
network_router_ip: str
+ """The IP address of the local router, e.g. 192.168.0.1."""
+
presence_location: Location
+ """Same as location, above."""
+
is_anyone_present: Callable
+ """Returns a callable which, when invoked, will tell you if it detects
+ any person in your location by auditing network device MAC addresses."""
+
arper_minimum_device_count: int
+ """How many MAC addresses do we need to see for it to be considered a
+ successful scan?"""
+
arper_cache_file: str
+ """The location of the persisted IP-MAC address mappings."""
-def get_location_name():
+def get_location_name() -> str:
"""
Where are we?
@@ -56,7 +75,7 @@ def get_location_name():
return get_config().location_name
-def get_location():
+def get_location() -> Location:
"""
Returns location as an enum instead of a string.
@@ -69,7 +88,7 @@ def get_location():
return get_config().location
-def is_anyone_present_wrapper(location: Location):
+def _is_anyone_present_wrapper(location: Location):
import base_presence
p = base_presence.PresenceDetection()
@@ -164,7 +183,7 @@ def get_config(location_override: Optional[str] = None):
network_netmask='255.255.255.0',
network_router_ip='10.0.0.1',
presence_location=Location.HOUSE,
- is_anyone_present=lambda x=Location.HOUSE: is_anyone_present_wrapper(x),
+ is_anyone_present=lambda x=Location.HOUSE: _is_anyone_present_wrapper(x),
arper_minimum_device_count=50,
arper_cache_file='/home/scott/cache/.arp_table_cache_house',
)
@@ -176,7 +195,7 @@ def get_config(location_override: Optional[str] = None):
network_netmask='255.255.255.0',
network_router_ip='192.168.0.1',
presence_location=Location.CABIN,
- is_anyone_present=lambda x=Location.CABIN: is_anyone_present_wrapper(x),
+ is_anyone_present=lambda x=Location.CABIN: _is_anyone_present_wrapper(x),
arper_minimum_device_count=15,
arper_cache_file='/home/scott/cache/.arp_table_cache_cabin',
)