SecKatie / ha-wyzeapi

Home Assistant Integration for Wyze devices.
733 stars 112 forks source link

[Bug] unauthorized operation error #543

Closed djlactose closed 5 months ago

djlactose commented 6 months ago

Describe the bug I am getting an unauthorized operations when I attempt to use automations with that contain the wyze integration. The issue started yesterday. This halts the entire automation.

To Reproduce Steps to reproduce the behavior:

  1. Run my automation with the wyze integration

Expected behavior Automation continues to run without error taking place.

System configuration System: docker HA Version: 2024.1.6 WyzeApi Version: 0.1.23

home-assistant.log

[home-assistant_wyzeapi_2024-02-02T22-24-08.145Z.log](https://github.com/SecKatie/ha-wyzeapi/files/14146121/home-assistant_wyzeapi_2024-02-02T22-24-08.145Z.log)
brg468 commented 6 months ago

I’m getting it too, seems to only be happening with the camera notification switch.

brg468 commented 6 months ago

What’s odd is that it still performs the action (switch on/off) but throws the error.

brg468 commented 6 months ago

Was able to fix this by changing the endpoint that the notification switch uses. I'll open a PR

neilbrookins commented 6 months ago

In my automation the action section toggles the camera notifications on. Then the next action in the same automation doesn’t run because of the error. Is this expected behavior? Should an error stop processing of the next action which is able to run because it’s not related to the prior error? I’m differentiating between continue on error vs stop on error. I can see either choice as valid depending on the situation.

brg468 commented 6 months ago

Yes this is expected, as described here https://www.home-assistant.io/docs/scripts/#continuing-on-error

My understanding is continue_on_error only works on errors that are some sort of HA error, not uncaught exceptions like this.

drewkeller commented 5 months ago

How can I update this into my HA? I found the wyzeapi in config/custom_components/wyzeapi. The binary_sensor.py has an import from wyzeapy.services.camera_service, but I think that must be in the python site-packages in the HA docker image. I don't know how to update that. Or maybe there is a clever way to override it in wyzeapi binary_sensor?

brg468 commented 5 months ago

It needs to be updated in camera_services, which like you suspected is found in site-packages. The easiest way to temporarily update is to actually download the wyzeapy folder from git and put it into your config folder. Since the PR was merged, you can grab the main branch from the wyzeapy repo, download, and put it into your config folder and restart. That should take care of it for now, just remember to delete it later on or it will never update any further. Its getting pretty hard getting updates to this integration published lately, so this is the best I can offer.

drewkeller commented 5 months ago

Excellent, thank you for this :) What worked was extracting the "wyzeapy" folder out of the zip file and putting it directly in the config folder, so that it is a sibling to the infamous configuration.yaml file.