• Categories
    • Recent
    • Tags
    • Popular
    • Register
    • Login
    1. Home
    2. gouds
    3. Posts
    G
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 6
    • Posts 17
    • Groups 0

    Posts

    Recent Best Controversial
    • RE: MyController 1.2.0.Final version released

      Hi jkandasa,
      The new build looks good. I have a small problem with the Sensor Names resetting to all the same name. '1.0' I found this was the case when updating to the new 1.2 final. I went through and updated all the sensor names and came back an hour or so later and all the sensor names had changed cack to txt '1.0'.

      Any ideas on why this would happen. Something new in the update?

      Thanks

      posted in Announcements
      G
      gouds
    • RE: MyController 1.0.0.Final version released

      @jkandasa Thanks for your prompt reply. This seems to have corrected the issue that i was experiencing.

      Thanks once again.

      Cheers

      Gouds

      posted in Announcements
      G
      gouds
    • RE: MyController 1.0.0.Final version released

      Hi Guys,
      Good work on the new release. I have updated to the new Build and i am now experiencing issues my timers/scripts not executing. This was based off this topic (https://forum.mycontroller.org/topic/45/timers-and-scripts/15)

      Im now getting the below error:

      2017-11-06 09:05:00,430 ERROR [Quartz_Scheduler_Worker-6] [org.mycontroller.standalone.operation.model.OperationExecuteScript:133] Exception on McScript(engineName=null, mimeType=null, extension=js, name=/opt/mycontroller/conf/resources/scripts/operations/Timer-Garden-Schedule-Front.js, canonicalPath=null, type=OPERATION, size=0, lastModified=0, bindings={})
      javax.script.ScriptException: TypeError: (mcApi.uidTag().getByUid("GardenFront-Maser")).getSensorVariable is not a function in <eval> at line number 14
      	at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:467)
      	at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:451)
      	at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:403)
      	at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:399)
      	at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:150)
      	at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249)
      	at org.mycontroller.standalone.scripts.McScriptEngine.executeScript(McScriptEngine.java:86)
      	at org.mycontroller.standalone.operation.model.OperationExecuteScript.executeScript(OperationExecuteScript.java:130)
      	at org.mycontroller.standalone.operation.model.OperationExecuteScript.execute(OperationExecuteScript.java:112)
      	at org.mycontroller.standalone.timer.jobs.TimerJob.executeTimer(TimerJob.java:58)
      	at org.mycontroller.standalone.timer.jobs.TimerJob.doRun(TimerJob.java:94)
      	at org.knowm.sundial.Job.execute(Job.java:57)
      	at org.quartz.core.JobRunShell.run(JobRunShell.java:178)
      	at org.quartz.core.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:515)
      Caused by: jdk.nashorn.internal.runtime.ECMAException: TypeError: (mcApi.uidTag().getByUid("GardenFront-Maser")).getSensorVariable is not a function
      	at jdk.nashorn.internal.runtime.ECMAErrors.error(ECMAErrors.java:57)
      	at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:213)
      	at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:185)
      	at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:172)
      	at jdk.nashorn.internal.runtime.Undefined.lookup(Undefined.java:102)
      	at jdk.nashorn.internal.runtime.linker.NashornLinker.getGuardedInvocation(NashornLinker.java:106)
      	at jdk.nashorn.internal.runtime.linker.NashornLinker.getGuardedInvocation(NashornLinker.java:98)
      	at jdk.internal.dynalink.support.CompositeTypeBasedGuardingDynamicLinker.getGuardedInvocation(CompositeTypeBasedGuardingDynamicLinker.java:176)
      	at jdk.internal.dynalink.support.CompositeGuardingDynamicLinker.getGuardedInvocation(CompositeGuardingDynamicLinker.java:124)
      	at jdk.internal.dynalink.support.LinkerServicesImpl.getGuardedInvocation(LinkerServicesImpl.java:154)
      	at jdk.internal.dynalink.DynamicLinker.relink(DynamicLinker.java:253)
      	at jdk.nashorn.internal.scripts.Script$132$\^eval\_.:program(<eval>:14)
      	at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:637)
      	at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)
      	at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
      	at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:446)
      

      My script is as follows:

      var myImports = new JavaImporter(java.io, java.lang, java.util);
      
      with(myImports) {
        
        var valveStatus = mcApi.variable().get("Timer-Garden-Schedule-Front-Status");
      
        //Check already running?
        if(valveStatus.value !== 'running'){
          //Update as running
          valveStatus.value = "running";
          mcApi.variable().update(valveStatus);
          mcApi.logger().debug("valve-control script triggered...");
          
          var masterValve = mcApi.uidTag().getByUid("GardenFront-Maser").getSensorVariable();
          var valve01 = mcApi.uidTag().getByUid("GardenFront-Driveway-Bottom-Front").getSensorVariable();
          var valve02 = mcApi.uidTag().getByUid("GardenFront-Driveway-Bottom-Back").getSensorVariable();
          var valve03 = mcApi.uidTag().getByUid("GardenFront-Driveway-Top-Front").getSensorVariable();
          var valve04 = mcApi.uidTag().getByUid("GardenFront-Driveway-Top-Back").getSensorVariable();
          var valve05 = mcApi.uidTag().getByUid("GardenFront-FrontHouse").getSensorVariable();
          var valve06 = mcApi.uidTag().getByUid("GardenFront-Side").getSensorVariable();
          var valve07 = mcApi.uidTag().getByUid("GardenFront-Driveway-Trees").getSensorVariable();
          var valve08 = mcApi.uidTag().getByUid("GardenFront-NatureStrip-Trees").getSensorVariable();
      
            
          var delayTime = 1000 * 60 * 15; //15 minutes
        
          //Turn ON master valve and Valve01
          masterValve.value = "1"; //Update master valve ON state
          mcApi.sensor().sendPayload(masterValve); //send state
          valve01.value = "1"; //Update valve01 ON state
          mcApi.sensor().sendPayload(valve01); //send state
            
          //Update valve01 is running
          valveStatus.value2 = "valve01";
          mcApi.variable().update(valveStatus);
        
        
          //Wait time
          Thread.sleep(delayTime);
        
          //Turn OFF valve01 and turn ON valve02
          valve01.value = "0"; //Update valve01 OFF state
          mcApi.sensor().sendPayload(valve01); //send state
          valve02.value = "1"; //Update valve02 ON state
          mcApi.sensor().sendPayload(valve02); //send state
          
          //Update valve02 is running
          valveStatus.value2 = "valve02";
          mcApi.variable().update(valveStatus);
          
          //Wait time
          Thread.sleep(delayTime);
        
          //Turn OFF valve02 and turn ON valve03
          valve02.value = "0"; //Update valve02 OFF state
          mcApi.sensor().sendPayload(valve02); //send state
          valve03.value = "1"; //Update valve03 ON state
          mcApi.sensor().sendPayload(valve03); //send state
        
          //Update valve03 is running
          valveStatus.value2 = "valve03";
          mcApi.variable().update(valveStatus);
        
          //Wait time
          Thread.sleep(delayTime);
      
          //Turn OFF valve03 and turn ON valve04
          valve03.value = "0"; //Update valve03 OFF state
          mcApi.sensor().sendPayload(valve03); //send state
          valve04.value = "1"; //Update valve04 ON state
          mcApi.sensor().sendPayload(valve04); //send state
        
          //Update valve04 is running
          valveStatus.value2 = "valve04";
          mcApi.variable().update(valveStatus);
        
          //Wait time
          Thread.sleep(delayTime);
      
      
          //Turn OFF valve04 and turn ON valve05
          valve04.value = "0"; //Update valve04 OFF state
          mcApi.sensor().sendPayload(valve04); //send state
          valve05.value = "1"; //Update valve05 ON state
          mcApi.sensor().sendPayload(valve05); //send state
        
          //Update valve05 is running
          valveStatus.value2 = "valve05";
          mcApi.variable().update(valveStatus);
        
          //Wait time
          Thread.sleep(delayTime);
      
      
          //Turn OFF valve05 and turn ON valve06
          valve05.value = "0"; //Update valve05 OFF state
          mcApi.sensor().sendPayload(valve05); //send state
          valve06.value = "1"; //Update valve06 ON state
          mcApi.sensor().sendPayload(valve06); //send state
        
          //Update valve06 is running
          valveStatus.value2 = "valve06";
          mcApi.variable().update(valveStatus);
        
          //Wait time
          Thread.sleep(delayTime);
      
      
          //Turn OFF valve06 and turn ON valve07
          valve06.value = "0"; //Update valve06 OFF state
          mcApi.sensor().sendPayload(valve06); //send state
          valve07.value = "1"; //Update valve07 ON state
          mcApi.sensor().sendPayload(valve07); //send state
        
          //Update valve07 is running
          valveStatus.value2 = "valve07";
          mcApi.variable().update(valveStatus);
        
          //Wait time
          Thread.sleep(delayTime);
      
      
          //Turn OFF valve07 and turn ON valve08
          valve07.value = "0"; //Update valve07 OFF state
          mcApi.sensor().sendPayload(valve07); //send state
          valve08.value = "1"; //Update valve08 ON state
          mcApi.sensor().sendPayload(valve08); //send state
        
          //Update valve08 is running
          valveStatus.value2 = "valve08";
          mcApi.variable().update(valveStatus);
        
          //Wait time
          Thread.sleep(delayTime);
      
          //Turn OFF valve08 and turn OFF master valve
          valve08.value = "0"; //Update valve08 OFF state
          mcApi.sensor().sendPayload(valve08); //send state
          masterValve.value = "0"; //Update master valve OFF state
          mcApi.sensor().sendPayload(masterValve); //send state
          
          //Update not running
          valveStatus.value = "stopped";
          valveStatus.value2 = "-";
          mcApi.variable().update(valveStatus);
          mcApi.logger().debug("valve-control script completted...");
        }else{
          mcApi.logger().warn("valve-control script is already running...");
        }
      }
      

      Any pointers on getting this to function again? (This has been working ok for the past year or so with no problems)

      All the best and thank in advance.

      Gouds

      posted in Announcements
      G
      gouds
    • Custom Dashboard Item to Trigger JavaScript/Operations

      Hi,

      I have a JavaScript/Operations that i would like to run from the dashboard. I was thinking that a custom button that when pressed triggers the JavaScript/Operations. Currently i have a trigger that is executed on a timer but would like to be able to execute this a any time (outside of the schedule).

      Basic button that when pressed executes the JavaScript/Operation.
      Dashboard item (Custom Widget)?

      Thanks in advance

      posted in General Discussion
      G
      gouds
    • RE: Widget - Running Sensors

      Thanks very much. This worked a treat. 🙂

      posted in General Discussion
      G
      gouds
    • RE: Widget - Running Sensors

      cheers. It would be a great help.... Thanks

      posted in General Discussion
      G
      gouds
    • RE: Widget - Running Sensors

      @jkandasa List sensors that are currently 'ON'

      posted in General Discussion
      G
      gouds
    • Widget - Running Sensors

      Dashboard Item - List all running sensors. Anyone done anything? (Just a nice table to show a list)

      posted in General Discussion
      G
      gouds
    • RE: Send Email (Bug)?

      I can now confirm email from a timer works by using the new distro 🙂 Thanks

      However the below does not seem to work correctly. Does not trigger an email. (Perhaps i am doing this incorrectly)

      The 0_1482879717922_upload-cc9a90c0-decb-4b07-874f-613b5d749d2f

      posted in General Discussion
      G
      gouds
    • RE: Send Email (Bug)?

      Further more on this i have found that in a post it may not be supported using timers. I have attempted to also use a rule. Monitor a valve for Active (on) time set to 20secs (Test) then to send email. This also does not work. But... Setting the rule to just look at ==On. Triggers an email event straight away. Whats the best way to monitor all Valves and running time and send email if on for X time?

      posted in General Discussion
      G
      gouds
    • Send Email (Bug)?

      Set up a timer to send email. The following displays when looking at the log.
      2016-12-27 18:56:00,009 ERROR [Quartz_Scheduler_Worker-4] [org.mycontroller.standalone.operation.model.OperationSendEmail:145] Timer will not support for this operation.
      SMTP tests correctly.
      No email is sent. Is this a bug? Or doing it incorrect.

      Ultimately what i would like to achieve is that if there is any valve on. to send a reminder msg. List running valves. (In email) (System to check at Scheduled Rule time 6pm) Save running the valves all night if manually set and forget to turn off. (I have Timer schedules set that also write to variable but this should not matter as these look after them self) Valves do not write to a variable if Manually triggered On)

      posted in General Discussion
      G
      gouds
    • Setting Time Zone

      Hi Guys,
      I have MC on a server that uses PST as a timezone. Im unable to change this (Limitation of the NAS) to my local region. Is there a way to explicitly set the time zone for MC my TZ. When i go into MC i get the server time. Or is it possible to set the Java instance to a time zone leaving the local server as is.
      Thanks
      Gouds

      posted in General Discussion
      G
      gouds
    • MyController on Drobo

      Hi Guys,
      Has anyone on here setup mycontroller on a Drobo NAS? Supports Java application and thought it could be a good server alternative to my Raspberry Pi. Thoughts? Configurations?

      posted in General Discussion
      G
      gouds
    • RE: Timers and scripts

      Cheers. Ill give this a go.

      posted in Scripts
      G
      gouds
    • RE: Timers and scripts

      Grabed the new distro. Worked a treat. Thanks for your assistance.

      posted in Scripts
      G
      gouds
    • RE: Timers and scripts

      Wow, thanks jkandasa. Was not expecting such a detailed reply. This is great. I went through and completed based on your instructions and i got the following when attempting to execute the script.

      {
      "errorMessage": "TypeError: org.mycontroller.standalone.api.SensorApi@11be5f8 has no such function "sendPayload" in <eval> at line number 23"
      }

      also found a small bug on the timer. (I will log this on the issues register)

      posted in Scripts
      G
      gouds
    • Timers and scripts

      Hi Guys. Liking this controller 🙂 I would like to know how to add in a timer that works like the following:
      I have a bunch of Valves (On/Off)
      Would like the rule to do the below:

      Master Valve - On
      Valve01 - On (Run for 10min); then
      Valve01 - Off; then
      Valve02 - On (Run for 10min); then
      Valve02 - Off; then
      Valve03 - On (Run for 10min); then
      Valve03 - Off; then
      Master Valve - Off

      Any pointers would be a great help.

      posted in Scripts script javascript valve
      G
      gouds