OK got pan-tilt control from HASS using the command line switch:
switch:
platform: command_line
switches:
pan_tilt:
command_on: 'python /home/pi/Desktop/basic_pan_tilt_RC.py -90 -20'
command_off: 'python /home/pi/Desktop/basic_pan_tilt_RC.py 50 -20'
and the script basic_pan_tilt_RC.py:
import pantilthat
import sys
import time
pan_angle = int(sys.argv[1])
tilt_angle = int(sys.argv[2])
if __name__ == "__main__":
pantilthat.tilt(tilt_angle)
pantilthat.pan(pan_angle)
time.sleep(0.5)
VIdeo on Youtube:
Will next create a custom component.
Ideas for automations include triggered sweep of an area and motion tracking.
Cheers