Skip to content

Commit

Permalink
fix!: fix mixed case when URI_MAC=true
Browse files Browse the repository at this point in the history
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: mrlt8#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
1 parent bf89374 commit 51e85b8
Showing 1 changed file with 2 additions and 1 deletion.
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

0 comments on commit 51e85b8

Please sign in to comment.