Skip to content

Commit

Permalink
fix #2610
Browse files Browse the repository at this point in the history
  • Loading branch information
zoic21 authored Jun 4, 2024
1 parent defbd48 commit bba42e0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
6 changes: 3 additions & 3 deletions core/class/history.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1027,14 +1027,14 @@ public function save($_cmd = null, $_direct = false) {
$this->setValue(round($this->getValue(), $cmd->getConfiguration('historizeRound')));
}
if ( $JEEDOM_INTERNAL_CONFIG['cmd']['type']['info']['subtype'][$cmd->getSubType()]['isHistorized']['canBeSmooth']
&& $cmd->getConfiguration('smooth', 0) > 0
&& $cmd->getConfiguration('history::smooth', config::byKey('history::smooth','core',0)) > 0
&& $cmd->getConfiguration('historizeMode', 'none') != 'none'
&& $this->getValue() !== null ) {
if ($this->getTableName() == 'history') {
$time = strtotime($this->getDatetime());
$time -= $time % $cmd->getConfiguration('smooth', 0);
$time -= $time % $cmd->getConfiguration('smooth', config::byKey('history::smooth','core',0));
if ($this->getValue() == 0) {
$this->setDatetime(date('Y-m-d H:i:00', $time + $cmd->getConfiguration('smooth', 0)));
$this->setDatetime(date('Y-m-d H:i:00', $time + $cmd->getConfiguration('smooth', config::byKey('history::smooth','core',0))));
$values = array(
'cmd_id' => $this->getCmd_id(),
'datetime' => date('Y-m-d H:i:00', strtotime($this->getDatetime())),
Expand Down
1 change: 1 addition & 0 deletions core/config/default.config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ historyArchiveTime = 2
historyArchivePackage = 1
displayStatsWidget = 0
history::defautShowPeriod = -1 month
history::smooth = 0

;security
security::maxFailedLogin = 6
Expand Down
5 changes: 3 additions & 2 deletions desktop/modal/cmd.configure.php
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,9 @@
<sup><i class="fas fa-question-circle" title="{{Limite le nombre de valeur historisé par la commande en temps réel (avant le lissage de la nuit). Attention un mode de lissage doit absolument être défini.}}"></i></sup>
</label>
<div class="col-sm-6">
<select class="form-control cmdAttr" data-l1key="configuration" data-l2key="smooth">
<option value="0">{{Aucun}}</option>
<select class="form-control cmdAttr" data-l1key="configuration" data-l2key="history::smooth">
<option value="">{{Default}}</option>
<option value="-1">{{Aucun}}</option>
<option value="60">{{1 min}}</option>
<option value="300">{{5 min}}</option>
<option value="600">{{10 min}}</option>
Expand Down
13 changes: 13 additions & 0 deletions desktop/php/administration.php
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,19 @@
<input type="text" class="configKey form-control" data-l1key="historyCalculTendanceThresholddMax">
</div>
</div>
<div class="form-group">
<label class="col-md-3 col-sm-3 control-label">{{Limiter à une valeur toute les}}
<sup><i class="fas fa-question-circle" title="{{Limite le nombre de valeur historisé par les commandes en temps réel (avant le lissage de la nuit). Attention un mode de lissage doit absolument être défini.}}"></i></sup>
</label>
<div class="col-sm-6">
<select class="form-control configKey" data-l1key="history::smooth">
<option value="-1">{{Aucun}}</option>
<option value="60">{{1 min}}</option>
<option value="300">{{5 min}}</option>
<option value="600">{{10 min}}</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-lg-4 col-md-4 col-sm-6 col-xs-6 control-label">{{Période d'affichage des graphiques par défaut}}</label>
<div class="col-lg-2 col-md-2 col-sm-5 col-xs-6">
Expand Down

0 comments on commit bba42e0

Please sign in to comment.