You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey guys, I am trying to get the device properties on client.connect(). I have already registered a MessageCallback and an IotHubEventCallback. Through these I can get the properties changes once I am connected and I correctly get the messages sent from the iot Hub.
However I dont get the complete desired properties on connect. I only get the changed values after I have connected.
If I delete the device twin from the iot hub and then connect, I do get the full desired properties !!. I would expect this to be the behavior whenever I connect to the iot hub.
Additionally I also tried using the Node.js sdk and there the complete desired properties are fetched on connect.
Code sample exhibiting the issue:
StringconnString = CONNECTION_TEMPLATE.replace(PLACEHOLDER_HOSTNAME, object.data.azure.hostname)
.replace(PLACEHOLDER_ID, myID)
.replace(PLACEHOLDER_AZURE_PRIMARY_KEY, object.data.azure.primarykey);
try {
IotHubClientProtocolprotocol = IotHubClientProtocol.MQTT;
client = newDeviceClient(connString, protocol);
MessageCallbackMqttcallback = newMessageCallbackMqtt();
//Counter counter = new Counter(0);client.setMessageCallback(callback, java.util.UUID.randomUUID().toString());
// Create a Device object to store the device twin propertiesDevicedataCollector = newDevice() {
// Print details when a property value changes@OverridepublicvoidPropertyCall(StringpropertyKey, ObjectpropertyValue, Objectcontext) {
Log.i(TAG, propertyKey + " changed to " + propertyValue);
}
};
dataCollector.setDesiredPropertyCallback(newcom.microsoft.azure.sdk.iot.device.DeviceTwin.Property("foo", false),
newPropertyCallBack<String, Object>() {
@OverridepublicvoidPropertyCall(StringpropertyKey, ObjectpropertyValue, Objectcontext) {
Log.i(TAG, "My FOO changed to " + propertyValue);
}
}, null);
// Create a reported property and send it to your IoT hub.//dataCollector.setReportedProp(new com.microsoft.azure.sdk.iot.device.DeviceTwin.Property("connectivityType", "cellular"));// start client connectionclient.open();
client.startDeviceTwin(newEventCallback(), null, dataCollector, null);
//client.sendReportedProperties(dataCollector.getReportedProp());client.subscribeToDesiredProperties(dataCollector.getDesiredProp());
}
catch(IOExceptione1) {
Log.e(TAG, "Exception while opening IoTHub connection: " + e1.toString());
} catch(Exceptione2)
{
Log.e(TAG, "Exception while opening IoTHub connection: " + e2.toString());
}
Console log of the issue:
10-10 17:07:16.695 20759-20759/my.app W/System.err: log4j:WARN No appenders could be found for logger (com.microsoft.azure.sdk.iot.device.IotHubConnectionString).
10-10 17:07:17.515 20759-20914/my.app V/AzureSystemStatePlugin: IoT Hub responded to message 7626ad3c-b4e8-4b1f-b669-93ec8eca5fb7 with status OK_EMPTY
10-10 17:07:19.875 20759-20915/my.app V/AzureSystemStatePlugin: IoT Hub responded to message 1d01a59c-1f3e-426d-acaf-0de8f14161c0 with status OK_EMPTY
10-10 17:07:20.925 20759-20915/my.app V/AzureSystemStatePlugin: IoT Hub responded to message 0d200d03-0619-43f8-b522-af880342e060 with status OK_EMPTY
10-10 17:07:21.415 20759-20914/my.app V/AzureSystemStatePlugin: IoT Hub responded to message be5a205d-04e6-48a0-981e-efcfec6651f4 with status OK_EMPTY
10-10 17:07:22.105 20759-20914/my.app V/AzureSystemStatePlugin: IoT Hub responded to message ed0956c0-bbe5-4dff-ada9-20afb68b9cb1 with status OK_EMPTY
10-10 17:07:22.795 20759-20914/my.app V/AzureSystemStatePlugin: IoT Hub responded to message 058417cb-d7de-4318-bc2e-8b574620dcf6 with status OK_EMPTY
10-10 17:07:26.856 20759-20915/my.app V/AzureSystemStatePlugin: IoT Hub responded to message 96923f94-87a8-438e-9fa8-364128cdc925 with status OK_EMPTY
10-10 17:07:31.906 20759-20914/my.app V/AzureSystemStatePlugin: IoT Hub responded to message aa4780c5-25fd-4657-87ed-262053e1274f with status OK_EMPTY
10-10 17:07:33.495 20759-20914/my.app V/AzureSystemStatePlugin: IoT Hub responded to message 7336c4b7-f45e-47a6-9989-e4dc6213c395 with status OK_EMPTY
The text was updated successfully, but these errors were encountered:
OS and version used: MAC OS X 10.11.6
Java runtime used: Android JDK 1.7
SDK version used: iot-device-client:1.5.35
Description of the issue:
Hey guys, I am trying to get the device properties on
client.connect()
. I have already registered aMessageCallback
and anIotHubEventCallback
. Through these I can get the properties changes once I am connected and I correctly get the messages sent from the iot Hub.However I dont get the complete
desired properties
onconnect
. I only get the changed values after I have connected.If I delete the device twin from the iot hub and then connect, I do get the full
desired properties
!!. I would expect this to be the behavior whenever I connect to the iot hub.Additionally I also tried using the Node.js sdk and there the complete
desired properties
are fetched onconnect
.Code sample exhibiting the issue:
Console log of the issue:
The text was updated successfully, but these errors were encountered: