Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/evse_monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -777,11 +777,14 @@ void EvseMonitor::getTemperatureFromEvse()
if(_temps[i].isValid())
{
double temp = _temps[i].get();
_temps[EVSE_MONITOR_TEMP_MONITOR].set(temp);
if(temp > _temps[EVSE_MONITOR_TEMP_MAX].get()) {
if(!_temps[EVSE_MONITOR_TEMP_MONITOR].isValid() || temp > _temps[EVSE_MONITOR_TEMP_MONITOR].get())
{
_temps[EVSE_MONITOR_TEMP_MONITOR].set(temp);
}
if(temp > _temps[EVSE_MONITOR_TEMP_MAX].get())
Copy link

Copilot AI Apr 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a validity check for _temps[EVSE_MONITOR_TEMP_MAX] (similar to the monitor sensor) before comparing the temperature. This could help avoid unexpected behavior if the max sensor’s value is uninitialized.

Suggested change
if(temp > _temps[EVSE_MONITOR_TEMP_MAX].get())
if(!_temps[EVSE_MONITOR_TEMP_MAX].isValid() || temp > _temps[EVSE_MONITOR_TEMP_MAX].get())

Copilot uses AI. Check for mistakes.

{
_temps[EVSE_MONITOR_TEMP_MAX].set(temp);
}
break;
}
}
_data_ready.ready(EVSE_MONITOR_TEMP_DATA_READY);
Expand Down
Loading