Skip to content

Commit

Permalink
Merge pull request #21 from saniho/integrationOfMeteoMarinev2
Browse files Browse the repository at this point in the history
integration de des infos de marées
  • Loading branch information
saniho authored Dec 16, 2022
2 parents 2510d23 + ed50a52 commit acadd20
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
5 changes: 5 additions & 0 deletions custom_components/apiMareeInfo/apiMareeInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ def getjson(self, url):
def getlisteport(self, nomport):
url = "http://webservices.meteoconsult.fr/meteoconsultmarine/android/100/fr/v20/recherche.php?rech=%s&type=48" % (
nomport)
url = "https://ws.meteoconsult.fr/meteoconsultmarine/android/100/fr/v30/recherche.php?rech=%s&type=48" % (
nomport)
print(url)
retour = self.getjson(url)
print(retour)
Expand All @@ -45,6 +47,9 @@ def __init__(self, lat, lng):
self._url = \
"http://webservices.meteoconsult.fr/meteoconsultmarine/androidtab/115/fr/v20/previsionsSpot.php?lat=%s&lon=%s" % (
lat, lng)
self._url = \
"http://ws.meteoconsult.fr/meteoconsultmarine/androidtab/115/fr/v30/previsionsSpot.php?lat=%s&lon=%s" % (
lat, lng)
""" autre url possible
self._url = \
# "http://webservices.meteoconsult.fr/meteoconsultmarine/android/100/fr/v20/previsionsSpot.php?lat=%s&lon=%s" % (
Expand Down
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.0"
__VERSION__ = "1.1.1"

__name__ = "apiMareeInfo"
6 changes: 5 additions & 1 deletion custom_components/apiMareeInfo/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def __init__(self, idDuPort, lat, lng, stormkey, _update_interval):
self._idDuPort = idDuPort
self._lat = lat
self._lng = lng
self._origine = "MeteoMarine"
self._stormkey = stormkey
self._myMaree = apiMareeInfo.ApiMareeInfo()
pass
Expand All @@ -61,7 +62,10 @@ def update(self, ):
((self._lastSynchro + self._update_interval) < courant):
_LOGGER.warning("-update possible- on lance")
self._myMaree.setport(self._lat, self._lng)
self._myMaree.getinformationport( origine="stormio", info={"stormkey":self._stormkey})
if ( self._origine == "MeteoMarine"):
self._myMaree.getinformationport(origine=self._origine)
else:
self._myMaree.getinformationport( origine="stormio", info={"stormkey":self._stormkey})
self._lastSynchro = datetime.datetime.now()

def getIdPort(self):
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 @@ -42,10 +42,12 @@ def testPortStormGlass():
# lat, lng = "46.7711", "-2.05306"
lat, lng = "46.4967", "-1.79667"
_myMaree.setport(lat, lng)
#_myMaree.getinformationport( jsondata= dataJson, outfile = "file_20220726.json",
# origine="stormio", info={'stormkey':thekey} )
_myMaree.getinformationport( jsondata= dataJson, outfile = "file_20220726.json",
origine="stormio", info={'stormkey':thekey} )
origine="MeteoMarine")

_myMaree.getinformationport( outfile = "file_20220726.json", origine="stormio", info={'stormkey':thekey} )
#_myMaree.getinformationport( outfile = "file_20220726.json", origine="stormio", info={'stormkey':thekey} )
# print(_myMaree.getinfo())
# print(_myMaree.getnomduport())
# print(_myMaree.getdatecourante())
Expand Down

0 comments on commit acadd20

Please sign in to comment.