@@ -326,6 +326,11 @@ void ArduinoIoTCloudTCP::update()
326
326
#endif
327
327
328
328
329
+ if (getThingIdOutdatedFlag ()) {
330
+ DEBUG_VERBOSE (" ArduinoIoTCloudTCP::%s Thing id outdated, reconfiguring..." , __FUNCTION__);
331
+ _state = State::CheckDeviceConfig;
332
+ }
333
+
329
334
/* Run through the state machine. */
330
335
State next_state = _state;
331
336
switch (_state)
@@ -476,7 +481,6 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_WaitDeviceConfig()
476
481
return State::SubscribeDeviceTopic;
477
482
}
478
483
}
479
-
480
484
return State::WaitDeviceConfig;
481
485
}
482
486
@@ -490,16 +494,13 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_CheckDeviceConfig()
490
494
return State::ConnectPhy;
491
495
}
492
496
493
- if (getThingIdOutdatedFlag () )
497
+ if (_deviceSubscribedToThing == true )
494
498
{
495
- if (_deviceSubscribedToThing == true )
496
- {
497
- /* Unsubscribe from old things topics and go on with a new subsctiption */
498
- _mqttClient.unsubscribe (_shadowTopicIn);
499
- _mqttClient.unsubscribe (_dataTopicIn);
499
+ /* Unsubscribe from old things topics and go on with a new subsctiption */
500
+ _mqttClient.unsubscribe (_shadowTopicIn);
501
+ _mqttClient.unsubscribe (_dataTopicIn);
500
502
501
- _deviceSubscribedToThing = false ;
502
- }
503
+ _deviceSubscribedToThing = false ;
503
504
}
504
505
505
506
updateThingTopics ();
@@ -716,7 +717,6 @@ void ArduinoIoTCloudTCP::handleMessage(int length)
716
717
CBORDecoder::decode (_device_property_container, (uint8_t *)bytes, length);
717
718
_last_device_subscribe_cnt = 0 ;
718
719
_next_device_subscribe_attempt_tick = 0 ;
719
- _state = State::CheckDeviceConfig;
720
720
}
721
721
722
722
/* Topic for user input data */
0 commit comments