* Extend sitemap syntax for switch to support press & release buttons
Mappings attribute for switch element now accepts one or two commands for each button.
If only one command is provided, the button is a click button, the command is sent to the item when the button is clicked.
If two commands are provided (separated by ":"), the button is a press & release button, the first command is sent to the item when the button is pressed and the second when the button is released.
Syntax example for a click button: Switch item=DemoSwitch mappings=[ ON="ON" ]
Syntax example for a press & release button: Switch item=DemoSwitch mappings=[ ON:OFF="ON" ]
Related to #3822
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
* Speed up calculations in rules
* Add test for NumberExtensions.numberToBigDecimal
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
Co-authored-by: Holger Friedrich <mail@holger-friedrich.de>
Fix#2283Fix#4050
This PR is fixing two things in the computation of the displayState:
- If a transformation is present in the state pattern, it has now priority over options provided by the state description
- If no transformation is present in state pattern but options are provided by the state description, the provided state pattern is applied to the matching option
Also remove a deprecated call to transform.
If there is no transformation but options are provided without any matching with the current state and there is a pattern provided, then this pattern is used to format the output.
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
* update reference to method / parameter names from documentation
* reflect that subscriptions for a whole page are possible in the documentation
* document that subscriptions to a whole sitemap are possible but discouraged
Signed-off-by: Tassilo Karge <tassilo.karge@web.de>
* Set a default presentation pattern for String/Number/Datetime items
A default state pattern was previously provided by ChannelStateDescriptionProvider only for String and Number items linked to a channel.
It is now the class DefaultStateDescriptionFragmentProvider which is responsible for providing the default state pattern for items, whether the item is linked to a channel or not.
This new class is the lowest ranked StateDescriptionFragmentProvider so that all other providers have priority in setting the state pattern.
Default pattern for string item: %s
Default pattern for datetime item or group with datetime state: %1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS
Default pattern for number item or group with number state: %.0f
Default pattern for number+dimension item or group with number+dimension state: %.0f %unit%
Closes#4071Closes#3835
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
* 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>
* [modbus] reduce log level when modbus slave returns DEVICE_BUSY exception
This exception is meant to indicate that the request should be retried
shortly, essentially, and at least some of the devices I own seem to be
busy bees. Thus my logs receive significant spam of this warning.
Since the exception is transient and retrying it is the expected course
of action, I think it makes sense to reduce the log level here slightly
and only output an error when the retries get exhausted.
Signed-off-by: Simonas Kazlauskas <git@kazlauskas.me>
* Update bundles/org.openhab.core.io.transport.modbus/src/main/java/org/openhab/core/io/transport/modbus/internal/ModbusManagerImpl.java
Signed-off-by: Simonas Kazlauskas <github@kazlauskas.me>
---------
Signed-off-by: Simonas Kazlauskas <git@kazlauskas.me>
Signed-off-by: Simonas Kazlauskas <github@kazlauskas.me>
Between Java 17 and Java 21, serialization of DateTime has changed due to
CLDR 42 which uses a narrow non-breaking space.
To ease switching JDK versions, the seralization format is explicitly
set to the Java 17 format.
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
Previously it was not supporting paging. This validated correct
behaviour with historicState & lastUpdate & previousState
that have the pageSize defined.
Signed-off-by: Sami Salonen <ssalonen@gmail.com>