fwestenberg / reolink_dev

Home Assistant Reolink addon
MIT License
550 stars 102 forks source link

Push notification state is always "on" - RLC410 and RLC423 #363

Closed a42wg closed 2 years ago

a42wg commented 2 years ago

Describe the bug Trying to make scenes for "home" and "away", when configuring the Push notification state to "off" it jumps back to "on" by itself

To Reproduce

  1. Changes of push notification state in the Reolink App will not be mirrored in the plug-in.
  2. Change Push notification state to off in the plug-in, it reverts to "on" by itself

Expected behavior Push notification state should be selected

Screenshots NA

Environment: Please provide useful information about your environment, like:

cpainchaud commented 2 years ago

Hello,

Is there any logs generated which you could share? You can enable more useful logs here: https://github.com/fwestenberg/reolink_dev/blob/master/TSHOOT.md

a42wg commented 2 years ago

Hello, I have tried to add the log-config to the configuration file, restarted the server and then tried to toggle the "Push notification" slider from "Devices". That did not generate any log statements at all. For what it worth I did a small video of the behavior. Doing that I noticed that other sliders also behaves odd. The "Recording" slider was shifted from on to off, it then shifted back to on by itself and then again back to off by itself and stayed there. The "Push notification" slider on the other hand is always "on no matter what state it actually have in the camera.

Is there any timeout settings I may need to configure?

https://user-images.githubusercontent.com/93745277/141870936-a3e28bfb-fd91-464b-8d4f-c48ed334a463.mp4

"

cpainchaud commented 2 years ago

please provide logs as requested earlier

a42wg commented 2 years ago

I tried, but no log entries was generated. Maybe because I just rebooted the HA server. Now I have reloaded customizations and it seems better. Got this during reload, I have 6 of those cameras and only one had some kind of problem here:

Logger: reolink.camera_api Source: /usr/local/lib/python3.9/site-packages/reolink/camera_api.py:1069 First occurred: 17:09:33 (4 occurrences) Last logged: 17:13:34

Host: 192.168.1.104: Failed to get results for Search, JSON data was was empty?

Logger: homeassistant.components.webhook Source: components/webhook/init.py:92 Integration: Webhook (documentation, issues) First occurred: 17:08:55 (106 occurrences) Last logged: 17:15:28

This was when I toggled the Push notification on 192.168.1.104 and it reverted to earlier state, camera ranges are IP 101..106:

Received message for unregistered webhook e793a8f58d7e316c48190366dd94e58978eec649c837bd65d3e22dacddda6415 from 192.168.1.104 Received message for unregistered webhook 0a35bae3cd40812692f203cdf7115a3384a650abf280bf0c60663e697cc65e34 from 192.168.1.105 Received message for unregistered webhook d7431984dd9233254a9319f1afa853fceb3ba5f16541595891369d8a10b40852 from 192.168.1.103

As earlier stated the Push notification switch does not work on any of the cameras.

reg Anders

cpainchaud commented 2 years ago

please try v0.38 and if it's still not working please provide extra logs according to https://github.com/fwestenberg/reolink_dev/blob/master/TSHOOT.md

a42wg commented 2 years ago

Hi, I have tried v0.38 and now the notification sliders are greyed out. I have tried to raise the log level as you asked for, but I am unsure what to expect. The only entry's I see in Configuration->Logs, which seems to relate to the cameras are these: Logger: homeassistant.helpers.service Source: helpers/service.py:130 First occurred: November 20, 2021, 23:00:00 (6 occurrences) Last logged: November 20, 2021, 23:00:00

Unable to find referenced entities switch.forhave_push_notifications Unable to find referenced entities switch.forhave2_push_notifications Unable to find referenced entities switch.garage_push_notifications Unable to find referenced entities switch.indgang_push_notifications Unable to find referenced entities switch.terrasse_push_notifications

/A

apiejka commented 2 years ago

Hi, same problem here since the v0.38 upgrade. The switch became undefined.

cpainchaud commented 2 years ago

Hi , please provide logs as requested or we can't help you

apiejka commented 2 years ago

Hi , please provide logs as requested or we can't help you

I have the same logs as a42wg :

2021-11-20 17:40:06 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities switch.rdc_push_notifications

cpainchaud commented 2 years ago

you are copy/pasting the logs summary. I want all logs since last time you start HA

a42wg commented 2 years ago

I will happily provide all the logs you want, but then you have to tell me where they are supposed to be. I have enabled logging as suggested earlier, but nothing seems to be written to the log I find in "Configurations/logs" - The entries I have pasted into this thread is all I get

cpainchaud commented 2 years ago

scroll down and hit that button "Load full home assistant logs": image

a42wg commented 2 years ago

OK I see. Now I have a new problem the log has grown to a size where Firefox nor Chrome are able to load it. I will clear the log and restart everything. hopefully that will produce a usable log

New to this, but you probably know that by now

reg Anders

a42wg commented 2 years ago

Hi, hope this will do it

home-assistant.zip

cpainchaud commented 2 years ago

Thank you,

Can you please get the output of the following URL on one of your buggy camera:

https://camera_ip/cgi-bin/api.cgi?cmd=GetPush&user=admin&password=password&channel=0

https://camera_ip/cgi-bin/api.cgi?cmd=GetPushV20&user=admin&password=password&channel=0

a42wg commented 2 years ago

https://camera_ip/cgi-bin/api.cgi?cmd=GetPush&user=admin&password=password&channel=0": [ { "cmd" : "GetPush", "code" : 0, "value" : { "Push" : { "schedule" : { "enable" : 1, "table" : "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" } } } } ]

https://camera_ip/cgi-bin/api.cgi?cmd=GetPushV20&user=admin&password=password&channel=0": [ { "cmd" : "Unknown", "code" : 1, "error" : { "detail" : "not support", "rspCode" : -9 } } ]

cpainchaud commented 2 years ago

wow ... Reolink is not following its own API standards, API version=1 is supposed to use GetPushV20 which is not available on your camera as it's using API version=0 instead ....

cpainchaud commented 2 years ago

waiting for them to tell us how this is working:

https://www.reddit.com/r/reolinkcam/comments/qzkhwk/about_api_versions_and_their_respect_on_each_model/

a42wg commented 2 years ago

Ok, just read your post, seems you have been there before :-)

reg Anders

cpainchaud commented 2 years ago

yeah , I have changed the code dozen times toward what I thought was the solution based on my observations, they're really annoying with their inconsistencies.

apiejka commented 2 years ago

I have a RLC-520-5MP but since my last restart I don't have anymore logs about the camera... But the push notifications button is still greyed out. I tried to cold reboot the host or reload the HACs plugin. Still no info inside logs...

cpainchaud commented 2 years ago

https://camera_ip/cgi-bin/api.cgi?cmd=GetPushV20&user=admin&password=password&channel=0

What is the output of this command?

apiejka commented 2 years ago

I will try when I get back home :). My camera is on my LAN.

apiejka commented 2 years ago

here are the results for both urls : https://camera_ip/cgi-bin/api.cgi?cmd=GetPush&user=admin&password=password&channel=0

[ { "cmd" : "GetPush", "code" : 0, "value" : { "Push" : { "schedule" : { "enable" : 1, "table" : "111111110000000000000000111111111111111111000000111111111111111111000000111111111111111111000000111111111111111111000000111111111111111111000000111111110000000000000000" } } } } ]

https://camera_ip/cgi-bin/api.cgi?cmd=GetPushV20&user=admin&password=password&channel=0

[ { "cmd" : "Unknown", "code" : 1, "error" : { "detail" : "not support", "rspCode" : -9 } } ]

cpainchaud commented 2 years ago

I fear you are facing the same issue. Please downgrade to earlier versions until we get an answer from Reolink

apiejka commented 2 years ago

Yes, that's what I thought. No need to downgrade because with the v0.37 the push notifications switch was not working (not greyed out but is has no effect on the option in reolink app). I will wait until a fix will enventually be released :) .

cpainchaud commented 2 years ago

Yes, that's what I thought. No need to downgrade because with the v0.37 the push notifications switch was not working (not greyed out but is has no effect on the option in reolink app). I will wait until a fix will enventually be released :) .

This behavior is normal, the toggle switch in your phone app concerns only your phone (it's a pairing process with Google APIs). The toggle switch in this integration is a Master switch, it goes on top/as an additional switch. The Master switch is not available in phone app

apiejka commented 2 years ago

oh, ok, I didn't see it like that. Thanks for the precision. I thought the switch enable or disable the phone notifications.

cpainchaud commented 2 years ago

just added to https://github.com/fwestenberg/reolink_dev/blob/master/TSHOOT.md

a42wg commented 2 years ago

I was not aware of the master switch either, but the UI control in HA should still mirror the state of the master switch right?

Is it the master switch I see if I login to the camera from a browser? or is there a way to get the state of the "master switch" from outside HA.

cpainchaud commented 2 years ago

I was not aware of the master switch either, but the UI control in HA should still mirror the state of the master switch right? in HA we mirror the master switch state, it is the only one we have access to.

Is it the master switch I see if I login to the camera from a browser? or is there a way to get the state of the "master switch" from outside HA. the Camera HTTP UI doesn't expose the master switch as far as I know, it's only available through API

My own home system has been using Master push toggle for a while without issues. On my phone and my wife's the phone push toggle is always On and my automation only plays with the master switch depending if we are home on not

cpainchaud commented 2 years ago

Reolink dev answers from their own words: https://www.reddit.com/r/reolinkcam/comments/qzkhwk/about_api_versions_and_their_respect_on_each_model/hmr3z5n/?context=3 Usually the model with the letter "a" supports v20, and the model without a supports the previous one. Sorry to trouble you, we will improve this. You have to know that wyze even charges for the use of cgi and web terminals. We will continue to optimize the cgi system, but we are short of manpower. Thank you very much for your support.

Translates to : firmware code is so messy we can't even tell you how it works. Go figure out and good luck!

cpainchaud commented 2 years ago

@a42wg please try v0.39

a42wg commented 2 years ago

You did figure it out - The push notification switch now works.

Thanks br Anders