UNPKG

@trusthab/composable-resources

Version:

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

30 lines (22 loc) 647 B
const composer = require('../../mixin_loader'); module.exports = (App) => { const { underscore } = require('inflected'); const PROPERTIES_VALUES = ['cooling', 'heating']; class ThermostatsExcessiveRuntimeResource { static mixins() { return [ 'MetricTimer', 'Kpi' ]; } getMetricId() { return `thermostats_excessive_runtime`; } shouldRun() { const { device_type, status } = this.get('obj'); if (device_type !== 'thermostat') { return undefined; } return PROPERTIES_VALUES.includes(status); } } return composer(ThermostatsExcessiveRuntimeResource, App); };