SgtBatten / HA_blueprints

Somewhere to store automation blueprints
212 stars 82 forks source link

[Config Support]: No snapshot or clip in notification on iOS on local network (wifi) #179

Open Calimerorulez opened 9 months ago

Calimerorulez commented 9 months ago

Describe the problem you are having or the outcome you are trying to achieve.

Hi,

I just discovered your repository as I was using the one from Hunter.

I'm trying to make it work on iOS, I'm receiving push messages, but no attachment or action is available. I only see the text.

Version

Latest beta and latest stable

Automation config file

Where do I find that?

Frigate Config

No response

Any other information that may be helpful

No response

SgtBatten commented 9 months ago

Hi, sorry I'll make the template clearer. In the automation page select edit in yaml and copy the yaml for your automation.

Calimerorulez commented 9 months ago

Hi 😄

I do not know if this helps a lot:

alias: "[Security] Object deurbel - new"
description: ""
use_blueprint:
  path: SgtBatten/Beta.yaml
  input:
    camera: camera.g4_deurbel
    notify_device: ad73a195f1df0eb2ffe7c069097df9e9
    cooldown: 0
    silence_timer: 0
    debug: true
    base_url: https://xxx.xxx.redacted
SgtBatten commented 9 months ago

Is frigate recording events?

For action buttons, hold the notification down

Calimerorulez commented 9 months ago

Yes, Frigate is recording events. Using 0.13.2.

Pressing and holding the notification does not show anything extra.

image

Calimerorulez commented 9 months ago

Triggered by the mqtt topic frigate/events at 8 maart 2024 om 12:52:24
Choose: Frigate Event executed
Frigate Notification () DEBUG: Info: fps: 5, frigate event id: 1709898743.43791-up3t61, object (formatted): person (Person), Config: camera(formatted): g4_deurbel(G4 Deurbel), Base URL: https://xxx, critical: False, alert once: False, Update Thumbnails: False, Video: , Target: Mobile Device cooldown: 0s, loiter timer: 0s, initial delay: 0s, color: #03a9f4, sound: default, android_auto: False, Group: g4_deurbel-frigate-notification, Channel: , Sticky: False, Title: , Message: A Person was detected on the G4 Deurbel camera., Subtitle: , tap_action: https://xxx/api/frigate/notifications/1709898743.43791-up3t61/g4_deurbel/clip.mp4, button 1 Text/URL/Icon: View Clip (https://xxx/api/frigate/notifications/1709898743.43791-up3t61/g4_deurbel/clip.mp4) , button 2 Text/URL/Icon: View Snapshot (https://xxx/api/frigate/notifications/1709898743.43791-up3t61/snapshot.jpg) , button 3 Text/URL/Icon: Silence New Notifications (silence-g4_deurbel) , icon: mdi:home-assistant tv: False, tv_position: center, tv_size: large, tv_duration: 10, tv_transparency: 0%, tv_interrupt: False, Filters: Zones: zone filter toggle on: False, Multi Zone toggle on: False, Required zones: [], Entered Zones: ['zone_voortuin'], Zone Filter TEST: PASS, Required objects TEST: Input: , TEST: PASS presence entity (not home): Entity: TEST: PASS, disabled times: [], State Filter: state filter toggle on: False, state filter entity: , required states: [], State Filter TEST: PASS, Custom Filter: True
4 seconden later
Frigate Notification () DEBUG (in loop): Send Notification: False Info: sublabel: None, image: "https://xxx/api/frigate/notifications/1709898743.43791-up3t61/thumbnail.jpg" Title: message: A Person was detected on the G4 Deurbel camera. iOS sound: enabled, Android Sound: enabled, iOS url: /api/frigate/notifications/1709898743.43791-up3t61/thumbnail.jpg video: "" critical: False, Triggers: New Snapshot: True - Disabled Presence Changed: False, Stationary Moved: False, Entered Zones Changed: False - Disabled, sublabel changed: False, Conditions: Loitering: 0 or Filters: Zones: Zone Filter Enabled: False, Multi Zone Enabled: False, Required Zones: [], Last Zones: ['zone_voortuin'], Entered zones: 1 - ['zone_voortuin'], TEST: PASS, Object Filter: Input: , TEST: PASS, Presence entity (not home): Entity: , TEST: PASS, Time Filter: Disabled times: [], TEST: PASS State Filter: state filter toggle on: False, state filter entity: , required states: [], TEST: PASS, Custom Filter: PASS,
Finished at 8 maart 2024 om 12:52:28 (runtime: 4.25 seconds)
Not all shown logbook entries might be related to this automation.
Calimerorulez commented 9 months ago

If I manually visit the URLs in de debug message, I can see footage.

Calimerorulez commented 9 months ago

And if I tap the message, the clip does open in a new browser window.

SgtBatten commented 9 months ago

Try using update attachment. Could be related to #45

Calimerorulez commented 8 months ago

Small update. I've disabled ipv6 on my network and now it seems to work... 😄

I will experiment more.

Calimerorulez commented 8 months ago

Small update. When connected via the internal network/Home Assistant url, I now do not see the small preview. When connected externally, it does show.

Both messages are actionable so that is working now 😃

image

SgtBatten commented 8 months ago

It gets weirder and weirder. Appreciate the troubleshooting

wraith1385 commented 8 months ago

I am experiencing this issue too. I have my doorbell notifications on the beta blueprint and all of my others on the stable. The ones on the stable show the snapshots, but the doorbell one doesn't. I should also note that the doorbell one used to show snapshots when it was on stable version.

SgtBatten commented 8 months ago

I am experiencing this issue too. I have my doorbell notifications on the beta blueprint and all of my others on the stable. The ones on the stable show the snapshots, but the doorbell one doesn't. I should also note that the doorbell one used to show snapshots when it was on stable version.

If that stays consistent for a while you might have identified something, but every time so far it's been one way for a while then reverts sometimes so it's Inconsistent. Please continue to monitor it.

NasKar2 commented 8 months ago

I'm having the same issue. Sometimes I get the notification with a thumbnail and sometimes just text. I want when I press and hold the notification to see the snapshot of who is at the door. If I go to my frigate card I can see the snapshot and view the clip.

alias: Frigate Notifications (0.12.0.2)
description: ""
use_blueprint:
  path: SgtBatten/Stable.yaml
  input:
    camera: camera.camerafrontdoor
    notify_device: xxxxxxxxxxxxxxxxxxxxxxx
    attachment: thumbnail
    critical: "false"
    title: Front Door
    silence_timer: 1
    debug: true
    ios_live_view: true
    tap_action: "{{base_url}}/api/frigate/notifications/{{id}}/snapshot.jpg"
    url_1: "{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4"
    base_url: ha.xxxxxxxxxx.com
    labels:
      - person
      - car
    notify_group: all_phones
andersonsmith commented 5 months ago

I have an android and my wife uses an iphone. Having the same issue where my phone was working great but notifications on my wife's phone were missing the image. Testing with manual notifications through a completely non-scientific process of trial and error I have been able to get the iphone notifications to include a thumbnail as long as video: '' is removed/commented out. I updated the yaml for the blueprint to comment out all lines where video would be called in message data and it is working perfectly. I also tried to include a link to a clip instead but that also caused issues with the thumbnail.

SgtBatten commented 5 months ago

@NasKar2 add a delay (initial delay option) or enable update thumbnails.

SgtBatten commented 5 months ago

I have been able to get the iphone notifications to include a thumbnail as long as video: '' is removed/commented out

This is incredibly interesting. So even if the parameter is blank it causes issues but if commented out it does not?

Digital-Ark commented 5 months ago

I get thumbnail images on my notifications 100% of the time when I am off my local wifi, via my domain (i.e. https://hass.mydomain.ca

I get notifications without thumbnails 100% of the time when I am at home on my local wifi. My ISP-supplied router does not support loopback, so my domain is not reachable.

Is this interesting, is there any info I can provide to help solve this issue?

ratbich commented 3 months ago

i get picture attachment only off wifi

off wifi I am connected to my network via wireguard with same DNS so I am not sure why

anyone have fix?

OneBangDash commented 3 months ago

I can confirm that my issue is identical to what @Digital-Ark and @ratbich have described. I use my own domain, hass.mydomain.com, and when on my home wifi, I do not get thumbnails on my notifications. Long pressing the notification does show the snapshot while on wifi. If I turn my wifi off and trigger an alert, I do get thumbnails.

SgtBatten commented 3 months ago

It seems to be unique to IOS though is that right?

I have my own domain also and no issues on android. (with the image anyway. sometimes the text is missing but it's too random for me to work out yet)

andersonsmith commented 3 months ago

I have also had zero issues with android but my wife's iPhone still keeps being tricky. Have my own domain as well. Also get this on my wife's phone for the exact notifications that work on my android. IMG_20240825_153502~2

OneBangDash commented 3 months ago

It seems to be unique to IOS though is that right?

I have my own domain also and no issues on android. (with the image anyway. sometimes the text is missing but it's too random for me to work out yet)

That's correct, this is on iOS. My wife and I both have iPhones. I kept hers on wifi, put mine to cellular, and triggered an event. My phone on cellular showed the thumbnail while hers was text only. Long pressing the notification on either phone did show the snapshot. Very strange.

SgtBatten commented 3 months ago

I still hope there's something in the HA docs that's I've missed and it can be fixed.

WilldabeastHA commented 2 months ago

I have an android and my wife uses an iphone. Having the same issue where my phone was working great but notifications on my wife's phone were missing the image. Testing with manual notifications through a completely non-scientific process of trial and error I have been able to get the iphone notifications to include a thumbnail as long as video: '' is removed/commented out. I updated the yaml for the blueprint to comment out all lines where video would be called in message data and it is working perfectly. I also tried to include a link to a clip instead but that also caused issues with the thumbnail.

I can confirm that removing all of the sections that contain 'video' and updating the url to '/api/frigate/frigate{{client_id}}'

also i have to set my base url in HA to http://xxx.xxx.x.xxx:8123/

not sure why my url contains /frigate/frigate but it works when this is updated as well. i'm using the beta 12.0.4f blueprint

SgtBatten commented 2 months ago

The companion docs clearly say that using the keys how we do should override any video key

image

It is an IOS only option

SgtBatten commented 2 months ago

Can you guys try latest beta 0.12.0.4g. random idea. please report back

                                    attachment:
                                      url: "{{base_url}}/api/frigate{{client_id}}/notifications/{{id}}/{{camera + '/clip.mp4' if video|length>0 and wait.trigger.payload_json['type'] == 'end' else attachment }}"
                                      lazy: true
ratbich commented 2 months ago

I can test the 0.12.0.4g beta tomorrow with my findings

wraith1385 commented 2 months ago

Just tried out the beta and now the snapshot doesn't show up when off of local wifi either. I left some of the notifications on the stable version and they are still showing the snapshot when not connected to local wifi.

SgtBatten commented 2 months ago

Thanks. I'll revert it tomorrow.

@wraith1385 can you access home assistant via your external url when at home on wifi?

wraith1385 commented 2 months ago

Yeah, and when I tap on the notification it opens the clip. Just nothing is attached.

ratbich commented 2 months ago

Did a quick test 0.12.0.4g on wifi , no snapshot in the notification. Used fresh template and only picked my camera and iPhone all rest default.

SgtBatten commented 2 months ago

reverted that change. thanks for trying.

Do you all have persistent connections set up?

its in the companion app settings

https://companion.home-assistant.io/docs/notifications/notification-local/

Digital-Ark commented 2 months ago

Yes, I have an internal server configured with local push enabled.

wraith1385 commented 2 months ago

Same here

SgtBatten commented 2 months ago

trying something else, can you try this version please from #282 https://github.com/SgtBatten/HA_blueprints/blob/00160db01138e076d6391525749cb2f1d69c202c/Frigate_Camera_Notifications/Beta.yaml

wraith1385 commented 2 months ago

So, now it's trying to attach something to the notification, but I'm getting "Failed to load Attachment Response status code was unacceptable 404" when not on local wifi and "Failed to load Attachment The given URL was invalid" when on local wifi.

evgenyyy commented 2 months ago

I am having the same problem on iOS. No snapshots in the notification whether on or off WiFi. This was working on Frigate 13 btw. Also, there are no action buttons when I long press on the notification. If I open the notification URL (from Traces) manually in the browser, the clip/snapshot shows up.

SgtBatten commented 2 months ago

Not the same issue. Please open a new one @evgenyyy

SgtBatten commented 1 month ago

Could someone specifically having this issue where it wont work on local wifi please test the latest beta

wraith1385 commented 1 month ago

I moved to the newest beta and can confirm that the snapshot is now showing up in the notification on both local wifi and cellular.

Amadou91 commented 1 month ago

I have been following this issue for a very long time and I can also now confirm that this is the first time it has been consistently working without issue. There were so many other times I thought it was fixed, but this sure seems to have done it.

Amadou91 commented 1 month ago

Will these put into the 0.14 Frigate branch? I prefer using the reviews topic and having the option of reviews or defections. 😁

SgtBatten commented 1 month ago

well hot damn that's great news. Yes i can add it ot the other files tonight maybe