Early on, I put a couple of PoE surveillance cameras on the property just so I could keep an eye on things. I’m not sure they do much to deter crime, but they help me feel a bit less uptight about conditions around the place. And, after all, any self-respecting gated compound must have security systems.
I’ve mentioned before that it gets mighty dark here at night. There are no nearby cities to light up the skies. Mostly we’re surrounded by a lot of ocean. There are nearby observatories that take advantage of this excellent seeing. I don’t want to gum up our clear skies with extraneous lights.
I did install some landscape lighting that is on for limited hours in the evenings. But there are a couple of spots where it would be nice to have intermittent lighting just as needed. The walk from the gate to the house is one place — the driveway is quite dark. Another is around the studio. Both those places have Amcrest cameras, and those cameras have built-in floodlights. They work well, but turning them on is pretty burdensome:
- point a web browser at the camera’s control site (can only be done from within our local area network)
- log in, which involves looking up our password
- wait for the site to load
- click on the icon to toggle the light
The camera web site isn’t particularly mobile friendly, and it signs you off after a couple of minutes, so you have to go through the process again.
Since I have Home Assistant monitoring the cameras and controlling the landscape lights, I though it would be nice to have control of the camera floodlights, too. It turns out to not be too complicated, but it definitely took some research and trial-and-error to get it working. To create a RESTful action:
The file config/configuration.yaml should look something like this:
rest_command:
main_gate_light_on:
url: http://192.168.200.164/cgi-bin/coaxialControlIO.cgi?action=control&channel=1&info[0].Type=1&info[0].IO=1
method: get
authentication: digest
username: admin
password: !secret mainGatePW
main_gate_light_off:
url: http://192.168.200.164/cgi-bin/coaxialControlIO.cgi?action=control&channel=1&info[0].Type=1&info[0].IO=0
method: get
authentication: digest
username: admin
password: !secret mainGatePW
Replace 192.168.200.164 with the IP address of your camera.
The file config/secrets.yaml should look like this:
# Use this file to store secrets like usernames and passwords.
# Learn more at https://www.home-assistant.io/docs/configuration/secrets/
mainGatePW: 5uper5ecr3tPassw0rd
Replace 5uper5ecr3tPassw0rd with your camera’s actual password.
Next, create buttons on your favorite dashboard with this yaml:
show_name: true
show_icon: true
name: gate light on
type: button
tap_action:
action: call-service
service: rest_command.main_gate_light_on
data: {}
target: {}
grid_options:
rows: auto
and
show_name: true
show_icon: true
name: gate light off
type: button
tap_action:
action: call-service
service: rest_command.main_gate_light_off
data: {}
target: {}
grid_options:
rows: auto
Now you’ll have buttons on your dashboard to turn the light on and off. I can do it from my control center, my laptop, and my phone.
Alas, it doesn’t show the state of the light. That’s a project for another day.
—2p