Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure IoT中心设备双更改通知问题_Azure_Iot_Azure Eventhub_Azure Iot Hub_Azure Iot Sdk - Fatal编程技术网

Azure IoT中心设备双更改通知问题

Azure IoT中心设备双更改通知问题,azure,iot,azure-eventhub,azure-iot-hub,azure-iot-sdk,Azure,Iot,Azure Eventhub,Azure Iot Hub,Azure Iot Sdk,我正在尝试在设备属性更改时在云后端接收通知。为此,我设置了一条路线,如下面的图片链接所示 我还创建了一个Azure函数,该函数在内置端点事件的默认使用者组上触发。但是,当我为我的一台设备更新device twin文档时,azure功能不会触发。如果我使用IoTubExplorer或device explorer监视设备的事件,则根本看不到“UpdateWin”事件。但是,如果我从接收常规设备的设备向云端发送常规设备,它就会工作 Im使用以下代码更新设备: 'use strict'; var

我正在尝试在设备属性更改时在云后端接收通知。为此,我设置了一条路线,如下面的图片链接所示

我还创建了一个Azure函数,该函数在内置端点事件的默认使用者组上触发。但是,当我为我的一台设备更新device twin文档时,azure功能不会触发。如果我使用IoTubExplorer或device explorer监视设备的事件,则根本看不到“UpdateWin”事件。但是,如果我从接收常规设备的设备向云端发送常规设备,它就会工作

Im使用以下代码更新设备:

'use strict';

var Client = require('azure-iot-device').Client;
var Protocol = require('azure-iot-device-mqtt').Mqtt;

var connectionString = '';
var client = Client.fromConnectionString(connectionString, Protocol);


client.open(function(err) {
if (err) {
    console.error('could not open IotHub client');
}  else {
    console.log('client opened');

    client.getTwin(function(err, twin) {
    if (err) {
        console.error('could not get twin');
    } else {
        var body = {
            temperature: '40'
        }

        console.log(twin.properties.reported);

        twin.properties.reported.update(body, function(err) {
            if (err) {
                console.error('could not update twin');
            } else {
                console.log('twin state reported');
                process.exit();
            }
        });
    }
    });
}
});
我还尝试使用iothub explorer使用以下命令: iothub浏览器更新双初始值设备{\“属性\”:{\“所需\”:
{\“interval\”:9000}}}--登录“”

我用你文章中的代码测试了它,它可以工作,所以你的路由设置和代码是正确的。


你提到过这个吗?我猜问题与此类似。请尝试检查帐户位置并根据Roman Kiss的建议进行测试。

出于测试目的,您可以使用设备浏览器(或Azure门户)更新设备属性,以在Azure功能中查看通知消息。谢谢您的回复。经过多次尝试,我移除了我的物联网中心,在欧洲西部而不是欧洲北部创建了一个新的物联网中心,之后一切都很顺利。也许是服务的位置,或者是我设法激活的其他设置。不管怎样,它现在起作用了。干杯