Skip to content

Commit

Permalink
Merge pull request #55 from sbabcock23/connectedTo
Browse files Browse the repository at this point in the history
Connected to
  • Loading branch information
sbabcock23 authored Aug 26, 2022
2 parents c6efe75 + 59b36f7 commit 3a96c76
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ Turns on the collar light after dark if the pet is not home.
* Enable possibility of if pet not home and not with owner then trigger lost dog mode

# Version History
## 0.0.17
* Enhancement - added the attribute ConnectedTo which will determine if the pet is connected to a person, base, etc.
* Fix - base data was not updating. This issue is resolved.
## 0.0.16
* Enhancement - requested to add the attributes Activity Type, Current Place Name and Current Place Address.
## 0.0.15
Expand Down
2 changes: 1 addition & 1 deletion custom_components/tryfi/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"domain": "tryfi",
"name": "TryFi",
"version": "0.0.16",
"version": "0.0.17",
"config_flow": true,
"documentation": "https://github.com/sbabcock23/hass-tryfi",
"issue_tracker": "https://github.com/sbabcock23/hass-tryfi/issues",
Expand Down
10 changes: 7 additions & 3 deletions custom_components/tryfi/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ async def async_setup_entry(hass, config_entry, async_add_devices):
new_devices.append(PetGenericSensor(hass, pet, coordinator, "Activity Type"))
new_devices.append(PetGenericSensor(hass, pet, coordinator, "Current Place Name"))
new_devices.append(PetGenericSensor(hass, pet, coordinator, "Current Place Address"))
new_devices.append(PetGenericSensor(hass, pet, coordinator, "Connected To"))


for base in tryfi.bases:
LOGGER.debug(f"Adding Base: {base}")
Expand Down Expand Up @@ -76,9 +78,7 @@ def baseId(self):

@property
def base(self):
# FIX - need to update interface with getbase class
#return self.coordinator.data.bases[0]
return self._base
return self.coordinator.data.getBase(self.baseId)

@property
def device_id(self):
Expand Down Expand Up @@ -167,6 +167,8 @@ def icon(self):
return "mdi:earth"
elif self.statType == "Current Place Address":
return "mdi:map-marker"
elif self.statType == "Connected To":
return "mdi:human-greeting-proximity"

@property
def state(self):
Expand All @@ -176,6 +178,8 @@ def state(self):
return self.pet.getCurrPlaceName()
elif self.statType == "Current Place Address":
return self.pet.getCurrPlaceAddress()
elif self.statType == "Connected To":
return self.pet.device.connectionStateType
@property
def unit_of_measurement(self):
return None
Expand Down

0 comments on commit 3a96c76

Please sign in to comment.