A short guide for setting up TV PiP notifications (with PiPup)

Also interested, have you figured this out?

Hello , still not .

On my Google TV I was able to install PiPup by just searching for it in the normal app installer. I tried adb first but was getting errors sideloading it. Once I got that installed the rest of the instructions are the same.

I am having issues getting an image to show up though through home assistant. This is what I have in there right now. Am I missing something?

service: rest_command.pipup_image_on_tv
data:
  ip: 192.168.170.83
  title: Home Assistant
  message: Doorbell pressed!
  duration: 30
  backgroundColor: "#80000000"
  url: http://MYURL.com/HomeAssistant/Snapshots/snapshot.jpg

The image is accessible on the local network and over the Internet. The message displays but not the image.

IP address isn’t required when already defined in rest_commands.yaml.

I installed and ran the allow permission step but the JSON never shows anything on my screen. I’m using Firestick 4K … do I have the wrong device or recent update broke this function?

Links from go2rtc do not work correctly. there is 401: Unauthorized messgae. Maybe you know how avoid it?

Does anyone else get warning and errors generate when running the script to generate the link ID to create the URL fir displaying the camera feed? Although my camera feed pops up on my android tv, I notice that when my automation runs the script, the following are logged:

Logger: homeassistant.core
Source: core.py:1253
First occurred: 11:35:57 (2 occurrences)
Last logged: 11:36:25

Error running job: <Job listen * HassJobType.Callback functools.partial(<function _forward_events_unconditional at 0x7f12838b62a0>, <bound method WebSocketHandler._send_message of <WebSocketHandler closing=False authenticated=True description=Supervisor from 172.30.32.2 (HomeAssistantSupervisor/2024.02.0 aiohttp/3.9.3 Python/3.12)>>, 86)>
OverflowError: int too big to convert

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 1253, in async_fire
    job.target(event)
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 132, in _forward_events_unconditional
    send_message(messages.cached_event_message(msg_id, event))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/messages.py", line 122, in cached_event_message
    _partial_cached_event_message(event)[:-1],
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/messages.py", line 138, in _partial_cached_event_message
    _message_to_json_bytes_or_none({"type": "event", "event": event.json_fragment})
                                                              ^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/backports/functools.py", line 70, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 1136, in json_fragment
    return json_fragment(json_bytes(self._as_dict))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Integer exceeds 64-bit range
Logger: homeassistant.components.recorder.table_managers.event_data
Source: components/recorder/table_managers/event_data.py:42
Integration: Recorder (documentation, issues)
First occurred: 11:35:57 (2 occurrences)
Last logged: 11:36:25

Event is not JSON serializable: <Event call_service[L]: domain=webrtc, service=create_link, service_data=link_id=6787777203816264975872725917469303880736, entity=camera.front_doorbell_sub, open_limit=1, time_to_live=120>: Integer exceeds 64-bit range
Event is not JSON serializable: <Event call_service[L]: domain=webrtc, service=create_link, service_data=link_id=6120108750403071545556268576633341270480, entity=camera.front_doorbell_sub, open_limit=1, time_to_live=120>: Integer exceeds 64-bit range

How can a smaller integer value within the 64-bit range be created instead of the current integers?

I raised the above with the WEBRTC dev and the link id variable needed to be changed from:

link_id: '{% for _ in range(40) %}{{ range(10)|random }}{% endfor %}'

to

link_id: "0{% for _ in range(39) %}{{ range(10)|random }}{% endfor %}"

and this prevents the above error. @seanblanchfield It might be worth updating this code in your guide at some point if you do any additional updates in future - thanks for your immensely helpful guide by the way! Also thanks @pacjo for this guide too!

I followed the guide, everything was working for 2 days, now it’s not working anymore.

When I check my script I see a error. It looks like that the pip app is starting in the background and is not reachable. Any ideas?

I had something similar the other day, and it turned out my firestick that I use for this had crashed and wasn’t responding. I unplugged it, then restarted it, and the script worked fine again. Maybe check your android device is fully functioning, or give it a reboot and then try running the script manually and see what happens?

I run this on 2 Sony Bravia TV’s , everything works fine on the TV. I think the PIP app is not starting in the background all the time!? And because off that it’s not reachable.

As soon as a open de PIP app manual, then it’s all working again.

You can try run pip apk by command, for start via Home Assistant’s ADB integration

Yaml code:

service: androidtv.adb_command
data:
command: >-
ps -ef | grep -v grep | grep pipup || am start nl.rogro82.pipup/.MainActivity
target:
device_id: you device id

Original Source

I’m wanting to use this as a free baby monitor for the wife and I to have as an option. How do I get a toggle effect to work, I know I can set duration to 0 but how do I remove it from the screen ideally with the same zwave button

I’ve made an integration that adds some services that should make it easier to use PipUp from HA: GitHub - dannytrigo/ha-pipup: Home Assistant integration for calling PipUp

Add the repository as a custom repository in HACS, restart, then add the integration, and you should get a new service to display the notifications, without messing with rest commands/templates in your configuration.yaml.

At the moment it depends on the androidtv (ADB) integration, and it takes the media player from that as input.

2 Likes

for me on hisense google tv I used
adb install app-debug.apk
instead of
adb sideload app-debug.apk

2 Likes

When the stream starts on the television, the sound is muted.
Is there a way to enable the playback of sound? Or start the video popup unmuted?

You can try

metadata: {}
data:
  command: >-
    adb shell media volume --show --stream 3 --set 65 
target:
  entity_id: media_player.android_tv_192_168_0_186
action: androidtv.adb_command

This is script for set volume to your desire.
So you can try to add to your pip script. Just edit your entitity.

Where do I put the code, my scripts is as following:

pipup_url_on_tv:

Use with Webrtc camera as described here:

Cast or share camera stream · AlexxIT/WebRTC Wiki · GitHub

url: http://192.168.2.181:7979/notify
content_type: ‘application/json’
verify_ssl: false
method: ‘post’
timeout: 65
payload: >
{
“duration”: {{ duration | default(130) }},
“position”: {{ position | default(0) }},
“title”: “{{ title | default(‘’) }}”,
“titleColor”: “{{ titleColor | default(‘#50BFF2’) }}”,
“titleSize”: {{ titleSize | default(12) }},
“message”: “{{ message }}”,
“messageColor”: “{{ messageColor | default(‘#fbf5f5’) }}”,
“messageSize”: {{ messageSize | default(14) }},
“backgroundColor”: “{{ backgroundColor | default(‘#0f0e0e’) }}”,
“media”: {
“web”: {
“uri”: “{{ url }}”,
“width”: {{ width | default(640) }},
“height”: {{ height | default(480) }}
}
}

Before or after you call your script. Put both in one automation or script as another action.