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

BUG: URI_MAC attribute causing multiple MQTT endpoints #1382

Open
unlifelike opened this issue Nov 11, 2024 · 0 comments · May be fixed by #1399
Open

BUG: URI_MAC attribute causing multiple MQTT endpoints #1382

unlifelike opened this issue Nov 11, 2024 · 0 comments · May be fixed by #1399
Labels
bug Something isn't working

Comments

@unlifelike
Copy link

Describe the bug

Setting the attribute URI_MAC to true results in extra MQTT endpoints for each camera: one with the MAC in uppercase, and one in lowercase, with each getting assigned only some of the available topics.

image

I'm not sure if this is directly related, or whether it should be 2 separate issues, but in my case, this appears to result in problems sending SET commands to cameras. I was able to see the various properties in my HA controls, and they would respond appropriately to changes made elsewhere (e.g., in the Wyze app, I could turn the status light off/on, and the toggle switch in HA would reflect that change), but I wasn't able to change anything via MQTT. Flipping a toggle would immediately revert to what it was before, even though I could see on MQTT Explorer that the publish command was sent to the broker. Additionally, I wasn't able to manually publish SET commands. I tried on both MQTT Explorer, and using mosquitto_pub locally on the broker CLI.

Strangely, this "secondary" issue only presented with local cameras. I also have a couple of cameras that are shared with me, and with those, I was able to issue SET commands just fine (even though I was still seeing the duplicate endpoints for those as well). The whole reason I had this setting enabled in the first place is because the name of one of those shared cameras conflicts with one of mine.

Another observation was that when attempting to change a property of a local (not working) camera, nothing appeared in the log, as if nothing was even attempted. When changing a property of a shared (working) camera, relevant entries did appear in the log, as such:

[front-porch-cam] [CONTROL] Attempting to SET: status_light=1
[front-porch-cam] [CONTROL] response=1
[front-porch-cam] [CONTROL] Attempting to SET: status_light=2
[front-porch-cam] [CONTROL] response=1

Steps to replicate:

  1. Set URI_MAC to true
  2. Connect to broker with MQTT Explorer (or admin tool of choice) and observe the "duplicate" endpoints
  3. Attempt to toggle the camera status light:
    • Using the toggle switch in HA (assuming the device was picked up in discovery)
    • Sending a manual SET command in MQTT Explorer
    • Sending a manual SET command from the CLI (e.g., mosquitto_pub)
  4. Observe in MQTT Explorer that the broker does receive the command from all test methods, but the property does not change.
  5. Repeat the previous tests with a shared camera. The property should change.
  6. Set URI_MAC to false
  7. Repeat the tests. Note the lack of duplicate names in MQTT Explorer. All tests should now function properly.

Other things I tried before getting to this point:

  • Downgraded firmware on local camera to match that of a shared camera. No change.
  • Set up a different broker. My current one runs in a separate docker container. I disabled this and ran the HA addon. No change.
  • Set allow_anonymous in mosquitto.conf to true. No change.
  • Set WB_AUTH to false. No change.
  • Sent manual SET command to both the upper and lowercase endpoints. No difference.

Loving this project, thank you for everything you do! Let me know if you have any questions.

Affected Bridge Version

2.10.3

Bridge type

Home Assistant

Affected Camera(s)

No response

Affected Camera Firmware

No response

docker-compose or config (if applicable)

ENABLE_AUDIO: true
ON_DEMAND: false
WB_AUTH: true
MOTION_API: true
MQTT: true
CAM_OPTIONS: []
URI_MAC: true
FILTER_BLOCK: true
FILTER_MACS: <redacted>
MOTION_START: true
SUBSTREAM: false
WYZE_EMAIL: "!secret wyze_email"
WYZE_PASSWORD: "!secret wyze_password"
API_ID: "!secret wyze_api_id"
API_KEY: "!secret wyze_api_key"
MQTT_HOST: 192.168.1.12:1883
MQTT_AUTH: "!secret mqtt_auth"
MQTT_DTOPIC: homeassistant
DISABLE_CONTROL: false
LOG_FILE: false
@unlifelike unlifelike added the bug Something isn't working label Nov 11, 2024
unlifelike added a commit to unlifelike/docker-wyze-bridge that referenced this issue Dec 11, 2024
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
@unlifelike unlifelike linked a pull request Dec 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant