diff --git a/src/assets/svg/compressorB_rev.svg b/src/assets/svg/compressorB_rev.svg index cf3bfe0..8346838 100644 --- a/src/assets/svg/compressorB_rev.svg +++ b/src/assets/svg/compressorB_rev.svg @@ -1971,12 +1971,12 @@ MPa #### #### - #### + #### #### - #### + #### #### - #### - #### + #### + #### #### #### Plant Air Reciever diff --git a/src/components/Global/MqttConnection.jsx b/src/components/Global/MqttConnection.jsx index ab8287c..829f598 100644 --- a/src/components/Global/MqttConnection.jsx +++ b/src/components/Global/MqttConnection.jsx @@ -2,7 +2,7 @@ import mqtt from 'mqtt'; const mqttUrl = `${import.meta.env.VITE_MQTT_SERVER ?? 'ws://localhost:1884'}`; -const topics = ['PIU_GGCP/Devices/PB']; +const topics = ['cod/air_dryer/air_dryer1']; const options = { keepalive: 30, clientId: 'react_mqtt_' + Math.random().toString(16).substr(2, 8), @@ -66,7 +66,8 @@ const listenMessage = (callback) => { const setValSvg = (listenTopic, svg) => { client.on('message', (topic, message) => { - if (topic == listenTopic) { + // console.log(topic ,' = ', listenTopic); + if (topic === listenTopic) { const objChanel = JSON.parse(message); Object.entries(objChanel).forEach(([key, value]) => { @@ -78,7 +79,7 @@ const setValSvg = (listenTopic, svg) => { } else if (value === false) { el.style.display = 'none'; } else if (!isNaN(value)) { - el.textContent = Number(value ?? 0.0); + el.textContent = Number(value ?? 0.0).toFixed(2); } else { el.textContent = value; } diff --git a/src/pages/home/SvgCompressorB.jsx b/src/pages/home/SvgCompressorB.jsx index 32e1370..418a39c 100644 --- a/src/pages/home/SvgCompressorB.jsx +++ b/src/pages/home/SvgCompressorB.jsx @@ -6,9 +6,7 @@ import SvgViewer from './SvgViewer'; import filePathSvg from '../../assets/svg/compressorB_rev.svg'; const { Text } = Typography; - -// const filePathSvg = '/src/assets/svg/test-new.svg'; -const topicMqtt = 'PIU_GGCP/Devices/PB'; +const topicMqtt = 'cod/air_dryer/air_dryer1'; const SvgCompressorB = () => { return (