|
|
@ -358,6 +358,7 @@ export default { |
|
|
|
// 数据结构参考 src\subpackage\device\js\ouxuanac.md |
|
|
|
// 空调开关数据结构独立判断处理 hardware_type === 'Air' |
|
|
|
getSwitchQuery({ switchInfo, status = '' }){ |
|
|
|
|
|
|
|
let { |
|
|
|
hardware_connect_method, |
|
|
|
hardware_type, |
|
|
@ -365,17 +366,19 @@ export default { |
|
|
|
node_id, |
|
|
|
hardware_net_addr |
|
|
|
} = switchInfo; |
|
|
|
|
|
|
|
const _hardware_connect_method = this.changeLowerCase(hardware_connect_method) |
|
|
|
|
|
|
|
const postData = { |
|
|
|
name: this.getQueryName(switchInfo), |
|
|
|
value: { id: hardware_id + '', } // value 内值全为String |
|
|
|
}; |
|
|
|
|
|
|
|
if (this.changeLowerCase(hardware_connect_method) === 'gpio') postData.value['status'] = this.getRelayStatus(status); |
|
|
|
if (_hardware_connect_method === 'gpio') postData.value['status'] = this.getRelayStatus(status); |
|
|
|
|
|
|
|
// tcp 连接需要 hardware_net_addr |
|
|
|
if (this.changeLowerCase(hardware_connect_method) === 'tcp') postData.value['tcp'] = hardware_net_addr + ''; |
|
|
|
let _flag = this.changeLowerCase(hardware_connect_method) === 'serialport485' || this.changeLowerCase(hardware_connect_method) === 'tcp'; |
|
|
|
if (_hardware_connect_method === 'tcp') postData.value['tcp'] = hardware_net_addr + ''; |
|
|
|
// let _flag = _hardware_connect_method === 'serialport485' || _hardware_connect_method === 'tcp'||_hardware_connect_method==='yzk'; |
|
|
|
let _flag = ['serialport485','tcp','yzk'].some(e=> e===_hardware_connect_method); |
|
|
|
if (_flag){ |
|
|
|
if(hardware_type === 'Air'){ // 空调开关状态 key为 op |
|
|
|
postData.value['op'] = this.getAirRelayStatus(status); |
|
|
@ -386,10 +389,11 @@ export default { |
|
|
|
postData.value['o'] = this.getRelayStatus(status); // 开关状态 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return postData; |
|
|
|
}, |
|
|
|
changeLowerCase(str){ |
|
|
|
return str.toString().toLocaleLowerCase(); |
|
|
|
return str.toString().toLocaleLowerCase(); |
|
|
|
}, |
|
|
|
// 常规开关状态 |
|
|
|
// Low = "low", // 低电位,为开启 |
|
|
|