Skip to content

Commit

Permalink
NotificationAction: add Notification.log to send log notifications (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jimtng authored Jul 5, 2024
1 parent 5c06b9f commit 5efc2e8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/openhab/core/actions/notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,20 @@ def hide(email: nil, id: nil, tag: nil)
NotificationAction.__send__(:"hide_#{notification}_by_reference_id", *args, id) if id
NotificationAction.__send__(:"hide_#{notification}_by_tag", *args, tag) if tag
end

#
# Sends a log notification.
#
# Log notifications do not trigger a notification on the device.
#
# @param msg [String] The message to send.
# @param icon [String, Symbol, nil] The icon name
# @param tag [String, Symbol, nil] a name to group the type or severity of the notification.
# @return [void]
#
def log(msg, icon: nil, tag: nil)
NotificationAction.send_log_notification(msg.to_s, icon&.to_s, tag&.to_s)
end
end

Object.const_set(name.split("::").last, self)
Expand Down

0 comments on commit 5efc2e8

Please sign in to comment.