Skip to content

Commit

Permalink
[#] remove fetch of previous sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
brielsilva committed Jul 29, 2024
1 parent 19a2348 commit d75238c
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions sensor.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
const client = require('./connection');
const sensorsList = document.getElementById('sensorsList');

client.on('connect', () => {
client.subscribe('sensor/registration', { qos: 1 }, (err) => {
if (!err) {
console.log('Subscribed to sensor registration topic');
client.publish('sensor/registration/request', 'Requesting existing sensors');
}
});
});

client.on('message', (topic, message) => {
const topicParts = topic.split('/');
if (topic === 'sensor/registration') {
const sensorData = JSON.parse(message.toString());
addSensorToList(sensorData);
}
});

document.getElementById('sensorForm').addEventListener('submit', (event) => {
event.preventDefault();
const type = document.getElementById('type').value;
Expand Down Expand Up @@ -77,4 +60,3 @@ window.updateSensorValue = function(sensorId, minLimit, maxLimit) {
}
};

client.publish('sensor/registration/request', JSON.stringify({ action: 'fetch' }));

0 comments on commit d75238c

Please sign in to comment.