Commit Graph
100 Commits
Author SHA1 Message Date
lolodomoandGitHub e2aacb11a9 [DSL rule] Add time of day trigger to DSL file syntax (#5440)
* [DSL rule] Add time of day trigger to DSL file syntax

Closes #5435

Exampele of rule:
```
rule "Test time of day trigger"
when
  Time is 20:13
then
  logInfo("Rule","Test")
end
```

For backward compatibility, using "noon" and "midnight" is still supported.
"timer.TimeOfDayTrigger" is now used (instead of "timer.GenericCronTrigger").

Here is the log confirming the execution of the rule at the expected time:
```
20:13:00.531 [INFO ] [org.openhab.core.model.script.Rule  ] - Test
```

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2026-03-25 21:48:52 +01:00
lolodomoandGitHub 0edae941f1 [DSL rule] Add tags to DSL file syntax (#5442)
* [DSL rule] Add tags to DSL file syntax

Closes #5436

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2026-03-25 21:22:06 +01:00
lolodomoandGitHub 52ca83fadb [DSL item provider] Check channel profile value + add line number to validation errors (#5429)
* [DSL item provider] Check channel profile value + add line number to validation errors

Closes #5057

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2026-03-25 21:10:11 +01:00
lolodomoandGitHub abdda021b8 Check valid properties for channel (#5416)
Null key or value are rejected and an IllegalArgumentException is thrown.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2026-03-15 12:18:54 +01:00
lolodomoandGitHub 2e7be80e21 Fix when "Unloading DSL model" is logged (#5411)
Fix #5350

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2026-03-08 16:53:18 +01:00
lolodomoandGitHub 3bc47c09a2 [YAML thing provider] Remove unsued and unneeded variable "modelLoaded" (#5362)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2026-02-15 12:57:18 +01:00
lolodomoandGitHub 3706443006 [YAML] Enhance removedModel method in all providers (#5341)
The enhancement consists in just getting the UID of the elements to be removed rather than building a full object.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2026-02-14 08:21:06 +01:00
lolodomoandGitHub 5391ba2cbf [DSL generator] Do not generate thing label if same as in thing type (#5305)
Apply the same logic as for YAML.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2026-02-14 08:15:21 +01:00
lolodomoandGitHub 60331d1d65 [YAML thing] Allow "configuration" in syntax as alternative to "config" (#5332)
For thing and channel.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2026-02-12 06:32:17 +01:00
lolodomoandGitHub 759d6b27dc [YAML] Move YAML test files in sub-folders (#5331)
Move YAML test files in sub-folders

Tests for YamlThingProvider moved in a separate class.
Also test that a thing change listener is properly called when loading a YAML file containing things.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2026-02-12 06:26:06 +01:00
lolodomoandGitHub 0e9ca965f2 [YAML] Use Objects.equals for Map + adjust hashCode methods (#5335)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2026-02-11 11:18:09 +01:00
lolodomoandGitHub 1a41209d9c [REST] API /file-format/parse: do not extend thing/channel config (#5295)
* [REST] API /file-format/parse: do not extend thing/channel config

The /file-format/parse API does no more extend the thing and channel configuration with parameters having a default value. The output will contain hte thing/channel configuration parameters provided in the input.

It is fixed for YAML and DSL formats.

Unit tests added for YAML models containing Thing


Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2026-01-27 16:04:54 +01:00
lolodomoandGitHub a2b15263a2 [YAML provider] Add INFO log for config TEXT param value not parsed a… (#5280)
* [YAML provider] Add INFO log for config TEXT param value not parsed as string

Related to openhab/openhab-webui#3696
Follow-up #5248

A log at level INFO is now displayed when a YAML file is loaded and contains a thing or channel configuration parameter of type TEXT whose value is not parsed as a string. This occurs when an unquoted number is provided. The log recommends enclosing the value in double quotes to prevent conversion.

For better consistency, the YAML provider is now also processing any BigDecimal value to convert it into a String type when the config paramater is of type TEXT.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2026-01-17 19:22:33 +01:00
lolodomoandGitHub fdf8d6589c Normalize thing/channel config in response of /file-format/parse API (#5242)
This PR normalizes thing/channel configuration before producing the response.
It allows having proper types for config parameters in the JSON response of the API.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2026-01-06 18:13:38 +01:00
lolodomoandGitHub 58a0cc06b1 [YAML provider] Add special handling to thing/channel config param of… (#5248)
* [YAML provider] Add special handling to thing/channel config param of type text

Related to openhab/openhab-webui#3696

For configuration parameter of type text only, if the value in YAML is an unquoted number (value is then of type BigDecimal after loading and mapping in our DTO) and there is no decimal, we convert it to an integer and return a String from that integer.
Value 1 in YAML is converted into String "1"
Value 1.0 in YAML is converted into String "1"
Value 1.5 in YAML is untouched
Value "1" in YAML is untouched
Value "1.0" in YAML is untouched
Value "1.5" in YAML is untouched

All this is to avoid that 1 filled in YAML without quotes finally results in string "1.0" after configuration normalization.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2026-01-05 22:52:58 +01:00
lolodomoandGitHub 448fe6516f [YAML] Use quotes for numbers stored as strings when generating YAML (#5241)
Related to openhab/openhab-webui#3696

We setup our YAML generator library to use quotes for strings when the value is a number.
Strings being not a number will still be generated without quotes.
It avoids later when parsing the generated YAML to retrieve a BigDecimal type instead of a String type when the DTO is defined with a Java Object type (that is the case for thing/channel configuration in particular).

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2026-01-05 09:13:32 +01:00
lolodomoandGitHub bda83d8a85 Fix checkstyle findings in config.discovery.usbserial.windowsregistry (#5223)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-12-24 13:19:11 +01:00
lolodomoandGitHub 76da187921 [REST] Add missing media type for output of /links/orphans API (#5216)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-12-23 00:33:14 +01:00
lolodomoandGitHub 19f5ad7569 [REST] Fix /links/orphans API (return of the result) (#5214)
Closes #5207

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-12-20 15:37:14 +01:00
lolodomoandGitHub 2789e69d5e [YAML thing provider] Handles properly channels with group (#5181)
Fix openhab/openhab-webui#3562

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-12-12 08:45:42 +01:00
lolodomoandGitHub 8f8fabbd2f [DSL/YAML] Changes prefix for isolated models (#5153)
Isolated DSL/YAML models are models that do not fill the things/items/... registries when they are loaded.
They are used as temporary models for particular features.

These models have a particular prefix in their names to distinguish them.
It was "tmp_" before, it is now "___tmp_".
The risk that a user names one of its file with such prefix is reduced.
If a DSL file with prefix "___tmp_" is by the way used by a user, this file is ignored and a message is now logged to inform the user.

Closed #5134

Change pattern for isolated model name

tmp_DSL_model_<N>.items => ___tmp_model_<N>.items
tmp_YAML_model_<N>.yaml => ___tmp_model_<N>.yaml

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-12-06 19:48:08 +01:00
lolodomoandGitHub 21acfb57e0 [DSL/YAML generator] Consider item pattern formatter even without label (#5154)
* [DSL/YAML generator] Consider item pattern formatter even without label

Items without label but with a formatter are now properly considered when generating DSL and YAML syntax.
Example: Number SceneItem "[MAP(scene.map):%s]"
Bug was reported on the community forum.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>

* Fix typos discovered by Copilot

Signed-off-by: Laurent Garnier <lg.hc@free.fr>

---------

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-12-06 19:45:36 +01:00
lolodomoandGitHub 725cd267b8 [YAML item/thing providers] Change way to check syntax for few fields (#5085)
Concerned fields are:
- group in the "groups" list of an item
- UID of a linked channel in an item
- namespace of a metadata attached to an item
- UID of a thing
- "bridge" field of a thing
- channel id of a channel declared in a thing
- "type" field of a channel

A check was also added for the "profile" configuration parameter of a linked channel.
Related to #5057

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-11-23 12:43:00 +01:00
lolodomoandGitHub 6282298b15 [YAML provider] Fix check of syntax for item names (#5065)
Closes #4903

Makes check consistent with what was done for DSL in #4928

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-10-10 23:32:33 +02:00
lolodomoandGitHub 00b6a476a7 [REST] New API for conversion between file format and JSON (#4793)
* [REST] New API for conversion between file format and JSON

Related to #4585

This PR supports conversion of things and items.
It supports DSL and YAML file formats.

A first new API (POST /file-format/create) allows to create a file format (DSL or YAML) from a JSON object.
A second new API (POST /file-format/parse) allows to parse a file format (DSL or YAML) to a JSON object.

These 2 APIs should help Main UI displaying DSL and YAML file formats for things.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-09-21 11:48:33 +02:00
lolodomoandGitHub 9c6d304b7d Fix enabling/disabling of addons suggestors at OH startup (#5020)
Before this fix, the AddonSuggestionService service was started and an incomplete configuration was considered, a configuration containing none of the user settings defining if each suggestion finder should be enabled or disabled.
Later, when AddonFinderService service was added, the same incomplete configuration was reused.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-09-20 20:54:34 +02:00
lolodomoandGitHub ebd6b06d75 [YAML config] Fix YAML loading to handle elements in file original order (#5010)
Change the implementation of the method listToMap

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-09-05 20:38:29 +02:00
lolodomoandGitHub c787ce953a [REST] Fix version number in YAML examples (#4978)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-08-31 12:36:23 +02:00
lolodomoandGitHub 69d4c83991 Fix USB discovery on Windows in case there is no USB port (#4996)
Fix #4993

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-08-31 11:48:49 +02:00
lolodomoandGitHub 478a7deb63 YAML config: enhance hashCode() and add new unit tests (#4941)
Reduce potential collisions in hashCode()

Make identical a null list/set and an empty list/set

Test hashCode in addition to equals in unit tests.
Add new tests for YamlItemDTO (equals/hashCode)

Related to #4936

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-08-24 18:55:13 +02:00
lolodomoandGitHub cd26f6feaf Registry: Avoid warn log when adding ActionType/Metadata several times (#4900)
Fix openhab/openhab-addons#18945
Regression from #4880

For Metadata, it was reported on the community forum, it occured when an item is linked to several channels.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-07-15 22:56:52 +02:00
lolodomoandGitHub ff1156566b Fix ready marker not set for model when folder is missing (#4897)
Related to #3823
Replaces #4444

If the sub-folder where models are supposed to be found does not exist, the service is marked as ready anyway.
If not, start level 100 could be never reached at OH startup.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-07-13 17:16:47 +02:00
lolodomoandGitHub cc95a6d045 Fix NPE in FolderObserver (#4896)
Fix #4890

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-07-13 09:49:58 +02:00
lolodomoandGitHub b48e1632aa WARN log when an object with same ID is added to a registry by a seco… (#4880)
* WARN log when an object with same ID is added to a registry by a second provider

Log was existing but at DEBUG level, meaning the general user was not informed that he defined the same object (thing, item, ...) at different places (providers) like for example an item in Main UI and an item in config file with same name.

Fix #4810

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-07-01 16:25:03 +02:00
lolodomoandGitHub fb62bf33cd YAML config: fix user defined channels creation when binding loads late (#4823)
While things can now be loaded even when the binding is not yet available, channel types for user defined channels could be not yet in the registry when these channels are first created.
So when the binding is finally available, the thing is updated and user defined channels are now created again to retrieve properties from channel types.

This fix avoids warnings at startup regarding missing channel types.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-05-25 21:18:17 +02:00
lolodomoandGitHub 26c2631296 YAML model loading: WARN log when an element is not a container object (#4824)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-05-25 21:17:01 +02:00
lolodomoandGitHub cb42343c3e YAML item proviuder: fix method isVersionSupported (#4820)
Required after the merge of PR #4807 and PR #4776

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-05-18 21:57:02 +02:00
lolodomoandGitHub bc62a202ee YAML configuration: add support for items/metadata/channel links (#4776)
* YAML configuration: add support for items/metadata/channel links

This PR adds the support of items in the YAML configuration file.
It also includes the support of items metadata and items channel links.

Related to #3666

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-05-18 20:46:18 +02:00
lolodomoandGitHub 53ddb0c29c YAML model repository: supports only version 1 with elements as map (#4807)
* YAML model repository: supports only version 1 with elements as map

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-05-18 20:44:31 +02:00
lolodomoandGitHub d6fb61d0c7 YAML config: add "description" field to channel for things (#4795)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-05-18 18:57:43 +02:00
lolodomoandGitHub 3df33758d4 YAML things provider: create things even if binding is not yet installed (#4753)
Makes it consistent with managed thing provider.

Removes the OSGi reference between YamlThingProvider and YamlModelRepository and as consequence removes the circular reference.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-05-11 12:57:21 +02:00
lolodomoandGitHub 8d3c3575a2 [REST] Fix API to get file format when applied to a subset of elements (#4786)
Fix #4778

Things and items are now sorted in output only when all elements are requested.
If the API is requested only for a subset of elements (things or items), the output respects the input order of elements.

DSL generator for things and items is also fixed to avoid a crash when called with 0 element.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-05-06 20:16:24 +02:00
lolodomoandGitHub a65b9a4b83 YAML things: clean map when removing the last elements for a model (#4763)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-04-30 22:14:13 +02:00
lolodomoandGitHub 3404384c47 YAML parser: filter unexpected part from the parse exception message (#4759)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-04-30 22:11:16 +02:00
lolodomoandGitHub 003c6e18e1 YAML things: adjustment of messages when checking a thing element (#4761)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-04-30 06:42:08 +02:00
lolodomoandGitHub 46dcfa674d [DSL generator] Consider a bridge thing as bridge if it contains things (#4740)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-04-23 19:05:12 +02:00
lolodomoandGitHub 2a4b0735fc [DSL generator] Avoid injecting the state pattern in label if already present in stateDescription metadata (#4730)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-04-23 18:49:17 +02:00
lolodomoandGitHub b7b23db9a7 YAML configuration: add support for things (#4691)
Related to #3666

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-04-19 22:21:09 +02:00
lolodomoandGitHub 788b40f8a0 [DSL generator] Check that metadata config value type is supported (#4720)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-04-13 13:53:45 +02:00
lolodomoandGitHub 7b6e4c0718 YAML configuration: add basic version management (#4667)
Each YAML element provider can now define which YAML file versions it is applicable to and whether it is deprecated or not.

Related to #3666

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-04-04 11:23:41 +02:00
lolodomoandGitHub 2aa19c73d0 Introduce YAML configuration version 2 (#4648)
* Introduce YAML configuration version 2

Version 2 uses map to store elements while version 1 uses table.
Version 1 is still supported.

Unit tests have been extended to cover version 1 and 2.

Related to #3666

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-04-03 21:22:44 +02:00
lolodomoandGitHub 8efa024632 File format generator: do not change order of thing channels (#4636)
Keep original order of channels

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-03-09 15:12:29 +01:00
lolodomoandGitHub 3af47e9c30 [DSL generator] Handle config parameter value of type Double (#4629)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-03-09 10:51:09 +01:00
lolodomoandGitHub 67303fa5f3 [REST] New REST APIs to generate DSL syntax for items and things (#4569)
* [REST] New REST APIs to generate DSL syntax for items and things

Related to #4509

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2025-03-02 11:11:01 +01:00
lolodomoandGitHub a05aca6c79 Thing action REST API: allow extended scope like bindingid-xxx (#4495)
It is required for actions from the max binding.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-12-15 11:39:57 +01:00
lolodomoandGitHub be003029b0 Add unit hint to color-temperature-abs system channel type (#4451)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-11-17 08:58:59 +01:00
lolodomoandGitHub bc6731157c Add support for more types as output of thing actions (#4435)
Byte
Short
Long
BigDecimal
QuantityType
LocalDate
LocalTime
LocalDateTime
ZonedDateTime
Instant
Duration

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-11-04 10:40:31 +01:00
lolodomoandGitHub 7d98903acb [sitemap] Add new element Colortemperaturepicker (#4420)
Related to #3891

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-10-29 06:07:24 +01:00
lolodomoandGitHub d431013198 Enhance ThingActions UI support (#4392)
* Enhance ThingActions UI support

Fixes #1745

Return config description parameters for the ActionInputs of ThingActions for the REST GET /action/{thingUID} and REST GET /module-types endpoints.
The config description parameters are only provided if all input parameters have a type that can be mapped to a config description parameter (String, boolean, Boolean, byte, Byte, short, Short, int, Integer, long, Long, float, Float, double, Double, Number, DecimalType, QuantityType<?>, LocalDateTime, LocalDate, LocalTime, ZonedDateTime, Date, Instant and Duration).

Enhance the REST POST /actions/{thingUID}/{actionUid} endpoint (allows invoking Thing actions via REST) and the AnnotationActionHandler (allows invoking Thing actions from UI-rules) in order to be more flexible regarding the type of each provided argument value and to map the value to the expected data type. Number and string values will be accepted as inputs and the expected data type will be created from this value.

This will be used by the UI's Thing page and rule editor to allow invoking Thing actions through the UI or adding them to UI-bases rules.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
2024-10-20 12:39:30 +02:00
lolodomoandGitHub b8b3ec9df0 Add a new optional input parameter to discovery services (#4389)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-09-29 14:08:29 +02:00
lolodomoandGitHub 3e912eca4b Fix translation of label for system:addons service (#4306)
The i18n file containing this label is in org.openhab.core bundle.

Fix openhab/openhab-webui#1669

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-09-08 06:13:58 +02:00
lolodomoandGitHub edf5b62213 [sitemap] Remove snedFrequency parameter for Slider/Colorpicker widgets (#4347)
Related to #4338

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-09-07 18:41:52 +02:00
lolodomoandGitHub 289f06378d Config parameter: Change inferred i18n key for add-ons + alternative key (#4305)
Fix openhab/openhab-webui#2641

The i18n key for add-on configuration parameter should now start with addon.config.<param>.
To maintain compatibility with hundreds of existing translations, an alternative key starting with <type>.config.<param> is still accepted for an add-on parameter

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-08-04 13:13:15 +02:00
lolodomoandGitHub 0a5886c7e7 Fix startup of background discovery (#4323)
Apply the same logic in AbstractThingHandlerDiscoveryService as in AbstractDiscoveryService to determine if background discovery should be enabled or disabled.

Fix openhab/openhab-addons#17089

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-07-17 19:50:51 +02:00
lolodomoandGitHub 9f80bbf0a7 Add default scope to profile when loading items file (#4314)
* Add default scope to profile when loading items file

Fix #4277

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-07-14 20:28:11 +02:00
lolodomoandGitHub 9d4ec613a2 Add a warning log to mention the field when configuration parsing is failing (#4311)
Fixes #4248

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-07-14 10:06:41 +02:00
lolodomoandGitHub 24d1ba0b2a Fix merge of AddonInfo (masterAddonInfo field) (#4309)
This fix allows having translated label for bindings when showing list of installed bindings in Main UI parameters.

Fix openhab/openhab-webui#2639

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-07-13 15:32:47 +02:00
lolodomoandGitHub 71b50c5462 Fix dynamic binding of AddonService to ConsoleCommandExtension service (#4312)
Fix #4146

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-07-13 15:11:17 +02:00
lolodomoandGitHub b932a4df5e YAML files: ignore files inside automation sub-folder (#4291)
Also ignore unreachable files

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-07-04 17:35:45 +02:00
lolodomoandGitHub 37e09f5ab8 Fix description of the location setting (#4286)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-07-02 08:40:47 +02:00
lolodomoandGitHub d22e14a1e4 Make input formatting for transformations consistent everywhere (#4203)
Use item state formatter to format input of transformation, meaning using state.format(format) instead of String.format(format, state.toString())
This was already the case in sitemap API but not in other APIs used by Main UI.

Make sure to call transformation even for NULL and UNDEF states.
It was not the case in one API used by Main UI.

When calling transformation and state is NULL or UNDEF, do not apply format to the input value and do not replace by "-".
That means the transformation will be called with "NULL" or "UNDEF".
Sitemap API was calling the transformation using a pattern containing "-".

Fix #4101
Also related to discussion in openhab/openhab-addons#13777

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-06-26 21:25:13 +02:00
lolodomoandGitHub a5a7eee9a8 Ephemeris: consider the default weekend dayset (#4253)
Fix openhab/openhab-addons#16812

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-05-27 22:34:54 +02:00
lolodomoandGitHub ad74d5a296 Fix a wrongly failing validation rule for sitemap (#4240)
Problem introduced by #4223

checkFramesInWidgetList for LinkableWidget was triggering an error when the Buttongrid element has no parameter set.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-05-26 16:02:54 +02:00
lolodomoandGitHub 3b9a97101b [sitemap] Buttongrid as container for new Button elements (#4223)
Related to #4173

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-05-18 14:51:39 +02:00
lolodomoandGitHub 965e7311eb [sitemap] Do not try to convert item state into OnOffType for Switch widget if item has options (#4226)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-05-13 22:20:59 +02:00
lolodomoandGitHub b40e6db514 Extend sitemap syntax for switch to support press & release buttons (#4183)
* Extend sitemap syntax for switch to support press & release buttons

Mappings attribute for switch element now accepts one or two commands for each button.
If only one command is provided, the button is a click button, the command is sent to the item when the button is clicked.
If two commands are provided (separated by ":"), the button is a press & release button, the first command is sent to the item when the button is pressed and the second when the button is released.

Syntax example for a click button: Switch item=DemoSwitch mappings=[ ON="ON" ]
Syntax example for a press & release button: Switch item=DemoSwitch mappings=[ ON:OFF="ON" ]

Related to #3822

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-05-05 09:45:24 +02:00
lolodomoandGitHub 97cedc46e9 SseItemStatesEvent displayState: priority to transform over options (#4193)
Fix #2283
Fix #4050

This PR is fixing two things in the computation of the displayState:
- If a transformation is present in the state pattern, it has now priority over options provided by the state description
- If no transformation is present in state pattern but options are provided by the state description, the provided state pattern is applied to the matching option

Also remove a deprecated call to transform.

If there is no transformation but options are provided without any matching with the current state and there is a pattern provided, then this pattern is used to format the output.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-05-04 18:38:48 +02:00
lolodomoandGitHub 1fb949ba8f Set a default presentation pattern for String/Number/Datetime items (#4175)
* Set a default presentation pattern for String/Number/Datetime items

A default state pattern was previously provided by ChannelStateDescriptionProvider only for String and Number items linked to a channel.
It is now the class DefaultStateDescriptionFragmentProvider which is responsible for providing the default state pattern for items, whether the item is linked to a channel or not.
This new class is the lowest ranked StateDescriptionFragmentProvider so that all other providers have priority in setting the state pattern.

Default pattern for string item: %s
Default pattern for datetime item or group with datetime state: %1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS
Default pattern for number item or group with number state: %.0f
Default pattern for number+dimension item or group with number+dimension state: %.0f %unit%

Closes #4071
Closes #3835

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-05-02 16:29:35 +02:00
lolodomoandGitHub 21186d6168 Use option label when formatting the option label with the provided pattern fails (#4205)
Issue discussed in openhab/openhab-android#3623

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-05-01 17:33:38 +02:00
lolodomoandGitHub 619762a297 [sitemap] Extend chart periods to cover past and future (#4172)
* [sitemap] Extend chart periods to cover past and future

Closes openhab/openhab-webui#2518

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-04-07 10:51:24 +02:00
lolodomoandGitHub dcfadaede6 Move to JUPnP v3.0.1 (#4165)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-04-02 18:21:57 +02:00
lolodomoandGitHub a906d09b40 [sitemap] Add releaseOnly parameter to Slider sitemap element (#4084)
Related to #3430

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-02-12 20:12:19 +01:00
lolodomoandGitHub a9571228d2 Remove state description when loading an item with a removed pattern (#4068)
* Remove state description when loading an item with a removed pattern

Fix openhab/openhab-webui#2251

Signed-off-by: Laurent Garnier <lg.hc@free.fr>

* Extended integration test testSquareBracketsInFormat

Signed-off-by: Laurent Garnier <lg.hc@free.fr>

---------

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-01-27 18:00:56 +01:00
lolodomoandGitHub 5c9f192764 Useful logs added in SitemapResource for REST API calls (#4054)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2024-01-20 22:25:18 +01:00
lolodomoandGitHub 8b14d56e2e [sitemap] Fix parsing of button (buttongrid element built with MainUI) (#3980)
Fix openhab/openhab-webui#2242

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2023-12-30 15:57:52 +01:00
lolodomoandGitHub 63ae134c33 Consider network settings to avoid creating unexpected JmDNS instances (#3978)
Fix #3976

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2023-12-30 12:50:27 +01:00
lolodomoandGitHub d7486a985e Sitemap generator: fix button parsing for Buttongrid (#3938)
Fix #3937

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2023-12-20 09:46:41 +01:00
lolodomoandGitHub 4b92db3775 Add a log when loading a YAML file (#3916)
For consistency with other model files loading.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2023-12-13 08:26:29 +01:00
lolodomoandGitHub 070de55b27 Add a YAML file provider for semantic tags (#3659)
* Add a YAML file provider for semantic tags

Files in folder conf/tags are loaded by this provider.

Related to #3619

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2023-12-10 11:26:03 +01:00
lolodomoandGitHub 152ffe3fbb Fix handling of mDNS instances when an IP address changed (#3906)
Fix openhab/openhab-addons#16023

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2023-12-09 21:56:56 +01:00
lolodomoandGitHub 76b10ac1c1 [Sitemap] Change syntax for Buttongrid sitemap element (#3898)
Follow-up #3810

Location in the grid is now defined by a row number and a column number.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2023-12-05 21:50:58 +01:00
lolodomoandGitHub f71ebfb83c Extend support to ISO8601 format for sitemap chart period parameter (#3863)
* Extend support to ISO8601 format for sitemap chart period parameter

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2023-11-24 16:53:10 +01:00
lolodomoandGitHub 7281dca286 [Sitemap] Add optional conditional rules for icon (#3820)
This allows dynamic icons based on items states even with non OH icon sources.
This also allows overwritting the default handling with state done by the icon servlet.

Example: icon=[item1>0=temperature,==0=material:settings,f7:house]

Related to openhab/openhab-webui#1938

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2023-10-15 22:00:35 +02:00
lolodomoandGitHub e5518b9322 [Sitemap] Add support for multiple AND conditions (#3819)
Concerns labelcolor, valuecolor and visibility

Also fix wrong positions of ")" in Sitemap.xtext

Closes #3058

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2023-10-08 09:48:58 +02:00
lolodomoandGitHub f7d176570c [Sitemap] Accept an optional icon for each value/label mapping (#3809)
* [Sitemap] Accept an optional icon for each value/label mapping

When set by the user, the icon can be used by UIs for switch element with mappings to render a button with the icon rather than the label.

Related to #3441

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2023-10-02 09:36:23 +02:00
lolodomoandGitHub 366bffa406 [Sitemap] Introduce "Buttongrid" as new sitemap element (#3810)
Related to #3441

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2023-10-01 21:36:31 +02:00
lolodomoandGitHub 369a49aab1 [sitemap/MainUI] Fix a typo in buildWidget (#3811)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2023-10-01 16:38:38 +02:00
lolodomoandGitHub 1c8096b4eb [DSL] Expose ColorUtil methods to DSL rules (#3749)
Fix #3743

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2023-09-02 19:14:59 +02:00
lolodomoandGitHub 5f8658d0ae [REST] Check a label is provided when creating a new semantic tag (#3734)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2023-08-16 17:48:09 +02:00
lolodomoandGitHub c12067a63b [sitemap] Add new "staticIcon" parameter (#3735)
When set, the UI should not provide the item state when requestiong the
OH icon and should not request again the icon when the item state is
updated.

Related to openhab/openhab-android#3404

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2023-08-13 19:36:41 +02:00