I found the way controlling my camera’s PTZ (D-Link DCS-5020L) via POST requests here. What’s the best way to create a user interface on HASS?
@fabaff Sorry for my lack of experience in this particular topic.
Let’s say I can tilt my camera with this command:
curl --user <username>:<password> --user-agent "user" --data "PanSingleMoveDegree=5&TiltSingleMoveDegree=5&PanTiltSingleMove=5" http://<ip>/pantiltcontrol.cgi
How should I write it as a REST switch? I already read the documentation and I’m still clueless.
Thanks for the reply.
The REST switch is limited. In your case I assume it would be easier to go with a command-line switch
I do this with a command line switch. Not ideal but definitely works
Hi,
I apologize for reviving this old thread, but in case this is useful for someone, this is how I did it:
camera:
- platform: mjpeg
name: "Front"
mjpeg_url: http://192.168.86.46/mjpeg.cgi?user=admin&password=xxxxxxxxxx&channel=2;type=.mjpg
shell_command:
front_camera_garage: 'curl -k "http://admin:[email protected]/pantiltcontrol.cgi?PanTiltPresetPositionMove=1"'
front_camera_mailbox: 'curl -k "http://admin:[email protected]/pantiltcontrol.cgi?PanTiltPresetPositionMove=2"'
front_camera_3: 'curl -k "http://admin:[email protected]/pantiltcontrol.cgi?PanTiltPresetPositionMove=3"'
front_camera_4: 'curl -k "http://admin:[email protected]/pantiltcontrol.cgi?PanTiltPresetPositionMove=4"'
front_camera_5: 'curl -k "http://admin:[email protected]/pantiltcontrol.cgi?PanTiltPresetPositionMove=5"'
front_camera_6: 'curl -k "http://admin:[email protected]/pantiltcontrol.cgi?PanTiltPresetPositionMove=6"'
input_select:
front_camera_control:
name: Front Camera Control
options:
- "Street"
- "Main Door"
- "Garage Door"
- "Mailbox"
- "Front Lawn"
icon: mdi:camera-switch
Here you create the preset positions:
Thanks! Looks very good. I’ll try it soon!
Thank’s for reviving this old thread, it was indeed usefull for me, I still own two DCS-5010L cameras… For your information, there is a “complete” example, including the automations at : Need help with Input Select and Shell Command which finally helped newbee me…
Thats really great, but where do I put your code? It doesnt work in the tile, nor in configuration.yaml
Some help would be appreceated!