Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ private void refreshAccessTokenIfNeeded() {
if (accessTokenResponse.isExpired(Instant.now(), 120)) {
try {
this.accessTokenResponse = oAuthService.refreshToken();
if (this.accessTokenResponse != null) {
this.bearer = this.accessTokenResponse.getAccessToken();
accessTokenResponse = this.accessTokenResponse;
if (accessTokenResponse != null) {
this.bearer = accessTokenResponse.getAccessToken();
logger.trace("AccessToken renewed: {}", bearer);
}
} catch (InterruptedIOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
public class OndiloHandler extends BaseThingHandler {
private static final String NO_ID = "NO_ID";
private final Logger logger = LoggerFactory.getLogger(OndiloHandler.class);
private int recommendationId = 0; // Used to track the last recommendation ID processed
private int recommendationId; // Used to track the last recommendation ID processed
private AtomicReference<String> ondiloId = new AtomicReference<>(NO_ID);
private final int configPoolId;
private @Nullable ScheduledFuture<?> bridgeRecoveryJob;
Expand Down Expand Up @@ -100,6 +100,9 @@ public void handleCommand(ChannelUID channelUID, Command command) {
public void initialize() {
OndiloBridge ondiloBridge = getOndiloBridge();
if (ondiloBridge != null) {
// Initialize to 0, as no recommendation has been processed yet
recommendationId = 0;

if (configPoolId == 0) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, I18N_ID_INVALID);
return;
Expand Down Expand Up @@ -140,6 +143,7 @@ public void dispose() {
if (!ondiloId.get().equals(NO_ID)) {
ondiloId.set(NO_ID);
}
recommendationId = 0; // Reset last processed recommendation ID
}

public void clearLastMeasuresChannels() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class LastMeasure {
* {
* "data_type": "temperature",
* "value": 12.5,
* "value_time": "2020-03-23T16:08:51+0000",
* "value_time": "2025-07-13 04:33:39",
* "is_valid": true,
* "exclusion_reason": null
* }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ public class Recommendation {
* "id": 10251,
* "title": "Clean your filter",
* "message": "I recommend you to ...",
* "created_at": "2020-03-25T04:09:59+0000",
* "updated_at": "2020-03-25T04:09:59+0000",
* "created_at": "2025-07-13T00:32:06+0000",
* "updated_at": "2025-07-13T00:32:06.000000Z",
* "status": "waiting",
* "deadline": "2020-03-26T00:00:00+0000"
* "deadline": "2052-11-28T00:00:00.000000Z"
* }
*/

Expand Down