Class: OpenHAB::Core::Sitemaps::Provider

Inherits:
Provider show all
Defined in:
lib/openhab/core/sitemaps/provider.rb

Overview

Provides sitemaps created in Ruby to openHAB

Instance Method Summary collapse

Methods inherited from Provider

#[], #all, current, #inspect

Methods included from Enumerable

#all_groups, #all_members, #command, #command!, #decrease, #down, #equipments, #fast_forward, #groups, #increase, #locations, #member_of, #members, #move, #next, #not_member_of, #not_tagged, #off, #on, #pause, #play, #points, #previous, #refresh, #rewind, #stop, #tagged, #up, #update, #update!

Instance Method Details

#build(update: true) { ... } ⇒ void

This method returns an undefined value.

Enter the Sitemap Builder DSL.

Examples:

sitemaps.build do
  sitemap "default", "My Residence" do
    frame label: "Control" do
      text label: "Climate", icon: "if:mdi:home-thermometer-outline" do
        frame label: "Main Floor" do
          text item: MainFloor_AmbTemp
          switch item: MainFloorThermostat_TargetMode, label: "Mode", mappings: %w[off auto cool heat]
          setpoint item: MainFloorThermostat_SetPoint, label: "Set Point", visibility: "MainFloorThermostat_TargetMode!=off"
        end
        frame label: "Basement" do
          text item: Basement_AmbTemp
          switch item: BasementThermostat_TargetMode, label: "Mode", mappings: { OFF: "off", COOL: "cool", HEAT: "heat" }
          setpoint item: BasementThermostat_SetPoint, label: "Set Point", visibility: "BasementThermostat_TargetMode!=off"
        end
      end
    end
  end
end

Parameters:

  • update (true, false) (defaults to: true)

    When true, existing sitemaps with the same name will be updated.

Yields:

See Also:



86
87
88
# File 'lib/openhab/core/sitemaps/provider.rb', line 86

def build(update: true, &block)
  DSL::Sitemaps::Builder.new(self, update: update).instance_eval(&block)
end

#remove(sitemap_name) ⇒ Boolean

Remove a sitemap.

Parameters:

  • sitemap_name (String)

Returns:

  • (Boolean)

    If a sitemap was removed



106
107
108
# File 'lib/openhab/core/sitemaps/provider.rb', line 106

def remove(sitemap_name)
  super("#{PREFIX}#{sitemap_name}#{SUFFIX}")
end