from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient #Define some globals GPIO.setmode(GPIO.BCM) camera = RCamera() #Camera connected to camera pins credentials: Credentials = Credentials() device_client: IoTCClient = None #IoTHubDeviceClient.create_from_connection_string(credentials.get_credentail_info(CredentialInfo.connection_string)) start_time = datetime.now() tfclassifier = TFClassify() tfclassifier2 = TFClassify2() log: logging.Logger = app_logger.get_logger() log.info(f"TensorFlow took {datetime.now() - start_time} seconds to load") modelTier = "tier1" _app_settings = AppSettings() _app_settings.ensure_label_folders_exist(modelTier) modelTier2 = "tier2" _app_settings2 = AppSettings() _app_settings.ensure_label_folders_exist(modelTier2) # Set the trigger word for setting a sub tier model lookup _subTierTrigger = _app_settings.get_SubTierTrigger(modelTier) _subTierTrigger2 = _app_settings2.get_SubTierTrigger(modelTier2) _USE_TEST_MODE = False _USE_BLOB_STORGE = False #_app_settings = AppSettings() #These commands are sent by IoT Central to the device _IoT_Commands = {
import iot_events.iot_commands as iot_commands #Define some globals GPIO.setmode(GPIO.BCM) move_sensor = MotionSensor(17) #Motion Sensor control connected to GPIO pin 17 red_led = LED(18) #LED connected to GPIO pin 18 camera = RCamera() #Camera connected to camera pins credentials: Credentials = Credentials() device_client: IoTCClient = None #IoTHubDeviceClient.create_from_connection_string(credentials.get_credentail_info(CredentialInfo.connection_string)) start_time = datetime.now() tfclassifier = TFClassify() log:logging.Logger = app_logger.get_logger() #print(f"TensorFlow took {datetime.now() - start_time} seconds to load") log.info(f"TensorFlow took {datetime.now() - start_time} seconds to load") _app_settings = AppSettings() _app_settings.ensure_label_folders_exist() _USE_TEST_MODE = False #These commands are sent by IoT Central to the device _IoT_Commands = { 'DownloadModel': iot_commands.iot_download_model, 'UploadImages': iot_commands.iot_upload_images, 'Blink': iot_commands.iot_blink } async def send_iot_message(message=""): await device_events.send_iot_message(device_client, message) def movement_detected(): global start_time, _USE_TEST_MODE log.info("Movement Detected!")