Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Eclipse SmartHome » Need help understanding the rules engine implementation
Need help understanding the rules engine implementation [message #1797726] Mon, 05 November 2018 16:43 Go to next message
Dominik Schlierf is currently offline Dominik SchlierfFriend
Messages: 6
Registered: November 2018
Junior Member
Hello everyone,

in order to contribute to the project I just read the Documentation for the rules engine, but a few things remain unclear to me. So I would really appreciate your help!

1. Quote:
Each module is created from a template called "module type"

Where can I find this template? Is it the abstract class ModuleType?

2. Quote:
there are system module types which are provided by the system

Are these the ones in the package org.eclipse.smarthome.automation.module.core in the folder ESH-INF\automation\moduletypes?

3. How does for example this JSON File ItemActions.json turn into a Module that can be used by the rules engine? It somehow has an ItemCommandActionHandler which is able to post an ItemCommandEvent to the EventPublisher, but I seem to miss how all these objects are actually created from the JSON Files.

4. Why are the options that can be sent as commands predefined in the JSON File of the ItemActions.json? Shouldn't this somehow depend on the Item which you are sending commands to?

I hope I did not miss any Documentation that is already explaining these things and again, I would really appreciate any help :)
Re: Need help understanding the rules engine implementation [message #1797831 is a reply to message #1797726] Wed, 07 November 2018 08:00 Go to previous messageGo to next message
Henning Treu is currently offline Henning TreuFriend
Messages: 44
Registered: April 2017
Member
Hi Dominik,

unfortunately the automation bundles are not well documented right now. We are just in the process of leaving the beta phase for these bundles.

Quote:
Where can I find this template? Is it the abstract class ModuleType?


ModuleType is the base class for these templates. From there you have three module types (Trigger, Action, Condition) which are the concrete types used in the rule engine.

Quote:
Are these the ones in the package org.eclipse.smarthome.automation.module.core in the folder ESH-INF\automation\moduletypes?


Yes.

Quote:
How does for example this JSON File ItemActions.json turn into a Module


Look at the ModuleTypeFileProvider: It loads these json files and provides them to the ModuleTypeRegistry. From there all ModuleTypes are available to the framework and the user.

Quote:
Why are the options that can be sent as commands predefined in the JSON File of the ItemActions.json?


Those are just defaults for easy selection. With the "limitToOptions":false flag the UI is told to let the user enter any command.

Glad you are curious about the automation bundles. There is a lot going on right now (look for instance here) so it should mature from now on.
Re: Need help understanding the rules engine implementation [message #1798001 is a reply to message #1797831] Fri, 09 November 2018 23:08 Go to previous messageGo to next message
Dominik Schlierf is currently offline Dominik SchlierfFriend
Messages: 6
Registered: November 2018
Junior Member
First off, thank you very much for your reply, Henning :)

Quote:
ModuleType is the base class for these templates. From there you have three module types (Trigger, Action, Condition) which are the concrete types used in the rule engine.

Ah ok, so the template called "module type" means the templates ESH-INF\automation\moduletypes, which are used by classes extending the base class ModuleType?

Quote:
Look at the ModuleTypeFileProvider: It loads these json files and provides them to the ModuleTypeRegistry. From there all ModuleTypes are available to the framework and the user.

Alright, I will have a look!

Quote:
Those are just defaults for easy selection. With the "limitToOptions":false flag the UI is told to let the user enter any command.

Yes, but what would you think of the idea to make it possible, that the options depend on the item the command is sent to instead?
From what I understand the ItemTypes provide information about that, so would it be possible to check the selected item in the Paper UI for it's type and provide options depending on the type?

Another question about that: I noticed the TimeOfDayTrigger contains a property called "context":"time". This has the effect, that in Paper UI, the Input value is rendered in the format of hh:mm instead of an empty text field. Do you by any chance know which values can be entered for the context property?
From looking at the Paper UI code, I think it might be channel, thing, item, time, date, color, skript, dayOfWeek, rule. But I didn't have time yet to try all of these.

Quote:
Glad you are curious about the automation bundles. There is a lot going on right now (look for instance here) so it should mature from now on.

This seems very interesting, I will have a look! :)

[Updated on: Fri, 09 November 2018 23:28]

Report message to a moderator

Re: Need help understanding the rules engine implementation [message #1798197 is a reply to message #1798001] Wed, 14 November 2018 06:13 Go to previous message
Dominik Schlierf is currently offline Dominik SchlierfFriend
Messages: 6
Registered: November 2018
Junior Member
Quote:
Look at the ModuleTypeFileProvider: It loads these json files and provides them to the ModuleTypeRegistry. From there all ModuleTypes are available to the framework and the user.

I had a look and while doing so I created a class diagram in the hope to understand how the architekture works. Is this somehow accurate?

When testing, I found that only an Instance of CommandlineModuleTypeProvider, ModuleTypeResourceBundleProvider and two Instances of the ScriptedCustomModuleTypeProvider were running. If the ModuleTypeFileProviderWatcher was running, it was not registered in the ModuleTypeRegistry. Do you have any Idea why, or am I missing something?
Previous Topic:Timer reschedule()
Next Topic:OSGi test problem: missing constraints
Goto Forum:
  


Current Time: Mon Dec 02 15:12:51 GMT 2024

Powered by FUDForum. Page generated in 0.06315 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top