• Categories
    • Recent
    • Tags
    • Popular
    • Register
    • Login
    1. Home
    2. benya
    3. Best
    B
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 10
    • Posts 46
    • Groups 0

    Posts

    Recent Best Controversial
    • RE: MySensor auto node ID

      @jkandasa Turned out that EEPROM was not cleared properly with 0xFF

      posted in Troubleshooting
      B
      benya
    • RE: Triggering rule through the HTTP request

      Here is a sample REST API call that modifies MyController repository variable:

      curl -X PUT -H "Content-Type: application/json" -d '{"key":"Var1","value":"222"}' "http://demo:demo@demo.mycontroller.org/mc/rest/variables"
      posted in General Discussion
      B
      benya
    • RE: Corrupted database?

      Thanks. Your fix helped

      posted in Troubleshooting
      B
      benya
    • RE: Triggering rule through the HTTP request

      I figured how to set dummy sensor by script called through REST API.

      I created "Set DummySensor" groovy script:

      def uid = "DummySensor"
      def value = "1"
      def sensor = mcApi.uidTag().getByUid(uid).getResource()
      sensor.setValue(value)
      mcApi.sensor().sendPayload(sensor);
      

      and call it through the REST API:

      curl "http://admin:admin@localhost:9880/mc/rest/scripts/runNow?bindings=%7B+%7D&script=operations%2FSet+DummySensor.groovy&scriptBindings=%7B%7D"
      

      I defined rule that gets triggered when dummy sensor value changes.
      No 5 sec delays anymore. Cool!

      posted in General Discussion
      B
      benya
    • RE: "Send email" questions

      @jkandasa Yes, followed https://easyengine.io/tutorials/linux/ubuntu-postfix-gmail-smtp/ and got it working in short time.

      posted in General Discussion
      B
      benya
    • RE: Controlling global variable and timer from Groovy

      @benya I verified, Groovy could execute external tools. Tested with Demo system:

      return "ls".execute().text.split("\n")
      

      Result:

      {
        "mcResult": [
          "Publicbroker-wstestmosquittoorg8080mqtt",
          "h2",
          "start.bat",
          "start.sh",
          "start_.sh",
          "stop.sh",
          "test_19Kz0-tcpwantsoftru1883",
          "test_48n0f-tcpwantsoftru1883",
          "test_FzOqu-tcpwantsoftru1883",
          "test_epPgp-tcpwantsoftru1883",
          "tmp"
        ]
      }
      posted in General Discussion
      B
      benya
    • RE: Controlling global variable and timer from Groovy

      @jkandasa Seems mcApi.timer().update(myTimer); causes timer to loose references to the operations and doesn't trigger operation when enabled again.

      I had better luck with the following code:

      def filters = [:];
      filters.put("name", "Timer1");
      def myTimer = mcApi.timer().get(filters);
      
      def timerIds = [myTimer.getId()];
      mcApi.timer().disable(timerIds)
      
      mcApi.timer().enable(timerIds)
      posted in General Discussion
      B
      benya
    • RE: Synchronization between rules and timer handlers

      @jkandasa We need some mechanism to prevent race condition.

      posted in General Discussion
      B
      benya