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