Comments (8)
That could be implemented using this syntax:
<condition type="x" id="x" op="x" value="on" trigger="ontrue | onfalse | always | never">
- ontrue = trigger when going from false to true
- onfalse = trigger when going from true to false
- always = the current trigger="true"
- never = the current trigger="false"
from linknx.
I think I understood what you are trying to achieve. But I may be wrong. What I understood is that at sunrise you want to execute action A if a second condition is true and action B is the second condition is false.
If I got it right, then triggers are not to blame. You can do what you need with two rules (one for sunset when other-condition is true, another for sunset when other-condition is false).
You can certainly do it in a single rule with conditional actions but that seems less natural to me.
If I misunderstood what you are aiming to do, please provide me with a XML sample of your config.
from linknx.
Thank you for your answer !
My explanation may have been a little tricky.
I actually have two different rules. One for sunrise, and one for sunset. Both have a second condition.
So, at sunrise, if condition 2 is true, I want action A to be executed, and if condition 2 is false, I want action B to be executed. And that's the same thing for my other rule evaluated at sunset.
The fact is that if sunrise is at 8:03:00 :
- at 8:02:59 that condition is "false"
- at 8:03:00 that condition becomes "true", then it trigs my rule, which is evaluated as "true" if condition 2 is also true and execute "if-true" actions, or evaluated as "false" if condition 2 is false and execute "if-false" actions --> And that's what I want
- at 8:03:01 that condition becomes "false", then it trigs my rule, which is evaluated as "false" (because "sunrise" condition is now false, no matter my second condition), and execute "if-false" actions --> And that's what I don't want
Here is the XML sample :
<rule id="LeverSoleilOuvrirVolets" description="Ouvrir les volets au lever du soleil si on est absent" init="false" active="yes">
<condition type="and">
<condition type="timer" trigger="true" >
<at type="sunrise" offset="10" wdays="1234567"></at>
</condition>
<condition type="object" id="Etat_Presence-Absence" op="eq" value="on" trigger="false" ></condition>
</condition>
<actionlist type="if-true">
<action type="set-value" value="0" id="Position_Volet-Bureau" delay="" ></action>
<action type="set-value" value="0" id="Position_Volet-SdB" delay="1" ></action>
<action type="set-value" value="0" id="Position_Volet-Dressing" delay="2" ></action>
<action type="set-value" value="0" id="Position_Volet-Chambre" delay="3" ></action>
<action type="set-value" value="0" id="Position_Volet-Salon_fenetre" delay="4" ></action>
<action type="set-value" value="0" id="Position_Volet-Salon_baie" delay="5" ></action>
<action type="set-value" value="0" id="Position_Volet-Cuisine" delay="6" ></action>
<action type="send-email" to="[email protected]" subject="Fermeture volets automatique ${Temps-Date_actuelle}" var="true" delay="" >Lever du soleil, ouverture automatique des volets. Etat absence : ${Etat_Presence-Absence} Etat Jour : ${Scenes_Linknx-Etat_Jour-Soleil_leve_avec_offset}</action>
</actionlist>
<actionlist type="if-false">
<action type="send-email" to="[email protected]" subject="Fermeture volets non automatique ${Temps-Date_actuelle}" var="true" delay="" >Lever du soleil, mais présent à la maison, donc pas d'ouverture automatique Etat absence : ${Etat_Presence-Absence} Etat Jour : ${Scenes_Linknx-Etat_Jour-Soleil_leve_avec_offset}</action>
</actionlist>
</rule>
from linknx.
So what he wants is the timer condition to only trigger when it goes from False to True and not when it switches from False to True...
from linknx.
OK, that was what I understood from your first description.
The only way I can see to address your need is with the two rules below. (I did not test them, there may be syntax errors...)
<rule id="LeverSoleilOuvrirVolets" description="Ouvrir les volets au lever du soleil si on est absent" init="false" active="yes">
<condition type="and">
<condition type="timer" trigger="true" >
<at type="sunrise" offset="10" wdays="1234567"></at>
</condition>
<condition type="object" id="Etat_Presence-Absence" op="eq" value="on"/>
</condition>
<actionlist type="on-true">
<action type="set-value" value="0" id="Position_Volet-Bureau" delay="" ></action>
<action type="set-value" value="0" id="Position_Volet-SdB" delay="1" ></action>
<action type="set-value" value="0" id="Position_Volet-Dressing" delay="2" ></action>
<action type="set-value" value="0" id="Position_Volet-Chambre" delay="3" ></action>
<action type="set-value" value="0" id="Position_Volet-Salon_fenetre" delay="4" ></action>
<action type="set-value" value="0" id="Position_Volet-Salon_baie" delay="5" ></action>
<action type="set-value" value="0" id="Position_Volet-Cuisine" delay="6" ></action>
<action type="send-email" to="[email protected]" subject="Fermeture volets automatique ${Temps-Date_actuelle}" var="true" delay="" >Lever du soleil, ouverture automatique des volets. Etat absence : ${Etat_Presence-Absence} Etat Jour : ${Scenes_Linknx-Etat_Jour-Soleil_leve_avec_offset}</action>
</actionlist>
</rule>
<rule id="LeverSoleilNePasOuvrirVolets" description="Ne pas ouvrir les volets au lever du soleil si on est présent" init="false" active="yes">
<condition type="and">
<condition type="timer" trigger="true" >
<at type="sunrise" offset="10" wdays="1234567"></at>
</condition>
<condition type="object" id="Etat_Presence-Absence" op="eq" value="off"/>
</condition>
<actionlist type="on-true">
<action type="send-email" to="[email protected]" subject="Fermeture volets non automatique ${Temps-Date_actuelle}" var="true" delay="" >Lever du soleil, mais présent à la maison, donc pas d'ouverture automatique Etat absence : ${Etat_Presence-Absence} Etat Jour : ${Scenes_Linknx-Etat_Jour-Soleil_leve_avec_offset}</action>
</actionlist>
</rule>`
from linknx.
Tagging as enhancement for the record. Stefaan's proposal looks consistent. But we have to handle changes on rules with extra care. Further investigation is required.
from linknx.
Thank you for the enhancement label !
I already thought about your proposal... But that means multiplying rules, and when you need to change a condition, you have to change it in each other rule... That added to my second "feature request", the workarounds are not elegant at all. :-/
I really think that these two enhancements would greatly make linknx more powerful and useful. To me, linknx will reach perfection for my needs...
But you're right to be careful. I was used to code in C++ 15 years ago, and I'm not skilled anymore... And what I could think to be "quite easy" to implement could be in fact very hard... So, I know that what I'm asking you requires a lot of work, and I really appreciate your attention and your help !
from linknx.
Been looking at the documentation of linknx, and you could also do this by putting a condition inside the action:
conditional
One condition child elements that is evaluated when the action is executed.
One or more action child elements to execute if condition above is true.
Example
<action type="conditional">
<condition type="object" id="alarm_email_enabled" value="on" />
<action type="send-email" to="[email protected]" subject="Foreign contaminant">Intrusion in your shrubbery!</action>
</action>
So you just repeat the condition that triggered the event inside the action and you effectively have an "ontrue". By reversing the "value" parameter, you get an "onfalse".
Not ideal (because you have to repeat the condition and remember to make changes to both, but will solve your problem.
from linknx.
Related Issues (20)
- Create Tag / Release for the project HOT 3
- Add support for 229 and 235 KNX datapoints HOT 2
- Unable to start linknx with --daemon from systemd HOT 3
- New rule action that triggers another rule HOT 2
- Get rid of pthsem HOT 5
- Integrate with Travis CI HOT 2
- compilation fails with gcc6 HOT 13
- Rules cannot mix if-xxx and on-xxx actionlists
- Regression in rules in v0.0.1.35 and v0.0.1.36
- Compile fails since commit 0512f6d0a07d50df33bfdca22d48360d164922a8 HOT 1
- sunrise and sunset timer fail to schedule at the end of the month (for the first day of the next month) HOT 4
- Move to Github Actions HOT 2
- configure: error: cannot run /bin/bash ./config.sub HOT 6
- init="request" for object of type "20.102" does not trigger a read group address on the bus at startup HOT 4
- Broken build on Github, master branch HOT 1
- Migrate from MySQL connector to MariaDB connector
- Make CI build matrix more explicit in the way it selects optional features
- Library in cpp HOT 1
- rules created with flag active="no" have stateless actionlists executed on initialization HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from linknx.