HA push notification: Send a local image?

When my camera detects a motion, i’m capturing a snapshot and saving it under:

/config/www/backyard_snapshot.jpg

now i want to access this image when i use a call service (in node red) and send it over to my phone. i’ve tried the following but haven’t been able to make it work:

{
    "title": "Backyard",
    "message": "Motion Detected!",
    "data": {
        "ttl": 0,
        "priority": "high",
        "image": "local/backyard_snapshot.jpg"
    }
}
{
    "title": "Backyard",
    "message": "Motion Detected!",
    "data": {
        "ttl": 0,
        "priority": "high",
        "image": "https://x.duckdns.org/local/backyard_snapshot.jpg"
    }
}
{
    "title": "Backyard",
    "message": "Motion Detected!",
    "data": {
        "ttl": 0,
        "priority": "high",
        "photo": [
            {
                "url": "https://x.duckdns.org/local/backyard_snapshot.jpg"
            }
        ]
    }
}

any ideas? thanks!

Do it the same way I mentioned in the other thread. This is the exact automation my example came from, sending a camera snapshot to me. As for the Node-Red side, I can’t help as I don’t use it.

Lonely Node-Red user here!

Lipstick, were you able to figure out how to accomplish this?

Personally speaking, I have been able to push a notification to the HA-companion app on Android.

That will prompt me when I enter or leave a pre-set radius around my home using GPS.

The last thing I would like to add to this flow is an image from within my garage to come along with the Android Notification.

This is what I have cobbled together, though sadly no image pops up with the android notification:

{
    "title": "HA - Notification",
    "message": "Trigger Garage Door?",
    "data": {
        "attachment": {
            "content-type": "jpeg",
            "url": "https://??????.duckdns.org/local/garage_snapshot.jpg"
        },
        "actions": [
            {
                "action": "Garage_Door",
                "title": "Yes Please"
            }
        ]
    }
}

Thoughts anyone?

You should always look at the proper documentation when doing these things, Android has never sent images in that format :slight_smile:

1 Like

Too bad android doesn’t allow video, would be great…
Is there no other workaround? Maybe send each sec snapshots to the same notification popup?

Thank you for your feedback!

I am VERY interested in finding the correct format that I should be using in order for this function to be successful. I have looked at that HA document prior, though sadly I have not taken away anything that gave me correct format to use via NodeRed.

All of the helpful information is written in YAML, though it would seem that all NodeRed wants me to enter is JSON :frowning:

So, that is my disconnect.

I tried using a YAML - > JSON converter online, though that is causing some API errors with the call services node. (Most likely because I am sending redundant info)

It is possible that I might be barking up the wrong tree coming here to ask for a solution to an issue that is caused by my lack of knowledge with how to properly use NodeRed.

That said, I am sure if I just used the notification platform within HA, then it would be working as intended.

YAML and JSON may be formatted differently but the keywords and variables use are still the same. So where in the link I posted do you see attachment being used? You need to start there and look at the basics. If you don’t get YAML maybe consider focusing on understanding YAML before you move on to Node Red?

Follow the examples on the docs site and make sure your JSON sticks to that. There is also a discord channel for node red if you need more help too.

Thank you for your prompt reply and encouragement.

As you have suggested, it is more a matter of me understanding and navigating to nuances between YAML and JSON.

The real breakthrough came when I was reading a GitHub post that you had helped with last Oct 2020.

I have posted my findings here:
My solution

All the best,
Rob

1 Like

Hi All,

anybody a hint how to grab and send a 5 sec Video instead of the picture?

THX M

Android doesn’t support that.