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

fix!: fix mixed case when URI_MAC=true #1399

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
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
fix!: fix mixed case when URI_MAC=true
When URI_MAC=true, value returned from function name_uri appends the 
MAC suffix as uppercase to an otherwise lowercase camera name (e.g., 
backyard-camera-ABCD). This results in "duplicate" MQTT endpoints; 
one with a lowercase and one with an uppercase MAC suffix, causing 
MQTT commands to fail. This fixes changes the function so that the 
return result will be entirely lowercase.

Resolves: #1382

BREAKING CHANGE: 

URI change to all lowercase for consistency with current conventions

Users whose config includes URI_MAC=true will need to update URIs
  • Loading branch information
unlifelike authored Dec 11, 2024
commit 51e85b8d6f7d5d939518eb95bb275eff32f5852c
3 changes: 2 additions & 1 deletion app/wyzecam/api_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,10 @@ def name_uri(self) -> str:
uri_sep = "-"
if os.getenv("URI_SEPARATOR") in {"-", "_", "#"}:
uri_sep = os.getenv("URI_SEPARATOR", uri_sep)
uri = clean_name(self.nickname or self.mac, uri_sep).lower()
uri = self.nickname or self.mac
if os.getenv("URI_MAC", "").lower() == "true" and (self.mac or self.parent_mac):
uri += uri_sep + (self.mac or self.parent_mac or "")[-4:]
uri = clean_name(uri, uri_sep).lower()
return uri

@property
Expand Down