Skip to content

Commit

Permalink
Add tern definitions for event, items.getItems (#1292)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Cossey authored Jan 31, 2022
1 parent 39fa259 commit 6e06022
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 0 deletions.
50 changes: 50 additions & 0 deletions bundles/org.openhab.ui/web/src/assets/nashorn-tern-defs.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,52 @@
"!doc": "Returns a string representation of the state",
"!type": "fn() -> string"
}
},
"TriggerType": {
"cronExpression": {
"!doc": "The cron expression for the event (timer.GenericCronTrigger)",
"!type": "string"
},
"time": {
"!doc": "The time of the event in \"hh:mm\" format (timer.TimeOfDayTrigger)",
"!type": "string"
},
"itemName": {
"!doc": "The name of the item that triggered the event (core.ItemStateUpdateTrigger, core.ItemStateChangeTrigger, core.ItemCommandTrigger)",
"!type": "string"
},
"state": {
"!doc": "The state of the item that triggered the event (core.ItemStateUpdateTrigger, core.ItemStateChangeTrigger)",
"!type": "string"
},
"previousState": {
"!doc": "The previous state of the item that triggered the event (core.ItemStateChangeTrigger)",
"!type": "string"
},
"command": {
"!doc": "The command of the item that triggered the event (core.ItemCommandTrigger)",
"!type": "string"
},
"channelUID": {
"!doc": "The channelUID of the channel that triggered the event (core.ChannelEventTrigger)",
"!type": "string"
},
"event": {
"!doc": "The event of the channel that triggered the event (core.ChannelEventTrigger)",
"!type": "string"
},
"eventTopic": {
"!doc": "The topic of the event (core.GenericEventTrigger)",
"!type": "string"
},
"eventSource": {
"!doc": "The Item name, ChannelUID, ThingUID, etc (core.GenericEventTrigger)",
"!type": "string"
},
"eventTypes": {
"!doc": "The event type (core.GenericEventTrigger)",
"!type": "string"
}
}
},
"events": {
Expand All @@ -104,6 +150,10 @@
"!doc": "Alias for itemRegistry",
"!type": "ItemRegistry"
},
"event": {
"!doc": "Data passed from triggers.",
"!type": "TriggerType"
},

"ON": "OnOffType",
"OFF": "OnOffType",
Expand Down
58 changes: 58 additions & 0 deletions bundles/org.openhab.ui/web/src/assets/openhab-js-tern-defs.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
"!doc": "Gets the tags from this item",
"!type": "[string]"
},
"groupNames": {
"!doc": "Gets the groups for this item",
"!type": "[string]"
},
"getMetadataValue": {
"!doc": "Gets metadata values for this item.",
"!type": "fn(namespace: string) -> string"
Expand Down Expand Up @@ -154,6 +158,10 @@
"!doc": "This method retrieves a single item from the registry.",
"!type": "fn(name: string) -> Item"
},
"getItems": {
"!doc": "Returns all items.",
"!type": "fn() -> [Item]"
},
"getItemsByTag": {
"!doc": "Returns a list of items containing all of the given tags.",
"!type": "fn(tag?: [string]) -> [Item]"
Expand Down Expand Up @@ -273,6 +281,52 @@
"!type": "fn() -> string"
}
},
"TriggerType": {
"cronExpression": {
"!doc": "The cron expression for the event (timer.GenericCronTrigger)",
"!type": "string"
},
"time": {
"!doc": "The time of the event in \"hh:mm\" format (timer.TimeOfDayTrigger)",
"!type": "string"
},
"itemName": {
"!doc": "The name of the item that triggered the event (core.ItemStateUpdateTrigger, core.ItemStateChangeTrigger, core.ItemCommandTrigger)",
"!type": "string"
},
"state": {
"!doc": "The state of the item that triggered the event (core.ItemStateUpdateTrigger, core.ItemStateChangeTrigger)",
"!type": "string"
},
"previousState": {
"!doc": "The previous state of the item that triggered the event (core.ItemStateChangeTrigger)",
"!type": "string"
},
"command": {
"!doc": "The command of the item that triggered the event (core.ItemCommandTrigger)",
"!type": "string"
},
"channelUID": {
"!doc": "The channelUID of the channel that triggered the event (core.ChannelEventTrigger)",
"!type": "string"
},
"event": {
"!doc": "The event of the channel that triggered the event (core.ChannelEventTrigger)",
"!type": "string"
},
"eventTopic": {
"!doc": "The topic of the event (core.GenericEventTrigger)",
"!type": "string"
},
"eventSource": {
"!doc": "The Item name, ChannelUID, ThingUID, etc (core.GenericEventTrigger)",
"!type": "string"
},
"eventTypes": {
"!doc": "The event type (core.GenericEventTrigger)",
"!type": "string"
}
},

"AudioActions": {
"decreaseMasterVolume": { "!type": "fn(percent: float)" },
Expand Down Expand Up @@ -430,5 +484,9 @@
"require": {
"!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.",
"!type": "fn(module: string) -> ?"
},
"event": {
"!doc": "Data passed from triggers.",
"!type": "TriggerType"
}
}

0 comments on commit 6e06022

Please sign in to comment.