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
Just a suggestion: for Operation #235
Comments
I tried a workaround with scripts but I have no idea how to list all operations with their correspondig ID so I could use a script to disable the specific operation via scripting. Could you provide a very small example on how to list all operations with ID and how to disable/enable an operation? Thank you in advance! I think I have an working example for displaying all operations: Script: var HashMap = Java.type('java.util.HashMap');
var map = new HashMap();
var myoperations2 = mcApi.operation().getAllRaw(map); Template: ${( myoperations2.toString() )} Result: |
Operations inside operation might create recursive loop, hence I disable that option.
To list operations on Dashboard.Script:
|
Thank you very much. This looks much more refined as my little "hack" 💃 I think this will do exactly what I want. Maybe I should take my time to sum up what I intent to do with the possibility to enable/disable operations. My Plan: I plan to send pushbullet notifications depending on my sensor threshold. This should be pretty straightforward and is currently working as expected. To disable these notifications at night it would be possible to disable every rulde which leads to a notification. I thought it would be much easyier to disable the notification, leaving all rules intact. To disable the operation I would then use a simple rule and an V_ARMED switch which would execute my custom script to disable the notification operation. I am not totally sure if it is flawless but having the possibility to disable operations from script is very nice and I think will help me a lot. @jkandasa: I think your example is very elaborated and very good. If you/I close this issue the information would be "Lost" for other users. Maybe you could add this and the statistics example from earlyer to the documentation?! It would help a lot to get a quickstart for custom widgets for other users! |
@cimba007 great! This is awesome!
Yes, you are right I will create entry on http://forum.mycontroller.org and close this one.
Yes, for that reason I gave an option for operations also. We may use operations on timer, rule(multiple places). When disabling operation directly never get executed by any rules, timers. If you have only requirement that to disable operations on night time, simply schedule a cron, other other timer to execute enable/disable operations script. Which is easier than manual switch. but it is up to you. |
If you create the entry on the forum please add a link to the forum post to the documentation too! People will most likely have a look at the documentation first so this would ensure this valuable information can be easylie found. |
updated in forum, http://forum.mycontroller.org/topic/46/control-display-operations-via-script
Sure, I will add this on 0.0.3.Final release document. |
I even thought if it would be usefull to include the example in the actual mycontroller version as EXAMPLE_SCRIPT with the disabled flag set. It would be even easier to find a quickstart to scripting ;-) |
Reported by @cimba007 at https://forum.mysensors.org/topic/4431/mycontroller-0-0-3-alpha2-released/15
Send notification would include all further kinds of notifications you might include but grouping this is not that important. The current way it is is already very easy to understand so a change might not be necessary.
Send payload might be better split into three different points as it would be very clear from the beginning what you are dealing with.
The text was updated successfully, but these errors were encountered: