OK ;D no problem
Version 0.04 is available :
- fix bug when saving a rule
- add rule acknowledgement
known bugs :
- sometimes, have to refresh blockly display for action with params
- deleting rule needs a reload
You can create rules from template (import from XML when creating a new rule).
For example, this rule is active when a door is open since 5 minutes.
An recurrent action is done every 5 minutes.
<xml xmlns="http://www.w3.org/1999/xhtml">
<block type="rule" x="0" y="0">
<field name="id"></field>
<value name="name">
<block type="text">
<field name="TEXT">Surveillance of the front door</field>
</block>
</value>
<value name="description">
<block type="text_area">
<field name="TEXT">If the main door is opened since 5 minutes\\nThen vocal reminder every 5 minutes</field>
</block>
</value>
<value name="properties">
<block type="property_is_acknowledgeable">
<field name="isAcknowledgeable">TRUE</field>
</block>
</value>
<value name="conditions">
<block type="list_with_operator_condition">
<mutation items="1"></mutation>
<field name="operator">OR</field>
<value name="ADD0">
<block type="condition_value" inline="false">
<mutation room_id="" device_name="Door/Window Sensor" device_id="205" service="urn:micasaverde-com:serviceId:SecuritySensor1" variable="Tripped"></mutation>
<field name="roomId"></field>
<field name="deviceId">205</field>
<field name="service">urn:micasaverde-com:serviceId:SecuritySensor1</field>
<field name="variable">Tripped</field>
<field name="operator">EQ</field>
<field name="value">1</field>
<value name="params">
<block type="list_condition_param">
<mutation items="1"></mutation>
<value name="ADD0">
<block type="condition_param_since">
<field name="sinceInterval">5</field>
<field name="unit">M</field>
</block>
</value>
</block>
</value>
</block>
</value>
</block>
</value>
<statement name="actions">
<block type="action_group">
<mutation recurrent_interval_input="true"></mutation>
<field name="event">reminder</field>
<field name="recurrentInterval">5</field>
<field name="unit">M</field>
<statement name="do">
<block type="action_function">
<field name="functionContent">-- Do something</field>
</block>
</statement>
</block>
</statement>
</block>
</xml>
When you import a rule :
- check that the id of the rule is empty (it will be computed after having saved the rule)
- you will have to choose the devices that trigger the rule (service, variable are kept according to the template)
Thanks for your work!!
Any thoughts about getting it added to Vera’s App Store?
Any update on this?
It seems very promising
Hello mrv777,
I’ve fixed some problems with timers, and I’m migrating all my scenarios and scripts into rules.
The purpose is to test with a lot of rules.
After these tests and (perhaps) some return of users, I will put it on the Vera’s App Store.
Thanks! Great work again!
Darn, wish there was some sort of dummie manual for using this…
This looks awesome! I was just on the verge of switching away from Vera after a frustrating experience with UI7. Question, though: I’m having some trouble with installation on a clean install of UI5 with AltUI. I uploaded the required files and created a device using D_RulesEngine1.xml but am getting an error of “Startup Lua Failed” on reload. Good chance I’m missing something but any help would be greatly appreciated.
Hello adamfox,
on UI5, you need to install a json library
In Apps->Developp Apps->Test Luup code (LUA)
os.execute("wget -q -O /usr/lib/lua/json.lua http://code.mios.com/trac/mios_genericutils/export/20/json.lua")
If this doesn’t solve your problem, perhaps you can find more information in the logs :
in an SSH session :
tail -f /var/log/cmh/LuaUPnP.log | grep "^01\|RulesEngine"
Version 0.05 is available :
- Lua editor for action of type LUA function
- Action “wait”
- Action conditions
This looks great! I’m trying to upload the files, but getting an error message on the L_Rules Engine file saying “aserl CGI Error
Attempted to send content larger than allowed.” Any thoughts?
ETA I’m on a Vera3 running UI5
Hello,
no problem on a Vera Lite (UI5).
For the moment, you have to download the zip from GitHub, extract the files in “luup files” and upload them one by one in your Vera (on UI5).
Perhaps you have a lot of plugins in your system and no more space left ?
You can test the plugin with openLuup if you want (I develop it on openLuup and Windows).
http://forum.micasaverde.com/index.php/topic,34463.0.html
http://forum.micasaverde.com/index.php/topic,34480.msg259829.html#msg259829
The version 0.6 is in development. I’m working on the Blockly interface, to make it more easier to select devices.
[quote=“vosmont, post:33, topic:189418”]Hello,
no problem on a Vera Lite (UI5).
For the moment, you have to download the zip from GitHub, extract the files in “luup files” and upload them one by one in your Vera (on UI5).
Perhaps you have a lot of plugins in your system and no more space left ?
You can test the plugin with openLuup if you want (I develop it on openLuup and Windows).
http://forum.micasaverde.com/index.php/topic,34463.0.html
http://forum.micasaverde.com/index.php/topic,34480.msg259829.html#msg259829
The version 0.6 is in development. I’m working on the Blockly interface, to make it more easier to select devices.[/quote]
Thanks Vosmont. My guess is that I’m running short on space… Sigh. Guess this will have to wait until I get the vera plus. (and manage to upgrade to ui7!)
I just gave this a shot, and perhaps I can get some help with the logfile which is attached. I am sure the json.lua file is in the right place (I checked via ssh). At first I was getting a startup.lua failure. Now, the rules engine device is decorated with “lua failure”.
This looks interesting — would love a chance to play with it.
Hi vosmont,
I am starting with this on openLuup (have not tried on Vera it self) and the save option does not seem to work. Is that as expected?
I see these messages displayed.
12-2-2016 23:54:47 Modified XML file has been exported. You have to upload it on the Vera by hand.
12-2-2016 23:54:47 Save "C_RulesEngine_Rules.xml" : error - unknown
Is this as expected? When I manualy create the rules file and then realod luup it seems to work like a charm. Realy nice bit of work. Sure beats setting up a scene especially if you need more complex conditions.
Only thing I don’t quite understand yet are the properties. What are those used for?
Cheers Rene
Hi Vosmont,
I am trying some actions on my Harmony Hub that are not getting triggered. Any ideas? I attached the rules file and the log with debug on level 2.
The rules.lua file exists but only has a comment line in it.
Update: I think I found why, but have no to clue to avoid. Because the triggers of the rule are on values that are changed by the actions, they get re-evaluated and the second time are not true. This causes the rules engine to remove any delayed tasks.
Cheers Rene
Version 0.06 is available :
- Lots of internal enhancements
- Rework of blockly interface (rules created with version < 0.06 are no more compatible)
- Panic button (enable/disable rules engine)
- Rules infos are stored in temp memory in order to spare resources
- History is stored (should be given up later - should be replaced by syslog)
For the moment this version has just been tested with openLuup… my VeraEdge became at the moment a zombie (not really dead but full of bad blocks)
For openLuup users, you can save your rules directly by following this thread : http://forum.micasaverde.com/index.php/topic,36189.0.html
[quote=“reneboer, post:37, topic:189418”]I am trying some actions on my Harmony Hub that are not getting triggered. Any ideas? I attached the rules file and the log with debug on level 2.
Update: I think I found why, but have no to clue to avoid. Because the triggers of the rule are on values that are changed by the actions, they get re-evaluated and the second time are not true. This causes the rules engine to remove any delayed tasks.[/quote]
Hello reneboer,
you’re right : after the first action, the rule condition is no more performed.
Then the rule becomes inactive and the delayed actions are discarded.
I will try to find a solution. I have similar needs.
The problem is that your rule is made as a legacy scene : a trigger runs some actions.
The rules engine is made for managing a main condition, with a life cycle (begin, reminder, end).
EDIT :
I think I will add a group action property “unstoppable” or a new type of event “once” in order to address this need.