@trusthab/composable-resources
Version:
migrating https://github.com/knetikmedia/hab-api/tree/integration/app/resources/composable
31 lines (23 loc) • 645 B
JavaScript
const composer = require('../../mixin_loader');
module.exports = (App) => {
const { underscore } = require('inflected');
const PROPERTY_VALUE = 'idle';
class ThermostatsAvgIdleTimeResource {
static mixins() {
return [
'MetricTimer',
'Kpi'
];
}
getMetricId() {
return `thermostats_avg_idle_time`;
}
shouldRun() {
if (this.get('obj').device_type !== 'thermostat') { return undefined; }
const value = this.get('obj').status;
if (value === PROPERTY_VALUE) { return true; }
return false;
}
};
return composer(ThermostatsAvgIdleTimeResource , App);
};