Module: OpenHAB::Core::EntityLookup
- Included in:
- DSL, DSL::Items::Builder, DSL::Items::ItemBuilder, DSL::Rules::Builder, DSL::Rules::BuilderDSL, DSL::Sitemaps::WidgetBuilder
- Defined in:
- lib/openhab/core/entity_lookup.rb
Overview
Thing UIDs are separated by a colon ‘:`. Since it is not a valid symbol for an identifier, it must be replaced with an underscore `_`. So to access `astro:sun:home`, use `astro_sun_home` as an alternative to `things`
Manages access to openHAB entities
You can access openHAB items and things directly using their name, anywhere ‘EntityLookup` is available.
Instance Method Summary collapse
-
#items ⇒ Core::Items::Registry
Fetches all items from the item registry.
-
#method_missing ⇒ Item, ...
Automatically looks up openHAB items and things in appropriate registries.
-
#things ⇒ Core::Things::Registry
Get all things known to openHAB.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing ⇒ Item, ...
Automatically looks up openHAB items and things in appropriate registries
126 127 128 129 130 131 132 133 |
# File 'lib/openhab/core/entity_lookup.rb', line 126 ruby2_keywords def method_missing(method, *args) return super unless args.empty? && !block_given? logger.trace { "method missing, performing openHAB Lookup for: #{method}" } EntityLookup.lookup_entity(method, create_dummy_items: self.class.respond_to?(:create_dummy_items?) && self.class.create_dummy_items?) || super end |
Instance Method Details
#items ⇒ Core::Items::Registry
Fetches all items from the item registry
The examples all assume the following items exist.
“‘xtend Dimmer DimmerTest “Test Dimmer” Switch SwitchTest “Test Switch” “`
99 100 101 |
# File 'lib/openhab/core/entity_lookup.rb', line 99 def items Core::Items::Registry.instance end |
#things ⇒ Core::Things::Registry
Get all things known to openHAB
117 118 119 |
# File 'lib/openhab/core/entity_lookup.rb', line 117 def things Core::Things::Registry.instance end |