PTZ Control of Swann cameras using Generic IP Camera


First time poster, long time lurker. Be gentle.

I inherited two SWANN PTZ netcams from a family member shortly after installing HASS AIO. I wasn’t able to find a component that could control them even though they should be similar to FOSCAM and such. So, though much research, I was able to find a way to control them. I realize that there is a generic camera component, but I would like for this to be added to it.

Introducing… Generic IP Camera - With PTZ Controls

Actually it controls a hell of a lot more than just PTZ. I haven’t tried yet but apparently you can store present camera positions and even set configurations. Anywho… here is my switches.yaml…

platform: command_line
command_on: ‘curl -u XXXXXXX “hxxp://X.X.X.X/decoder_control.cgi?command=2”’
command_off: ‘curl -u XXXXXXX “hxxp://X.X.X.X/decoder_control.cgi?command=3”’
friendly_name: 'Move Up’
command_on: “/usr/bin/curl -u XXXXXXX hxxp://X.X.X.X/decoder_control.cgi?command=0”
command_off: “/usr/bin/curl -u XXXXXXX hxxp://X.X.X.X/decoder_control.cgi?command=1”
friendly_name: 'Move Down’
command_on: “curl -u XXXXXXX hxxp://X.X.X.X/decoder_control.cgi?command=6”
command_off: “curl -u XXXXXXX hxxp://X.X.X.X/decoder_control.cgi?command=7”
friendly_name: 'Move Left’
command_on: “curl -u XXXXXXX hxxp://X.X.X.X/decoder_control.cgi?command=4”
command_off: “curl -u XXXXXXX hxxp://X.X.X.X/decoder_control.cgi?command=5”
friendly_name: ‘Move Right’

You all have helped me so much, I hope that this helps at least one person.


Thanks for sharing this! Can I suggest a change in the title though; CGI control of a cam is going to be different for each vendor; different vendors use different CGI commands and even different names for their CGI.

I think a clearer title might be “PTZ Control of Swann cameras using Generic IP Camera”.

I didn’t want to change the title in mod mode and then have you not be able to find it! :wink:

1 Like


I only had Swann cameras, and I got this working by using documentation for a different generic camera. I wonder how many other cameras this would work for.

Also, in my haste to anonymize this I scrubbed an important detail… should be “-u USER:PASS”, not “-u XXXXXXX” :confused:

I can confirm it will work with some models of Foscams, especially the older ones, because I am using the same commands myself.

Replying in case anyone else comes across this: I discovered that these commands work for my 2015-era Insteon 75790 cameras. Thanks for the info, @Lucky_Strike!

1 Like

New to Home Assistant here and I have a 75790 camera working with the generic camera integration but want to add PTZ. Can someone direct me to where I need to put these commands?

OK, I put the lnes from the original post in config.yaml and I now have switches in the Overview but they don’t do anything with my 75790. I had some difficulty with the pasted characters when I copied the config entries above, so maybe I have the format wrong? This is what I have in config.yaml for the commands, for example here’s “move up”:

command_on: ‘/usr/bin/curl -u xxxx:yyyy “”’

I wasn’t sure whether I needed to include port or not. I’ve tried both with and without but without success.

I also noticed some of the config lines above include /usr/bin but others do not, does that matter?