Skip to content

Commit

Permalink
v8.1.1 bug fix for service call without town init to empty string int…
Browse files Browse the repository at this point in the history
…ead of 'None' #38
  • Loading branch information
myTselection committed Dec 16, 2023
1 parent 76c4a8d commit d054838
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion custom_components/carbu_com/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/myTselection/carbu_com/issues",
"requirements": ["bs4","requests","ratelimit"],
"version": "8.1.0"
"version": "8.1.1"
}
4 changes: 3 additions & 1 deletion custom_components/carbu_com/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

_DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%S.0%z"


def check_settings(config, hass):
errors_found = False
if not any(config.get(i) for i in ["country"]):
Expand Down Expand Up @@ -135,6 +136,7 @@ def convertLocationBoundingBox(self, postalcode, country, town):
if country.lower() == 'es':
country_name = "Spain"
orig_location = self.searchGeocodeOSM(postalcode, town, country_name)
_LOGGER.debug(f"searchGeocodeOSM({postalcode}, {town}, {country_name}): {orig_location}")
if orig_location is None:
return []
orig_boundingbox = orig_location.get('boundingbox')
Expand Down Expand Up @@ -579,6 +581,7 @@ def getFuelPrediction(self, fueltype_prediction_code):
header = {"Content-Type": "application/x-www-form-urlencoded"}
# Super 95: https://carbu.com/belgie//index.php/voorspellingen?p=M&C=E95
# Diesel: https://carbu.com/belgie//index.php/voorspellingen?p=M&C=D
_LOGGER.debug(f"https://carbu.com/belgie//index.php/voorspellingen?p=M&C={fueltype_prediction_code}")

response = self.s.get(f"https://carbu.com/belgie//index.php/voorspellingen?p=M&C={fueltype_prediction_code}",headers=header,timeout=30)
if response.status_code != 200:
Expand Down Expand Up @@ -689,7 +692,6 @@ def getOilPrediction(self):
@sleep_and_retry
@limits(calls=10, period=5)
def getStationInfo(self, postalcode, country, fuel_type: FuelType, town="", max_distance=0, filter=""):
town = None
locationinfo = None
single = True if max_distance == 0 else False
if country.lower() in ["be","fr","lu"]:
Expand Down

0 comments on commit d054838

Please sign in to comment.