def water_depth(): '''Determine the depth of the water, log result and generate alert if needed. ''' critical_water_level = configs['critical_water_level'] water_depth = water_reading() log.log_reading(water_depth) if water_depth > critical_water_level and configs['alert_when'] == 'high': alerts.determine_if_alert(water_depth) elif water_depth < critical_water_level and configs['alert_when'] == 'low': alerts.determine_if_alert(water_depth) else: pass
def water_depth(): """Determine the depth of the water, log result and generate alert if needed. """ critical_water_level = configs["critical_water_level"] water_depth = water_reading() if water_depth < 0.0: water_depth = 0.0 log.log_reading(water_depth) if water_depth > critical_water_level and configs["alert_when"] == "high": alerts.determine_if_alert(water_depth) elif water_depth < critical_water_level and configs["alert_when"] == "low": alerts.determine_if_alert(water_depth) else: pass initiate_heartbeat()
def generate_log(water_depth): '''Log water level reading to a file.''' log.log_reading(water_depth)