Skip to content

Commit

Permalink
Use serial number instead of name hash for storage
Browse files Browse the repository at this point in the history
  • Loading branch information
hannseman committed Apr 20, 2018
1 parent 59168c2 commit 69f51cc
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/accessory.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const crypto = require('crypto');

const { Scanner } = require('./scanner');
const { version } = require('../package.json');

Expand Down Expand Up @@ -141,9 +139,8 @@ class HygrothermographAccessory {
if (!this.fakeGatoEnabled) {
return undefined;
}
const displayName = this.displayName || '';
const hashedAccessoryName = crypto.createHash('sha256').update(displayName).digest('hex');
const filename = `fakegato-history_${hashedAccessoryName}.json`;
const serialNumber = this.serialNumber || this.constructor.name;
const filename = `fakegato-history_${serialNumber}.json`;
return new FakeGatoHistoryService('room', this, { filename, storage: 'fs' });
}

Expand Down

0 comments on commit 69f51cc

Please sign in to comment.