Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add event Terns #1292

Merged
merged 2 commits into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
}
}