Files
linker/cmonitor.web/src/views/device/plugins/light/index.js
2024-04-29 14:18:38 +08:00

28 lines
634 B
JavaScript

import { injectGlobalData } from "@/views/provide";
export default {
pluginName: 'cmonitor.plugin.light.',
field() {
return {
Light: {
Value: 0
},
}
},
state: {
light: {
showLight: false,
showLightSingle: false,
devices: []
}
},
globalData: null,
init() {
this.globalData = injectGlobalData();
},
update(item, report) {
if (!report.Light) return;
item.Light.Value = Math.floor(+report.Light.Value);
if (isNaN(item.Light.Value)) item.Light.Value = 0;
}
}