Exemple #1
0
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)
Exemple #2
0
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)
Exemple #3
0
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)