diff --git a/custom_components/fordpass/manifest.json b/custom_components/fordpass/manifest.json index f9f4e20..7a05e12 100644 --- a/custom_components/fordpass/manifest.json +++ b/custom_components/fordpass/manifest.json @@ -5,7 +5,7 @@ "integration_type": "device", "documentation": "https://github.com/itchannel/fordpass-ha", "issue_tracker": "https://github.com/itchannel/fordpass-ha/issues", - "version": "0.1.40", + "version": "0.1.41", "requirements": [], "ssdp": [], "zeroconf": [], diff --git a/custom_components/fordpass/sensor.py b/custom_components/fordpass/sensor.py index 8c8343c..2cb4e39 100644 --- a/custom_components/fordpass/sensor.py +++ b/custom_components/fordpass/sensor.py @@ -42,7 +42,7 @@ class CarSensor( def __init__(self, coordinator, sensor, options): self.sensor = sensor - self.options = options + self.fordoptions = options self._attr = {} self.coordinator = coordinator self._device_id = "fordpass_" + sensor @@ -52,8 +52,8 @@ def __init__(self, coordinator, sensor, options): def get_value(self, ftype): if ftype == "state": if self.sensor == "odometer": - if self.options[CONF_DISTANCE_UNIT] != None: - if self.options[CONF_DISTANCE_UNIT] == "mi": + if self.fordoptions[CONF_DISTANCE_UNIT] != None: + if self.fordoptions[CONF_DISTANCE_UNIT] == "mi": return round( float(self.coordinator.data[self.sensor]["value"]) / 1.60934 ) @@ -107,8 +107,8 @@ def get_value(self, ftype): ) elif self.sensor == "elVeh": if self.coordinator.data["elVehDTE"] != None: - if self.options[CONF_DISTANCE_UNIT] != None: - if self.options[CONF_DISTANCE_UNIT] == "mi": + if self.fordoptions[CONF_DISTANCE_UNIT] != None: + if self.fordoptions[CONF_DISTANCE_UNIT] == "mi": return round( float(self.coordinator.data["elVehDTE"]["value"]) / 1.60934 @@ -146,7 +146,7 @@ def get_value(self, ftype): return len(self.coordinator.data["messages"]) elif ftype == "measurement": if self.sensor == "odometer": - if self.options[CONF_DISTANCE_UNIT] == "mi": + if self.fordoptions[CONF_DISTANCE_UNIT] == "mi": return "mi" else: return "km" @@ -186,7 +186,7 @@ def get_value(self, ftype): elif self.sensor == "fuel": if self.coordinator.data[self.sensor] == None: return None - if self.options[CONF_DISTANCE_UNIT] == "mi": + if self.fordoptions[CONF_DISTANCE_UNIT] == "mi": self.coordinator.data["fuel"]["distanceToEmpty"] = round( float(self.coordinator.data["fuel"]["distanceToEmpty"]) / 1.60934 @@ -203,11 +203,11 @@ def get_value(self, ftype): elif self.sensor == "tirePressure": if self.coordinator.data["TPMS"] != None: - if self.options[CONF_PRESSURE_UNIT] == "PSI": + if self.fordoptions[CONF_PRESSURE_UNIT] == "PSI": sval = 0.1450377377 rval = 1 decimal = 0 - if self.options[CONF_PRESSURE_UNIT] == "BAR": + if self.fordoptions[CONF_PRESSURE_UNIT] == "BAR": sval = 0.01 rval = 0.0689475729 decimal = 2 diff --git a/info.md b/info.md index 615f995..0a774af 100644 --- a/info.md +++ b/info.md @@ -1,5 +1,7 @@ ## **Changelog** +### Version 1.41 +- Fix options error in HA 2023 ### Version 1.40 - Fix empty value bug for lighting attributes - Fix casting bug for elvehdte and batterly level