fwestenberg / reolink_dev

Home Assistant Reolink addon
MIT License
553 stars 101 forks source link

RLC-820A Pet motion sensor not working #512

Open craggyh opened 2 years ago

craggyh commented 2 years ago

The "Pet" binary motion sensor doesn't work with 820A cameras on latest firmware. I get IOS notifications from the Reolink mobile app when a pet is detected but the motion sensor in HA never fires.

GewoonRoy commented 2 years ago

@craigueh What type of camera are you using, what firmware does your camera have and what does your json look like when you open the url:

http://`{your_camera_ip}`/api.cgi?cmd=getAiState&user=`{your_username}`&password=`{your_password}`

craggyh commented 2 years ago

Here's the relevant camera info:

and here's the json output:

[ { "cmd" : "GetAiState", "code" : 0, "value" : { "channel" : 0, "dog_cat" : { "alarm_state" : 0, "support" : 1 }, "face" : { "alarm_state" : 0, "support" : 0 }, "people" : { "alarm_state" : 0, "support" : 1 }, "vehicle" : { "alarm_state" : 0, "support" : 1 } } } ]

On Fri, Jun 3, 2022 at 7:41 AM GewoonRoy @.***> wrote:

@craigueh https://github.com/craigueh What type of camera are you using, what firmware does your camera have and what does your json look like when you open the url:

http://{your_camera_ip}/api.cgi?cmd=getAiState&user={your_username} &password={your_password}

— Reply to this email directly, view it on GitHub https://github.com/fwestenberg/reolink_dev/issues/512#issuecomment-1145638294, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALSWGIVXAOMGBTXBXEL4UPDVNGSIHANCNFSM5XVDJXUQ . You are receiving this because you were mentioned.Message ID: @.***>

GewoonRoy commented 2 years ago

Okay, well your json seems correct. I'm assuming that the sensor doesn't listen to "dog_cat" and there needs to be an update. But i might be wrong. Someone with more knowledge of python or the scripts of reolink_dev might help more.

craggyh commented 2 years ago

I managed to fix this by making the following changes to base.py and binary_sensor.py

base.py line 134. Add the following: self.object_pet_detection_state = True

binary_sensor.py line 33. Change to: base.sensor_pet_detection = ObjectDetectedSensor(hass, config_entry, "dog_cat")

line 218. Change to: if self._object_type == "dog_cat":

Restart Homeassistant and you should now have working pet detection sensors.

skynet01 commented 2 years ago

Would be awesome to include this in the next release :)

stalakerob commented 1 year ago

Works for me too. Be aware that the sensor name changes to binary_sensor.(your camera name)_dog_cat_detected

craggyh commented 1 year ago

Can we get this fix added to the official release? It's a real nuisance having to edit the files to apply the fix every time the component is updated.

1danielsan commented 1 year ago

Yes, would be fantastic if been added to the next official release... Thank you very much

techolutions commented 1 year ago

I made a pull request: #579

skynet01 commented 1 year ago

JimStar's version fixed this issue for me, along with other things https://github.com/JimStar/reolink_cctv