Hi, I have 5 YOOSEE PTZ IP cameras:
those are working with Android YooSee application and known as yoosee cameras. Cameras capable of streaming 2 main video and audio streams:
- hires main stream: rtsp://<camera_ip>:554/onvif1
- lowres substream: rtsp://<camera_ip>:554/onvif2
Onvif port for PTZ control is 5000.
Another thing is, those are UDP (not TCP) streams and I have tried many ways to get the to display video including onvif:
- platform: onvif
name: kitchen_camera
host: 192.168.x.x
username: admin
password: verysecret
port: 5000
extra_arguments: -rtsp_transport udp
and mjpeg:
- platform: ffmpeg
input: rtsp://192.168.1.xxx:554/onvif1
name: xxx
with extra parameters like tcp_transport udp and without non of them working.
The only way worked is through motioneye plugin installed through supervisor panel in HA.
I have got YCC365 camera to work with the following card in lovelace:
type: picture-elements
title: Hall PTZ Camera
camera_image: camera.hall_camera
elements:
- type: state-icon
tap_action:
action: call-service
service: ptz_camera.move_left
service_data:
host: '192.168.1.12'
entity: camera.hall_camera
icon: 'mdi:arrow-left-drop-circle'
style:
bottom: 45%
left: 5%
color: white
opacity: 0.5
transform: ' scale (1.5, 1.5) '
- type: state-icon
tap_action:
action: call-service
service: ptz_camera.move_right
service_data:
host: '192.168.1.12'
entity: camera.hall_camera
icon: 'mdi:arrow-right-drop-circle'
style:
bottom: 45%
right: 5%
color: white
opacity: 0.5
transform: ' scale (1.5, 1.5) '
- type: state-icon
tap_action:
action: call-service
service: ptz_camera.move_up
service_data:
host: '192.168.1.12'
entity: camera.hall_camera
icon: 'mdi:arrow-up-drop-circle'
style:
top: 10%
left: 46%
color: white
opacity: 0.5
transform: ' scale (1.5, 1.5) '
- type: state-icon
tap_action:
action: call-service
service: ptz_camera.move_down
service_data:
host: '192.168.1.12'
entity: camera.hall_camera
icon: 'mdi:arrow-down-drop-circle'
style:
bottom: 10%
left: 46%
color: white
opacity: 0.5
transform: ' scale (1.5, 1.5) '
- type: state-icon
tap_action:
action: more-info
entity: camera.hall_camera
icon: 'mdi:arrow-expand-all'
style:
top: 5%
right: 5%
color: white
opacity: 0.5
transform: ' scale (1.5, 1.5) '
camera_view: live
But I can’t figure out how to get yoosee PTZ to work.
I changed code and added port:
type: picture-elements
title: Hall PTZ Camera
camera_image: camera.hall_camera
elements:
- type: state-icon
tap_action:
action: call-service
service: ptz_camera.move_left
service_data:
host: '192.168.1.12:5000'
entity: camera.hall_camera
icon: 'mdi:arrow-left-drop-circle'
style:
bottom: 45%
left: 5%
color: white
opacity: 0.5
transform: ' scale (1.5, 1.5) '
- type: state-icon
tap_action:
action: call-service
service: ptz_camera.move_right
service_data:
host: '192.168.1.12:5000'
entity: camera.hall_camera
icon: 'mdi:arrow-right-drop-circle'
style:
bottom: 45%
right: 5%
color: white
opacity: 0.5
transform: ' scale (1.5, 1.5) '
- type: state-icon
tap_action:
action: call-service
service: ptz_camera.move_up
service_data:
host: '192.168.1.12:5000'
entity: camera.hall_camera
icon: 'mdi:arrow-up-drop-circle'
style:
top: 10%
left: 46%
color: white
opacity: 0.5
transform: ' scale (1.5, 1.5) '
- type: state-icon
tap_action:
action: call-service
service: ptz_camera.move_down
service_data:
host: '192.168.1.12:5000'
entity: camera.hall_camera
icon: 'mdi:arrow-down-drop-circle'
style:
bottom: 10%
left: 46%
color: white
opacity: 0.5
transform: ' scale (1.5, 1.5) '
- type: state-icon
tap_action:
action: more-info
entity: camera.hall_camera
icon: 'mdi:arrow-expand-all'
style:
top: 5%
right: 5%
color: white
opacity: 0.5
transform: ' scale (1.5, 1.5) '
camera_view: live
However it throws the following error when I try to control camera:
Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/ptz_camera/__init__.py:34
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 6:05:38 PM (1 occurrences)
Last logged: 6:05:38 PM
[1771407032] ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 445, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 440, in _make_request
httplib_response = conn.getresponse()
File "/usr/local/lib/python3.8/http/client.py", line 1347, in getresponse
response.begin()
File "/usr/local/lib/python3.8/http/client.py", line 307, in begin
version, status, reason = self._read_status()
File "/usr/local/lib/python3.8/http/client.py", line 276, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
resp = conn.urlopen(
File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "/usr/local/lib/python3.8/site-packages/urllib3/util/retry.py", line 531, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/local/lib/python3.8/site-packages/urllib3/packages/six.py", line 734, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 445, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 440, in _make_request
httplib_response = conn.getresponse()
File "/usr/local/lib/python3.8/http/client.py", line 1347, in getresponse
response.begin()
File "/usr/local/lib/python3.8/http/client.py", line 307, in begin
version, status, reason = self._read_status()
File "/usr/local/lib/python3.8/http/client.py", line 276, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 141, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1488, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1527, in _execute_service
await self._hass.async_add_executor_job(handler.job.target, service_call)
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/ptz_camera/__init__.py", line 82, in move_right
stop(call)
File "/config/custom_components/ptz_camera/__init__.py", line 34, in stop
r = requests.post('http://'+host+'/onvif/PTZ', data=xml, headers=DEFAULT_HEADERS)
File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 119, in post
return request('post', url, data=data, json=json, **kwargs)
File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 498, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
I’m using the following custom component for PTZ control: ptz_camera to send onvif ptz xml
Can somebody help?
thanks