co2 = BrickletCO2(CO2_UID, ipcon) # Create device object humidity = HumidityV2(HUMIDITY_UID, ipcon) sound_intensity = SoundIntensity(SOUND_INTENSITY_UID, ipcon) dust_density = DustDetector(DUST_UID, ipcon) temperature = Temperature(TEMPERATURE_UID, ipcon) ambientlight = AmbientLight(AMBIENTLIGHT_UID, ipcon) uvlight = BrickletUVLight(UVLIGHT_UID, ipcon) motiondetect = BrickletMotionDetector(MOTIONDETECTOR_UID, ipcon) ipcon.connect(HOST, PORT) # Connect to brickd while (True): curtime = datetime.now() print("Time: " + curtime.strftime('%Y/%m/%d %H:%M:%S')) motion = motiondetect.get_motion_detected() print("Motion: " + str(motion)) illuminance = ambientlight.get_illuminance() / 10.0 print("Illuminance: " + str(illuminance)) uv_light = uvlight.get_uv_light() print("UV Light: " + str(uv_light)) # Get current CO2 concentration (unit is ppm) cur_co2_concentration = co2.get_co2_concentration() print("CO2: " + str(cur_co2_concentration)) # Get current sound intensity level cur_si = sound_intensity.get_intensity() print("Sound intensity: " + str(cur_si))
def print_motion_detector(conn, settings, uid): from tinkerforge.bricklet_motion_detector import BrickletMotionDetector # type: ignore[import] br = BrickletMotionDetector(uid, conn) print_generic(settings, "motion", br.get_identity(), 1.0, "", br.get_motion_detected())
def print_motion_detector(conn, settings, uid): from tinkerforge.bricklet_motion_detector import BrickletMotionDetector # type: ignore[import] # pylint: disable=import-error,import-outside-toplevel br = BrickletMotionDetector(uid, conn) print_generic(settings, "motion", br.get_identity(), 1.0, "", br.get_motion_detected())