Skip to content

Commit

Permalink
Merge pull request #14 from sbabcock23/feature/multiplebases
Browse files Browse the repository at this point in the history
added additional logging and fixed base issue for issue #2
  • Loading branch information
sbabcock23 authored Dec 29, 2020
2 parents 46a47e3 + 0f6896c commit 9acd6ed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ 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.3
* Multiple bases fix
## 0.0.2
* Documentation updates
## 0.0.1
Expand Down
7 changes: 6 additions & 1 deletion custom_components/tryfi/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,16 @@ async def async_setup_entry(hass, config_entry, async_add_devices):

new_devices = []
for pet in tryfi.pets:
LOGGER.debug(f"Adding Pet Battery Sensor: {pet}")
new_devices.append(TryFiBatterySensor(hass, pet, coordinator))
for statType in SENSOR_STATS_BY_TYPE:
for statTime in SENSOR_STATS_BY_TIME:
LOGGER.debug(f"Adding Pet Stat: {pet}")
new_devices.append(
PetStatsSensor(hass, pet, coordinator, statType, statTime)
)
for base in tryfi.bases:
LOGGER.debug(f"Adding Base: {base}")
new_devices.append(TryFiBaseSensor(hass, base, coordinator))
if new_devices:
async_add_devices(new_devices)
Expand All @@ -47,6 +50,7 @@ class TryFiBaseSensor(CoordinatorEntity, Entity):
def __init__(self, hass, base, coordinator):
self._hass = hass
self._baseId = base.baseId
self._base = base
super().__init__(coordinator)

@property
Expand All @@ -66,7 +70,8 @@ def baseId(self):
@property
def base(self):
# FIX - need to update interface with getbase class
return self.coordinator.data.bases[0]
#return self.coordinator.data.bases[0]
return self._base

@property
def device_id(self):
Expand Down

0 comments on commit 9acd6ed

Please sign in to comment.