The `migrateThingType` call the managed thing provider directly instead of checking if it's actually a managed thing.
This check is done in the `thingUpdated` method. Changed the code so it makes the same call as in `thingUpdated`.
Also-by: Jan N. Klug <github@klug.nrw>
Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
* Bump commons-net from 3.7.2 to 3.9.0 in /bom/runtime
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Wouter Born <github@maindrain.net>
* handle entire directories being moved in and out of a watched script path
* ensure sorted scripts when ScriptFileWatcher restarts or new directories are added
Signed-off-by: Cody Cutrer <cody@cutrer.us>
When updating file-based script transformations used in item state-descripting a CME can occur during reload. This is fixed by using thread-safe implementation of `HashMap`.
Signed-off-by: Jan N. Klug <github@klug.nrw>
When writing tests and mocking time, it can be important that
execution_time match _exactly_ with what was sent to reschedule().
When re-calculating based on now and the expected remaining delay,
this might be off by a few milliseconds. We have the exact time
that was requested already, so might as well use it.
Signed-off-by: Cody Cutrer <cody@cutrer.us>
this is a useful helper that can eliminate some complicated code elsewhere.
starting in SystemOffsetProfile. then I also want to use it in the homekit
addon.
Signed-off-by: Cody Cutrer <cody@cutrer.us>
* log full exception information when calling JSR223 scripts
The scripts are user code, so in order to help them debug their code,
the full stack trace is very useful.
Signed-off-by: Cody Cutrer <cody@cutrer.us>
Pattern %s will match <hue>,<saturation>,<brightness>
Pattern %hsb% will match <hue>,<saturation>,<brightness>
Pattern %rgb% will match <red>,<green>,<blue>
Related to discussion in openhab/openhab-webui#427
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
* tweak ScriptedRuleProvider slightly
just extend AbstractProvider so that it doesn't need to re-implement
managing listeners
Signed-off-by: Cody Cutrer <cody@cutrer.us>
* have ScriptedRuleProvider implement ManagedProvider
there's nothing that says ManagedProvider has to be backed by storage,
just that they should be able to add and remove elements
Since that's exactly what ScriptedRuleProvider does, might as well
have it conform to the interface.
Signed-off-by: Cody Cutrer <cody@cutrer.us>
* Fix missing stateDescriptionProvider in Group items
The stateDescriptionProvider was not properly passed to the base item. Because of that units set in the state description were not properly used when setting the group state after calculating aggregation functions.
Signed-off-by: Jan N. Klug <github@klug.nrw>
* [mqtt] Properly process retained messages
Only the _first_ message has the retained flag (always on MQTT3,
there is a flag to forward the retain flag on all messages with
MQTT5, but we don't set it), so we have to keep track of previously
retained messages as well.
This shows up as when a thing comes back online and re-subscribes
to a retained message that another thing subscribed to also,
it won't see any changes that happened to that topic since the
very first message was received.
Signed-off-by: Cody Cutrer <cody@cutrer.us>
* Fix ItemStateCondition for PercentType values
Dimmer items return their state as PercentType. The code did not properly handle PercentType because PercentType is a subclass of DecimalType. One value was converted by casting the value to DecimalType (which leads to 40 for 40%) while the other one used `.as` (which results in 0.4 for 40%). A comparison than of "state <= 50" with state = 20 is therefore executed as "20 <= 0.5" which is not what the user would expect.
Signed-off-by: Jan N. Klug <github@klug.nrw>
* fix invertible unit conversions when sent via a binding
* do invertible unit conversion in ItemUIRegistry
Signed-off-by: Cody Cutrer <cody@cutrer.us>
* Implement command completion in console for openhab command
And subcommands can implement it if they want. At the least the
CommandConsoleExtension's description will now be visible in
tab-completion.
I've also implemented detailed completion for openhab:items,
openhab:status, openhab:send, and openhab:update.
Signed-off-by: Cody Cutrer <cody@cutrer.us>
* Support mired units
Mired are fairly common to describe the color temperature of
lightbulbs (slightly less common than Kelvin), but are very
useful for various calculations when adjusting the color
temperature, as well as being necessary for various integerations
that require mired units.
This commit makes them a well-known unit (previously they were
still usable, using "MK^-1"), as well as making them easier to
work with on QuantityType. The hiccup is that Mireds aren't
technically a Temperature dimension, because they're a reciprocal.
So add a `inverse` method that delegates to javax.measure's
same method, and then use it as necessary when doing unit
conversions and comparisons. Unfortunately, because the
dimension changes, the return value of a conversion won't
necessarily be the same type, an additional method is added
for callers that are willing to handle the change in
dimension. This is implemented for all callers that can use
it in core.
Signed-off-by: Cody Cutrer <cody@cutrer.us>