pksaheb commited on
Commit
3ab01b1
·
verified ·
1 Parent(s): 7e201e8

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +37 -29
index.html CHANGED
@@ -684,33 +684,8 @@
684
 
685
  // Update temperature display and history
686
  function updateTemperature(temp) {
687
- currentTempEl.textContent = `${temp}°C`;
688
- updateGauge(temp);
689
- updateStatus(temp);
690
-
691
- temperatureHistory.push({
692
- temp: temp,
693
- timestamp: new Date().toLocaleTimeString(),
694
- status: getStatus(temp)
695
- });
696
-
697
- if (temperatureHistory.length > 20) {
698
- temperatureHistory.shift();
699
- }
700
-
701
- if (maxTemp === null || temp > maxTemp) {
702
- maxTemp = temp;
703
- maxTempEl.textContent = `${maxTemp}°C`;
704
- }
705
-
706
- if (minTemp === null || temp < minTemp) {
707
- minTemp = temp;
708
- minTempEl.textContent = `${minTemp}°C`;
709
- }
710
-
711
- updateHistoryTable();
712
- updateLiveChart(temp, new Date().toLocaleTimeString());
713
-
714
  // 🔥 Webhook Integration for High Temperature Alert
715
  if (temp > 50) {
716
  fetch('https://n8n-1r4e.onrender.com/webhook/c9e82b5a-2f26-425e-ba7d-f2c8b7d28f89', {
@@ -729,8 +704,41 @@
729
  .then(data => logDebug(`Webhook triggered: ${data}`))
730
  .catch(err => logDebug(`Webhook error: ${err.message}`));
731
  }
732
- }
733
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
734
 
735
  // Update gauge display
736
  function updateGauge(temp) {
 
684
 
685
  // Update temperature display and history
686
  function updateTemperature(temp) {
687
+ // Update current temperature
688
+ currentTempEl.textContent = `${temp
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689
  // 🔥 Webhook Integration for High Temperature Alert
690
  if (temp > 50) {
691
  fetch('https://n8n-1r4e.onrender.com/webhook/c9e82b5a-2f26-425e-ba7d-f2c8b7d28f89', {
 
704
  .then(data => logDebug(`Webhook triggered: ${data}`))
705
  .catch(err => logDebug(`Webhook error: ${err.message}`));
706
  }
707
+ }°C`;
708
+
709
+ // Update gauge
710
+ updateGauge(temp);
711
+
712
+ // Update status
713
+ updateStatus(temp);
714
+
715
+ // Update history
716
+ temperatureHistory.push({
717
+ temp: temp,
718
+ timestamp: new Date().toLocaleTimeString(),
719
+ status: getStatus(temp)
720
+ });
721
+
722
+ // Keep only last 20 readings
723
+ if (temperatureHistory.length > 20) {
724
+ temperatureHistory.shift();
725
+ }
726
+
727
+ // Update min/max
728
+ if (maxTemp === null || temp > maxTemp) {
729
+ maxTemp = temp;
730
+ maxTempEl.textContent = `${maxTemp}°C`;
731
+ }
732
+
733
+ if (minTemp === null || temp < minTemp) {
734
+ minTemp = temp;
735
+ minTempEl.textContent = `${minTemp}°C`;
736
+ }
737
+
738
+ // Update history table and chart
739
+ updateHistoryTable();
740
+ updateLiveChart(temp, new Date().toLocaleTimeString());
741
+ }
742
 
743
  // Update gauge display
744
  function updateGauge(temp) {