Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jin committed Apr 27, 2023
1 parent a226593 commit f2e4b9b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/lib/DeviceModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export class DeviceModel {
}

public default(name: string) {
return this.data.Value[name].default;
return this.data?.Value[name]?.default;
}

public enumValue(key: string, name: string) {
Expand Down
6 changes: 3 additions & 3 deletions src/v1/transforms/RefState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ export default function RefState(deviceModel: DeviceModel, decodedMonitor) {
snapshot.refState.freezerTemp = parseInt(snapshot.refState.freezerTemp);

if ('IcePlus' in decodedMonitor) {
snapshot.refState['expressMode'] = decodedMonitor['IcePlus'] || deviceModel.default('IcePlus');
snapshot.refState['expressMode'] = decodedMonitor['IcePlus'] || deviceModel.default('IcePlus') || '0';
}

if ('ExpressFridge' in decodedMonitor) {
snapshot.refState['expressFridge'] = decodedMonitor['ExpressFridge'] || deviceModel.default('ExpressFridge');
snapshot.refState['expressFridge'] = decodedMonitor['ExpressFridge'] || deviceModel.default('ExpressFridge') || '0';
}

if ('EcoFriendly' in decodedMonitor) {
snapshot.refState['ecoFriendly'] = decodedMonitor['EcoFriendly'] || deviceModel.default('EcoFriendly');
snapshot.refState['ecoFriendly'] = decodedMonitor['EcoFriendly'] || deviceModel.default('EcoFriendly') || '0';
}

return snapshot;
Expand Down

0 comments on commit f2e4b9b

Please sign in to comment.