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

Commit 4205682

Browse files
committed
Fixed combined trackers
1 parent 61ace19 commit 4205682

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

custom_components/format_ble_tracker/const.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717
ENTITY_ID = "entity_id"
1818
NEW_STATE = "new_state"
1919
MERGE_LOGIC = "merge_logic"
20-
AWAY_WHEN_OR = "away_when_or"
21-
AWAY_WHEN_AND = "away_when_and"
20+
AWAY_WHEN_OR = "home_when_and"
21+
AWAY_WHEN_AND = "home_when_or"

custom_components/format_ble_tracker/device_tracker.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ def _async_state_changed_listener(event: Event) -> None:
121121
self.on_state_changed(
122122
event.data[ENTITY_ID], event.data[NEW_STATE].state
123123
)
124+
self.async_write_ha_state()
124125

125126
self.async_on_remove(
126127
async_track_state_change_event(
@@ -132,7 +133,7 @@ def on_state_changed(self, entity_id, new_state):
132133
"""Calculate new state."""
133134
self.states[entity_id] = new_state
134135
states = self.states.values()
135-
if STATE_HOME not in states and STATE_NOT_HOME not in states:
136+
if None in states:
136137
self.merged_state = STATE_UNKNOWN
137138
else:
138139
if self.logic == AWAY_WHEN_OR:
@@ -145,8 +146,6 @@ def on_state_changed(self, entity_id, new_state):
145146
self.merged_state = STATE_HOME
146147
else:
147148
self.merged_state = STATE_NOT_HOME
148-
self.async_write_ha_state()
149-
150149

151150
@property
152151
def extra_state_attributes(self):

custom_components/format_ble_tracker/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"domain": "format_ble_tracker",
33
"name": "Format BLE Tracker",
4-
"version": "0.0.6",
4+
"version": "0.0.7",
55
"config_flow": true,
66
"documentation": "https://github.com/formatBCE/Format-BLE-Tracker/blob/main/README.md",
77
"issue_tracker": "https://github.com/formatBCE/Format-BLE-Tracker/issues",

0 commit comments

Comments
 (0)