コード例 #1
0
ファイル: routes.py プロジェクト: imfht/flaskapps
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)
コード例 #2
0
ファイル: routes.py プロジェクト: simonsan/GardenPi
def zone_control():
    log.debug('zone_control() called')
    current_zones = system_info.garden_zones
    zone_running_data = {}
    for zone in current_zones:
        zone_running_data[zone] = neptune.is_this_zone_running(zone)

    return render_template('zone_control.html', **zone_running_data)
コード例 #3
0
ファイル: routes.py プロジェクト: simonsan/GardenPi
def power_zone_control():
    log.debug('power_zone_control() called')
    current_power_zones = system_info.allpowerzones
    power_zone_running_data = {}
    for zone in current_power_zones:
        power_zone_running_data[zone] = neptune.is_this_zone_running(zone)

    return render_template('power_zone_control.html',
                           **power_zone_running_data)
コード例 #4
0
ファイル: routes.py プロジェクト: simonsan/GardenPi
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)
コード例 #5
0
ファイル: routes.py プロジェクト: imfht/flaskapps
def rodi():
    log.debug('rodi() called')
    rodiwater_tank_enabled = neptune.is_tank_enabled('rodiwater_tank')
    if rodiwater_tank_enabled:
        rodiwater_tank_level = neptune.get_tank_gallons('rodiwater_tank')
    else:
        rodiwater_tank_level = 0
    rodiwater_temp = onewire_temp_probes('get_current_temp', 'rodi_water', 0)
    is_zone_running_manually = neptune.is_this_zone_running_manually('zone28')
    is_zone_running = neptune.is_this_zone_running('zone28')
    is_zone_enabled = neptune.zone_enabled('zone28')
    return render_template('rodi.html', rodiwater_tank_level = rodiwater_tank_level,
                           rodiwater_temp = rodiwater_temp, rodiwater_tank_enabled = rodiwater_tank_enabled,
                           is_zone_running_manually = is_zone_running_manually,
                           is_zone_running = is_zone_running,
                           is_zone_enabled = is_zone_enabled)
コード例 #6
0
ファイル: routes.py プロジェクト: simonsan/GardenPi
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)