Azure IoT Edge 设备未连接到 IoT 中心

问题描述 投票:0回答:1

我遵循了这个教程:https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-create-through-portal#register-a-new-device-in- the-iot-hub 但我收到错误,我不知道如何解决

这里有一些:

运行命令

iotedge system logs -- -f

运行命令

iotedge check --verbose

在蔚蓝中

单击“错误”我得到:

我尝试了很多事情,从修改连接配置文件(/etc/aziot/config.toml),到使用自签名证书,在主机和linux虚拟机上打开端口8883,443和5671,重新-安装运行时。 还有这里的东西:https://learn.microsoft.com/en-us/azure/iot-edge/troubleshoot?view=iotedge-1.4 没有任何效果。

azure azure-iot-hub azure-iot-edge
1个回答
0
投票

设备离线且未运行,因此显示错误设备离线。我按照此文档部署 IoT Edge 模块并使其运行。 enter image description here

enter image description here

  • 创建边缘设备

enter image description here 部署模块:

  1. 在“设备管理”下选择“设备”,然后选择目标设备 ID。
  • 我按照文档使用 Visual Studio 开发和调试 Azure IoT Edge 模块。

  • 将此代码用于模拟温度传感器模块,该模块设计用于来自 git 的 Azure IoT Edge。

  1. 选择“设置模块”并从 Azure Marketplace 添加模块(模拟温度传感器)。
  2. 配置路由并检查部署,然后创建它。

enter image description here

  • 复制连接字符串或使用以下命令检索设备的连接字符串
az iot hub device-identity connection-string show --device-id myEdgeDevice --hub-name {hub_name}

安装和启动 IoT Edge 运行时的步骤:

在 Windows 设备上以管理员身份运行 PowerShell 并使用以下方法启用 Hyper-V:

   Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

使用以下命令下载 Windows 上适用于 Linux 的 IoT Edge 安装程序:

  $msiPath = $([io.Path]::Combine($env:TEMP, 'AzureIoTEdge.msi'))
  Invoke-WebRequest "https://aka.ms/AzEFLOWMSI_1_4_LTS_X64" -OutFile $msiPath

如果您使用的是 ARM64 架构,请将 URL 替换为“https://aka.ms/AzEFLOWMSI_1_4_LTS_ARM64”。

  • 使用以下命令在 Windows 上安装适用于 Linux 的 IoT Edge:
    Start-Process -Wait msiexec -ArgumentList "/i","$([io.Path]::Combine($env:TEMP, 'AzureIoTEdge.msi'))","/qn"
    
  1. 使用以下方法将执行策略设置为

    AllSigned

    Set-ExecutionPolicy -ExecutionPolicy AllSigned -Force
    

enter image description here

  1. 使用以下方式部署 IoT Edge 运行时:

    Deploy-Eflow

enter image description here

  • 使用之前检索到的设备连接字符串配置您的设备:
    Provision-EflowVm -provisioningType ManualConnectionString -devConnString "<CONNECTION_ST>"
    

enter image description here

  • 连接到虚拟机
Connect-EflowVm

enter image description here 使用命令列出设备上运行的 IoT Edge 模块

sudo iotedge list

查看从温度传感器模块发送的消息

sudo iotedge logs SimulatedTemperatureSensor -f

可以在IoT模块中看到运行状态

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.