Log zigbee2mqtt version information to bridge/config (#1267)

* add coordinator_firmware to bridge/config

* Add zigbee2mqtt version and commit

* Whoops
This commit is contained in:
Oli authored and Koen Kanters committed 2019-03-17 20:07:24 +01:00
1 parent 1043053812
commit a2a90bcdbd
4 files changed
+43 -26

No files matched your search

+23
View File
@@ -67,6 +67,28 @@ function getEndpointByEntityID(zigbee, entityID, epName) {
return endpoint;
}
function getZigbee2mqttVersion(callback) {
const git = require('git-last-commit');
const packageJSON = require('../../package.json');
const version = packageJSON.version;
git.getLastCommit((err, commit) => {
let commitHash = null;
if (err) {
try {
commitHash = require('../.hash.json').hash;
} catch (error) {
commitHash = 'unknown';
}
} else {
commitHash = commit.shortHash;
}
callback({commitHash, version});
});
}
module.exports = {
millisecondsToSeconds: (milliseconds) => milliseconds / 1000,
secondsToMilliseconds: (seconds) => seconds * 1000,
@@ -76,4 +98,5 @@ module.exports = {
toLocalISOString: (dDate) => toLocalISOString(dDate),
getPostfixes: () => postfixes,
getEndpointByEntityID,
getZigbee2mqttVersion,
};