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

Support providing and accessing context in rules #133

Merged
merged 1 commit into from
Sep 8, 2023

Conversation

jimtng
Copy link
Contributor

@jimtng jimtng commented Sep 2, 2023

No description provided.

@jimtng jimtng added the enhancement New feature or request label Sep 2, 2023
@jimtng jimtng force-pushed the rule-context branch 3 times, most recently from eed6097 to 615e4d9 Compare September 2, 2023 01:39
@jimtng jimtng marked this pull request as ready for review September 2, 2023 01:48
@jimtng jimtng requested a review from ccutrer September 2, 2023 01:48
Copy link
Contributor

@ccutrer ccutrer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a spec that verifies a local variable "hides" any incoming context?:

command = ON
rule do
  received_command Switch1
  run do
    expect(command).to be ON
  ned
end

Switch1.off

lib/openhab/dsl.rb Outdated Show resolved Hide resolved
lib/openhab/dsl/rules/automation_rule.rb Show resolved Hide resolved
lib/openhab/dsl/rules/automation_rule.rb Outdated Show resolved Hide resolved
lib/openhab/core/rules/rule.rb Show resolved Hide resolved
lib/openhab/dsl/rules/automation_rule.rb Outdated Show resolved Hide resolved
@jimtng
Copy link
Contributor Author

jimtng commented Sep 8, 2023

Working on adding the spec

@jimtng
Copy link
Contributor Author

jimtng commented Sep 8, 2023

specs added

@jimtng jimtng requested a review from ccutrer September 8, 2023 01:04
ccutrer pushed a commit that referenced this pull request Sep 8, 2023
…ngGroup (#123)" (#138)

This reverts commit 8cb45f6.

Reasons:
* Unable to access toplevel UI local variables to get to
`triggeringGroup`, so #123 created an inconsistency where event.group is
only available on file-based rules
* File-based rules now has access to top level context so it can use
`triggeringGroup` just like UI rules, since #133

Signed-off-by: Jimmy Tanagra <[email protected]>
@ccutrer ccutrer merged commit 123eb88 into openhab:main Sep 8, 2023
16 checks passed
@jimtng jimtng deleted the rule-context branch September 8, 2023 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants