You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
2.0 KiB
70 lines
2.0 KiB
function getDeviceDataValue(device, name) {
|
|
var data = Enumerable.from(device.data).where(o => o.name === name).firstOrDefault();
|
|
if (data) {
|
|
return data['value'];
|
|
}
|
|
return null;
|
|
}
|
|
function getDeviceDataDescription(device, name) {
|
|
var data = Enumerable.from(device.data).where(o => o.name === name).firstOrDefault();
|
|
if (data) {
|
|
return data['description'];
|
|
}
|
|
return null;
|
|
}
|
|
function getDeviceDataUnit(device, name) {
|
|
var data = Enumerable.from(device.data).where(o => o.name === name).firstOrDefault();
|
|
if (data) {
|
|
return data['unit'];
|
|
}
|
|
return null;
|
|
}
|
|
function getDeviceData(device, name) {
|
|
var data = Enumerable.from(device.data).where(o => o.name === name).firstOrDefault();
|
|
if (data) {
|
|
return data['value'] + ' ' + data['unit'];
|
|
}
|
|
return null;
|
|
}
|
|
function getData(device, name) {
|
|
return Enumerable.from(device.data).where(o => o.name === name).firstOrDefault();
|
|
}
|
|
//devices
|
|
var iotComponents = [
|
|
'gateway',
|
|
'light',
|
|
'humiture',
|
|
'smoke',
|
|
'person',
|
|
'curtain',
|
|
'switch',
|
|
'switch3',
|
|
'socket',
|
|
'ir',
|
|
'color-light',
|
|
'door',
|
|
'camera',
|
|
'serial-port',
|
|
];
|
|
for (var i = 0; i < iotComponents.length; i++) {
|
|
var name = 'iot-'+iotComponents[i];
|
|
var url = "/components/iot/" + iotComponents[i] + ".html";
|
|
vueComponent(name, url);
|
|
}
|
|
var deviceInfo = [];
|
|
deviceInfo['网关'] = 'iot-gateway';
|
|
deviceInfo['光强检测器'] = 'iot-light';
|
|
deviceInfo['温湿度传感器'] = 'iot-humiture';
|
|
deviceInfo['烟雾报警器'] = 'iot-smoke';
|
|
deviceInfo['人体感应器'] = 'iot-person';
|
|
deviceInfo['窗帘电机'] = 'iot-curtain';
|
|
deviceInfo['一路开关'] = 'iot-switch';
|
|
deviceInfo['三路开关'] = 'iot-switch3';
|
|
deviceInfo['插座'] = 'iot-socket';
|
|
deviceInfo['智能插座'] = 'iot-socket';
|
|
deviceInfo['红外转发器'] = 'iot-ir';
|
|
deviceInfo['调色灯'] = 'iot-color-light';
|
|
deviceInfo['门锁'] = 'iot-door';
|
|
deviceInfo['摄像头'] = 'iot-camera';
|
|
deviceInfo['摄像头'] = 'gateway';
|
|
deviceInfo['串口控制器'] = 'iot-serial-port'; |