Skip to content

Commit

Permalink
Merge pull request #57 from itchannel/1.0.10-Update
Browse files Browse the repository at this point in the history
1.10 update
  • Loading branch information
itchannel authored Dec 12, 2020
2 parents cf8c3fd + ba0de64 commit 9965ac2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
8 changes: 7 additions & 1 deletion custom_components/fordpass/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@
from . import FordPassEntity
from .const import DOMAIN

_LOGGER = logging.getLogger(__name__)


async def async_setup_entry(hass, config_entry, async_add_entities):
"""Add the Entities from the config."""
entry = hass.data[DOMAIN][config_entry.entry_id]

async_add_entities([CarTracker(entry, "gps")], True)
# Added a check to see if the car supports GPS
if entry.data["gps"] != None:
async_add_entities([CarTracker(entry, "gps")], True)
else:
_LOGGER.debug("Vehicle does not support GPS")


class CarTracker(FordPassEntity, TrackerEntity):
Expand Down
9 changes: 8 additions & 1 deletion custom_components/fordpass/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def get_value(self, ftype):
elif self.sensor == "tirePressure":
return self.coordinator.data[self.sensor]["value"]
elif self.sensor == "gps":
if self.coordinator.data[self.sensor] == None:
return "Unsupported"
return self.coordinator.data[self.sensor]["gpsState"]
elif self.sensor == "alarm":
return self.coordinator.data[self.sensor]["value"]
Expand All @@ -64,7 +66,10 @@ def get_value(self, ftype):
if self.coordinator.data[self.sensor] == None:
return "Unsupported"
for key, value in self.coordinator.data[self.sensor].items():
if value["value"] != "Fully_Closed":
if (
value["value"] != "Fully_Closed"
or value["value"] != "Fully_closed_position"
):
return "Open"
return "Closed"
elif self.sensor == "lastRefresh":
Expand Down Expand Up @@ -151,6 +156,8 @@ def get_value(self, ftype):
}
return None
elif self.sensor == "gps":
if self.coordinator.data[self.sensor] == None:
return None
return self.coordinator.data[self.sensor].items()
elif self.sensor == "alarm":
return self.coordinator.data[self.sensor].items()
Expand Down
5 changes: 5 additions & 0 deletions info.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@

# **Changelog**
### Version 1.10
- Fixed door open bug 2.0 (New position value)
- Added a check to see if a vehicle supports GPS before adding the entity


### Version 1.09
- Added individual TMPS Support
- Fixed door open bug
Expand Down

0 comments on commit 9965ac2

Please sign in to comment.