summaryrefslogtreecommitdiff
path: root/site_config.py
diff options
context:
space:
mode:
Diffstat (limited to 'site_config.py')
-rw-r--r--site_config.py40
1 files changed, 23 insertions, 17 deletions
diff --git a/site_config.py b/site_config.py
index 1281661..62c2b98 100644
--- a/site_config.py
+++ b/site_config.py
@@ -13,7 +13,7 @@ logger = logging.getLogger(__name__)
args = config.add_commandline_args(
f'Global Site Config ({__file__})',
- 'Args related to global site-specific configuration'
+ 'Args related to global site-specific configuration',
)
args.add_argument(
'--site_config_override_location',
@@ -64,6 +64,7 @@ def get_location():
def is_anyone_present_wrapper(location: Location):
import base_presence
+
p = base_presence.PresenceDetection()
return p.is_anyone_in_location_now(location)
@@ -90,25 +91,29 @@ def get_config():
location = 'CABIN'
if location == 'HOUSE':
return SiteConfig(
- location_name = 'HOUSE',
- location = Location.HOUSE,
- network = '10.0.0.0/24',
- 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),
- arper_minimum_device_count = 50,
+ location_name='HOUSE',
+ location=Location.HOUSE,
+ network='10.0.0.0/24',
+ 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
+ ),
+ arper_minimum_device_count=50,
)
elif location == 'CABIN':
return SiteConfig(
- location_name = 'CABIN',
- location = Location.CABIN,
- network = '192.168.0.0/24',
- 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),
- arper_minimum_device_count = 15,
+ location_name='CABIN',
+ location=Location.CABIN,
+ network='192.168.0.0/24',
+ 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
+ ),
+ arper_minimum_device_count=15,
)
else:
raise Exception(f'Unknown site location: {location}')
@@ -116,4 +121,5 @@ def get_config():
if __name__ == '__main__':
import doctest
+
doctest.testmod()