Commit 62748eef60b163ab439a6b1f81675e4769152790
Committed by
Andrew Shvayka
1 parent
14230744
added deviceCreationTime to the DeviceStateData
Showing
2 changed files
with
4 additions
and
3 deletions
... | ... | @@ -393,7 +393,7 @@ public class DefaultDeviceStateService implements DeviceStateService { |
393 | 393 | if (stateData != null) { |
394 | 394 | DeviceState state = stateData.getState(); |
395 | 395 | state.setActive(ts < state.getLastActivityTime() + state.getInactivityTimeout()); |
396 | - if (!state.isActive() && (state.getLastInactivityAlarmTime() == 0L || state.getLastInactivityAlarmTime() < state.getLastActivityTime()) && UUIDs.unixTimestamp(deviceId.getId()) + state.getInactivityTimeout() < ts) { | |
396 | + if (!state.isActive() && (state.getLastInactivityAlarmTime() == 0L || state.getLastInactivityAlarmTime() < state.getLastActivityTime()) && stateData.getDeviceCreationTime() + state.getInactivityTimeout() < ts) { | |
397 | 397 | state.setLastInactivityAlarmTime(ts); |
398 | 398 | pushRuleEngineMessage(stateData, INACTIVITY_EVENT); |
399 | 399 | save(deviceId, INACTIVITY_ALARM_TIME, ts); |
... | ... | @@ -480,6 +480,7 @@ public class DefaultDeviceStateService implements DeviceStateService { |
480 | 480 | return DeviceStateData.builder() |
481 | 481 | .tenantId(device.getTenantId()) |
482 | 482 | .deviceId(device.getId()) |
483 | + .deviceCreationTime(device.getCreatedTime()) | |
483 | 484 | .metaData(md) |
484 | 485 | .state(deviceState).build(); |
485 | 486 | } catch (Exception e) { | ... | ... |