@@ -331,6 +331,11 @@ void ArduinoIoTCloudTCP::update()
331
331
_next_state = State::Invalid;
332
332
}
333
333
334
+ if (getThingIdOutdatedFlag ()) {
335
+ DEBUG_VERBOSE (" ArduinoIoTCloudTCP::%s Thing id outdated, reconfiguring..." , __FUNCTION__);
336
+ _state = State::CheckDeviceConfig;
337
+ }
338
+
334
339
/* Run through the state machine. */
335
340
State next_state = _state;
336
341
switch (_state)
@@ -481,7 +486,6 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_WaitDeviceConfig()
481
486
return State::SubscribeDeviceTopic;
482
487
}
483
488
}
484
-
485
489
return State::WaitDeviceConfig;
486
490
}
487
491
@@ -495,16 +499,13 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_CheckDeviceConfig()
495
499
return State::ConnectPhy;
496
500
}
497
501
498
- if (getThingIdOutdatedFlag () )
502
+ if (_deviceSubscribedToThing == true )
499
503
{
500
- if (_deviceSubscribedToThing == true )
501
- {
502
- /* Unsubscribe from old things topics and go oi with a new subsctiption */
503
- _mqttClient.unsubscribe (_shadowTopicIn);
504
- _mqttClient.unsubscribe (_dataTopicIn);
504
+ /* Unsubscribe from old things topics and go oi with a new subsctiption */
505
+ _mqttClient.unsubscribe (_shadowTopicIn);
506
+ _mqttClient.unsubscribe (_dataTopicIn);
505
507
506
- _deviceSubscribedToThing = false ;
507
- }
508
+ _deviceSubscribedToThing = false ;
508
509
}
509
510
510
511
updateThingTopics ();
@@ -700,7 +701,6 @@ void ArduinoIoTCloudTCP::handleMessage(int length)
700
701
CBORDecoder::decode (_device_property_container, (uint8_t *)bytes, length);
701
702
_last_device_subscribe_cnt = 0 ;
702
703
_next_device_subscribe_attempt_tick = 0 ;
703
- _next_state = State::CheckDeviceConfig;
704
704
}
705
705
706
706
/* Topic for user input data */
0 commit comments