PiPup - Android TV app for notifications

lol duh. my fault, thx

Can someone please kindly send me the APK file?

Not sure of the legality of that, but also don’t know how to get the apk off my MiBox.
Finally got it to work, but video is proving tough for me to get working. I think it is likely my situation with my network and everything in my house more than this application though.

1 Like

I’m trying to get this working but not having any success. I have the app installed and running on my Android TV.

code:

rest_command:
  loungetv_doorbell:
    url: http://192.168.0.81:7979/notify
    content_type: 'application/json'
    verify_ssl: false
    method: 'post'
    timeout: 30
    payload: >
      {
      "duration": 20,
      "position": 0,
      "title": "Home Assistant",
      "titleColor": "#50BFF2",
      "titleSize": 14,
      "message": "Someone is at the door",
      "messageColor": "#fbf5f5",
      "messageSize": 12,
      "backgroundColor": "#0f0e0e",
      "media": { "web": {
        "uri": "rtsp://admin:[email protected]:554/ch1/main/av_stream", "width": 480
      }}
      }

The stream loads in VLC player so I know the URL is ok (password has been changed for this post).

If I call the service from the dev panel, I get nothing on the TV or in the HA logs… any ideas? I initially tried with the media type being ‘video’, then ‘web’. Neither work.

I would suggest to just try an image first and see if you can get that to work.
I had issues with video too, but images work fine.
I got one stream to work and that was from blue iris that is setup to push the video via HLS. It just took too long to load to be usable.

Unfortunately pipup can neither stream RTSP nor handle authentication.

installed PiPup on my Android TV. when i go in the brower to ip:7979. i get; invalid request: invalid method

Hey, I managed to get this working which is fantastic and soo simple!
QQ: is it possible to add multiple AndroidTVs to the url?
i.e: url: http://192.168.0.yy:7979/notify; http://192.168.0.xx:7979/notify

Cheers

I have the same issue but am using ZoneMinder and it comes up with an error in the box.
net:err_cleartext_not_permitted

I am using HTTP locally, does this need to be HTTPS?

I’ve been using this for my video feeds and it’s been working great most of the time. There are times where a white box pops up instead of the video feed. I’m trying to debug it but was wondering if anybody else has run into a similar issue with it.

It seems like a reboot will fix it. I’ve heard that it may be an issue with webview but don’t know much more than that.

Thanks!

1 Like

Can I ask you to share your PIPUP-config? which TV are you using?

Thanks

A bit late but yes currently HTTPS is required because of Androids default policies. You can alter the manifest to allow HTTP though… perhaps I should change that as I also ran into this issue myself :slight_smile:

2 Sony TVs ( one running with a Shield )

Are there plans to release a non-beta version in the Play Store? I might want to take a look at creating an Home Assistant Notify integration for this.

I initially looked at the nfandroidtv, but the App has an issue where it seems to delay the popup for a few secons.

I suspect we’ve already got what we need from the rest platform… I did a quick test with the following configuration;

- platform: rest
  name: pipup_living_room_tv
  resource: !secret living_room_android_tv_pipup_host
  method: POST_JSON
  headers:
    Content-Type: application/json
  message_param_name: message
  title_param_name: title
  data_template:
    duration: >
      {{ states("input_number.pipup_living_room_tv_duration")|int }}
    position: >-
      {%- set map = {
        'Top left': 1,
        'Top right': 0,
        'Bottom left': 3,
        'Bottom right': 2,
        'Center': 4,
      } -%}
      {{ map[states("input_select.pipup_living_room_tv_position")]|int }}
    titleColor: >
      {{ states("input_text.pipup_living_room_tv_title_color") }}
    titleSize: >
      {{ states("input_number.pipup_living_room_tv_title_size")|int }}
    messageColor: >
      {{ states("input_text.pipup_living_room_tv_message_color") }}
    messageSize: >
      {{ states("input_number.pipup_living_room_tv_message_size")|int }}
    backgroundColor: >
      {{ states("input_text.pipup_living_room_tv_background_color") }}

    # This is where I ran in to trouble, though..
    # How do we properly render the values from i.e. `data.image.uri` passed in with the service call here?
    media:
      image:
        uri: '{{ value }}'
        width: '{{ value }}'

… and the input helpers, for anyone interested;

##
input_number:
  - pipup_living_room_tv_duration:
      name: Varighet
      min: 1
      max: 60
      step: 1
      icon: mdi:timelapse
      unit_of_measurement: s
  - pipup_living_room_tv_title_size:
      name: Tekststørrelse tittel
      min: 5
      max: 40
      step: 1
      icon: mdi:format-size
      unit_of_measurement: pt
  - pipup_living_room_tv_message_size:
      name: Tekststørrelse melding
      min: 5
      max: 40
      step: 1
      icon: mdi:format-size
      unit_of_measurement: pt

##
input_text:
  - pipup_living_room_tv_title_color:
      name: Tittelfarge
      icon: mdi:format-color-text
      min: 7
      max: 9
      pattern: ^((0x){0,1}|#{0,1})([0-9A-F]{8}|[0-9A-F]{6})$
  - pipup_living_room_tv_message_color:
      name: Meldingsfarge
      icon: mdi:format-color-text
      min: 7
      max: 9
      pattern: ^((0x){0,1}|#{0,1})([0-9A-F]{8}|[0-9A-F]{6})$
  - pipup_living_room_tv_background_color:
      name: Bakgrunnsfarge
      icon: mdi:format-color-fill
      min: 7
      max: 9
      pattern: ^((0x){0,1}|#{0,1})([0-9A-F]{8}|[0-9A-F]{6})$

##
input_select:
  - pipup_living_room_tv_position:
      name: Posisjon
      icon: mdi:dots-grid
      options:
      - 'Top left'
      - 'Top right'
      - 'Bottom left'
      - 'Bottom right'
      - 'Center'

… and the lovelace card to configure the helpers and test it out:

type: 'custom:vertical-stack-in-card'
cards:
  - type: picture-entity
    entity: camera.living_room_tv_snapshot
    show_state: false
    show_name: false
  - type: entities
    show_header_toggle: false
    entities:
      - entity: input_select.pipup_living_room_tv_position
        tap_action:
          action: none
      - entity: input_number.pipup_living_room_tv_duration
        tap_action:
          action: none
      - type: section
        label: Farger
      - entity: input_text.pipup_living_room_tv_title_color
        name: Tittel
        tap_action:
          action: none
      - entity: input_text.pipup_living_room_tv_message_color
        name: Melding
        tap_action:
          action: none
      - entity: input_text.pipup_living_room_tv_background_color
        name: Bakgrunn
        tap_action:
          action: none
      - type: section
        label: Tekststørrelse
      - entity: input_number.pipup_living_room_tv_title_size
        name: Tittel
      - entity: input_number.pipup_living_room_tv_message_size
        name: Melding
      - type: section
      - type: button
        name: ' '
        icon: 'mdi:send-circle-outline'
        action_name: Forhåndsvisning
        tap_action:
          action: call-service
          service: notify.pipup_living_room_tv
          service_data:
            title: Test
            message: Dette er en test av innstillingene!
1 Like

This looks really awesome but sadly I can’t get it to work.
I installed the app from the Play Store and can connect to it (invalid request: invalid method in the browser).

I then tried send a simple POST, which gives me a 200 return code and this response:

PopupProps(duration=30, position=TopRight, backgroundColor=#CC000000, title=Hello, titleSize=16.0, titleColor=#ffffff, message=There, messageSize=16.0, messageColor=#ffffff, media=null)

So the communication with the app appears to be OK but nothing is showing up on the TV itself sadly. I restarted the TV and have the app open.

Anything else I can try? Do I need to give it permissions somewhere? It’s a Sony XH90 TV.

EDIT: got it working by going into the TV to Apps > Special Apps permissions at the botttom > Show before other apps and there enable PIPup. (Mine is in Dutch so I don’t have the exact translation)

2 Likes

It’s a shame this doesn’t support RTMP/RTSP. I intended to use it to send a security camera stream when Frigate’s person detection triggered. Currently, I’m opening VLC when the TV is on standby, and using PiPup to send a snapshot if not. Not ideal, but a good opportunity for me to learn how to configure Home Assistant.

Here’s my rest command configuration:

  pipup:
    url: !secret pipup_host
    content_type: 'application/json'
    verify_ssl: false
    method: 'post'
    timeout: 20
    payload: >
      {
      "duration": "{{ duration }}",
      "position": "{{ position }}",
      "title": "{{ title }}",
      "titleColor": "{{ titleColor }}",
      "titleSize": "{{ titleSize }}",
      "message": "{{ message }}",
      "messageColor": "{{ messageColor }}",
      "messageSize": "{{ messageSize }}",
      "backgroundColor": "{{ backgroundColor }}",
      "media": { "{{ mediaType }}": {
        "uri": "{{ uri }}", "width": "{{ width }}"
      }}
      }

Here’s the automation I described above:

  - alias: "Person Detected"
    trigger:
      platform: mqtt
      topic: frigate/events
    action:
      - choose:
        - alias: "If Standby, VLC"
          conditions:
            - condition: state
              entity_id: media_player.tv
              state: "standby"
          sequence:
            - service: androidtv.adb_command
              data:
                entity_id: media_player.tv
                command: >-
                  input keyevent KEYCODE_WAKEUP
            - service: androidtv.adb_command
              data:
                entity_id: media_player.tv
                command: >-
                  am start -a android.intent.action.VIEW -d
                  <RTSP_URL> -n
                  org.videolan.vlc/.gui.video.VideoPlayerActivity
        default:
          - service: rest_command.pipup
            data:
              title: "Home Assistant"
              message: "A {{trigger.payload_json['after']['label']}} was seen in {{trigger.payload_json['after']['camera']}}."
              backgroundColor: "#DD000000"
              duration: 10
              messageColor: "#FFFFFF"
              messageSize: 10
              position: 2
              titleColor: "#50BFF2"
              titleSize: 15
              mediaType: "image"
              uri: "https://<HA_URL>/api/frigate/notifications/{{trigger.payload_json['after']['id']}}/thumbnail.jpg"
              width: 640
2 Likes

I have a Shield TV running Android 9, and I installed PiPup using the playstore and then adb the system alert permission (I dont have the apk).
Working well for everything, except I can’t display http images from my local network, which would be quite useful :yum:
How is it possible to edit the manifest.xml ? I should take the sources and build the apk from it ? If yes, should I use Android Studio or some ?
Also, what should be changed to allow no secured http connections ?

1 Like

thanks but why image local dont work?
only full path external internet work
please help

i have mi box androaid 9