Notifications with snapshots - internal/external URL problem

Hi there,

I use this code to take a snapshot and send it as notification:

action:
  - variables:
      path: /config/www/tmp/
      datetime: "{{as_timestamp(now()) | timestamp_custom('%y%m%d_%H%M%S')}}"
      time: "{{as_timestamp(now()) | timestamp_custom('%H:%M')}}"
      inturl: http://192.168.100.23:8123/local/tmp/
      exturl: http://exturl.net:8123/local/tmp/
  - delay: "00:00:01"
  - service: camera.snapshot
    data:
      filename: "{{path}}{{datetime}}_Haustuer.jpg"
    target:
      entity_id: camera.webcamhaustuer_snapshots_sub
  - service: camera.snapshot
    data:
      filename: "{{path}}{{datetime}}_Pool.jpg"
    target:
      entity_id: camera.webcampool_snapshots_sub
  - delay: "00:00:01"
  - service: notify.mobile_app_handynermin
    data:
      title: Bewegung erkannt
      message: >
        {% if trigger.entity_id == 'binary_sensor.webcamhaustuer_person'
        %}Bewegung vorm Haus um {{time}} Uhr erkannt{% else %}Bewegung vorm Pool
        um {{time}} Uhr erkannt{% endif %}
      data:
        image: "{{exturl}}{{datetime}}_Haustuer.jpg"
        clickAction: /dashboard-nermin/sicherheit
        group: webcam
        channel: SemiCritical
  - service: notify.mobile_app_handynermin
    data:
      title: Bewegung erkannt
      message: >
        {% if trigger.entity_id == 'binary_sensor.webcamhaustuer_person'
        %}Bewegung vorm Haus um {{time}} Uhr erkannt{% else %}Bewegung vorm Pool
        um {{time}} Uhr erkannt{% endif %}
      data:
        image: "{{exturl}}{{datetime}}_Pool.jpg"
        clickAction: /dashboard-nermin/sicherheit
        group: webcam
        channel: SemiCritical
mode: single

The issue is following:

  • If my phone is in home WiFi, than snapshots are only shown in notifications, if I use the inturl in the “image:” attribute
  • when my phone is on GSM, snapshots are only shown, if exturl is used

Other combination (WiFi+exturl or GSM+inturl) simply show no snapshot in the notification.

Is this normal behavior?

Cheers and thanks,
zavjah

You cannot access internal network(LAN) directly from GSM (WAN) IP. Router or firewall will/should block this.

Can you connect to HA UI using wifi + external? May be NAT issue? Maybe ISP block this?

Hello @tmjpugh ,

yes, my HA is accessible form outside via an external URL all the time, no need for local WiFI or VPN. That’s why I’m wndieriung.

I expect this to work:

And that would be fine. BUT, with the combination of Phone @local WiFi + xyz.com snapshots are not shown in the notification, ALTHOUGH when I copy the URL in the phones browser snapshot is shown. That’s why I am wondering. Or am I overseeing something?

Cheers.
Zavjah

Based in the image, the only “X” should not work and is normal. You cannot access local IPs from internet directly.

Notifications must use WAN/web accessible link.

Image is downloaded from external server then sent to phone. Notification services is not direct from your HA server and use external service.

Exactly! When Phone is NOT in local network, cases 2 and 4 must work, provided I have web accessible links to the snapshots, which I have.

Strange enough - without me changing a thing - just until few minutes ago case 2 didn’t work, but it works now :smiley:

I have no clue why, but I do not care for the moment.

thx anyhow and cheers,
Zavjah