Skip to content

Commit

Permalink
add yesterdayConsumptionMaxPower
Browse files Browse the repository at this point in the history
  • Loading branch information
saniho committed Feb 28, 2021
1 parent 7fe393e commit 9bab8ec
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion custom_components/apiEnedis/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
DEFAULT_SCAN_INTERVAL_HISTORIQUE = 60*10 # 1 fois toutes les 10 minutes

HEURESCREUSES_ON = "heuresCreusesON"
__VERSION__ = "1.1.3.2RC"
__VERSION__ = "1.1.3.2RC3"
__name__ = "myEnedis"

_consommation = "consommation"
Expand Down
3 changes: 3 additions & 0 deletions custom_components/apiEnedis/myEnedis.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ def myLog(self, message):
def myLogWarning(self, message):
self._log.warning(message)

def myLogError(self, message):
self._log.error(message)

def setUpdateRealise(self, value):
self._updateRealise = value

Expand Down
6 changes: 4 additions & 2 deletions custom_components/apiEnedis/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ def update():
if not state:
return

if 'yesterday' not in self._attributes.keys() and 'yesterday_production' not in self._attributes.keys(): # pas plutot la key à checker ??
if ( 'yesterday' not in self._attributes.keys() and 'yesterday_production' not in self._attributes.keys() )\
or ( self._attributes['yesterday'] != "-1" ): # pas plutot la key à checker ??
self._state = state.state
self._attributes = state.attributes
self.setLastAttributes()
Expand Down Expand Up @@ -592,7 +593,8 @@ async def async_added_to_hass(self) -> None:
# ADDED CODE HERE
# si seulement pas eut de mise à jour !!
# si la clef yesterday est disponible dans l'element courant, alors c'est que l'on a eut une mise à jour
if 'yesterday' not in self._attributes.keys() and 'yesterday_production' not in self._attributes.keys(): # pas plutot la key à checker ??
if ( 'yesterday' not in self._attributes.keys() and 'yesterday_production' not in self._attributes.keys() )\
or ( self._attributes['yesterday'] != "-1" ): # pas plutot la key à checker ??
self._state = state.state
# _LOGGER.warning("*** / / / \ \ \ *** mise a jour state precedent %s " % (self._state))
self._attributes = state.attributes
Expand Down
3 changes: 2 additions & 1 deletion custom_components/apiEnedis/sensorEnedis.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,18 @@ def getStatus(self, typeSensor = _consommation):
status_counts["timeLastCall"] = self._myDataEnedis.getTimeLastCall()
# à supprimer car doublon avec j_1
status_counts['yesterday'] = self._myDataEnedis.getYesterday()
status_counts['yesterdayConsumptionMaxPower'] = self._myDataEnedis.getYesterdayConsumptionMaxPower()
status_counts['last_week'] = self._myDataEnedis.getLastWeek()

if (1):#self._myDataEnedis.getStatusLastCall(): # update avec statut ok
try:
# typesensor ... fonction de ?
if typeSensor == _consommation: #self._myDataEnedis.isConsommation():

status_counts["lastUpdate"] = self._myDataEnedis.getLastUpdate()
status_counts["timeLastCall"] = self._myDataEnedis.getTimeLastCall()
# à supprimer car doublon avec j_1
status_counts['yesterday'] = self._myDataEnedis.getYesterday()
status_counts['yesterdayConsumptionMaxPower'] = self._myDataEnedis.getYesterdayConsumptionMaxPower()
status_counts['last_week'] = self._myDataEnedis.getLastWeek()
last7daysHP = self._myDataEnedis.get7DaysHP()
listeClef = list(last7daysHP.keys())
Expand Down

0 comments on commit 9bab8ec

Please sign in to comment.