diff --git a/src/device-state/current-state.ts b/src/device-state/current-state.ts index b9d828e6..a4abeeec 100644 --- a/src/device-state/current-state.ts +++ b/src/device-state/current-state.ts @@ -108,18 +108,18 @@ const getStateDiff = (): DeviceStatus => { } const diff = { - local: _(stateForReport.local) - .omitBy((val, key: keyof DeviceStatus['local']) => + local: _.omitBy( + stateForReport.local, + (val, key: keyof NonNullable) => + INTERNAL_STATE_KEYS.includes(key) || _.isEqual(lastReportedLocal[key], val), - ) - .omit(INTERNAL_STATE_KEYS) - .value(), - dependent: _(stateForReport.dependent) - .omitBy((val, key: keyof DeviceStatus['dependent']) => + ), + dependent: _.omitBy( + stateForReport.dependent, + (val, key: keyof DeviceStatus['dependent']) => + INTERNAL_STATE_KEYS.includes(key) || _.isEqual(lastReportedDependent[key], val), - ) - .omit(INTERNAL_STATE_KEYS) - .value(), + ), }; const toOmit: string[] = sysInfo.filterNonSignificantChanges( diff --git a/src/types/state.ts b/src/types/state.ts index 3dfd2533..831ee2eb 100644 --- a/src/types/state.ts +++ b/src/types/state.ts @@ -40,7 +40,9 @@ export interface DeviceStatus { }; } & DeviceReportFields; // TODO: Type the dependent entry correctly - dependent?: any; + dependent?: { + [key: string]: any; + }; commit?: string; }