Skip to content

Commit

Permalink
4.8.2c
Browse files Browse the repository at this point in the history
redémarrage intempestif démon
  • Loading branch information
Noyax37 committed Sep 25, 2023
1 parent d445b6b commit d118df2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
1 change: 0 additions & 1 deletion core/class/teleinfo.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1689,7 +1689,6 @@ public static function calculateOtherStats()
}
log::add('teleinfo', 'info', 'other stats -------------------------------------');
}

public static function copyVersIndex($compteur, $startDate, $endDate,
$indexcopy01,$indexcopy02,$indexcopy03,$indexcopy04,$indexcopy05,$indexcopy06,$indexcopy07,$indexcopy08,$indexcopy09,$indexcopy10,
$coutcopy00,$coutcopy01,$coutcopy02,$coutcopy03,$coutcopy04,$coutcopy05,$coutcopy06,$coutcopy07,$coutcopy08,$coutcopy09,$coutcopy10,$coutcopyprod){
Expand Down
3 changes: 3 additions & 0 deletions docs/fr_FR/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ Pour toutes demandes :
- [Changelog version stable](https://nextdom.github.io/plugin-teleinfo/fr_FR/changelog.md)
- [Changelog version bêta](https://noyax.github.io/plugin-teleinfo/fr_FR/changelog.md)

## 4.8.2c (09-09-2023) => version stable ET bêta
- Pour les deux versions: résolution d'un problème de redémarrage intempestif du démon

## 4.8.2b (09-09-2023) => version stable ET bêta
- Pour la version béta: pas de changement, cette montée en version n'est là que pour vous prévenir que la version stable rejoint la version béta donc si vous ne voulez pas rester en béta vous pouvez rebasculer en stable
- pour la version stable: toutes les évolutions depuis la dernières version stable qui était la 4.7.3h
Expand Down
2 changes: 1 addition & 1 deletion plugin_info/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
"documentation" : "https://NextDom.github.io/plugin-teleinfo/fr_FR/",
"changelog_beta" : "https://Noyax.github.io/plugin-teleinfo/fr_FR/changelog",
"documentation_beta" : "https://Noyax.github.io/plugin-teleinfo/fr_FR/",
"pluginVersion" : "4.8.2b"
"pluginVersion" : "4.8.2c"
}
23 changes: 14 additions & 9 deletions ressources/teleinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,7 @@ def read(self):
logging.debug('MODEM------ name : ' + name + ' value : ' + value)
else:
name, value, checksum = resp.replace('\r', '').replace('\n', '').split()
logging.debug(
'MODEM------ name : ' + name + ' value : ' + value + ' checksum : ' + checksum)
logging.debug('MODEM------ name : ' + name + ' value : ' + value + ' checksum : ' + checksum)
if self._is_valid(resp, checksum):
content[name] = value
else:
Expand All @@ -341,8 +340,7 @@ def read(self):
checksum = ' '
logging.debug('MODEM------ name : ' + name + ' value : ' + value)
else:
name, value, checksum = resp.replace('\r', '').replace('\n', '').replace('\x02', '').replace(
'\x03', '').split()
name, value, checksum = resp.replace('\r', '').replace('\n', '').replace('\x02', '').replace('\x03', '').split()
logging.debug('MODEM------ name : ' + name + ' value : ' + value + ' checksum : ' + checksum)
if self._is_valid(resp, checksum):
is_ok = True
Expand Down Expand Up @@ -373,17 +371,20 @@ def _is_valid(frame, checksum):
my_sum = my_sum + ord(cks)
computed_checksum = ((my_sum + 0x09) & int("111111", 2)) + 0x20
if chr(computed_checksum) != checksum[0:1]:
logging.debug('MODEM------ checksum non concordant. Checksum reçu : ' + checksum[0:1] + ' Checksum calcul : ' + chr(
computed_checksum))
logging.debug('MODEM------ checksum non concordant. Checksum reçu : ' + checksum[0:1] + ' Checksum calcul : ' + chr(computed_checksum))
else:
logging.debug('MODEM------ .......... checksum concordant. Checksum reçu : ' + checksum[0:1] + ' Checksum calcul : ' + chr(computed_checksum))
logging.debug('MODEM------ checksum concordant. Checksum reçu : ' + checksum[0:1] + ' Checksum calcul : ' + chr(computed_checksum))
else:
# print "Check checksum : f = %s, chk = %s" % (frame, checksum)
datas = ' '.join(frame.split()[0:2])
my_sum = 0
for cks in datas:
my_sum = my_sum + ord(cks)
computed_checksum = (my_sum & int("111111", 2)) + 0x20
if chr(computed_checksum) != checksum[0:1]:
logging.debug('MODEM------ checksum non concordant. Checksum reçu : ' + checksum[0:1] + ' Checksum calcul : ' + chr(computed_checksum))
else:
logging.debug('MODEM------ checksum concordant. Checksum reçu : ' + checksum[0:1] + ' Checksum calcul : ' + chr(computed_checksum))
# print "computed_checksum = %s" % chr(computed_checksum)
return chr(computed_checksum) == checksum[0:1]

Expand All @@ -394,9 +395,11 @@ def run(self):
data = {}
data_temp = {}
raz_day = 0
raz_time = 0
info_heure_calcul = 0

# Read a frame + RAZ au changement de date
# Read a frame + RAZ au changement de date + evite le heartbeat du demon
raz_time = datetime.now()
raz_day = date.today()
info_heure = datetime.now()
while 1:
Expand All @@ -422,9 +425,10 @@ def run(self):
data[cle] = valeur
_SendData = {}
pending_changes = False
raz_calcul = datetime.now() - raz_time
for cle, valeur in data.items():
if cle in data_temp:
if data[cle] != data_temp[cle]:
if ((data[cle] != data_temp[cle]) or (raz_calcul.seconds > 55)):
if cle[:3] == 'EAS' or cle[:3] == 'EAI': # test si on a affaire à un index commençant par EAI ou EAS (EAIT, EASF??, ...)
if (int(data[cle]) > int(data_temp[cle])) and (int(data[cle]) < (int(data_temp[cle]) + 10000)): #s i la valeur relevée est plus grande que celle en mémoire et qu'elle n'est pas 10 kwh au dessus c'est ok
_SendData[cle] = valeur
Expand All @@ -443,6 +447,7 @@ def run(self):
pending_changes = True
try:
if pending_changes:
raz_time = datetime.now()
if globals.mode == "standard":
_SendData["device"] = data["ADSC"]
globals.JEEDOM_COM.add_changes('device::' + data["ADSC"], _SendData)
Expand Down

0 comments on commit d118df2

Please sign in to comment.