How to send a snapshot to the HA app?

Hello, I’m able to send a snapshot to Telegram by taking a snapshot with camera.snapshot service. and a function node like:

var snapshot = "/config/www/snapshots/snapshot_camera.jpg";

msg.payload = {};
msg.payload.chatId = [xxxxxxxxxxx];
msg.payload.type = "photo";
msg.payload.content = snapshot;
return msg;

Now I do try the same to notify for the HA app.
I’m not able to do so.
I try to use the “call service node”, but I’m not able to get the data part right. I’m able to send tekst as notify message. But how to send a snapshot?
this works for tekst:

{
    "title": "TEST bericht:",
    "message": "kijken of dit werkt: {{payload}}"
}

I tried this data for a snapshot giving an API error:

{
    "title": "TEST bericht:",
    "message": "kijken of dit werkt: ",
    "data": {
        "photo": "/config/www/snapshots/snapshot_camera.jpg",
        "capture": "Snapshot"
    }
}

Any help would be nice.

EDIT:
I found the solution at this link: https://companion.home-assistant.io/docs/notifications/notification-attachments

{
    "title": "TEST bericht:",
    "message": "Kijken of het werkt",
    "data": {
        "attachment": {
            "url": "https://myadres.duckdns.org/local/snapshots/snapshot_camera.jpg",
            "content-type": "png",
            "hide-thumbnail": false
        }
    }
}
This

is only giving a small thumbnail. Next step will be to find out the full image

Hey Canedje (I think I remember you from the Homey community? ;)),

I was wondering if you’ve got this puzzle solved?
Some months ago I started the same challenge but when I didn’t succeed I quit after putting in numerous hours.Since you were on the right way I was wondering if you completed your path and could give me some tips.

Hello Roel,
I’m coming from Homey indeed, but not willing to go back anymore.
HA is much stronger.

I did succeed indeed.
I do programming everything in NodeRED
Hereby the NodeRED node to send to HA:

[{"id":"3968012b.a85d1e","type":"api-call-service","z":"9434f210.13ebd","name":"Notify via HA","server":"783e002.7fe69","version":3,"debugenabled":false,"service_domain":"notify","service":"mobile_app_ipad_van_edward","entityId":"","data":"{\"title\":\"TEST bericht:\",\"message\":\"Kijken of het werkt\",\"data\":{\"image\":\"https://dukkie.duckdns.org/local/snapshots/snapshot_camera.jpg\"}}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":648,"y":527,"wires":[[]]},{"id":"783e002.7fe69","type":"server","name":"Home Assistant","version":1,"legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

Tipje: Het is veiliger om niet de link naar je eigen url in de nodered flow te zetten.
ik kan nu zelfs je auto voor je deur zien staan. :wink:

1 Like

yep je hebt gelijk. Dank je voor de tip

1 Like