-
-
Notifications
You must be signed in to change notification settings - Fork 135
Notification handling #923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Used guard instead of throwing cancellation Added proper weak self captures throughout Signed-off-by: Tim Mueller-Seydlitz <[email protected]>
Signed-off-by: Tim Mueller-Seydlitz <[email protected]>
Comprehensive parsing of notifications Improved error handling Signed-off-by: Tim Mueller-Seydlitz <[email protected]>
Signed-off-by: Tim Bert <[email protected]>
Signed-off-by: Tim Mueller-Seydlitz <[email protected]>
Signed-off-by: Tim Mueller-Seydlitz <[email protected]>
Signed-off-by: Tim Mueller-Seydlitz <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Enhances notification handling by introducing a structured payload model, improving UI display with icons, and refactoring various notification-related components.
- Introduces
PushNotificationPayloadfor structured notification data parsing - Adds notification icon display support and image fetching functionality
- Updates notification models and API methods for better data handling
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| openHAB/AppDelegate.swift | Adds image fetching for notification icons and updates notification display logic |
| openHAB/NotificationsView.swift | Updates UI state management and API method names |
| openHAB/OpenHABRootViewController.swift | Fixes typo in comment |
| OpenHABCore/Sources/OpenHABCore/Model/PushNotificationPayload.swift | New structured payload model for push notifications |
| OpenHABCore/Sources/OpenHABCore/Model/OpenHABNotification.swift | Restructures notification model with expanded payload support |
| OpenHABCore/Sources/OpenHABCore/Util/HTTPClient.swift | Renames method for consistency |
| OpenHABCore/Sources/OpenHABCore/Util/Endpoint.swift | Adds default parameters to icon method |
| openHAB.xcodeproj/project.pbxproj | Changes code signing configuration |
| fastlane/Fastfile | Updates changelog format |
| CHANGELOG.md | Adds recent change entries |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
OpenHABCore/Sources/OpenHABCore/Model/OpenHABNotification.swift
Outdated
Show resolved
Hide resolved
Signed-off-by: Tim Bert <[email protected]>
Signed-off-by: Tim Mueller-Seydlitz <[email protected]>
Signed-off-by: Tim Mueller-Seydlitz <[email protected]>
|
I overlooked NotificationService, maybe because it never worked so far for me. |
Signed-off-by: Tim Mueller-Seydlitz <[email protected]>
Not sure i understand, push notifications in general don't work for you ? |
|
Push notification work for me but the attached image is never displayed to me |
Is the image a openHAB image item or are you referencing a URL? It works for me consistently, would like to track down why its not working for you. FYI the "icon" option in the cloud actions does not work on iOS, maybe it did at one point long ago before i inherited it, but there is not a way to show an icon in an actual native iOS notification short of attaching it as a image which doesn't really make sense in practice. |
|
Can you please share an example call from a openhab rule where you send a notification |
|
Here's a notification when someone rings my front gate. actions.notificationBuilder("Someone is at the Front Gate")
.addUserId(email)
.withTitle('Front Gate')
.withTag('front-gate-activity')
.withReferenceId('front-gate-activity')
.withOnClickAction('ui:popup:widget:gate_control')
.withMediaAttachmentUrl('https://www.xxx.com/xxx/front-gate')
.addActionButton('Open Gate','command:GDSDrivewayGateSwitch:ON')
.addActionButton('Answer Call','ui:popup:widget:gate_control_auto')
.send();where I was actually just looking at changing the core HTTP rule actions to include an option to download and set an image to an item to make this easier for people, that would probably make this feature more accessible. |
|
@timbms if you are running 5.0.x nightlies, i added a new HTTP rule action to help with using images in notifications, you can grab a local image and set it as the state of an Item, then use that in the notification. This will work through myopenHAB as well a local, also has the advantage of capturing the image as the even happens, where a notification could be several seconds later and if hitting the camera directly, could miss the event in the image (which is why i will start using this) These are taken from the cloud binding README Rules DSL rule "Motion Detected Notification"
when
Item Apartment_MotionSensor changed to ON
then
setImage("Apartment_Camera_Snapshot", "http://camera.local/camera-snapshot.jpg");
sendBroadcastNotification("Motion detected in the apartment!", "motion", "Motion Tag",
"Motion Detected", "motion-id-1234", null, "item:Apartment_Camera_Snapshot",
"Turn on the light=command:Apartment_Light:ON", null, null)
endJavascript Rules rules.when().item('Apartment_MotionSensor').changed().to('ON').then(() => {
actions.HTTP.setImage("Apartment_Camera_Snapshot", "http://camera.local/camera-snapshot.jpg");
actions.notificationBuilder('Motion detected in the apartment!')
.withIcon('motion')
.withTag('Motion Tag')
.withTitle('Motion Detected')
.withReferenceId('motion-id-1234')
.withMediaAttachment('item:Apartment_Camera_Snapshot')
.addActionButton('Turn on the light', 'command:Apartment_Light:ON')
.send();
}).build('Motion Detected Notification');Ruby Rules rule "Motion Detected Notification" do
changed Apartment_MotionSensor, to: ON
run do
HTTP.setImage("Apartment_Camera_Snapshot", "http://camera.local/camera-snapshot.jpg");
Notification.send "Motion detected in the apartment!",
icon: "motion",
tag: "Motion Tag",
title: "Motion Detected",
id: "motion-id-1234"
attachment: "item:Apartment_Camera_Snapshot",
buttons: { "Turn on the light" => "command:Apartment_Light:ON" }
end
end |
|
Cool feature @digitaldan |
|
Hey @timbms i'm back from a trip and back working on openHAB, do you need anything from me on this PR? |
|
Hi @digitaldan good you are back. I was also off in remote Swiss mountains. |
The fix on the other notification PR that just got merged will address this. Hope you had a good holiday! My question was on this PR, are you waiting for a review, or is there more work to do? |
| options.append(contentsOf: extraOptions) | ||
|
|
||
| // Async Kingfisher call → gives you RetrieveImageResult with a UIImage. | ||
| let result = try await KingfisherManager.shared.retrieveImage(with: url, options: options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this will work with setups with authentication, client certs or myopenhab ?
Uh oh!
There was an error while loading. Please reload this page.