Advertisement
JLindvig

PTZ Generic

Jan 27th, 2021
2,492
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 0.97 KB | None | 0 0
  1. rest_command:
  2.   ptz:
  3.  # PTZ generic command
  4.   # Takes the following data:
  5.   #   ip, the IP adsress of the camera
  6.   #   direction, the direction to turn the camera. Must be a string containing the direction:
  7.   #              ex: "left up", "leftup", "upleft"
  8.   #   inverted, whether the cam is up side down, optional
  9.   url: >-
  10.     {% set inverted = inverted | default(false) %}
  11.     {% set direction = direction | lower %}
  12.     {% set ptz_command = "ptz"%}
  13.     {% if "left" in direction %}
  14.       {% set ptz_command = ptz_command ~ ("r" if inverted else "l") %}
  15.     {% elif "right" in direction %}
  16.       {% set ptz_command = ptz_command ~ ("l" if inverted else "r") %}
  17.     {% endif %}
  18.     {% if "up" in direction %}
  19.       {% set ptz_command = ptz_command ~ ("d" if inverted else "u") %}
  20.     {% elif "down" in direction %}
  21.       {% set ptz_command = ptz_command ~ ("u" if inverted else "d") %}
  22.     {% endif %}
  23.    
  24.     http://{{ ip }}:8080/cgi-bin/webui?command={{ ptz_command }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement