Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fixed combined trackers
Browse files Browse the repository at this point in the history
  • Loading branch information
formatBCE committed Aug 27, 2022
1 parent 61ace19 commit 4205682
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions custom_components/format_ble_tracker/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
ENTITY_ID = "entity_id"
NEW_STATE = "new_state"
MERGE_LOGIC = "merge_logic"
AWAY_WHEN_OR = "away_when_or"
AWAY_WHEN_AND = "away_when_and"
AWAY_WHEN_OR = "home_when_and"
AWAY_WHEN_AND = "home_when_or"
5 changes: 2 additions & 3 deletions custom_components/format_ble_tracker/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def _async_state_changed_listener(event: Event) -> None:
self.on_state_changed(
event.data[ENTITY_ID], event.data[NEW_STATE].state
)
self.async_write_ha_state()

self.async_on_remove(
async_track_state_change_event(
Expand All @@ -132,7 +133,7 @@ def on_state_changed(self, entity_id, new_state):
"""Calculate new state."""
self.states[entity_id] = new_state
states = self.states.values()
if STATE_HOME not in states and STATE_NOT_HOME not in states:
if None in states:
self.merged_state = STATE_UNKNOWN
else:
if self.logic == AWAY_WHEN_OR:
Expand All @@ -145,8 +146,6 @@ def on_state_changed(self, entity_id, new_state):
self.merged_state = STATE_HOME
else:
self.merged_state = STATE_NOT_HOME
self.async_write_ha_state()


@property
def extra_state_attributes(self):
Expand Down
2 changes: 1 addition & 1 deletion custom_components/format_ble_tracker/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"domain": "format_ble_tracker",
"name": "Format BLE Tracker",
"version": "0.0.6",
"version": "0.0.7",
"config_flow": true,
"documentation": "https://github.com/formatBCE/Format-BLE-Tracker/blob/main/README.md",
"issue_tracker": "https://github.com/formatBCE/Format-BLE-Tracker/issues",
Expand Down

0 comments on commit 4205682

Please sign in to comment.