예제 #1
0
파일: hydro.py 프로젝트: mmaton/hydro
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)
예제 #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)
예제 #3
0
def _make_safe(simulated):
    ext_op = input_output.get_output_interface(simulated)
    ext_op.set_light_on(False)
    ext_op.set_water_heater_on(False)
    ext_op.set_air_heater_on(False)
    ext_op.set_grow_media_heater_on(False)
예제 #4
0
파일: hydro.py 프로젝트: mmaton/hydro
def _make_safe(simulated):
    ext_op = input_output.get_output_interface(simulated)
    ext_op.set_light_on(False)
    ext_op.set_water_heater_on(False)
    ext_op.set_air_heater_on(False)
    ext_op.set_grow_media_heater_on(False)