python-amcrest icon indicating copy to clipboard operation
python-amcrest copied to clipboard

Control light on the ASH26-W?

Open poblabs opened this issue 5 years ago • 61 comments

Is it possible to control the light on the new ASH26-W? That would be great if it could be added. Happy to help test anything, too

poblabs avatar Sep 16 '20 01:09 poblabs

I am looking to do this too myself, still have not cracked it. Does anyone know the command to control the light?

DanPatten avatar Nov 01 '20 05:11 DanPatten

I figured it out:

http://IP/cgi-bin/configManager.cgi?action=setConfig&Lighting_V2[0][0][1].Mode=Manual http://IP/cgi-bin/configManager.cgi?action=setConfig&Lighting_V2[0][0][1].Mode=Off

DanPatten avatar Nov 02 '20 00:11 DanPatten

Awesome! I'll have to try this out. Do you know of a way to get status too?

On Sun, Nov 1, 2020, 7:10 PM DanPatten [email protected] wrote:

I figured it out:

http://IP/cgi-bin/configManager.cgi?action=setConfig&Lighting_V2[0][0][1].Mode=Manual

http://IP/cgi-bin/configManager.cgi?action=setConfig&Lighting_V2[0][0][1].Mode=Off

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tchellomello/python-amcrest/issues/161#issuecomment-720175176, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2SYZ6ORMDUTI4L5MK4GNLSNX2IHANCNFSM4ROA4S7Q .

poblabs avatar Nov 02 '20 00:11 poblabs

It looks like the config values do not sync with the smart home app but they do update when you query this point, I am unsure if this is right or not.

http://IP/cgi-bin/configManager.cgi?action=getConfig&name=Lighting_V2

The value you are looking for is table.Lighting_V2[0][0][1].Mode= Off = off Manual = on

DanPatten avatar Nov 02 '20 00:11 DanPatten

In my testing it seems that this only makes the light flash quickly, then turns off. Haven't been able to keep the lights on.

poblabs avatar Nov 02 '20 22:11 poblabs

I have my Floodlight setting set to manual, so maybe set that and try it? I am on the latest firmware too.

DanPatten avatar Nov 02 '20 22:11 DanPatten

I'm on the latest firmware too, and using this endpoint seemed to work to turn it on, but not off using Auto. I had to use the app to turn it off

http://ip/cgi-bin/configManager.cgi?action=setConfig&Lighting[0][0][0].Mode=Manual

poblabs avatar Nov 02 '20 22:11 poblabs

Use http://ip/cgi-bin/configManager.cgi?action=setConfig&Lighting[0][0][0].Mode=Off to turn it off. Maybe your light index is different than mine but mine is [0][0][1]

DanPatten avatar Nov 02 '20 22:11 DanPatten

Now it's not working to turn it back on 😄 Neither the Lighting nor the Lighting_V2 endpoint. I wonder what's changed. I'll keep looking around. Where were you able to find the Lighting_V2 endpoint? Is there another one I wonder?

poblabs avatar Nov 02 '20 22:11 poblabs

I did some crazy stuff with RDP since amcrest cameras are basically dahua cameras at their base and dug around there. You can view the entire config to see everything

http://IP/cgi-bin/configManager.cgi?action=getConfig&name=All

DanPatten avatar Nov 02 '20 22:11 DanPatten

Yeah not much else to see I guess. I tried a wireshark capture, and can see my phone viewing the stream from AWS, but when I press the light button it's not an HTTP command (looks like TCP?) and there's not much else I can gain from that.

poblabs avatar Nov 02 '20 23:11 poblabs

In the all config page, do you have this setting as false too?

table.All.LightGlobal[0].Enable=false

poblabs avatar Nov 02 '20 23:11 poblabs

That setting is true for me

DanPatten avatar Nov 06 '20 02:11 DanPatten

How did you set that to true? I wonder if that's why I'm not allowed to control the light?

poblabs avatar Nov 07 '20 00:11 poblabs

Take a look at the supporting doc: https://support.amcrest.com/hc/en-us/articles/360002007371-Amcrest-HTTP-API-SDK

I can't remember exactly but its setConfig I think

DanPatten avatar Nov 07 '20 02:11 DanPatten

I was able to set it to true, but still can't get the light to turn on. Not sure what I'm missing.

poblabs avatar Nov 08 '20 01:11 poblabs

This is my Lighting V2 Config (light is off atm)

table.Lighting_V2[0][0][0].Correction=50 table.Lighting_V2[0][0][0].LightType=InfraredLight table.Lighting_V2[0][0][0].MiddleLight[0].Angle=50 table.Lighting_V2[0][0][0].MiddleLight[0].Light=50 table.Lighting_V2[0][0][0].Mode=Auto table.Lighting_V2[0][0][0].Sensitive=3 table.Lighting_V2[0][0][1].Correction=50 table.Lighting_V2[0][0][1].LightType=WhiteLight table.Lighting_V2[0][0][1].Mode=Off table.Lighting_V2[0][0][1].NearLight[0].Angle=50 table.Lighting_V2[0][0][1].NearLight[0].Light=50 table.Lighting_V2[0][0][1].Sensitive=3 table.Lighting_V2[0][1][0].Correction=50 table.Lighting_V2[0][1][0].LightType=InfraredLight table.Lighting_V2[0][1][0].MiddleLight[0].Angle=50 table.Lighting_V2[0][1][0].MiddleLight[0].Light=50 table.Lighting_V2[0][1][0].Mode=Auto table.Lighting_V2[0][1][0].Sensitive=3 table.Lighting_V2[0][1][1].Correction=50 table.Lighting_V2[0][1][1].LightType=WhiteLight table.Lighting_V2[0][1][1].Mode=Off table.Lighting_V2[0][1][1].NearLight[0].Angle=50 table.Lighting_V2[0][1][1].NearLight[0].Light=50 table.Lighting_V2[0][1][1].Sensitive=3 table.Lighting_V2[0][2][0].Correction=50 table.Lighting_V2[0][2][0].LightType=InfraredLight table.Lighting_V2[0][2][0].MiddleLight[0].Angle=50 table.Lighting_V2[0][2][0].MiddleLight[0].Light=50 table.Lighting_V2[0][2][0].Mode=Auto table.Lighting_V2[0][2][0].Sensitive=3 table.Lighting_V2[0][2][1].Correction=50 table.Lighting_V2[0][2][1].LightType=WhiteLight table.Lighting_V2[0][2][1].Mode=Off table.Lighting_V2[0][2][1].NearLight[0].Angle=50 table.Lighting_V2[0][2][1].NearLight[0].Light=50 table.Lighting_V2[0][2][1].Sensitive=3

Also have: table.All.LightGlobal[0].Enable=true

For floodlight settings I have the light set to manual

DanPatten avatar Nov 08 '20 02:11 DanPatten

For floodlight settings I have the light set to manual

That did it. I had my floodlight setting in the app set to motion. Changing that to manual seems to have done it. Wish I could have motion controlled, and manual API override together

poblabs avatar Nov 08 '20 02:11 poblabs

For anyone that is searching for this too, here's an example I wrote for home assistant that might help:

  - platform: command_line
    switches:
      garage_floodlight:
        command_on:    '/usr/bin/curl -s --digest -u admin:password "http://IP/cgi-bin/configManager.cgi?action=setConfig&Lighting_V2[0][0][1].Mode=Manual" '
        command_off:   '/usr/bin/curl -s --digest -u admin:password "http://IP/cgi-bin/configManager.cgi?action=setConfig&Lighting_V2[0][0][1].Mode=Off" '
        command_state: '/usr/bin/curl -s --digest -u admin:password "http://IP/cgi-bin/configManager.cgi?action=getConfig&name=Lighting_V2[0][0][1].Mode" | grep -oc "Manual" ||true'
        value_template: '{{ value == "1" }}'
        friendly_name: Garage Floodlight

mcowger avatar Jan 06 '21 04:01 mcowger

Thank you so much for posting this!

I was searching to see if the light could be turned on / off locally before I pulled the trigger and ordered one of these to replace the floodlight in our garden.

Looks like its a go!

THANKS!!!

anonymous-one avatar Apr 28 '21 00:04 anonymous-one

For floodlight settings I have the light set to manual

That did it. I had my floodlight setting in the app set to motion. Changing that to manual seems to have done it. Wish I could have motion controlled, and manual API override together

Just a thought... Since you are looking to locally flip the light on / off I am going to assume you are feeding the video into your own NVR instead of using their cloud (yuck...) or the sd card (double yuck...)...

Why not just have your NVR trigger on motion detect and flip the light accordingly.

That is how I am planning on doing it anyways.

anonymous-one avatar Apr 28 '21 00:04 anonymous-one

For anyone that is searching for this too, here's an example I wrote for home assistant that might help:

  - platform: command_line
    switches:
      garage_floodlight:
        command_on:    '/usr/bin/curl -s --digest -u admin:password "http://IP/cgi-bin/configManager.cgi?action=setConfig&Lighting_V2[0][0][1].Mode=Manual" '
        command_off:   '/usr/bin/curl -s --digest -u admin:password "http://IP/cgi-bin/configManager.cgi?action=setConfig&Lighting_V2[0][0][1].Mode=Off" '
        command_state: '/usr/bin/curl -s --digest -u admin:password "http://IP/cgi-bin/configManager.cgi?action=getConfig&name=Lighting_V2[0][0][1].Mode" | grep -oc "Manual" ||true'
        value_template: '{{ value == "1" }}'
        friendly_name: Garage Floodlight

Thankyou so much for posting this. One question - do I paste this into a light section of the configuration.yaml?

haydonryan avatar Sep 25 '21 19:09 haydonryan

It is a command line switch: https://www.home-assistant.io/integrations/switch.command_line/ This is something that we could look into adding upstream in home assistant as a light entity in the integration, as well.

flacjacket avatar Sep 25 '21 20:09 flacjacket

Is this working reliably for you guys? I had mixed results and ended up not using it. Is there a new way now with these flood light cameras?

poblabs avatar Sep 25 '21 20:09 poblabs

This is something that we could look into adding upstream in home assistant as a light entity in the integration, as well.

That would be amazing :) I would actually use the flood light quite a lot as a regular light as it's in the perfect place for lighting while putting the bins out.

haydonryan avatar Oct 17 '21 18:10 haydonryan

I tried this on the command line and had to escape the square brackets, plus escape all the special characters in my password (note creds and IPs are not real here).

Thanks all for your suggestions - this is now working.

PASSWORD= password?yes

switch:
  - platform: command_line
    switches:
      garage_floodlight:
        command_on:    '/usr/bin/curl -s --digest -u admin:password\?yes "http://192.168.1.1/cgi-bin/configManager.cgi?action=setConfig&Lighting_V2\[0\]\[0\]\[1\].Mode=Manual" '
        command_off:   '/usr/bin/curl -s --digest -u admin:password\?yes "http://192.168.1.1/cgi-bin/configManager.cgi?action=setConfig&Lighting_V2\[0\]\[0\]\[1\].Mode=Off" '
        command_state: '/usr/bin/curl -s --digest -u admin:password\?yes "http://192.168.1.1/cgi-bin/configManager.cgi?action=getConfig&name=Lighting_V2\[0\]\[0\]\[1\].Mode" | grep -oc "Manual" ||true'
        value_template: '{{ value == "1" }}' 
        friendly_name: Garage Floodlight

haydonryan avatar Nov 29 '21 20:11 haydonryan

Does anyone have this working? I can change the settings and they sometimes turn the lights on for a second but then they turn off immediately.

Darkside138 avatar Apr 22 '22 23:04 Darkside138

Does anyone have this working? I can change the settings and they sometimes turn the lights on for a second but then they turn off immediately.

As long as motion detection is turned off on the camera then the script to turn on and off the light is working for me just fine

al3x1337 avatar Apr 22 '22 23:04 al3x1337

Thanks for the quick response! That was it, need to turn off Flood Light motion detection and set the lights to manual in the Amcrest app.

Darkside138 avatar Apr 22 '22 23:04 Darkside138

Seems like I can't use this light in automations? It needs an entity_id but I can't seem to configure one, says that's not a valid configuration?

Darkside138 avatar Apr 23 '22 00:04 Darkside138