From efe760aa768848d2eb5e29da9c381649ae9ce01f Mon Sep 17 00:00:00 2001 From: jimtng <2554958+jimtng@users.noreply.github.com> Date: Tue, 21 May 2024 15:39:03 -0400 Subject: [PATCH] change in Buttongrid: call create_button_definition in OH4.2 (#270) This is to adapt to the change in core: https://github.com/openhab/openhab-core/pull/4223 A separate PR will be created to add support for the new `Button` widget Signed-off-by: Jimmy Tanagra --- lib/openhab/dsl/sitemaps/builder.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/openhab/dsl/sitemaps/builder.rb b/lib/openhab/dsl/sitemaps/builder.rb index 53887ececb..d533b38d35 100644 --- a/lib/openhab/dsl/sitemaps/builder.rb +++ b/lib/openhab/dsl/sitemaps/builder.rb @@ -737,7 +737,12 @@ def button(button) def build widget = super buttons.each do |button| - button_object = SitemapBuilder.factory.create_button + button_object = if SitemapBuilder.factory.respond_to?(:create_button_definition) + SitemapBuilder.factory.create_button_definition + else + # @deprecated OH 4.1 in OH 4.2 this clause is not needed + SitemapBuilder.factory.create_button + end button_object.row = button[0] button_object.column = button[1] button_object.cmd = button[2]