HTTP Command to check if camera is enabled/disabled?
Hi Ben,
Is there a HTTP command that will return the enabled/disabled status of a camera please?
I know I can modify this setting via camEnabledCheck, and I can check camera modes using ++cameramodes, but I've not been able to find the option to determine the status of this setting yet. (it's so I can create a sensor in Home Assistant to poll for the camera status)
Thanks,
Paul.
Is there a HTTP command that will return the enabled/disabled status of a camera please?
I know I can modify this setting via camEnabledCheck, and I can check camera modes using ++cameramodes, but I've not been able to find the option to determine the status of this setting yet. (it's so I can create a sensor in Home Assistant to poll for the camera status)
Thanks,
Paul.
Comments
If you load this in a web browser (i.e. http://address:8000/systemInfo), you will see what this contains. I'm not sure exactly how you are linking this up to the Home Assistant sensor, however I hope this will do what you want.
Just to give some background which may help others wanting to do the same, I created a switch template in Home Assistant to monitor the status of Motion and Action schedules so that I could turn them on and off from HA (e.g. when I open the back door, the camera motion detection is disabled), and to update the switch if I manually change these settings in SecuritySpy.
secrets.yaml file
gardencam_ma_on: "/usr/bin/curl 'http://192.168.1.10:8000/++setSchedule?auth=myBase64AuthKey&cameraNum=7&mode=MA&id=1'"
gardencam_ma_off: "/usr/bin/curl 'http://192.168.1.10:8000/++setSchedule?auth=myBase64AuthKey&cameraNum=7&mode=MA&id=0'"
gardencam_ma_state: "output=$(/usr/bin/curl -s 'http://192.168.1.10:8000/++cameramodes?auth=myBase64AuthKey&cameraNum=7'); if [[ $(echo \"$output\" | grep \"M:\" | awk -F: '{print $2}') == \"ARMED\" ]] && [[ $(echo \"$output\" | grep \"A:\" | awk -F: '{print $2}') == \"ARMED\" ]]; then exit 0; else exit 1; fi"
package.yaml (I can't paste with the correct spacing on here, so if using this make sure it is indented correctly)
switch:
- platform: command_line
scan_interval: 300
switches:
gardencam_ma_arming:
command_on: !secret gardencam_ma_on
command_off: !secret gardencam_ma_off
command_state: !secret gardencam_ma_state
friendly_name: GardenCam Arm On Off
I plan to work out a bash command that will look at the output of systemInfo and return an enabled/disabled status from that. I'll post back the command once I've figured it out.
secrets.yaml
gardencam_disable: "/usr/bin/curl -d 'cameraNum=7&camEnabledCheck=0&action=save' 'http://192.168.1.10:8000/camerasettings?auth=myBase64AuthKey'"
gardencam_enable: "/usr/bin/curl -d 'cameraNum=7&camEnabledCheck=1&action=save' 'http://192.168.1.10:8000/camerasettings?auth=myBase64AuthKey'"
gardencam_state: "/usr/bin/curl -s 'http://192.168.1.10:8000/systemInfo?auth=myBase64AuthKey' | grep -i gardencam"
packages.yaml
switch:
- platform: command_line
scan_interval: 300
switches:
gardencam_enabled:
command_on: !secret gardencam_enable
command_off: !secret gardencam_disable
command_state: !secret gardencam_state
friendly_name: GardenCam Enabled Status