python-amcrest
python-amcrest copied to clipboard
Control light on the ASH26-W?
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
I am looking to do this too myself, still have not cracked it. Does anyone know the command to control the light?
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
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 .
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
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.
I have my Floodlight setting set to manual, so maybe set that and try it? I am on the latest firmware too.
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
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]
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?
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
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.
In the all config page, do you have this setting as false too?
table.All.LightGlobal[0].Enable=false
That setting is true for me
How did you set that to true? I wonder if that's why I'm not allowed to control the light?
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
I was able to set it to true, but still can't get the light to turn on. Not sure what I'm missing.
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
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
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
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!!!
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.
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?
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.
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?
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.
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
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.
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
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.
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?