* 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>
* [voice] Support custom rules on item metadata
* fix isTemplate functionality and test
* fix filter location based for non labeled rules
Signed-off-by: Miguel Álvarez <miguelwork92@gmail.com>
* Fix AutoUpdatePolicy for channel
Fixes#3887
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
* Simplify setting of auto update policy
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
---------
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
* [ColorUtil] Extend rgbToHsb(PercentType[]) for RGBW
rgbToHsb(PercentType) supports arrays of size 4 (RGBW) in addition to and arrays of size 3 (RGB).
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
* Use a scheduled thread pool in JsonStorage to avoid one thread per instance
* Removed an incorrect conversion between millis and nanos
Signed-off-by: Jörg Sautter <joerg.sautter@gmx.net>
* Add conversion for HSB to RGBW and back
for KNX DPT251.600 to use all 4 colors.
With the new feature, the HSBType can converted into RGBW, and also back
to HSB.
Due to the conversion, some accuracy is lost, but the result is
approximately correct.
Signed-off-by: Marco Müller <marco@ms-mueller.ch>
* [sitemap] Provide information about widget label source to clients
The label can be populated from a label specified on the respective
sitemap widget, or (if no label was specified) from the label of the
backing item. Allow clients to differentiate between both cases.
Related to openhab/openhab-webui#2065
Signed-off-by: Danny Baumann <dannybaumann@web.de>
Bridges could not be updated because the updated bridge was a `ThingImpl` instead of a `BridgeImpl`. Also the copy-creator in the `BridgeBuilder` was missing. This should also be cherry-picked to 4.0.x.
Signed-off-by: Jan N. Klug <github@klug.nrw>
The FolderObserver needs to make sure that paths are properly handled for any parsers that are added at any moment by other threads during activation.
Fixes#3784Fixes#3793
Signed-off-by: Wouter Born <github@maindrain.net>
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>
Using 'UID' is confusing as method parameter because it can be mistaken for some kind of constant while reading code.
Signed-off-by: Wouter Born <github@maindrain.net>
Simplifies the code by using List.of, List.copyOf etc. where possible which results in less code and imports.
Signed-off-by: Wouter Born <github@maindrain.net>
Stream.toList was introduced in Java 16 and creates an unmodifiable List so it can be used to simplify code whenever the List is not expected to be modified.
Signed-off-by: Wouter Born <github@maindrain.net>
While reviewing https://github.com/openhab/openhab-js/pull/300,
I noticed that filtering by source `org.openhab.core.expire` was not possible.
This was because the specified source was checked against the event topic, which makes no sense at all given that different schemes.
Source filtering is done inside the `apply` method.
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Concerns labelcolor, valuecolor and visibility
Also fix wrong positions of ")" in Sitemap.xtext
Closes#3058
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
AFAIK these annotations are not used when using declarative services.
I stubled upon these annotations when feature validation failed while creating #3817.
Xtext now uses Guice 7 which is using jakarta.inject imports.
Only si.uom:si-units:2.1 still imports javax.inject but it will also switch to jakarta.inject when 2.2 gets released.
Signed-off-by: Wouter Born <github@maindrain.net>
* Mark extensions as ready in addModelsToRepo only if parser was availabile
* Store valid extensions using Set instead of List
* Use java.nio where possible
* Add more debug logging
* Cleanup and simplify code
Signed-off-by: Wouter Born <github@maindrain.net>
* [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>
* Sync runtime dependencies with Karaf 4.4.4, most notably:
* Jetty 9.4.52.v20230823
* JNA 5.13.0
* SLF4J 2.0.6
* Pax Logging 2.2.3
* Pax Web 8.0.22
* Resolve itest runbundles
* Use new Pax Web features to simplify dependency management
* Add specs features because Pax Web now depends on "asm"
Signed-off-by: Wouter Born <github@maindrain.net>
Fixes the following:
* connection and countries details missing for some AddonServices
* missing connection getter on AddonInfo
* countries lists has empty String when when countries info is missing
Related to #3795
Signed-off-by: Wouter Born <github@maindrain.net>
When things from multiple handler factories are provisioned from the same file the internal thing map was not properly updated.
Signed-off-by: Jan N. Klug <github@klug.nrw>
This fixes that some linuxsysfs tests always fail on Linux whenever a real serial device is connected.
Due to the changes in #3290 the tests would also scan the actual devices causing tests to fail due to unexpected results.
Signed-off-by: Wouter Born <github@maindrain.net>
This is a workaround for JDK-8301341 by using the Java 11 LinkedTransferQueue with the QueueingThreadPoolExecutor in the Core and jUPnP.
Signed-off-by: Wouter Born <github@maindrain.net>
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>
In case of cyclic/recursive membership of groups (i.e. a group has itself or a child as parent) the recursive processing of the items leads to an `StackOverflowError` (reported in the forum and the german Facebook group). Also this is clearly a configuration error it should not result in the bundle not starting.
Signed-off-by: Jan N. Klug <github@klug.nrw>
Core part of https://github.com/openhab/openhab-webui/issues/1921.
With UI-support for scenes & scripts, the texts (labels, descriptions etc.) for rule-based actions should be updated to mention scenes & scripts as well.
This improves the UI experience.
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Setting up a treshold filter with the UI, it did not work because the unit field was blank.
I got an NPE from PersistenceTresholdFilter, and the PersistenceIncludeFilter would also throw a NPE in that case.
For PersistenceTimeFilter, defaulting to "s" is just cosmetic.
Picks-up PR #3681 and should be merged for the 4.0 release, because the UI does not prevent the unit field from being null.
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
* Align system-channel-types for electricity
These are only used by one binding at the moment and it's very inconsistent to have power, voltage and current with the "electric" prefix and energy with "electrical".
Signed-off-by: Jan N. Klug <github@klug.nrw>
* [voice] Add length limit to TTS handled by cache
We can safely assume that long TTS are generated for report (meteo, chatGPT ?), probably not meant to be repeated, and so not cached.
Signed-off-by: Gwendal Roulleau <gwendal.roulleau@gmail.com>
On larger installations with 1000+ items the limit of 1000 elements in the queue is exceeded easily. Since no events are lost (they just take longer to be processed), the limit that needs to be exceeded before a warning is issued should be increased.
See reports on the forum.
Signed-off-by: Jan N. Klug <github@klug.nrw>
* New translations scriptprofile.properties (Hungarian)
* New translations validation.properties (Hungarian)
* New translations automation.properties (Hungarian)
* New translations lsp.properties (German)
* New translations persistence.properties (German)
Instead of 5s before.
It helps triggering the end of playback earlier for audio sinks in asynchronous mode.
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Fix#3679
If not, calls of method limitToFields by PR #3335 fails when the list of
fields does not contain firmwareStatus.
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
* Improve threading in EventHandler
* refactor pagechangelistener to event
* One executor per subscriber type, not per subscriber
Signed-off-by: Jan N. Klug <github@klug.nrw>
* [voice] Add voice commands for register/unregister dialogs and list dialogs and dialog registrations
Signed-off-by: Miguel Álvarez <miguelwork92@gmail.com>
Allows the use of a Sizeable interface (for AudioStream that we know the length of, but we cannot clone). We can then improve the duration detection, for example for the pulseaudio sink (PR coming after).
We can also give the length information to sink in more cases.
Add the support of the mark / reset methods to some common AudioStream. We then allow more stream analysis for sink requiring it (Stream analysis often requires to get back in time after consuming a few bytes)
Signed-off-by: Gwendal Roulleau <gwendal.roulleau@gmail.com>
* Always use ThingUid as the unique identifier for thing status metrics
At bind time, ThingId was being used, but then ThingUid was being used when changes occured,
causing multiple meters to be created for the same Thing, with the status always being 0 for
the meter created at bind time.
This change uses the full ThingUid, for both binding and event processing, since ThingUid is
the globally unique value.
Fixes#3672
Signed-off-by: Scott Hraban <scotthraban@gmail.com>
See: https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/StringBuilder.html
> This class provides an API compatible with StringBuffer, but with no guarantee of synchronization.
> This class is designed for use as a drop-in replacement for StringBuffer in places where the string buffer was being used by a single thread (as is generally the case).
> Where possible, it is recommended that this class be used in preference to StringBuffer as it will be faster under most implementations.
Signed-off-by: Wouter Born <github@maindrain.net>
See title. This brings the query id in-line with the other add-on services.
Also adds correct content type.
Signed-off-by: Jan N. Klug <github@klug.nrw>
* [audio] More capabilities for AudioSink using the AudioServlet
AudioServlet can now serve all type of AudioStream multiple times by buffering data in memory or in temporary file.
Adding method to ease disposal of temporary file after playing a sound
Adding an identifyier to audio stream for further development (allow audio sink to cache computation data)
We can now send audio with a Runnable for a delayed task to be executed after. This delayed task includes temporary file deletion and volume restoration.
This is a no breaking change / no behaviour modification for other addon AudioSink, as existing AudioSink must explicitly override the old behaviour to use this capability.
Add AudioSinkSync / AudioSinkAsync abstract classes to use this capability easily.
WebAudioSink now implements this capability, with the help of a modified AudioServlet
Adding (approximative, better than nothing) sound duration computation method for MP3 and WAV.
Use this sound duration computation to guess when the async sound is finished and when to do the post process (i.e. volume restoration)
Signed-off-by: Gwendal Roulleau <gwendal.roulleau@gmail.com>
* Add semantic tag registry + REST API to manage user tags
Related to #3619
New registry for semantic tags.
New default semantic tags provider for all built-in semantic tags.
New managed provider to add/remove/update user semantic tags.
Storage of user semantic tags in a JSON DB file.
New REST API to add/remove/update user tags in the semantic model.
New REST API to get a sub-tree of the semantic tags.
Semantic tag class annotations are removed.
Semantic tag classes are now created at runtime.
Classes Locations, Equipments, Points and Properties are removed
Static methods SemanticTags.add removed
The adding of semantic tag classes is now managed only by the tag registry.
Avoids calling static method SemanticTags.getById when possible
SemanticsMetadataProvider service now requires semanticTagRegistry to start.
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
* Closes#3329.
This implements a new optional `cacheable` parameter for these REST endpoints:
- `/rest/items`
- `/rest/things`
- `/rest/rules`
When this parameter is set, a flat list of all elements excluding
non-cacheable fields (e.g. "state", "transformedState", "stateDescription",
"commandDescription" for items, "statusInfo", "firmwareStatus",
"properties" for things, "status" for rules) will be retrieved along with
a `Last-Modified` HTTP response header. When unknown, the Last-Modified
header will be set to the date of the request.
Also only when this parameter is set, and a `If-Modified-Since` header is
found in the request, that header will be compared to the last known
modified date for the corresponding cacheable list. The last modified date
will be reset when any change is made on the elements of the underlying
registry. If the `If-Modified-Since` date is equal or more recent than the
last modified date, then a 304 Not Modified response with no content will
be served instead of the usual 200 OK, informing the client that its
cache is still valid at the provided date.
All other request parameters will be ignored except for "metadata" in the
`/rest/items` endpoint. When a metadata selector is set, the resulting
item list will be considered like a completely different resource, i.e.
it will have its own last modified date. Regarding metadata, the approach
to invalidating last modified dates is very conservative: when any metadata
is changed, all cacheable lists of items will have their last modified date
reset even if the change was in a metadata namespace that wasn't requested.
This also implements the abovedescribed behavior for the
`/rest/ui/components/{namespace}` endpoint, but no `cacheable` parameter
is necessary. The last modified date is tracked by namespace.
Signed-off-by: Yannick Schaus <github@schaus.net>
* New translations audio.properties (Romanian)
* New translations addons.properties (Romanian)
* New translations i18n.properties (Romanian)
* New translations network.properties (Romanian)
* New translations marketplace.properties (Romanian)
* New translations validation.properties (Finnish)
* New translations scriptprofile.properties (French)
* New translations scriptprofile.properties (Slovenian)
* New translations validation.properties (Hebrew)
* New translations validation.properties (Polish)
* New translations validation.properties (Slovenian)
* New translations hli.properties (French)
* New translations hli.properties (Polish)
* New translations automation.properties (Hebrew)
* New translations automation.properties (Polish)
* New translations lsp.properties (Italian)
* New translations hli.properties (Italian)
* New translations addons.properties (Finnish)
* New translations automation.properties (Italian)
* New translations LanguageSupport.properties (Portuguese)
* Add a ScriptEngineFactory bundle tracker
The `ScriptEngingeFactoryBundleTracker` tracks all bundles that provide `ScriptEngineFcatory` capabilities and sets a `ReadyMarker` if all of them are activated.
Signed-off-by: Jan N. Klug <github@klug.nrw>
* Add group name to GroupStateTriggerHandler
When triggering on state change/update of group member, the group is not available in the rule context (because the event is the `ItemStateChanged/UpdatedEvent` that caused the group to change/update. This adds a new element `triggeringGroup` to the rule context.
This is useful for generalized rules that trigger on different groups.
Signed-off-by: Jan N. Klug <github@klug.nrw>
Posting the `ItemAddedEvent` after notifying the listeners results in `ItemStateUpdated/ChangedEvents` before the `ItemAddedEvent` because the state could be altered by persistence services. This is at least unexpected and can be fixed by swapping the order.
Signed-off-by: Jan N. Klug <github@klug.nrw>
This is needed to clean-up UI. The categories should be used for add-ons while core services should use `system`.
Signed-off-by: Jan N. Klug <github@klug.nrw>
This is needed to clean-up UI. The categories should be used for add-ons while core services should use `system`.
Signed-off-by: Jan N. Klug <github@klug.nrw>