OH4.2.0 Notifications with Android App - MEDIA ATTACHEMENTS

Hi

I have some issues to get the image working on my Android by using the “item:” tag in the media part of the notification.

I can’t get the image working when I try to send notifications from OpenHab in following way

sendNotification("gmail@gmail.com", "message", "camera","CameraTag", "Camera Title", null, null, "**item:NOB_ZM_Monitor1_Image**", "Turn on the light=command:Shelly1_01_Button:ON", null, null)

The item NOB_ZM_Monitor1_Image is defined as an image

Image       NOB_ZM_Monitor1_Image    "Image [%s]"                   				 { channel="zoneminder:monitor:1:image" }

However when I save that image to a jpg file in HTML folder and reference it then I get the image as expected.

sendNotification("gmail@gmail.com", "messageToSend", "camera","Camera", "Camera Detection", null, null, **"/static/camera.jpg"**, "Turn on the light=command:Shelly1_01_Button:ON", null, null) 

I tried to look in the android code and as well in the cloud connector to understand where the parsing happens and if I am using the right format. Please advice :slight_smile:

Note: I tried to upgrade my Android client with the latest release available in GitHub, and the OpenHab version is also on latest.

Hi,

I’m seeing the same issue.

With a url I get an image as expected, with an item (snapshot from one of my camera’s) I get the same result as if I send a notification without an attachment. (in a previous build it crashed the app)

My Item contains: “raw type (image/jpeg): …”

Same

(not me)

4 Likes

Hi @mueller-ma

Thank you for your fast support.
I can confirm that it is working now with the Android version 3.15.5-release

BR

Hi,
Since OH client got upgraded to 3.15.2 i have issues with sending information to the server (like alarm time, call state) i keep getting notification errors cannot send to server (no cloud, even with local connection on wifi)

I would like to try 3.15.5 you mentioned, but f-droid offers only 3.15.2.
I use fdroid version without google dependencies.
Can I download apk from somewhere?

F-Droid usually needs ~2-5 days to pick up updates. I pushed 3.15.5 to Play Store with 50% distribution right now.

Thanks i got it from github, problem solved

guys maybe a stupid question but this url attachement does it only work locally or also trough myopenhab ?

Items are proxied via myopenhab, but absolute urls don’t.

1 Like

Hi all. Using OH 4.2.1 I am trying to send a notification for our doorbell that includes the camera image. I am also having the problem that, while the notification itself is being send, it does not include the image media.

The image Item is defined as:

Image DoorbirdKameraKlingel "Doorbell Pressed Image [%s]" { channel="doorbird:d101:doorbell:doorbellImage" }

I am using the new notification action builder to build the notification in JS:

rules.
    when().item("DoorbirdKlingelGedrueckt").receivedUpdate().toOn()
    .then((event) => {
        actions.notificationBuilder('Es klingelt!').addUserId('a@b.de').withMediaAttachmentUrl('**item:DoorbirdKameraKlingel**').send();
    })
    .build("Notification bei Klingel", "Notification bei Klingel");

Am I doing anything wrong?

Anybody?

Android or iOS? From the Android app code what you’re doing seems correct.
Does the image item contain a URL or the actual image data?
Edit: and another thing: is your OH reachable for the phone at the time you receive the notification? That’s a precondition for fetching the item state.

Hello. I am using Android. The item contains the raw image. Is that wrong? Should it be a URL?

Why does your media attachment URL start with and end with **?

1 Like

I used the syntax in the original posting above. Is that not correct?

The syntax for image from Item is just

item:itemName

Ouch, and I thought this was just a failed attempt at highlighting the text :-/ @ericbodden I assume that’s exactly what the OP intended (showing the respective text in bold)

1 Like