Skip to content

Commit

Permalink
Merge pull request #25 from saniho/DefectNoneCoeffMaree
Browse files Browse the repository at this point in the history
Add Coeff prochaine marée pour la marée BM
  • Loading branch information
saniho authored Dec 19, 2022
2 parents b8076bb + 2482ed7 commit 7f66094
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion custom_components/apiMareeInfo/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
# delai pour l'update http, toutes les 3 heures
CONF_SCAN_INTERVAL_HTTP = datetime.timedelta(seconds=60 * 60 * 3)

__VERSION__ = "1.1.3"
__VERSION__ = "1.1.4"

__name__ = "apiMareeInfo"
2 changes: 1 addition & 1 deletion custom_components/apiMareeInfo/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"domain": "apiMareeInfo",
"name": "apiMareeInfo sensor",
"documentation": "",
"version": "1.0.3",
"version": "1.1.4",
"requirements": [
],
"dependencies": [],
Expand Down
14 changes: 10 additions & 4 deletions custom_components/apiMareeInfo/sensorApiMaree.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ def getstatus(self):
nieme = info["nieme"]
jour = info["jour"]
status_counts["horaire_%s_%s" % (jour, nieme)] = "%s" % (info['horaire'])
if info['coeff'] is None:
info['coeff'] = ""
status_counts["coeff_%s_%s" % (jour, nieme)] = "%s" % (info['coeff'])
status_counts["etat_%s_%s" % (jour, nieme)] = "%s" % (info['etat'])
status_counts["hauteur_%s_%s" % (jour, nieme)] = "%s" % (info['hauteur'])
Expand All @@ -81,11 +83,15 @@ def getstatus(self):
# pour avoir les 2 prochaines marées
for x in range(2):
i = x + 1
status_counts["next_maree_%s" % i] = "%s" % self.getnextmaree(i)["horaire"]
status_counts["next_coeff_%s" % i] = "%s" % self.getnextmaree(i)["coeff"]
status_counts["next_etat_%s" % i] = "%s" % self.getnextmaree(i)["etat"]
pMaree = self.getnextmaree(i)
if pMaree['coeff'] is None:
pMaree['coeff'] = ""
status_counts["next_maree_%s" % i] = "%s" % pMaree["horaire"]
status_counts["next_coeff_%s" % i] = "%s" % pMaree["coeff"]
status_counts["next_etat_%s" % i] = "%s" % pMaree["etat"]
if status_counts["next_coeff_%s" % i] == "":
status_counts["next_coeff_%s" % i] = "%s" % self.getnextmaree(i + 1)["coeff"]
pMaree = self.getnextmaree(i + 1)
status_counts["next_coeff_%s" % i] = "%s" % pMaree["coeff"]
status_counts["timeLastCall"] = datetime.datetime.now()

dicoPrevis = []
Expand Down
2 changes: 1 addition & 1 deletion file_20220726.json

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions testMareeInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ def testPortMeteoMarine():
_myMaree = apiMareeInfo.ApiMareeInfo()
# lat, lng = "46.7711", "-2.05306"
lat, lng = "46.4967", "-1.79667"
lat, lng = "46.009313818464726", "-1.1740585688883056"
lat, lng = "45.0015181", "-1.1999562"
_myMaree.setport(lat, lng)
_myMaree.getinformationport(outfile="file_20220726.json")
dataJson = None
Expand Down Expand Up @@ -70,6 +72,6 @@ def testListePorts():
print(a)


# testPortMeteoMarine()
testPortStormGlass()
testPortMeteoMarine()
# testPortStormGlass()
# testListePorts()

0 comments on commit 7f66094

Please sign in to comment.