-
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from itchannel/active_dev
Active dev
- Loading branch information
Showing
9 changed files
with
161 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import logging | ||
from datetime import timedelta | ||
|
||
from homeassistant.components.device_tracker import SOURCE_TYPE_GPS | ||
from homeassistant.components.device_tracker.config_entry import TrackerEntity | ||
|
||
from . import FordPassEntity | ||
from .const import DOMAIN | ||
|
||
|
||
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) | ||
|
||
|
||
class CarTracker(FordPassEntity, TrackerEntity): | ||
def __init__(self, coordinator, sensor): | ||
|
||
self._attr = {} | ||
self.sensor = sensor | ||
self.coordinator = coordinator | ||
self._device_id = "fordpass_tracker" | ||
|
||
@property | ||
def latitude(self): | ||
return float(self.coordinator.data[self.sensor]["latitude"]) | ||
|
||
@property | ||
def longitude(self): | ||
return float(self.coordinator.data[self.sensor]["longitude"]) | ||
|
||
@property | ||
def source_type(self): | ||
return SOURCE_TYPE_GPS | ||
|
||
@property | ||
def name(self): | ||
return "fordpass_tracker" | ||
|
||
@property | ||
def device_id(self): | ||
return self.device_id | ||
|
||
@property | ||
def device_state_attributes(self): | ||
return self.coordinator.data[self.sensor].items() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,33 @@ | ||
{ | ||
"title": "FordPass", | ||
"config": { | ||
"step": { | ||
"user": { | ||
"data": { | ||
"vin": "VIN", | ||
"username": "FordPass Username (Email)", | ||
"password": "FordPass Password" | ||
} | ||
"title": "FordPass", | ||
"config": { | ||
"step": { | ||
"user": { | ||
"data": { | ||
"vin": "VIN", | ||
"username": "FordPass Username (Email)", | ||
"password": "FordPass Password" | ||
} | ||
}, | ||
"error": { | ||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", | ||
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]", | ||
"unknown": "[%key:common::config_flow::error::unknown%]" | ||
}, | ||
"abort": { | ||
"already_configured": "[%key:common::config_flow::abort::already_configured_account%]" | ||
} | ||
}, | ||
"error": { | ||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", | ||
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]", | ||
"unknown": "[%key:common::config_flow::error::unknown%]" | ||
}, | ||
"abort": { | ||
"already_configured": "[%key:common::config_flow::abort::already_configured_account%]" | ||
} | ||
}, | ||
"options": { | ||
"step": { | ||
"init": { | ||
"data": { | ||
"units": "Unit of Measurement" | ||
}, | ||
"description": "Configure fordpass options" | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters