Class: OpenHAB::Core::Events::TimerEvent
- Inherits:
-
AbstractEvent
- Object
- AbstractEvent
- OpenHAB::Core::Events::TimerEvent
- Defined in:
- lib/openhab/core/events/timer_event.rb
Overview
Adds methods to core openHAB TimerEvent to make it more natural in Ruby
This event can be triggered by a DateTimeTrigger
, cron
, or TimeOfDay
trigger.
Instance Attribute Summary collapse
-
#cron_expression ⇒ String?
readonly
The cron expression that triggered this event.
-
#item ⇒ Item?
readonly
The DateTime item that triggered this event.
-
#time ⇒ LocalTime?
readonly
The configured time for this TimeOfDay trigger event.
Attributes inherited from AbstractEvent
Method Summary
Methods inherited from AbstractEvent
Instance Attribute Details
#cron_expression ⇒ String? (readonly)
Returns The cron expression that triggered this event.
nil
when this event wasn't triggered by a cron trigger.
24 25 26 |
# File 'lib/openhab/core/events/timer_event.rb', line 24 def cron_expression payload&.[](:cronExpression) end |
#item ⇒ Item? (readonly)
Returns The DateTime item that triggered this event.
nil
when this event wasn't triggered by a DateTimeItem trigger.
33 34 35 |
# File 'lib/openhab/core/events/timer_event.rb', line 33 def item payload&.[](:itemName)&.then { |item_name| EntityLookup.lookup_item(item_name) } end |
#time ⇒ LocalTime? (readonly)
Returns The configured time for this TimeOfDay trigger event.
nil
when this event wasn't triggered by a TimeOfDay trigger.
42 43 44 |
# File 'lib/openhab/core/events/timer_event.rb', line 42 def time payload&.[](:time)&.then { |time| LocalTime.parse(time) } end |