* Script action: Allow script to be empty
* Short evaluate to reasonable defaults when script is empty
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
* Upgrade to Karaf 4.4.5 and Xtext 2.34
Upgrade Karaf from 4.4.4 to 4.4.5:
* Sync runtime dependencies with Karaf 4.4.5, most notably:
* Jetty 9.4.53.v20231009
* JNA 5.14.0
* Pax Logging 2.2.6
* Pax Web 8.0.24
* ASM 9.6
* Resolve itest runbundles
Upgrade Xtext from 2.32 to 2.34
* Sync depencencies, most notably:
* Guava 33.0.0
* classgraph 4.8.165 changing provider to io.github.classgraph
* Migrate old Xtext generator xtext.generator to xtext.xtext.generator
as xtext.generator has been removed from Xtext, affecting
org.openhab.core.model.lazygen
* resolve runbundles
* Remove org.openhab.core.model.lazygen
No longer in use since 2017, see eclipse-archived/smarthome#4122.
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
* Contact item: Fix command descriptions provided even though commands are not accepted
If a state description is set on a contact item, currently a command description is automatically created as well.
This is wrong as contact items do not accept commands (except refresh) and caused the UI to display a control for the default (list) widget for these contacts.
* Also fix Call and Image items & Allow explicitly setting command description
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Fix two errors for calculating bitrate and duration of sound.
In AudioSinkUtilsImpl : confusion between byte / bite
In AudioWaveUtils : confusion between byte / bite AND with the defintion of framesize (framesize already includes channels number)
Signed-off-by: Gwendal Roulleau <gwendal.roulleau@gmail.com>
* Upgrades jUPnP from 2.7.1 to 3.0.0.
* Uses a custom OSGiUpnpServiceConfiguration for JDK-8301341 workaround
For release notes, see:
https://github.com/jupnp/jupnp/releases/tag/3.0.0
Signed-off-by: Wouter Born <github@maindrain.net>
Data added from the REST API is immediately stored in the selected persistence service, bypassing the `PersistenceManager`. Because of that the future values are not correctly "restored".
Signed-off-by: Jan N. Klug <github@klug.nrw>
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>
* Script profile: Separate toHandlerScript for commands and states
This allows much more fine-grained control for the script profile.
E.g. it is now possible to mimic the behaviour of the `system:follow` profile, but apply a script transformation to the forwarded state.
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
If the specified key is not already associated with a value (or is mapped to null), the given mapping function computes the value.
Signed-off-by: Wouter Born <github@maindrain.net>
* 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>
Installing from marketplace gives an Error that is not very helpful.
Couldn’t find the widget in the add-on entry
The cause was missing ```yaml code fence when a normal code fence was used. This used to work in the past so a number of widgets are done this way and will not install. Suggest a more useful message to help guide widget devs.
Signed-off-by: Matthew Skinner <matt@pcmus.com>
* Replace Markdown backticks with JavaDoc code tags
The proper way to format code with JavaDoc is using code tags and not Markdown backticks.
Signed-off-by: Wouter Born <github@maindrain.net>
It has been reported several times that add-ons were not properly installed / missing after an upgrade or the installation of incompatible add-ons resulted in broken installations.
After an upgrade (or clean cache) the `AddonHandler`s try to re-install the add-ons from the download cache (`<userdata>/marketplace`). This happens without checking compatibility. This was needed before OH4, because the cache was the only source providing information about installed add-ons. This is now different, since we store the add-on information in a JSON database, so the UIDs of the add-ons are known.
This PR changes improves the add-on services. It now
1. Reads the information about the installed add-ons from the database and sets the installation status based on information from the handlers.
2. Removes all add-ons that are not installed from the JSON database and remembers their UIDs.
3. Refreshes the remote add-on list (including check for compatibility if not disabled).
4. Tries installation of the add-ons remembered in step 2. Since incompatible add-ons are missing in the add-on list, their installation fails and a warning is logged.
This PR is has two corresponding PR in openhab-distro and openhab-linuxpkg to ensure that the upgrade script and `openhab-cli` also clear the marketplace cache.
Signed-off-by: Jan N. Klug <github@klug.nrw>
Upgrades Jollyday 0.5.10 (de.jollyday) to 0.23.2 of a more actively maintained fork (de.focus-shift).
* This adds many missing holidays.
* Also removes the workaround for the Danish Great Prayer Day introduced by #3573.
For release notes, see:
https://github.com/focus-shift/jollyday/releasesFixes#3544
Signed-off-by: Wouter Born <github@maindrain.net>
* Fix Instant serialization/deserialization regression
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
* Consolidate serialization and deserialization in same type adapter
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
* Simplify deserializer
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
---------
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Abstract classes should not have public constructors.
Constructors of abstract classes can only be called in constructors of their subclasses.
So there is no point in making them public.
The protected modifier should be enough.
Signed-off-by: Wouter Born <github@maindrain.net>
* Simplify adding elements to Collections
This optimizes and simplifies the code that adds elements to Collections.
Signed-off-by: Wouter Born <github@maindrain.net>
* Iterate using Map entries
Iteration using Map entries is preferred because it is more efficient and helps preventing NPEs.
Signed-off-by: Wouter Born <github@maindrain.net>
A static inner class does not keep an implicit reference to its enclosing instance.
This prevents a common cause of memory leaks and uses less memory per instance of the class.
Signed-off-by: Wouter Born <github@maindrain.net>
* Simplify assertions
Using the appropriate assertion methods results in less and easier to read code as well as better error messages when assertions fail.
Signed-off-by: Wouter Born <github@maindrain.net>
An infinite recursion would occur when calling this method.
I did not find any add-ons using this method but that could be due to this bug.
Signed-off-by: Wouter Born <github@maindrain.net>
Removes redundant modifiers from the code.
These modifiers redeclare the default modifiers that apply to interfaces, enums etc.
Signed-off-by: Wouter Born <github@maindrain.net>
These array creations are unnecessary because arrays are created automatically for methods using varargs.
Signed-off-by: Wouter Born <github@maindrain.net>
`isEmpty()` expresses the intent more clearly and is therefore preferred.
Counting the number of elements can also be an expensive operation e.g. when using linked lists.
Signed-off-by: Wouter Born <github@maindrain.net>
While cleaning up the code I found a some more code to cleanup:
* Remove unnecessary boxing
* Use `contains(..)` instead of `indexOf(..) != -1`
* Use `assertInstanceOf` in tests
* Make expensive trace logging conditional
* Remove redundant constructor
* Replace `collect(Collectors.toUnmodifiableList())` with `toList()`
* Replace `filter(..).count() == 0L` with `noneMatch(..)`
* Replace `filter(..).count() > 0` with `anyMatch(..)`
Signed-off-by: Wouter Born <github@maindrain.net>
* Use String.join instead of Collectors.joining
String.join results in less code when joining an Iterable or Array.
Signed-off-by: Wouter Born <github@maindrain.net>
Method references are more readable because they refer to class names and usually result in less code.
Signed-off-by: Wouter Born <github@maindrain.net>
Due to the way month, week and day are defined in Indriya their symbol is not added as alias. This is a bug in indriya, but their release cycles are quite long and we should provide a fix for our users.
This should be backported to 4.1.x
Signed-off-by: Jan N. Klug <github@klug.nrw>
* Delay the IP scan to make sure that no further candidates are added and do not use a dedicated thread pool
Signed-off-by: Kai Kreuzer <kai@openhab.org>
* minor doc update to fix javadoc build
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
Co-authored-by: Andrew Fiddian-Green <software@whitebear.ch>
* 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>