Example #1
0
def _adjust(control_set, simulated):
    if control_set is not None:
        now = datetime.now()
        hours_now = now.hour + now.minute / 60.0
        ext_ip = input_output.get_input_interface(simulated)
        ext_op = input_output.get_output_interface(simulated)
        light_should_be_on = control_set.light_on_h <= hours_now <= control_set.light_off_h
        ext_op.set_light_on(light_should_be_on)
        water_heater_should_be_on = ext_ip.get_water_c() < control_set.water_C
        ext_op.set_water_heater_on(water_heater_should_be_on)
        air_heater_should_be_on = ext_ip.get_air_c() < control_set.air_C
        ext_op.set_air_heater_on(air_heater_should_be_on)
        grow_media_heater_should_be_on = ext_ip.get_grow_media_c() < control_set.grow_media_C
        ext_op.set_grow_media_heater_on(grow_media_heater_should_be_on)
Example #2
0
def _adjust(control_set, simulated):
    if control_set is not None:
        now = datetime.now()
        hours_now = now.hour + now.minute / 60.0
        ext_ip = input_output.get_input_interface(simulated)
        ext_op = input_output.get_output_interface(simulated)
        light_should_be_on = control_set.light_on_h <= hours_now <= control_set.light_off_h
        ext_op.set_light_on(light_should_be_on)
        water_heater_should_be_on = ext_ip.get_water_c() < control_set.water_C
        ext_op.set_water_heater_on(water_heater_should_be_on)
        air_heater_should_be_on = ext_ip.get_air_c() < control_set.air_C
        ext_op.set_air_heater_on(air_heater_should_be_on)
        grow_media_heater_should_be_on = ext_ip.get_grow_media_c(
        ) < control_set.grow_media_C
        ext_op.set_grow_media_heater_on(grow_media_heater_should_be_on)
Example #3
0
def take_measurements(crop_id):
    session = database.core.get_db_session()
    crop = database.crops.get_crop_by_id(session, crop_id)
    ext_ip = input_output.get_input_interface(crop.simulated)
    database.measurements.store_measurement(session, crop, ext_ip)