Commit Graph
39 Commits
Author SHA1 Message Date
Cody CutrerandGitHub 839581898b Add HomieAddonUpgrader to upgradetool (#5180)
Signed-off-by: Cody Cutrer <cody@cutrer.us>
2025-12-13 14:48:01 +01:00
Cody CutrerandGitHub 7b80c1e9f5 Add HomeAssistantAddonUpgrader to upgradetool (#5178)
Automatically marks Home Assistant addon for installation if the
MQTT binding is marked for installation, and Home Assistant things
exist

Signed-off-by: Cody Cutrer <cody@cutrer.us>
2025-12-09 22:15:06 +01:00
Cody CutrerandGitHub fc9c923621 Allow cross-binding bridges (#5083)
Signed-off-by: Cody Cutrer <cody@cutrer.us>
2025-11-23 00:22:09 +01:00
Cody CutrerandGitHub 759c4e70d5 Allow source from header in REST API (#5131)
* Allow source from header in REST API

Signed-off-by: Cody Cutrer <cody@cutrer.us>
2025-11-22 22:41:53 +01:00
Cody CutrerandGitHub 6267d2ebca Populate source when sending item events via REST API (#5041)
Optionally allow providing a source, and then append (or directly) set
the REST package and authenticated username.

Signed-off-by: Cody Cutrer <cody@cutrer.us>
2025-11-10 22:33:46 +01:00
Cody CutrerandGitHub b1670ec2fa Make FilterCriteria.Operator.getSymbol public (#5106)
Signed-off-by: Cody Cutrer <cody@cutrer.us>
2025-10-31 00:35:14 +01:00
Cody CutrerandGitHub 934431cdb4 Set event source for updates and commands from bindings according to new standards (#5073)
* Set event source for updates and commands from bindings according to new standards

In particular, prefix the channel UID with the package (org.openhab.core.thing), and
the channel UID becomes the actor.

Extends ProfileCallback to allow profiles to explicitly specify a source, and then
uses the new delegation syntax to append the channel UID source component in that
case.

Signed-off-by: Cody Cutrer <cody@cutrer.us>
2025-10-24 06:09:32 +02:00
Cody CutrerandGitHub 7efff5b374 Send source for console commands to items (#5079)
Signed-off-by: Cody Cutrer <cody@cutrer.us>
2025-10-24 00:21:41 +02:00
Cody CutrerandGitHub 26a59793b3 Set event source for restoring item states from persistence (#5082)
Signed-off-by: Cody Cutrer <cody@cutrer.us>
2025-10-24 00:20:22 +02:00
Cody CutrerandGitHub e1a1d6c166 Add helpers for constructing event sources (#5078)
Signed-off-by: Cody Cutrer <cody@cutrer.us>
2025-10-24 00:01:37 +02:00
Cody CutrerandGitHub 32868df4d4 Pass event sources through item state update/change events (#5081)
Signed-off-by: Cody Cutrer <cody@cutrer.us>
2025-10-23 23:57:47 +02:00
Cody CutrerandGitHub 6f6ba7d4ec Include source with item event descriptions when present (#5080)
Signed-off-by: Cody Cutrer <cody@cutrer.us>
2025-10-23 23:36:55 +02:00
Cody CutrerandGitHub 71692e7b36 Add item overloads for providing source (#5040)
* Add item overloads for providing source

Signed-off-by: Cody Cutrer <cody@cutrer.us>
2025-10-07 22:39:40 +02:00
Cody CutrerandGitHub 5f72352a59 Pass event source to profiles (#4990)
So that a user can define a profile that takes different
actions depending on what's generating the command.

Signed-off-by: Cody Cutrer <cody@cutrer.us>
2025-09-14 16:39:21 +02:00
Cody CutrerandGitHub 5c42be4861 Allow ThingHandlers to dynamically register services (#4719)
Signed-off-by: Cody Cutrer <cody@cutrer.us>
2025-04-20 08:52:23 +02:00
Cody CutrerandGitHub ea5480d12b Add ColorUtil.xyToDuv (#4401)
Signed-off-by: Cody Cutrer <cody@cutrer.us>
2024-10-08 00:02:25 +02:00
Cody CutrerandGitHub 716045a174 Support lists for metadata properties in items files (#4330)
Signed-off-by: Cody Cutrer <cody@cutrer.us>
2024-08-05 23:19:30 +02:00
Cody CutrerandGitHub 474d24c62d Refactor GenericEventTrigger and GenericEventCondition (#3299)
* rework GenericEventTrigger and GenericEventCondition

fixes #3234

to make their interfaces and semantics match, as well as having a
well defined (and useful) way of defining topic filters

Signed-off-by: Cody Cutrer <cody@cutrer.us>
2023-02-14 09:07:23 +01:00
Cody CutrerandGitHub 35a70064c4 Fix CommunicationManager erroring on unusual item<->channel link (#3326)
Some bindings that dynamically create channels (mqtt.homie) might create
a channel that declares itself as Number:Dimensionless because the
end-device metadata has a unit of "%". But a savvy user might want to
link that to a Dimmer or Rollershutter item depending on what the device
actually is. This actually works just fine since QuantityType (with unit
PERCENT) and PercentType implicitly convert between each other. Except
this odd compatibility code in CommunicationManager that tries to assist
bindings that _aren't_ QuantityType compatible. It assumes if the channel's
item type is a dimensioned item, that the actual Item is a NumberItem,
and casts without checking. All this does is checks for that case to avoid
a ClassCastException.

Signed-off-by: Cody Cutrer <cody@cutrer.us>
2023-01-23 20:53:24 +01:00
Cody CutrerandGitHub d8a2c19609 Prevent a provider from removing elements added by another provider (#3301)
* prevent a provider from removing an element from another provider

if multiple providers provide the same element, the added callback
simply ignores the duplicates. but the provider has no idea its element
was ignored, so it may try to remove it in the future, and things will
get all out of whack if the element is removed from the registry even
if another provider thinks it's still there

this is easily reproducible by creating an item in the UI, then
creating the same item via a .items file, and then removing the item
from the .items file. The item will seem like it is gone to most
of openHAB, but will come back after reboot when the managed
provider re-adds.

Signed-off-by: Cody Cutrer <cody@cutrer.us>
2023-01-09 19:29:14 +01:00
Cody CutrerandGitHub 8be306a5bc Cleanup event filtering and improve EventFilter usage (#3295)
* don't use event.topics OSGi service property
* use TopicPrefixEventFilter

Signed-off-by: Cody Cutrer <cody@cutrer.us>
2023-01-03 16:30:12 +01:00
Cody CutrerandGitHub 1d8d04f75e Revert "Wrap ScriptEngine executions in a SafeCaller (#3180)" (#3227)
This reverts commit ff75505e70.

Signed-off-by: Cody Cutrer <cody@cutrer.us>
2022-12-13 19:16:27 +01:00
Cody CutrerandGitHub e2bcdcc8f3 Allow profiles to access the entire context of the link they're applied to (#3151)
So that they can vary their processing based on the item or channeluid itself,
instead of (or in addition to) solely on the prior states passing through it.

Signed-off-by: Cody Cutrer <cody@cutrer.us>
2022-12-11 13:30:16 +01:00
Cody CutrerandGitHub ac7378d1bb ScriptFileWatcher fixes for entire directories (#3185)
* 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>
2022-12-06 19:01:49 +01:00
Cody CutrerandGitHub ff75505e70 Wrap ScriptEngine executions in a SafeCaller (#3180)
Fixes #3179

Signed-off-by: Cody Cutrer <cody@cutrer.us>
2022-11-30 22:36:49 +01:00
Cody CutrerandGitHub d96e5d5bc0 return the precise scheduled execution time for timers (#3182)
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>
2022-11-29 18:25:53 +01:00
Cody CutrerandGitHub af3738487c add QuantityType.toUnitRelative (#3177)
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>
2022-11-27 10:09:52 +01:00
Cody CutrerandGitHub 0cceb5b156 log full exception information when calling JSR223 scripts (#3176)
* 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>
2022-11-27 09:28:36 +01:00
Cody CutrerandGitHub f0875a46f2 tweak ScriptedRuleProvider slightly (#3170)
* 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>
2022-11-24 18:55:52 +01:00
Cody CutrerandGitHub 221c80b12f Change system.color-temperature-abs channel type to be a Number:Temperature (#3129)
refs https://github.com/openhab/openhab-addons/pull/13570#issuecomment-1288139778

now that Kelvin and mireds/mireks are easily convertible

Signed-off-by: Cody Cutrer <cody@cutrer.us>
2022-11-01 09:50:01 +01:00
Cody CutrerandGitHub 3d279eb7f1 [mqtt] Properly process retained messages (#3124)
* [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>
2022-11-01 09:23:01 +01:00
Cody CutrerandGitHub a7d912d1e9 Fix invertible unit conversions when sent via a binding or uses in ItemUIRegistry (#3134)
* fix invertible unit conversions when sent via a binding
* do invertible unit conversion in ItemUIRegistry

Signed-off-by: Cody Cutrer <cody@cutrer.us>
2022-10-27 20:26:27 +02:00
Cody CutrerandGitHub e86f388a5b Implement command completion in console for openhab command (#3111)
* 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>
2022-10-22 10:52:31 +02:00
Cody CutrerandGitHub ccdf2c5573 Allow sending IncreaseDecreaseType directly to DimmerItem (#3116)
Signed-off-by: Cody Cutrer <cody@cutrer.us>
2022-10-17 08:05:02 +02:00
Cody CutrerandGitHub 3659542bae Support mired units (#3108)
* 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>
2022-10-16 13:50:46 +02:00
Cody CutrerandGitHub 7f38d419c6 Allow sending QuantityType to NumberItem (#3115)
NumberItems always accept QuantityType

Signed-off-by: Cody Cutrer <cody@cutrer.us>
2022-10-15 09:31:30 +02:00
Cody CutrerandGitHub 5062ab5fb0 [rulesupport] sort JSR223 scripts by start level before filename (#3099)
The docs say that JSR223 scripts will be loaded in order of start level
(as defined by filename or containing folder). this works (mostly) fine
when you're stepping through start levels sequentially on startup, but if
you're already at SL100, and have scripts located in sl folders, and then
install an addon for those scripts, they were loading in alphabetic
order instead. This ensures they'll still respect start level order
relative to each other.

This should also fix the case of script start levels not matching
start levels OpenHAB actually steps through (which are all multiples
of 10) - i.e. if you define scripts in sl30, sl31, and sl32, when
OpenHAB jumps from 30 to 40, 31 should be executed before 32.

Signed-off-by: Cody Cutrer <cody@cutrer.us>
2022-10-05 18:43:48 +02:00
Cody CutrerandGitHub 065e33f5ab Fix StartLevelService "hanging" if config is changed. (#3092)
Unregistered trackers aren't clear, so then we never register new trackers,
and thus never get notified of any changes.

Signed-off-by: Cody Cutrer <cody@cutrer.us>

Signed-off-by: Cody Cutrer <cody@cutrer.us>
2022-09-25 09:44:57 +02:00
Cody CutrerandGitHub 57ed7ef5a7 Include full exception when WatchQueueReader thread dies (#2538)
See #2537

Signed-off-by: Cody Cutrer <cody@cutrer.us>
2022-01-18 13:46:36 +01:00