设备控制

master
lld 2026-02-01 18:32:29 +08:00
parent 237ab647ab
commit 30d7a21b60
1 changed files with 4 additions and 3 deletions

View File

@ -318,7 +318,7 @@ export default {
if ((e === 'A' || e==='B' || e==='C') if ((e === 'A' || e==='B' || e==='C')
&& store.getters && store.getters.name === 'admin' ) { && store.getters && store.getters.name === 'admin' ) {
this.getNewSpecialData(e); this.getNewSpecialData(e);
this.mqttConfig.subscribeTopic = `frontend/${clientId}/dtu/862538065276061${MQTT_TOPIC_SUFFIX.UP}`; this.mqttConfig.subscribeTopic = `frontend/${clientId}/dtu/862538065276061`;
} }
const selectedItem = this.range.find(item => item.value === e); const selectedItem = this.range.find(item => item.value === e);
if (selectedItem) { if (selectedItem) {
@ -328,7 +328,7 @@ export default {
if (e !== 'A' && e!=='B' && e!=='C') { if (e !== 'A' && e!=='B' && e!=='C') {
// 使MQTT // 使MQTT
this.publishTopic = `frontend/${clientId}${MQTT_TOPIC_SUFFIX.DOWN}/${this.imei}`; this.publishTopic = `frontend/${clientId}${MQTT_TOPIC_SUFFIX.DOWN}/${this.imei}`;
this.mqttConfig.subscribeTopic = `frontend/${clientId}/dtu/${this.imei}${MQTT_TOPIC_SUFFIX.UP}`; this.mqttConfig.subscribeTopic = `frontend/${clientId}/dtu/${this.imei}`;
var queryParams = { var queryParams = {
imei: this.imei imei: this.imei
} }
@ -563,7 +563,8 @@ export default {
// //
ackMessage(topic, payload) { ackMessage(topic, payload) {
// 1. frontend/\\w+/control/\\w+" // 1. frontend/\\w+/control/\\w+"
if (topic !== this.mqttConfig.subscribeTopic) return; if ((topic !== this.mqttConfig.subscribeTopic+"/ack")
&& (topic !== this.mqttConfig.subscribeTopic+"/listener")) return;
let msgData = {}; let msgData = {};
// JSON // JSON
try { try {