UNPKG

@trusthab/composable-resources

Version:

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

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