openhab-scripting 5.41.0 → 5.42.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73d44fb2a401e3ffc950a2d19ca59000005bf77cbb891e9e94287b8f0909adb1
|
4
|
+
data.tar.gz: a7c690eb7003d86678ad9a3a5310eb3566a6f77d11fd984049f825959f5c4346
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1517830917a483f391f14fc45ad281e2f04165797a1f13a65b543d6cd89d1196f5312b605312e41733de73012282bf474c77bd261574ba226b6bd6df62055a5e
|
7
|
+
data.tar.gz: d0c83fdf5d653c0e548a7de8d0035e0b2beefa3963d963ef20d51b3ed01ffc585b9085124b0dc2dfb0eef6ae2e3848c44958cb6a7dc7d346dd45f94f568a96eb
|
@@ -39,7 +39,7 @@ module OpenHAB
|
|
39
39
|
#
|
40
40
|
# Returns the event payload as a Hash.
|
41
41
|
#
|
42
|
-
# @return [Hash, nil] The payload object parsed by JSON. The keys are symbolized.
|
42
|
+
# @return [Hash, String, nil] The payload object parsed by JSON. The keys are symbolized.
|
43
43
|
# `nil` when the payload is empty.
|
44
44
|
#
|
45
45
|
def payload
|
@@ -48,6 +48,8 @@ module OpenHAB
|
|
48
48
|
original_verbose = $VERBOSE
|
49
49
|
$VERBOSE = nil
|
50
50
|
@payload ||= JSON.parse(get_payload, symbolize_names: true) unless get_payload.empty?
|
51
|
+
rescue JSON::ParserError
|
52
|
+
get_payload
|
51
53
|
ensure
|
52
54
|
$VERBOSE = original_verbose
|
53
55
|
end
|
@@ -91,20 +91,30 @@ module OpenHAB
|
|
91
91
|
label || name
|
92
92
|
end
|
93
93
|
|
94
|
-
# @!attribute [r]
|
94
|
+
# @!attribute [r] display_state
|
95
95
|
#
|
96
96
|
# Format the item's state according to its state description
|
97
97
|
#
|
98
|
-
# This may include running a transformation
|
98
|
+
# This may include running a transformation, if one is defined in the
|
99
|
+
# state description's pattern, otherwise it will format according to the
|
100
|
+
# pattern. If no state description is defined, the state will simply
|
101
|
+
# be returned as a string.
|
102
|
+
#
|
103
|
+
# @note While this method is also aliased to `#transformed_state` to
|
104
|
+
# match the field available in the openHAB REST API, unlike the API it
|
105
|
+
# will always return a value even if the state description has no
|
106
|
+
# transformation.
|
99
107
|
#
|
100
108
|
# @return [String] The formatted state
|
101
109
|
#
|
102
110
|
# @example
|
103
|
-
# logger.info(Exterior_WindDirection.
|
111
|
+
# logger.info(Exterior_WindDirection.display_state) # => "NE (36°)"
|
104
112
|
#
|
105
|
-
def
|
113
|
+
def display_state
|
106
114
|
Item.item_states_event_builder.get_display_state(self)
|
107
115
|
end
|
116
|
+
alias_method :transformed_state, :display_state
|
117
|
+
alias_method :formatted_state, :display_state
|
108
118
|
|
109
119
|
#
|
110
120
|
# Send a command to this item
|
@@ -1804,6 +1804,7 @@ module OpenHAB
|
|
1804
1804
|
# end
|
1805
1805
|
#
|
1806
1806
|
def event(topic, source: nil, types: nil, attach: nil)
|
1807
|
+
types ||= org.openhab.core.events.EventSubscriber::ALL_EVENT_TYPES
|
1807
1808
|
types = types.join(",") if types.is_a?(Enumerable)
|
1808
1809
|
trigger("core.GenericEventTrigger",
|
1809
1810
|
topic:,
|
data/lib/openhab/dsl/version.rb
CHANGED