Module: OpenHAB::Core::Actions
- Included in:
- DSL
- Defined in:
- lib/openhab/core/actions.rb,
lib/openhab/core/actions/exec.rb,
lib/openhab/core/actions/http.rb,
lib/openhab/core/actions/ping.rb,
lib/openhab/core/actions/audio.rb,
lib/openhab/core/actions/voice.rb,
lib/openhab/core/actions/ephemeris.rb,
lib/openhab/core/actions/transformation.rb
Overview
Access to global actions.
All openHAB's actions including those provided by add-ons are available, notably:
From add-ons, e.g.:
- NotificationAction (from openHAB Cloud Connector; see notify)
Thing-specific actions can be accessed from the Thing object. See Thing#actions.
Defined Under Namespace
Classes: Audio, Ephemeris, Exec, HTTP, Ping, Transformation, Voice
Class Method Summary collapse
-
.notify(msg, email: nil, icon: nil, severity: nil, title: nil, on_click: nil, attachment: nil, buttons: nil) ⇒ void
Send a notification using openHAB Cloud Notification Action.
Class Method Details
.notify(msg, email: nil, icon: nil, severity: nil, title: nil, on_click: nil, attachment: nil, buttons: nil) ⇒ void
Note:
The parameters title
, on_click
, attachment
, and buttons
were added in openHAB 4.2.
This method returns an undefined value.
Send a notification using openHAB Cloud Notification Action.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/openhab/core/actions.rb', line 101 def notify( msg, email: nil, icon: nil, severity: nil, title: nil, on_click: nil, attachment: nil, buttons: nil ) unless Actions.const_defined?(:NotificationAction) raise NotImplementedError, "NotificationAction is not available. Please install the openHAB Cloud addon." end args = [] if email args.push(:send_notification, email) else args.push(:send_broadcast_notification) end args.push(msg.to_s, icon&.to_s, severity&.to_s) # @!deprecated OH 4.1 if Core.version >= Core::V4_2 buttons ||= [] buttons = buttons.map { |title, action| "#{title}=#{action}" } if buttons.is_a?(Hash) raise ArgumentError, "buttons must contain (0..3) elements." unless (0..3).cover?(buttons.size) args.push(title&.to_s, on_click&.to_s, attachment&.to_s, buttons[0]&.to_s, buttons[1]&.to_s, buttons[2]&.to_s) end NotificationAction.__send__(*args) end |