def gardenpi(): # Get Power Readings log.debug('gardenpi() called') if system_info.power_monitoring: current_power_keys = [ 'total_current_power_utilization', 'total_current_power_import', 'total_current_solar_production' ] power_data = {} for key in current_power_keys: power_data[key] = read_mysql_database("power_solar", key) else: power_data = { 'total_current_power_utilization': 0, 'total_current_power_import': 0, 'total_current_solar_production': 0 } any_zones_running = neptune.any_zones_running('water') any_power_zones_running = neptune.any_zones_running('power') current_water_source = (neptune.get_water_source()['source_to_use']) return render_template('gardenpi_index.html', any_zones_running=any_zones_running, current_water_source=current_water_source, any_power_zones_running=any_power_zones_running, **power_data)
def zone(id): zone = f'zone{id}' log.debug(f'zone() called with zone: {zone}') any_zones_running = neptune.any_zones_running('water') is_zone_enabled = neptune.zone_enabled(zone) is_zone_running = neptune.is_this_zone_running(zone) is_zone_running_manually = neptune.is_this_zone_running_manually(zone) job1_enabled = (neptune.get_schedule_by_zone_job(zone, '1')[0][3]) job2_enabled = (neptune.get_schedule_by_zone_job(zone, '2')[0][3]) job1_running = (neptune.get_schedule_by_zone_job(zone, '1')[0][7]) job2_running = (neptune.get_schedule_by_zone_job(zone, '2')[0][7]) total_zone_water_usage = water_usage(zone, 'read_total_gallons_used', 0) running_current_total_gallons = water_usage(zone, 'read_gallons_current_run', 0) current_gpm = neptune.get_current_gpm() current_water_source = (neptune.get_water_source()['source_to_use']) any_notification_source_available = neptune.notifications( 'systemwide', 'enabled', 'check') notifications_enabled = neptune.notifications(zone, 'notifications', 'enabled') systemwide_notifications_enabled = neptune.notifications( 'systemwide', 'enabled', 'enabled') sms_enabled = neptune.notifications(zone, 'sms', 'enabled') pb_enabled = neptune.notifications(zone, 'pb', 'enabled') email_enabled = neptune.notifications(zone, 'email', 'enabled') if job1_running: job_id = (neptune.get_schedule_by_zone_job(zone, '1')[0][0]) elif job2_running: job_id = (neptune.get_schedule_by_zone_job(zone, '2')[0][0]) else: job_id = '' return render_template( 'zone.html', zone_enabled=is_zone_enabled, is_zone_running=is_zone_running, is_zone_running_manually=is_zone_running_manually, any_zones_running=any_zones_running, job1_enabled=job1_enabled, job2_enabled=job2_enabled, job1_running=job1_running, job2_running=job2_running, total_zone_water_usage=total_zone_water_usage, running_current_total_gallons=running_current_total_gallons, current_gpm=current_gpm, current_water_source=current_water_source, notifications_enabled=notifications_enabled, any_notification_source_available=any_notification_source_available, systemwide_notifications_enabled=systemwide_notifications_enabled, sms_enabled=sms_enabled, email_enabled=email_enabled, pb_enabled=pb_enabled, job_id=job_id, id=id)
def water_source(): log.debug('water_source() called') water_source = neptune.get_water_source() is_fresh_zone_running = neptune.is_this_zone_running('fresh_water') is_fish_zone_running = neptune.is_this_zone_running('fish_water') any_zones_running = neptune.any_zones_running('water') return render_template('water_source.html', any_zones_running = any_zones_running, is_fresh_zone_running = is_fresh_zone_running, is_fish_zone_running = is_fish_zone_running, **water_source)
def power(id): zone = f'power{id}' log.debug(f'power() called with powerzone: {zone}') any_zones_running = neptune.any_zones_running('power') is_zone_enabled = neptune.zone_enabled(zone) is_zone_running = neptune.is_this_zone_running(zone) is_zone_running_manually = neptune.is_this_zone_running_manually(zone) job1_enabled = (neptune.get_schedule_by_zone_job(zone, '1')[0][3]) job2_enabled = (neptune.get_schedule_by_zone_job(zone, '2')[0][3]) job1_running = (neptune.get_schedule_by_zone_job(zone, '1')[0][7]) job2_running = (neptune.get_schedule_by_zone_job(zone, '2')[0][7]) any_notification_source_available = neptune.notifications( 'systemwide', 'enabled', 'check') notifications_enabled = neptune.notifications(zone, 'notifications', 'enabled') systemwide_notifications_enabled = neptune.notifications( 'systemwide', 'enabled', 'enabled') sms_enabled = neptune.notifications(zone, 'sms', 'enabled') pb_enabled = neptune.notifications(zone, 'pb', 'enabled') email_enabled = neptune.notifications(zone, 'email', 'enabled') if job1_running: job_id = (neptune.get_schedule_by_zone_job(zone, '1')[0][0]) elif job2_running: job_id = (neptune.get_schedule_by_zone_job(zone, '2')[0][0]) else: job_id = '' return render_template( 'power.html', zone_enabled=is_zone_enabled, is_zone_running=is_zone_running, is_zone_running_manually=is_zone_running_manually, any_zones_running=any_zones_running, job1_enabled=job1_enabled, job2_enabled=job2_enabled, job1_running=job1_running, job2_running=job2_running, job_id=job_id, id=id, notifications_enabled=notifications_enabled, any_notification_source_available=any_notification_source_available, systemwide_notifications_enabled=systemwide_notifications_enabled, sms_enabled=sms_enabled, email_enabled=email_enabled, pb_enabled=pb_enabled)