【问题标题】:Azure IoT Central - Enum value displaying blank value in DashboardAzure IoT Central - 枚举值在仪表板中显示空白值
【发布时间】:2020-08-05 09:15:35
【问题描述】:

我们正在使用带有枚举的遥测属性“灯泡状态”,如下所示

"@id": "urn:veeazigbeeappdemo:ZigbeeDeviceTemplate_12r3:on_off:1",
      "@type": "Telemetry",
      "displayName": {
        "en": "Bulb Status"
      },
      "name": "on_off",
      "schema": {
        "@id": "urn:veeazigbeeappdemo:ZigbeeDeviceTemplate_12r3:on_off:hxdsbx1pp:1",
        "@type": "Enum",
        "displayName": {
          "en": "Enum"
        },
        "valueSchema": "string",
        "enumValues": [
          {
            "@id": "urn:veeazigbeeappdemo:ZigbeeDeviceTemplate_12r3:on_off:hxdsbx1pp:On:1",
            "@type": "EnumValue",
            "displayName": {
              "en": "On"
            },
            "enumValue": "1",
            "name": "On"
          },
          {
            "@id": "urn:veeazigbeeappdemo:ZigbeeDeviceTemplate_12r3:on_off:hxdsbx1pp:Off:1",
            "@type": "EnumValue",
            "displayName": {
              "en": "Off"
            },
            "enumValue": "0",
            "name": "Off"
          }
        ]
      }

使磁贴在模板中显示“最后一个已知值”

当我们如下发送有效载荷时

payload = '{"on_off": %s}' % (random.choice([0, 1]))

我们正在正确显示灯泡状态,如下所示

当我们发送 没有 Bulb status(on_off) 遥测属性的有效负载时,如下所示

payload = '{"current_level": %f}' % random.randrange(10.0, 100.0)

我们将灯泡状态显示为空白,如下所示

正确的行为: Bulb 状态应显示来自 on_off 属性的最后一个已知值,并且在我们不发送该遥测属性时不应显示为空白。

这种枚举行为给我们带来了问题。请提供解决方案。

请让我知道我在哪里可以将此作为 Azure IoT Central 中的 Enum 错误发布?

【问题讨论】:

    标签: azure-iot-central


    【解决方案1】:

    看起来枚举类型处理空值的方式与其他类型不同。在我看来,未建模的数据不应该修改仪表板。

    作为一种解决方法,您能否将类型更改为 SemanticType/State?州历史运行良好:

    对 IoT Central 团队的反馈是 here

    【讨论】:

    • 我今天查了一下,这个bug似乎是用枚举修复的。
    • @HariharnathPaduchuru,这是正确的。感谢您指出这个问题以及 IoT Central 团队修复它的速度。
    猜你喜欢
    • 2021-08-13
    • 2018-10-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多