This is a brief guide on how to set up this Camera in Home Assistant, including controls.
Might work with other models as well.
Assumes it has been set up on your local network either via the D-Link app or the integrated Web UI. Note that the integrated Web UI does not load on most modern browsers and requires changing the user agent using a user agent switcher (like uaswitcher on Firefox) and a Internet Explorer profile.
These are the required integrations:
The camera provides endpoints with a video stream and still image. However the video will not work in HA using the Generic Camera integration.
A middleman is required to convert the stream into a useable format.
Set up go2rtc using the following configuration:
There is a H264 endpoint (
/h264.mpt), but it doesn't seem to work properly. Endpoint below is MJPEG and quality can be turned up in the camera configuration utility.
streams:
dlink5030: http://admin:[email protected]/video.cgiInstall WebRTC Camera and Button Card.
You have to set up go2rtc to be able to view the camera stream.
In configuration.yaml set up the REST commands to control the camera:
rest_command:
dsc5030_pan_tilt:
authentication: digest
username: !secret dlink5030_username
password: !secret dlink5030_password
url: "http://192.168.0.242/setControlPanTilt"
method: post
content_type: "application/x-www-form-urlencoded"
payload: 'PanSingleMoveDegree={{ degrees }}&TiltSingleMoveDegree={{ degrees }}&PanTiltSingleMove={{ direction }}'
headers:
Referer: "http://192.168.0.242"
dsc5030_set_home:
authentication: digest
username: !secret dlink5030_username
password: !secret dlink5030_password
url: "http://192.168.0.242/setControlPanTilt"
method: post
content_type: "application/x-www-form-urlencoded"
payload: 'SetHomePosition='
headers:
Referer: "http://192.168.0.242"
dsc5030_reset_home:
authentication: digest
username: !secret dlink5030_username
password: !secret dlink5030_password
url: "http://192.168.0.242/setControlPanTilt"
method: post
content_type: "application/x-www-form-urlencoded"
payload: 'ResetHomePosition='
headers:
Referer: "http://192.168.0.242"In secrets.yaml:
dlink5030_username: admin
dlink5030_password: your_password_hereCreate a new "Manual" card with the following YAML:
type: custom:webrtc-camera
url: dlink5030These controls will adjust the pan/tilt of the camera (home position / directions / set home / reset home) using a stack to show buttons in a single row.
Create a new "Manual" card with the following YAML:
type: horizontal-stack
cards:
- type: custom:button-card
icon: mdi:crosshairs
tap_action:
action: call-service
service: rest_command.dsc5030_pan_tilt
data:
degrees: 4
direction: 4
- type: custom:button-card
icon: mdi:arrow-bottom-left
tap_action:
action: call-service
service: rest_command.dsc5030_pan_tilt
data:
degrees: 4
direction: 6
- type: custom:button-card
icon: mdi:arrow-left
tap_action:
action: call-service
service: rest_command.dsc5030_pan_tilt
data:
degrees: 4
direction: 3
- type: custom:button-card
icon: mdi:arrow-top-left
tap_action:
action: call-service
service: rest_command.dsc5030_pan_tilt
data:
degrees: 4
direction: 0
- type: custom:button-card
icon: mdi:arrow-up
tap_action:
action: call-service
service: rest_command.dsc5030_pan_tilt
data:
degrees: 4
direction: 1
- type: custom:button-card
icon: mdi:arrow-down
tap_action:
action: call-service
service: rest_command.dsc5030_pan_tilt
data:
degrees: 4
direction: 7
- type: custom:button-card
icon: mdi:arrow-top-right
tap_action:
action: call-service
service: rest_command.dsc5030_pan_tilt
data:
degrees: 4
direction: 2
- type: custom:button-card
icon: mdi:arrow-right
tap_action:
action: call-service
service: rest_command.dsc5030_pan_tilt
data:
degrees: 4
direction: 5
- type: custom:button-card
icon: mdi:arrow-bottom-right
tap_action:
action: call-service
service: rest_command.dsc5030_pan_tilt
data:
degrees: 4
direction: 8
- type: custom:button-card
icon: mdi:target
tap_action:
action: call-service
service: rest_command.dsc5030_set_home
- type: custom:button-card
icon: mdi:crosshairs-off
tap_action:
action: call-service
service: rest_command.dsc5030_reset_home
grid_options:
columns: full