* Add support for short-form YAML semantic tags
Implemented hybrid mapping for YamlSemanticTagDTO to allow tags to be defined as either a simple string (label) or a detailed object (label, description, synonyms). Includes Jackson creator/value logic for round-trip serialization.
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
Co-authored-by: Laurent Garnier <lg.hc@free.fr>
* change groovycsv to jackson csv library
groovycsv caused an error in Groovy 5.x, even in its "latest" version 1.3.
Rerun the script which fixed a few errors in the manually generated tags (Property_Price, Equipment_HVAC_AirConditioner)
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
* Add Property_StateOfCharge semantic tag
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
* add readValues guard
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
---------
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
The ThingUID portion of a ChannelUID was previously only validated
lazily when getThingUID() was called. This could lead to
ChannelUID objects existing in an invalid state.
This change moves validation to the constructor to ensure
fail-fast behavior and provides a more descriptive error
message if the ThingUID part is malformed.
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
* Support deserializing short-form metadata in YamlMetadataDTO
So we can set
`metadata: value`
instead of
```
metadata:
value: value
```
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
Catch IAE during Thing configuration loading to prevent
the entire file from failing. Errors are now logged as warnings
instead of throwing a full stack trace.
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
* DSL Items Parser: Fix incorrect parsing of keywords encountered in the wrong context
When specifying tag names that match one of the valid item types, e.g. `Switch`, the parser incorrectly treated it as a new start of an item definition.
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
* Allow extended unit names for days, hours, minutes, seconds, milliseconds in expire duration parser
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
* Yaml Model Repository: skip non-existent paths during the initial scan instead of logging a warning
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
* Move expire's Duration parser to a separate utility class so it can be used elsewhere
* Support `ms` in Duration parser
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
* Yaml Model: restrict the watched folders to `things`, `items`, `tags`, and `yaml`
* Support `.yml` and `.yaml` extensions
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
* WatchService: use absolute path in processWatchEvent
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
* update interface and use a consistent name `fullPath`
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
---------
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
This fix two scenarios:
- When the new model is missing `version:` key but the old model had one, the file is considered invalid, but the previously loaded elements didn't get removed
- When the new model has a valid `version:` key, but the entire element type, e.g. `thing:` is removed, the previously loaded elements (e.g. things) didn't get removed.
Additionally, log a warning when an unknown element type is encountered.
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
* Make `expire` fully configurable through metadata configuration map
* raise an error when setting is specified in both value and config map
* support days and ISO8601
* unknown config raises an error
* throws an exception on negative duration
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
* Sort SemanticTags.csv and group children under their parent tag
* sort xsd tag entries alphabetically
* sort DefaultSemanticTagProvider.java
* change the order to Location, Point, Property, Equipment
* remove duplicate tilt property
* revert DefaultSemanticTagProvider sorting
* add back Tilt Property, remove Tilt Point instead
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
* Allow multiple default values to contain an escaped comma
An comma character can be a part of the value when escaped with a backslash.
The backslash will be removed, i.e. `\,` -> `,`
To have an actual backslash and comma, add an extra backslash, i.e. `\\,` -> `\,`
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
* Fix i18n:generate-default-translations on add-on config other than bindings
* translate all xml config descriptions
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
* Add `getLastChange`, `getLastUpdate`, and `getPreviousState` to GenericItem
* Rename to getLastStateChange, getLastStateUpdate, getLastState
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
* Revert "Fix addon name localisation before installation (#3908)"
This reverts commit 708a954081
but with some modifications
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
* Clean up removed links in GenericItemChannelLinkProvider
* defer processing until stopConfigurationUpdate is called
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
* Don't update unchanged things in .things file
There were two problems:
- The old things weren't removed, resulting in accumulation of duplicate things and comparing the new one against the old one resulting in erroneous update
- Numeric values (usually entered as integer) in a newly loaded Channel Configuration properties are stored as BigDecimal with Scale 0, but subsequent normalization changed it to scale 1. This made equals() return false when it shouldn't. This leads to calling notifyListenersAboutUpdatedElement unnecessarily.
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
Allow a group to be a member of its direct parent and also its parent's ancestors without raising an error.
Looping membership is still detected and prevented as before, thus Stack Overflow is still avoided.
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
* Apply channel config changes in .items file
Changes in channel config weren't applied because ItemChannelLink.equals() include the link configurations in the comparison. This caused the new link not being found in the set lookup, which leads to erroneously calling notifyListenersAboutAddedElement, when it should've called notifyListenersAboutUpdatedElement instead.
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
* Add dynamic scripting language transformation service
This replaced SCRIPT transformation with one specific to each language
e.g. JS, RB, GROOVY, etc.
Co-authored-by: Jan N. Klug <github@klug.nrw>
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>