Module: OpenHAB::DSL::Items::Builder
- Includes:
- Core::EntityLookup, OpenHAB::DSL
- Included in:
- GroupItemBuilder
- Defined in:
- lib/openhab/dsl/items/builder.rb
Overview
An item builder allows you to dynamically create openHAB items at runtime. This can be useful either to create items as soon as the script loads, or even later based on a rule executing.
Constant Summary
Constants included from OpenHAB::DSL
Instance Method Summary collapse
-
#call_item(name, label = nil, **kwargs) {|builder| ... } ⇒ CallItem
Create a new call item.
-
#color_item(name, label = nil, **kwargs) {|builder| ... } ⇒ ColorItem
Create a new color item.
-
#contact_item(name, label = nil, **kwargs) {|builder| ... } ⇒ ContactItem
Create a new contact item.
-
#date_time_item(name, label = nil, **kwargs) {|builder| ... } ⇒ DateTimeItem
Create a new date_time item.
-
#dimmer_item(name, label = nil, **kwargs) {|builder| ... } ⇒ DimmerItem
Create a new dimmer item.
-
#group_item(name, label = nil, **kwargs) {|builder| ... } ⇒ GroupItem
Create a new GroupItem.
-
#image_item(name, label = nil, **kwargs) {|builder| ... } ⇒ ImageItem
Create a new image item.
-
#location_item(name, label = nil, **kwargs) {|builder| ... } ⇒ LocationItem
Create a new location item.
-
#number_item(name, label = nil, **kwargs) {|builder| ... } ⇒ NumberItem
Create a new number item.
-
#player_item(name, label = nil, **kwargs) {|builder| ... } ⇒ PlayerItem
Create a new player item.
-
#rollershutter_item(name, label = nil, **kwargs) {|builder| ... } ⇒ RollershutterItem
Create a new rollershutter item.
-
#string_item(name, label = nil, **kwargs) {|builder| ... } ⇒ StringItem
Create a new string item.
-
#switch_item(name, label = nil, **kwargs) {|builder| ... } ⇒ SwitchItem
Create a new switch item.
Methods included from OpenHAB::DSL
after, between, config_description, debounce_for, ensure_states, ensure_states!, holiday_file, holiday_file!, items, only_every, persistence, persistence!, profile, provider, provider!, rule, rule!, rules, scene, scene!, script, script!, shared_cache, sitemaps, store_states, things, throttle_for, timers, transform, unit, unit!
Methods included from Rules::Terse
#changed, #channel, #channel_linked, #channel_unlinked, #cron, #every, #item_added, #item_removed, #item_updated, #on_start, #received_command, #thing_added, #thing_removed, #thing_updated, #updated
Methods included from Core::ScriptHandling
script_loaded, script_unloaded
Methods included from Core::Actions
Methods included from Core::EntityLookup
#items, #method_missing, #things
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class OpenHAB::DSL
Instance Method Details
#call_item(name, label = nil, **kwargs) {|builder| ... } ⇒ CallItem
Create a new call item
59 |
# File 'lib/openhab/dsl/items/builder.rb', line 59 def_item_method(:call) |
#color_item(name, label = nil, **kwargs) {|builder| ... } ⇒ ColorItem
Create a new color item
61 |
# File 'lib/openhab/dsl/items/builder.rb', line 61 def_item_method(:color) |
#contact_item(name, label = nil, **kwargs) {|builder| ... } ⇒ ContactItem
Create a new contact item
63 |
# File 'lib/openhab/dsl/items/builder.rb', line 63 def_item_method(:contact) |
#date_time_item(name, label = nil, **kwargs) {|builder| ... } ⇒ DateTimeItem
Create a new date_time item
65 |
# File 'lib/openhab/dsl/items/builder.rb', line 65 def_item_method(:date_time) |
#dimmer_item(name, label = nil, **kwargs) {|builder| ... } ⇒ DimmerItem
Create a new dimmer item
67 |
# File 'lib/openhab/dsl/items/builder.rb', line 67 def_item_method(:dimmer) |
#group_item(name, label = nil, **kwargs) {|builder| ... } ⇒ GroupItem
Create a new GroupItem
91 92 93 94 95 96 97 98 99 |
# File 'lib/openhab/dsl/items/builder.rb', line 91 def group_item(*args, **kwargs, &block) item = GroupItemBuilder.new(*args, provider: provider, **kwargs) item.instance_eval(&block) if block result = provider.add(item) item.members.each do |i| provider.add(i) end result end |
#image_item(name, label = nil, **kwargs) {|builder| ... } ⇒ ImageItem
Create a new image item
69 |
# File 'lib/openhab/dsl/items/builder.rb', line 69 def_item_method(:image) |
#location_item(name, label = nil, **kwargs) {|builder| ... } ⇒ LocationItem
Create a new location item
71 |
# File 'lib/openhab/dsl/items/builder.rb', line 71 def_item_method(:location) |
#number_item(name, label = nil, **kwargs) {|builder| ... } ⇒ NumberItem
Create a new number item
73 |
# File 'lib/openhab/dsl/items/builder.rb', line 73 def_item_method(:number) |
#player_item(name, label = nil, **kwargs) {|builder| ... } ⇒ PlayerItem
Create a new player item
75 |
# File 'lib/openhab/dsl/items/builder.rb', line 75 def_item_method(:player) |
#rollershutter_item(name, label = nil, **kwargs) {|builder| ... } ⇒ RollershutterItem
Create a new rollershutter item
77 |
# File 'lib/openhab/dsl/items/builder.rb', line 77 def_item_method(:rollershutter) |
#string_item(name, label = nil, **kwargs) {|builder| ... } ⇒ StringItem
Create a new string item
79 |
# File 'lib/openhab/dsl/items/builder.rb', line 79 def_item_method(:string) |
#switch_item(name, label = nil, **kwargs) {|builder| ... } ⇒ SwitchItem
Create a new switch item
81 |
# File 'lib/openhab/dsl/items/builder.rb', line 81 def_item_method(:switch) |