mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-22 16:56:50 +00:00
Update camera.foscam.markdown to include Pan/Tilt/Zoom Examples
Posted this example to Gitter: https://gitter.im/balloob/home-assistant?at=56e10e516fde057c26856411 Foscam supports commands including Motion Detection Activation and Pan/Tilt/Zoom to be send via cURL. Added an example of this, but these could be used in any number of ways. I'm open to making the example less verbose, if there's any thought that something could be taken out, but I think this would be helpful for other Foscam users, as HA can control almost everything about the camera via the cURL commands.
This commit is contained in:
parent
537f0d4c1b
commit
5f97272065
@ -34,4 +34,51 @@ Configuration variables:
|
||||
- **name** *Optional*: This parameter allows you to override the name of your camera.
|
||||
- **username** *Required*: The username for accessing your camera.
|
||||
- **password** *Required*: The password for accessing your camera.
|
||||
- **Note**: There seems to be some issues within Foscam with lengthy passwords and passwords containing certain symbols. Be sure to check your camera's documentation.
|
||||
|
||||
### {% linkable_title Control Foscam PTZ (Pan/Tilt/Zoom) - Home/Away %}
|
||||
Foscam Webcams which support CGI Commands ([Source](http://www.ipcamcontrol.net/files/Foscam%20IPCamera%20CGI%20User%20Guide-V1.0.4.pdf)) can be controlled by Home Assistant. The following outlines examples of the switch, services, and scripts required to move between 2 preset destinations while controlling motion detection, but many other options of movement are provided in the Foscam CGI User Guide linked above.
|
||||
|
||||
The switch.foscam_motion will control whether the motion detection is on or off. This switch supports statecmd, which checks the current state of motion detection.
|
||||
|
||||
The service shell_command.foscam_turn_off sets the camera to point down and away to indicate it is not recording.
|
||||
The service shell_command.foscam_turn_on sets the camera to point where I'd like to record.
|
||||
Both of these services require preset points to be added to your camera. See source above for additional information.
|
||||
|
||||
The script.foscam_off and script.foscam_on can be used to set the motion detection appropriately, and then move the camera. These scripts can be called as part of an automation with device_tracker triggers to set home and not_home modes for your Foscam and disable motion detection recording while home.
|
||||
|
||||
```yaml
|
||||
# Replace admin and password with an "Admin" priviledged Foscam user
|
||||
# Replace ipaddress with the local IP address of your Foscam
|
||||
switch:
|
||||
platform: command_line
|
||||
switches:
|
||||
#Switch for Foscam Motion Detection
|
||||
foscam_motion:
|
||||
oncmd: 'curl -k "https://ipaddress:443/cgi-bin/CGIProxy.fcgi?cmd=setMotionDetectConfig&isEnable=1&usr=admin&pwd=password"'
|
||||
offcmd: 'curl -k "https://ipaddress:443/cgi-bin/CGIProxy.fcgi?cmd=setMotionDetectConfig&isEnable=0&usr=admin&pwd=password"'
|
||||
statecmd: 'curl -k --silent "https://ipaddress:443/cgi-bin/CGIProxy.fcgi?cmd=getMotionDetectConfig&usr=admin&pwd=password" | grep -oP "(?<=isEnable>).*?(?=</isEnable>)"'
|
||||
value_template: '{{ value == "1" }}'
|
||||
|
||||
shell_command:
|
||||
#Created a preset point in Foscam Web Interface named Off which essentially points the camera down and away
|
||||
foscam_turn_off: 'curl -k "https://ipaddress:443/cgi-bin/CGIProxy.fcgi?cmd=ptzGotoPresetPoint&name=Off&usr=admin&pwd=password"'
|
||||
#Created a preset point in Foscam Web Interface named Main which points in the direction I would like to record
|
||||
foscam_turn_on: 'curl -k "https://ipaddress:443/cgi-bin/CGIProxy.fcgi?cmd=ptzGotoPresetPoint&name=Main&usr=admin&pwd=password"'
|
||||
script:
|
||||
foscam_off:
|
||||
sequence:
|
||||
- execute_service: switch.turn_off
|
||||
service_data:
|
||||
entity_id: switch.foscam_motion
|
||||
- service: shell_command.foscam_turn_off
|
||||
foscam_on:
|
||||
sequence:
|
||||
- execute_service: switch.turn_off
|
||||
service_data:
|
||||
entity_id: switch.foscam_motion
|
||||
- service: shell_command.foscam_turn_on
|
||||
- execute_service: switch.turn_on
|
||||
service_data:
|
||||
entity_id: switch.foscam_motion
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user