UNPKG

@trusthab/composable-resources

Version:

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

31 lines (23 loc) 655 B
const composer = require('../../mixin_loader'); module.exports = (App) => { const { underscore } = require('inflected'); const PROPERTY_VALUE = 'heating'; class ThermostatsAvgHeatingTimeResource { static mixins() { return [ 'MetricTimer', 'Kpi' ]; } getMetricId() { return `thermostats_avg_heating_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(ThermostatsAvgHeatingTimeResource, App); };