rroller / dahua

Dahua Camera and Doorbell Home Assistant Integration
MIT License
383 stars 74 forks source link

Control Floodlight - Amcrest ASH26-W #151

Open mpjanofsky opened 2 years ago

mpjanofsky commented 2 years ago

Is your feature request related to a problem? Please describe. The Illuminator option doesn't appear in Home Assistant for the Amcrest ASH26-W

Describe the solution you'd like I'd like to be able to control the floodlight on the Amcrest ASH26-W via this integration

mpjanofsky commented 2 years ago

Trying to find out if it's possible to control the floodlight on the Amcrest ASH26-W via this integration. I'd like to be able to disable it via automations in Home Assistant.

itkfilelor commented 2 years ago

@rroller added it a few releases ago, but I can't seem to get mine working. Also can't get the ROL working on my AD110 Doorbell. Everything else [appears] flawless.

EDIT (2/17/22): AD110 ROL is working with the newest updates. Still not getting the floodlight =(

itkfilelor commented 2 years ago

Just submitted a PR (#167) to support ASH26

mpjanofsky commented 2 years ago

@itkfilelor Awesome, thanks!

rroller commented 2 years ago

This was released in https://github.com/rroller/dahua/releases/tag/0.9.40

mschingel commented 1 year ago

Can you add the ability to turn on Manual Mode. This is the Only way for the light to function, by first changing the it into Manual mode first. Or change ability to alter the auto off. Otherwise you turn the light on and in seconds it turns right back off. When you switch the it from Manual mode I believe it defaults to stay on much longer default 1/2 Hr.

If you at min add in the duration of the light to stay on, I can setup automation for when the light is switch also alter the duration.

itkfilelor commented 1 year ago

I'll look at it when a get a few minutes. I already had manual mode set via curl before hand.

mschingel commented 1 year ago

I tired using curl and it never worked. I saw others having issues where curls for certain people just didnt work.

On Wed, Nov 9, 2022 at 11:16 AM itkfilelor @.***> wrote:

I'll look at it when a get a few minutes. I already had manual mode set via curl before hand.

— Reply to this email directly, view it on GitHub https://github.com/rroller/dahua/issues/151#issuecomment-1309003786, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2CAJZ23QEH2UOCYZ7PXNVTWHPE5XANCNFSM5MZ2XTWQ . You are receiving this because you commented.Message ID: @.***>

mschingel commented 1 year ago

https://github.com/tchellomello/python-amcrest/issues/161#issuecomment-1284755052

This is a compare of the configs using manual

On Wed, Nov 9, 2022 at 11:19 AM Matt Schingel @.***> wrote:

I tired using curl and it never worked. I saw others having issues where curls for certain people just didnt work.

On Wed, Nov 9, 2022 at 11:16 AM itkfilelor @.***> wrote:

I'll look at it when a get a few minutes. I already had manual mode set via curl before hand.

— Reply to this email directly, view it on GitHub https://github.com/rroller/dahua/issues/151#issuecomment-1309003786, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2CAJZ23QEH2UOCYZ7PXNVTWHPE5XANCNFSM5MZ2XTWQ . You are receiving this because you commented.Message ID: @.***>

mschingel commented 1 year ago

I'll look at it when a get a few minutes. I already had manual mode set via curl before hand.

Thanks you. @itkfilelor

I went to use manual mode. When I turn on the light it’s light brightness isn’t at 100%. It flickers badly. Can you possibly maybe just have it as an on off vs the Brightness adjustment. I had to switch it back to motion because the light was flickering at 100% which I can see now it’s just not actually at top brightness. Thanks

itkfilelor commented 1 year ago

I'll look at it when a get a few minutes. I already had manual mode set via curl before hand.

Thanks you. @itkfilelor

I went to use manual mode. When I turn on the light it’s light brightness isn’t at 100%. It flickers badly. Can you possibly maybe just have it as an on off vs the Brightness adjustment. I had to switch it back to motion because the light was flickering at 100% which I can see now it’s just not actually at top brightness. Thanks

Sorry this took forever. Too many kids, too many projects. I took a look back at my scribbles, manual mode is already set when switching the light: 'Manual' == 'On' 'Off' == 'Off' You may first need to switch the mode via the app under "Floodlight Setting" to manual, there you can set the time out as well. Personally, I have mine set to the minimum (30mins) in case HA hiccups. Switching the mode outside of the app itself is not recommended, it does not play well with the device, probably a code error within the light itself. Change it in the app and all should be fine from there.

As for the brightness, I noticed I was being a dummy when I added support originally and was sending the command to the incorrect endpoint, which is why nothing happened, and I scrapped it entirely as a bad job. I also don't recommend anything over 85% of below 15% (i think, been a while since I played with the brightness) because of the flicker issue and higher power will hasten the death of your LEDs. Mine is set at 50% and is plenty bright enough. My mother complains everytime she stops by after dark. ( The better to keep her away.. ha ha)

I am working it out now. And will report back as soon as I have something I am satisfied with. Should be in the next day or two barring disaster.

itkfilelor commented 1 year ago

I'll look at it when a get a few minutes. I already had manual mode set via curl before hand.

Thanks you. @itkfilelor I went to use manual mode. When I turn on the light it’s light brightness isn’t at 100%. It flickers badly. Can you possibly maybe just have it as an on off vs the Brightness adjustment. I had to switch it back to motion because the light was flickering at 100% which I can see now it’s just not actually at top brightness. Thanks

Sorry this took forever. Too many kids, too many projects. I took a look back at my scribbles, manual mode is already set when switching the light: 'Manual' == 'On' 'Off' == 'Off' You may first need to switch the mode via the app under "Floodlight Setting" to manual, there you can set the time out as well. Personally, I have mine set to the minimum (30mins) in case HA hiccups. Switching the mode outside of the app itself is not recommended, it does not play well with the device, probably a code error within the light itself. Change it in the app and all should be fine from there.

As for the brightness, I noticed I was being a dummy when I added support originally and was sending the command to the incorrect endpoint, which is why nothing happened, and I scrapped it entirely as a bad job. I also don't recommend anything over 85% of below 15% (i think, been a while since I played with the brightness) because of the flicker issue and higher power will hasten the death of your LEDs. Mine is set at 50% and is plenty bright enough. My mother complains everytime she stops by after dark. ( The better to keep her away.. ha ha)

I am working it out now. And will report back as soon as I have something I am satisfied with. Should be in the next day or two barring disaster.

So I got some time to actually test it. And the results are crap to put it simply. The only reliable results were to set the LightingV2[channel][profile][1].NearLight=50 and AlarmLighting[0][0].Attribute.Brightness to 100 Anything else caused flickering or no light or just no decernable change. So unfortunately, there isn't anything I can really do about it. What I will do, is hardcode the brightness values which should solve for those who can't get it working.

mschingel commented 1 year ago

Thank you, for now I don’t see the light flickering so maybe a prior firmware was causing the issue or outside environment.

These Amcrest cameras are finiky it seems. I think the hard code for brightness will help now and later down the road.

On Mon, Feb 6, 2023 at 8:43 PM itkfilelor @.***> wrote:

I'll look at it when a get a few minutes. I already had manual mode set via curl before hand.

Thanks you. @itkfilelor https://github.com/itkfilelor I went to use manual mode. When I turn on the light it’s light brightness isn’t at 100%. It flickers badly. Can you possibly maybe just have it as an on off vs the Brightness adjustment. I had to switch it back to motion because the light was flickering at 100% which I can see now it’s just not actually at top brightness. Thanks

Sorry this took forever. Too many kids, too many projects. I took a look back at my scribbles, manual mode is already set when switching the light: 'Manual' == 'On' 'Off' == 'Off' You may first need to switch the mode via the app under "Floodlight Setting" to manual, there you can set the time out as well. Personally, I have mine set to the minimum (30mins) in case HA hiccups. Switching the mode outside of the app itself is not recommended, it does not play well with the device, probably a code error within the light itself. Change it in the app and all should be fine from there.

As for the brightness, I noticed I was being a dummy when I added support originally and was sending the command to the incorrect endpoint, which is why nothing happened, and I scrapped it entirely as a bad job. I also don't recommend anything over 85% of below 15% (i think, been a while since I played with the brightness) because of the flicker issue and higher power will hasten the death of your LEDs. Mine is set at 50% and is plenty bright enough. My mother complains everytime she stops by after dark. ( The better to keep her away.. ha ha)

I am working it out now. And will report back as soon as I have something I am satisfied with. Should be in the next day or two barring disaster.

So I got some time to actually test it. And the results are crap to put it simply. The only reliable results were to set the LightingV2[channel][profile][1].NearLight=50 and AlarmLighting[0][0].Attribute.Brightness to 100 Anything else caused flickering or no light or just no decernable change. So unfortunately, there isn't anything I can really do about it. What I will do, is hardcode the brightness values which should solve for those who can't get it working.

— Reply to this email directly, view it on GitHub https://github.com/rroller/dahua/issues/151#issuecomment-1420045768, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2CAJZYFHPU5OEFCZJ5PRZ3WWGSDLANCNFSM5MZ2XTWQ . You are receiving this because you commented.Message ID: @.***>

itkfilelor commented 1 year ago

Thank you, for now I don’t see the light flickering so maybe a prior firmware was causing the issue or outside environment. These Amcrest cameras are finiky it seems. I think the hard code for brightness will help now and later down the road.

As I stated in your other thread, I may have found a working way to toggle smart and manual mode. Running out of time for the night, and the neighbors are going to start thinking I am crazy with my light going on and off lol. I may have to take my laptop outside this weekend and give it a go during the day.

mschingel commented 1 year ago

That would be great!

d0u8l3m commented 1 year ago

Hello! Thanks for your work on this, I'm having a weird issue though. I have 3 of these around my house and had them all working fine for about a week. Two are still good, but one now has either the flickering issue or just doesn't respond/turn on at all.

I have them all set to manual in the app, and can control that one's light with the app fine.

I can turn the light on with

Lighting_V2[0][0][0].Mode=ForceOn&Lighting_V2[0][0][1].Mode=ForceOn&Lighting_V2[0][1][0].Mode=ForceOn&Lighting_V2[0][1][1].Mode=ForceOn&Lighting_V2[0][2][0].Mode=ForceOn&Lighting_V2[0][2][1].Mode=ForceOn

that I got from the amcrest git issue which is just brute forcing everything on? Not sure what's different about this one camera, they are all on the same firmware (latest available from the app).

Any help is appreciated, thank you!

skooj commented 3 months ago

It looks like it's been a while since anything has been looked at here, but I am also having issues with this.

It appears as though, if I turn the light on in the app, I am able to use the switch in home assistant to turn the light off. I am, however, unable to turn the light on from the home assistant switch.

I am also getting errors for the switch when I am turning it off and on: turn on: Failed to call service light/turn_on. 400, message='Bad Request', url=URL('http://[IP]:80/cgi-bin/configManager.cgi?action=setConfig&FloodLightMode.Mode=2')

turn off: Failed to call service light/turn_off. 400, message='Bad Request', url=URL('http://[IP]:80/cgi-bin/configManager.cgi?action=setConfig&FloodLightMode.Mode=%7B%7D')

I am not sure what is happening here, but it looks like this is when it's attempting to set the mode to 'manual' when turning the light on. It also appears that it's attempting to send "{}" when turning it off...

Poking around some more, I found that these API calls, on this issue, work fine to turn the lights on and off.

In my current case, I intend to schedule this light to be on all night so setting the light to manual and using those will be fine for me. However, I'm hoping to purchase a second one of these where it would be nice to be able to trigger this between auto and manual.

If anyone has any insight or is able to help fix this, I'd appreciate it!

edit: I've done some further testing and found that using this branch that I found from this pr lets the home assistant switch work for both on and off without popping up an error.

jshatch commented 2 months ago

@skooj Thanks for finding that branch / PR that works, I tried it and sure enough the errors have disappeared and the light functions normally.