Android has the ability to output video to the frame using Pipup, but webOS does not have such a program, and it is also impossible to output video from the camera using service: camera.play_stream. It is also impossible to play videos with an RTSP stream through the built-in browser, since there is no support for h264/265 codecs. I found how to display video from the camera on webOS without installing third-party software on LG TV. To output video from the camera to LG TV, we will need an installed Agent DVR and we will use the Agent DVR API.
Read more about the AgentDVR API here
Below is an example of how to specify commands. We specify the IP address of the AgentDVR server, in my case it is 192.168.1.50:8090
http://192.168.1.50:8090/video.mjpg?oid=3&size=1920x1080&maintainAR=true&backColor=0,0,0
where:
- http://192.168.1.50:8090 - AgentDVR server address
- video.mjpg - we broadcast the video
- oid=1 - camera number, where each camera has its own number 1.2.3.4.5 … Specify the number of the camera we need. If you need to output camera 3, then specify oid=3
- size=1920x1080 - resolution of the output image
- backColor=0,0,0 - background color, I specified black color
Knowing the path of AgentDVR video streaming, we can add a url to the webasto.command service
service: webostv.command
data:
entity_id: media_player.smart_tv
command: system.launcher/open
payload:
target: >
http://192.168.1.50:8090/video.mjpg?oid=3&size=1920x1080&maintainAR=true&backColor=0,0,0
alias: Open a browser with a camera
Now the built-in browser will start on our TV and a window with a video camera with minimal delay (webrtc) will open
I use the EZVIZ CS-DP2K video viewer, which has an RTSP stream and can be added to AgentDVR. I note that RTSP works when the camera turns on, and when the camera turns off, then RTSP turns off. But you can turn off auto sleep and RTSP will always work. To do this, you need to install EZVIZ integration from the GUI and turn off auto sleep, after that RTSP will always work, but the battery charge level will quickly decrease, so you need to take care of constant power supply. I connected the video eye to a constant power supply by pulling the wire inside the door to the video eye
Next, we create automation that will open the browser on TV when an incoming call is made to the door. I use the “Last Notification” sensor as a trigger. Since there is no incoming call sensor in the EZVIZ integration for the EZVIZ CS-DP2C video eye, and I don’t want to disassemble and redo the video eye, I used the “Last Notification” sensor in the Home Assistant mobile application and specified only EZVIZ.
alias: "Video eyes: Broadcast on TV in the kitchen"
description: >-
When an incoming call is made to a video eye, a browser will open on the TV with
a real-time video stream tab for N seconds, while
saving the current TV status to the history. After that, the window on the TV with the camera will close
and TV will return by history
trigger:
- platform: state
entity_id:
- sensor.tablet_sm_t580_last_notification
to: Someone is ringing the doorbell
alias: Someone is ringing the doorbell
condition: []
action:
- service: scene.create
data:
scene_id: kitchen_tv_lg_history
snapshot_entities: media_player.lg_tv_kitchen
alias: Save to History
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
alias: 1 second delay
- service: webostv.command
data:
entity_id: media_player.lg_tv_kitchen
command: system.launcher/open
payload:
target: >
http://192.168.1.50:8090/video.mjpg?oid=3&size=1920x1080&maintainAR=true&backColor=0,0,0
alias: Open a browser with a camera
- delay:
hours: 0
minutes: 0
seconds: 20
milliseconds: 0
alias: Delay of 20 seconds
- service: scene.turn_on
target:
entity_id: scene.kitchen_tv_lg_history
metadata: {}
alias: Restore from History
mode: single
Текст на русском (Text in Russian)
У андроид есть возможность выводить видео в рамку используя Pipup, а у WebOS такой программы нет, а также нельзя вывести видео с камеры используя service: camera.play_stream. Через встроенный браузер также нельзя воспроизводить видео с потоком RTSP, так как нет поддержки кодеков h264/265. Я нашел как на WebOS можно вывести видео с камеры, при этом не устанавливая на ТВ LG сторонний софт. Для вывода видео с камеры на ТВ LG нам понадобится установленный Agent DVR и будем использовать API Agent DVR.
Подробности про API AgentDVR читаем здесь
Ниже пример как нужно указывать команды. Указываем IP адрес сервера AgentDVR, в моем случае это 192.168.1.50:8090
http://192.168.1.50:8090/video.mjpg?oid=3&size=1920x1080&maintainAR=true&backColor=0,0,0
где:
- http://192.168.1.50:8090 - адрес сервера AgentDVR
- video.mjpg - транслируем видео
- oid=1 - номер камеры, где у каждой камеры есть свой номер 1.2.3.4.5 … Указываем номер нужной нам камеры. Если нужно вывести камеру 3, то указываем oid=3
- size=1920x1080 - разрешение выводимой картинки
- backColor=0,0,0 - цвет фона, я указал черный цвет
Зная путь видеостриминга AgentDVR, можем в службу webostv.command добавить url
service: webostv.command
data:
entity_id: media_player.smart_tv
command: system.launcher/open
payload:
target: >
http://192.168.1.50:8090/video.mjpg?oid=3&size=1920x1080&maintainAR=true&backColor=0,0,0
alias: Открыть браузер с камерой
Теперь у нас на ТВ запустится встроенный браузер и откроется окно с видеокамерой с минимальной задержкой (webrtc)
У меня используется видеоглазок EZVIZ CS-DP2C у которого есть RTSP поток и можно добавить в AgentDVR. Отмечу, что RTSP работает тогда, когда включается камера, а как камера выключается, то RTSP выключается. Но можно выключить авто сон и RTSP будет работать всегда. Для этого нужно установить интеграцию EZVIZ из GUI и выключить auto sleep, после этого RTSP будет работать всегда, но будет быстро сокращаться уровень заряда аккумулятора, поэтому нужно озаботиться о постоянном питании. Я подключил видеоглазок к постоянному питанию, протянув провод внутри двери к видеоглазку
Далее создаем автоматизацию, которая будет при входящем вызове на дверь открывать браузер на ТВ. В качестве триггера я использую сенсор “Последнее уведомление”. Так как в интеграции EZVIZ для видеоглазка EZVIZ CS-DP2C нет сенсора входящего вызова, а разбирать и переделывать видеоглазок не хочется, то я использовал в мобильном приложении Home Assistant сенсор “Последнее уведомление” и указал только ezviz.
alias: "Видеоглазок: Трансляция на ТВ на кухне"
description: >-
При входящем вызове на видеоглазок, на телевизоре откроется браузер со
вкладкой видеопотока видеоглазка в реальном времени на N секунд, при этом
сохранив в историю текущий статус ТВ. После, окно на ТВ с камерой закроется и
ТВ вернется по истории
trigger:
- platform: state
entity_id:
- sensor.tablet_sm_t580_last_notification
to: Кто-то звонит в дверь
alias: Кто-то звонит в дверь
condition: []
action:
- service: scene.create
data:
scene_id: kitchen_tv_lg_history
snapshot_entities: media_player.lg_tv_kitchen
alias: Сохранить в историю
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
alias: Задержка в 1 секунду
- service: webostv.command
data:
entity_id: media_player.lg_tv_kitchen
command: system.launcher/open
payload:
target: >
http://192.168.1.50:8090/video.mjpg?oid=3&size=1920x1080&maintainAR=true&backColor=0,0,0
alias: Открыть браузер с камерой
- delay:
hours: 0
minutes: 0
seconds: 20
milliseconds: 0
alias: Задержка в 20 секунд
- service: scene.turn_on
target:
entity_id: scene.kitchen_tv_lg_history
metadata: {}
alias: Восстановить из истории
mode: single