UNPKG

@trusthab/composable-resources

Version:

migrating https://github.com/knetikmedia/hab-api/tree/integration/app/resources/composable

32 lines (24 loc) 676 B
const composer = require('../../mixin_loader'); module.exports = (App) => { const { underscore } = require('inflected'); const PROPERTY_VALUE = 'idle'; class ThermostatsTotalIdleTimeResource { static mixins() { return [ 'MetricTotalTimer', 'MetricTimer', 'Kpi' ]; } getMetricId() { return `thermostats_total_idle_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(ThermostatsTotalIdleTimeResource, App); };