Skip to content

Commit 6e06022

Browse files
authored
Add tern definitions for event, items.getItems (#1292)
Added event terns for the Trigger Types for both nashorn and openhab-js. Add groupNames to Item (openhab/openhab-js#86) Add getItems Signed-off-by: Stewart Cossey <[email protected]>
1 parent 39fa259 commit 6e06022

File tree

2 files changed

+108
-0
lines changed

2 files changed

+108
-0
lines changed

bundles/org.openhab.ui/web/src/assets/nashorn-tern-defs.json

+50
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,52 @@
9090
"!doc": "Returns a string representation of the state",
9191
"!type": "fn() -> string"
9292
}
93+
},
94+
"TriggerType": {
95+
"cronExpression": {
96+
"!doc": "The cron expression for the event (timer.GenericCronTrigger)",
97+
"!type": "string"
98+
},
99+
"time": {
100+
"!doc": "The time of the event in \"hh:mm\" format (timer.TimeOfDayTrigger)",
101+
"!type": "string"
102+
},
103+
"itemName": {
104+
"!doc": "The name of the item that triggered the event (core.ItemStateUpdateTrigger, core.ItemStateChangeTrigger, core.ItemCommandTrigger)",
105+
"!type": "string"
106+
},
107+
"state": {
108+
"!doc": "The state of the item that triggered the event (core.ItemStateUpdateTrigger, core.ItemStateChangeTrigger)",
109+
"!type": "string"
110+
},
111+
"previousState": {
112+
"!doc": "The previous state of the item that triggered the event (core.ItemStateChangeTrigger)",
113+
"!type": "string"
114+
},
115+
"command": {
116+
"!doc": "The command of the item that triggered the event (core.ItemCommandTrigger)",
117+
"!type": "string"
118+
},
119+
"channelUID": {
120+
"!doc": "The channelUID of the channel that triggered the event (core.ChannelEventTrigger)",
121+
"!type": "string"
122+
},
123+
"event": {
124+
"!doc": "The event of the channel that triggered the event (core.ChannelEventTrigger)",
125+
"!type": "string"
126+
},
127+
"eventTopic": {
128+
"!doc": "The topic of the event (core.GenericEventTrigger)",
129+
"!type": "string"
130+
},
131+
"eventSource": {
132+
"!doc": "The Item name, ChannelUID, ThingUID, etc (core.GenericEventTrigger)",
133+
"!type": "string"
134+
},
135+
"eventTypes": {
136+
"!doc": "The event type (core.GenericEventTrigger)",
137+
"!type": "string"
138+
}
93139
}
94140
},
95141
"events": {
@@ -104,6 +150,10 @@
104150
"!doc": "Alias for itemRegistry",
105151
"!type": "ItemRegistry"
106152
},
153+
"event": {
154+
"!doc": "Data passed from triggers.",
155+
"!type": "TriggerType"
156+
},
107157

108158
"ON": "OnOffType",
109159
"OFF": "OnOffType",

bundles/org.openhab.ui/web/src/assets/openhab-js-tern-defs.json

+58
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
"!doc": "Gets the tags from this item",
4343
"!type": "[string]"
4444
},
45+
"groupNames": {
46+
"!doc": "Gets the groups for this item",
47+
"!type": "[string]"
48+
},
4549
"getMetadataValue": {
4650
"!doc": "Gets metadata values for this item.",
4751
"!type": "fn(namespace: string) -> string"
@@ -154,6 +158,10 @@
154158
"!doc": "This method retrieves a single item from the registry.",
155159
"!type": "fn(name: string) -> Item"
156160
},
161+
"getItems": {
162+
"!doc": "Returns all items.",
163+
"!type": "fn() -> [Item]"
164+
},
157165
"getItemsByTag": {
158166
"!doc": "Returns a list of items containing all of the given tags.",
159167
"!type": "fn(tag?: [string]) -> [Item]"
@@ -273,6 +281,52 @@
273281
"!type": "fn() -> string"
274282
}
275283
},
284+
"TriggerType": {
285+
"cronExpression": {
286+
"!doc": "The cron expression for the event (timer.GenericCronTrigger)",
287+
"!type": "string"
288+
},
289+
"time": {
290+
"!doc": "The time of the event in \"hh:mm\" format (timer.TimeOfDayTrigger)",
291+
"!type": "string"
292+
},
293+
"itemName": {
294+
"!doc": "The name of the item that triggered the event (core.ItemStateUpdateTrigger, core.ItemStateChangeTrigger, core.ItemCommandTrigger)",
295+
"!type": "string"
296+
},
297+
"state": {
298+
"!doc": "The state of the item that triggered the event (core.ItemStateUpdateTrigger, core.ItemStateChangeTrigger)",
299+
"!type": "string"
300+
},
301+
"previousState": {
302+
"!doc": "The previous state of the item that triggered the event (core.ItemStateChangeTrigger)",
303+
"!type": "string"
304+
},
305+
"command": {
306+
"!doc": "The command of the item that triggered the event (core.ItemCommandTrigger)",
307+
"!type": "string"
308+
},
309+
"channelUID": {
310+
"!doc": "The channelUID of the channel that triggered the event (core.ChannelEventTrigger)",
311+
"!type": "string"
312+
},
313+
"event": {
314+
"!doc": "The event of the channel that triggered the event (core.ChannelEventTrigger)",
315+
"!type": "string"
316+
},
317+
"eventTopic": {
318+
"!doc": "The topic of the event (core.GenericEventTrigger)",
319+
"!type": "string"
320+
},
321+
"eventSource": {
322+
"!doc": "The Item name, ChannelUID, ThingUID, etc (core.GenericEventTrigger)",
323+
"!type": "string"
324+
},
325+
"eventTypes": {
326+
"!doc": "The event type (core.GenericEventTrigger)",
327+
"!type": "string"
328+
}
329+
},
276330

277331
"AudioActions": {
278332
"decreaseMasterVolume": { "!type": "fn(percent: float)" },
@@ -430,5 +484,9 @@
430484
"require": {
431485
"!doc": "Scripts may include standard NPM based libraries by using CommonJS require. The library search path will look in automation/js/node_modules in the user configuration directory.",
432486
"!type": "fn(module: string) -> ?"
487+
},
488+
"event": {
489+
"!doc": "Data passed from triggers.",
490+
"!type": "TriggerType"
433491
}
434492
}

0 commit comments

Comments
 (0)