-
-
Notifications
You must be signed in to change notification settings - Fork 461
Add source to StartLevel event #5189
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -878,8 +878,10 @@ private boolean activateRule(final WrappedRule rule) { | |
| if (slTriggers.stream() | ||
| .anyMatch(t -> ((BigDecimal) t.getConfiguration().get(SystemTriggerHandler.CFG_STARTLEVEL)) | ||
| .intValue() <= startLevelService.getStartLevel())) { | ||
| runNow(rule.getUID(), true, Map.of(SystemTriggerHandler.OUT_STARTLEVEL, StartLevelService.STARTLEVEL_RULES, | ||
| "event", SystemEventFactory.createStartlevelEvent(StartLevelService.STARTLEVEL_RULES))); | ||
| runNow(rule.getUID(), true, | ||
| Map.of(SystemTriggerHandler.OUT_STARTLEVEL, StartLevelService.STARTLEVEL_RULES, "event", | ||
| SystemEventFactory.createStartlevelEvent(StartLevelService.STARTLEVEL_RULES, | ||
| RuleEngineImpl.class.getName() + ".activateRule"))); | ||
| } | ||
|
|
||
| return true; | ||
|
|
@@ -1599,7 +1601,8 @@ private void executeRulesWithStartLevel() { | |
| .filter(this::mustTrigger) // | ||
| .forEach(r -> runNow(r.getUID(), true, | ||
| Map.of(SystemTriggerHandler.OUT_STARTLEVEL, StartLevelService.STARTLEVEL_RULES, "event", | ||
| SystemEventFactory.createStartlevelEvent(StartLevelService.STARTLEVEL_RULES)))); | ||
| SystemEventFactory.createStartlevelEvent(StartLevelService.STARTLEVEL_RULES, | ||
| RuleEngineImpl.class.getName() + ".executeRulesWithStartLevel")))); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... and here (and don't add the method name; users shouldn't know or care, as commented on the PR itself) ... |
||
| started = true; | ||
| readyService.markReady(MARKER); | ||
| logger.info("Rule engine started."); | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -42,10 +42,10 @@ public SystemEventFactory() { | |||||||||||||
| * @param startlevel Startlevel of system | ||||||||||||||
| * @return Created start level event. | ||||||||||||||
| */ | ||||||||||||||
|
||||||||||||||
| */ | |
| */ | |
| @Deprecated | |
| public static StartlevelEvent createStartlevelEvent(Integer startlevel) { | |
| return createStartlevelEvent(startlevel, null); | |
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -255,7 +255,8 @@ private void setStartLevel(int level) { | |
| } | ||
| openHABStartLevel = level; | ||
| scheduler.submit(() -> { | ||
| StartlevelEvent startlevelEvent = SystemEventFactory.createStartlevelEvent(level); | ||
| StartlevelEvent startlevelEvent = SystemEventFactory.createStartlevelEvent(level, | ||
| StartLevelService.class.getName()); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... and org.openhab.core here |
||
| eventPublisher.post(startlevelEvent); | ||
| logger.debug("Reached start level {}", level); | ||
| }); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
event sources should generally be the package name, not the class name. so just org.openhab.core.automation here...