From a277c70fdaa149815e6d870f81017014485f0453 Mon Sep 17 00:00:00 2001 From: Quentin WEPHRE Date: Wed, 17 Sep 2025 08:26:56 +0200 Subject: [PATCH] Upgrade for Liberty --- Moulinette/data_path_config.py | 4 +-- Moulinette/requirements.txt | 6 ++--- .../azure_iot_hub_get_connection_strings.py | 2 +- Python/azure_iot_hub_list_devices.py | 26 ++----------------- 4 files changed, 8 insertions(+), 30 deletions(-) diff --git a/Moulinette/data_path_config.py b/Moulinette/data_path_config.py index 4b493cd..900e8a0 100644 --- a/Moulinette/data_path_config.py +++ b/Moulinette/data_path_config.py @@ -40,7 +40,7 @@ allowed_name_characters.append('.') logging.basicConfig(format='%(asctime)s %(levelname)-8s %(message)s', filename='data_config_debug.log', filemode='w', level=logging.DEBUG, datefmt='%Y%m%d%H%M%S') dir_name = 'I-Sight_Generated_Files' -input_datamodel = 'DATAMODEL_1.0.6_BEI.xlsx' +input_datamodel = 'DATAMODEL_1.0.6_LIBERTY.xlsx' shell_script_name = dir_name + '/I-Sight_Configuration_' global_shell_script_name = dir_name + '/I-Sight_Global_Configuration.sh' @@ -204,7 +204,7 @@ def jq_filter(current_device, dsh, dsh_global, row_device): if filter in jq_filter_set and filter != "bitfield": logging.debug("Creating standard telemetry topic " + filter + ".") jq_data = {} - jq_data["enable"] = True + jq_data["enable"] = False jq_data["properties"] = [{"key": "deviceType", "value": "AC_GATEWAY"}, {"key": "cdid", "value": current_device}] jq_data["outputTopic"] = filter jq_data["sendOutThreshold"] = {"mode": "bySize", "size": int(128000), "time": int(30), "sizeIdleTimer": {"enable": True, "time": int(30)}} diff --git a/Moulinette/requirements.txt b/Moulinette/requirements.txt index cf52f81..32d016c 100644 --- a/Moulinette/requirements.txt +++ b/Moulinette/requirements.txt @@ -1,4 +1,4 @@ -pandas==1.4.3 -openpyxl==3.1.0 +pandas +openpyxl requests -dotenv-python +python-dotenv diff --git a/Python/azure_iot_hub_get_connection_strings.py b/Python/azure_iot_hub_get_connection_strings.py index 1be5006..bf908ce 100644 --- a/Python/azure_iot_hub_get_connection_strings.py +++ b/Python/azure_iot_hub_get_connection_strings.py @@ -15,7 +15,7 @@ if CONNECTION_STRING == "": print("Provide a connection string for the Iot Hub before running the script!") exit(13) -SITE_NAME = "COTTONWOOD" +SITE_NAME = "LIBERTY" registry_manager = IoTHubRegistryManager.from_connection_string(CONNECTION_STRING) diff --git a/Python/azure_iot_hub_list_devices.py b/Python/azure_iot_hub_list_devices.py index b518542..ea0532e 100644 --- a/Python/azure_iot_hub_list_devices.py +++ b/Python/azure_iot_hub_list_devices.py @@ -13,11 +13,6 @@ module_id = "thingspro-agent" method_name = "thingspro-api-v1" payload = '{"method":"GET", "path":"/device/general"}' -# Install the Azure IoT Hub SDK: -# pip install azure-iot-hub - -# Authenticate to your Azure account -# CONNECTION_STRING = str(os.getenv("CONNECTION_STRING_SAFT_PROD")) CONNECTION_STRING = str(os.getenv("CONNECTION_STRING_INOX_PROD")) if CONNECTION_STRING == "": print("Provide a connection string for the Iot Hub before running the script!") @@ -25,27 +20,10 @@ if CONNECTION_STRING == "": registry_manager = IoTHubRegistryManager.from_connection_string(CONNECTION_STRING) -query_spec = QuerySpecification(query="SELECT * FROM devices WHERE IS_DEFINED(tags.site) AND tags.site = 'DANISH' AND capabilities.iotEdge = true ") +query_spec = QuerySpecification(query="SELECT * FROM devices") query_result = registry_manager.query_iot_hub(query_spec) devices = [] for item in query_result.items: - # currentDevice = iSightDevice(str(item.device_id), str(item.tags['site']), int(item.tags['number']), str(item.tags['version'])) - devices.append(iSightDevice(str(item.device_id), str(item.tags['site']), int(item.tags['number']), str(item.tags['version']))) - -devices.sort(key = lambda d: (d.site, d.number)) - -for device in devices: - print(device, end="\t") - current_device_modules = registry_manager.get_modules(device.deviceId) - for module in current_device_modules: - if (module.module_id == "thingspro-agent"): - device.setModule(module) - try: - direct_method = CloudToDeviceMethod(method_name=method_name, payload=json.loads(payload)) - response = registry_manager.invoke_device_module_method(device_id=device.deviceId, module_id=module_id, direct_method_request=direct_method) - device_version = str(response.payload['data']['firmwareVersion']) - print(device_version) - except: - print("ERROR") \ No newline at end of file + print(item) \ No newline at end of file