Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PoC area mapping #415

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fresh start fixes
timon37 Tomasz Borowik committed Jan 20, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit f2c2e42916185376cab78d2fd87042c9dff96f20
8 changes: 6 additions & 2 deletions custom_components/bermuda/common/map.py
Original file line number Diff line number Diff line change
@@ -426,8 +426,12 @@ def bake_mean(self):
self.area_mean[area] = mean / count if count else 0
DBG('MEAN {} COUNT {} for {}', self.area_mean[area], count, area)

self.area_count_mean = statistics.mean(self.area_count.values())
self.area_mean_mean = statistics.mean(self.area_mean.values())
if self.area_count:
self.area_count_mean = statistics.mean(self.area_count.values())
self.area_mean_mean = statistics.mean(self.area_mean.values())
else:
self.area_count_mean = 0
self.area_mean_mean = 0
DBG('MEAN MEAN {} COUNT {}', self.area_mean_mean, self.area_count_mean)
# for area in self.areas:
# self.area_mean[area] = self.area_mean_mean / self.area_mean[area]
5 changes: 3 additions & 2 deletions custom_components/bermuda/coordinator.py
Original file line number Diff line number Diff line change
@@ -515,8 +515,9 @@ def _get_device(self, address: str) -> BermudaDevice | None:
mac = format_mac(address).lower()
# format_mac tries to return a lower-cased, colon-separated mac address.
# failing that, it returns the original unaltered.
if mac in self.devices:
return self.devices[mac]
if hasattr(self, devices):
if mac in self.devices:
return self.devices[mac]
return None

def _get_or_create_device(self, address: str) -> BermudaDevice: