Skip to content

Commit

Permalink
prevent issue if empty cache
Browse files Browse the repository at this point in the history
  • Loading branch information
zoic21 authored Feb 10, 2024
1 parent 1f2430b commit 2b5eaeb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/class/thermostat.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,12 +343,12 @@ public static function temporal($_options) {
$thermostat->reschedule(null, true);
}

if ($thermostat->getCache('lastState') == 'heat' && $temporal_data['direction'] < 0) {
if ($thermostat->getCache('lastState','none') == 'heat' && $temporal_data['direction'] < 0) {
log::add(__CLASS__, 'debug', $thermostat->getHumanName() . ' ' . __('Je dois refroidir mais avant je chauffais, je stop tout avant', __FILE__));
$thermostat->setCache('lastState', 'stop');
$thermostat->stopThermostat();
}
if ($thermostat->getCache('lastState') == 'cool' && $temporal_data['direction'] > 0) {
if ($thermostat->getCache('lastState','none') == 'cool' && $temporal_data['direction'] > 0) {
log::add(__CLASS__, 'debug', $thermostat->getHumanName() . ' ' . __('Je dois chauffer mais avant je refroidissait, je stop tout avant', __FILE__));
$thermostat->setCache('lastState', 'stop');
$thermostat->stopThermostat();
Expand Down

0 comments on commit 2b5eaeb

Please sign in to comment.