• Categories
    • Recent
    • Tags
    • Popular
    • Register
    • Login
    1. Home
    2. RMF69
    3. Posts
    R
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 4
    • Posts 25
    • Groups 0

    Posts

    Recent Best Controversial
    • RE: MyController 2.0 is ready for testing

      I'm trying to install the docker image, but can't get it to start up... Dosn't seem to pick up the yaml file as using defaults... {"error": "Get \"https://ipinfo.io/json\": dial tcp 0.0.0.0:443: connect: connection refused"} ```

      I've install everything on the quick install page... and use the following docker command

      docker run --detach --name mycontroller2b   --publish 8081:8080   --publish 8443:8443   --publish 9443:9443   --volume /root/mycontroller/mc_home:/mc_home   --volume /root/mycontroller/mycontroller.yaml:/app/mycontroller.yaml   --env TZ="Europe/Prague"   --restart unless-stopped   docker.io/mycontroller/server:master
      

      is the

      :/app/mycontroller.yaml 
      

      correct ?
      Thanks

      posted in General Discussion
      R
      RMF69
    • RE: custom widget: send command to node

      @jkandasa Sorry... I thought I'd edited or deleted that reply saying it didn't work. It now works... I'd taken the sensor ID from the summary page and not the edit page as you pointed me to in your last reply.

      So its working now... my mistake, thanks for your patience.

      posted in Dashboard
      R
      RMF69
    • RE: custom widget: send command to node

      @jkandasa Thanks for confirming that in 1.5, the hardcoding of rzModule in mycontroller/www/app.js isn't required. However if I remove rzModule then the slider widget isn't displayed.

      Still I can't get the example to work...I've got the id from the place you mention, mine is still 31... I've also noticed that the intial value of the sensor->variable isn't populated. I created simple script to update the value

      var myImports = new JavaImporter(java.lang, java.util, org.mycontroller.standalone.utils.McUtils);
      
      with(myImports) {
          dimSensor = mcApi.uidTag().getByUid("dimSensor").getResource();
          var v = dimSensor.value; //value2/3 etc
          dimSensor.setValue(parseInt(v) + 1);
          mcApi.sensor().sendPayload(dimSensor);
      }
      

      I insert the following code into "AngularJs custom controllers"

      myControllerModule.controller('myCustomWidgetController', function($scope, SensorsFactory){
          $scope.sVariable = {
            id: null,
            value:null
          };
        
          $scope.loadVariable = function(){
            SensorsFactory.getVariable({id:$scope.sVariable.id}, function(response){
              if(response.value != undefined){
                $scope.sVariable.value = parseInt(response.value);
              } 
            });
          }
      
          $scope.slider = {
            options: {
              floor: 0,
              ceil: 100,
              step: 1,
              minLimit: 0,
              maxLimit: 90,
              onEnd: function() {
                  $scope.sendPayload($scope.sVariable);
              },
            }
        };
      
          // send payload
          $scope.sendPayload = function(sVariable){
            SensorsFactory.updateVariable(sVariable, function(){
              //update Success
            },function(error){
              displayRestError.display(error);
            });
          };
        });
      

      Which is just the original example above, no changes... it seems to me that the pointer/reference to the variable I want to have connected to the slider is correct or working, both when the value is initialized on the loadVariable and when updated. But I just can't see what I've done wrong.

      posted in Dashboard
      R
      RMF69
    • RE: Help to send email when node goes down

      @jkandasa 🙂 No I hadn't, thanks, of course now its working. Great tool I'm enjoying getting to grips with the scripts and templates.

      posted in General Discussion
      R
      RMF69
    • RE: custom widget: send command to node

      @jkandasa

      Thanks, I've got the latest, Version 1.5.0. And I've not changed anything, just the script binding {sId:31} where 31 is the id of a light dimmer virtual sensor... see picture. I took the ID from the url of that page in the picture below.Screenshot_2020-01-02_18-31-18.png

      posted in Dashboard
      R
      RMF69
    • RE: custom widget: send command to node

      @RMF69 Ok looking through code, I understand that its updating a sensor.variabel and that this id is passed in via the script binding {sId:31}... 31 is the id of a sensor S_LIGHT_LEVEL![alt text](Screenshot from 2019-12-28 13-05-08.png
      I still get 400 bad requests... and

      ERROR [Acme.Utils.ThreadPool(0)-PooledThread: Acme.Serve.Serve$ServeConnection@1415568e] [org.mycontroller.standalone.api.jaxrs.exception.mappers.ApplicationExceptionMapper:42] ApplicationException,
      org.jboss.resteasy.spi.ApplicationException: java.lang.NullPointerException
      

      I'd love to understand what I've done wrong:)

      posted in Dashboard
      R
      RMF69
    • RE: custom widget: send command to node

      @RMF69 To myself... the script binding id mistyped {sId:2}... got the camel case wrong. Slider is now visible but I get 400 error... as I don't have the variable set up correctly which will get updated ? I've created a global variable "sVariable" but I don't think this is right. How do I get the value out of the slider when its value changes ?

      posted in Dashboard
      R
      RMF69
    • RE: Help to send email when node goes down

      I'm still getting "400 Bad request" even without this type. Is there something else I have to do to enable the email feature ?

      I've tried just mcApi.utils().sendEmail("username@gmail.com", "subject", "message"); and get the same 400 Bad request.

      posted in General Discussion
      R
      RMF69
    • RE: custom widget: send command to node

      I'm just testing out various examples to understand how things work, I'm getting

      Failed at: ${sId}  [in template "unknown" at line 1, column 69]
      
      

      which I assume is from the first line of the html template, its not finding the angularjs custom controller ? I did modify app.js.

      I'm pretty sure I've done all of the above to get the slider to appear on dashboard, but I must of missed something. I pasted the angularjs custom controller into the text field in HTML additional headers.

      Any help 🙂 thanks

      posted in Dashboard
      R
      RMF69
    • RE: Widgets for controlling nodes

      Has anyone got a slider widget for dimmer or the like yet ?

      I was going to try adding a slider myself, but don't know where to put the <head> code to pull in the jquery ?

      <!doctype html>
      <html lang="en">
      <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>jQuery UI Slider - Default functionality</title>
        <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
        <link rel="stylesheet" href="/resources/demos/style.css">
        <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
        <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
        <script>
        $( function() {
          $( "#slider" ).slider();
        } );
        </script>
      </head>
      <body>
       
      <div id="slider"></div>
       
       
      </body>
      </html>```
      
      thanks
      posted in General Discussion
      R
      RMF69
    • RE: Widget - Running Sensors

      @jkandasa Thanks for that, missed it.

      posted in General Discussion
      R
      RMF69
    • RE: Widget - Running Sensors

      [EDIT] I've answered myself... in the .js there was a filter restriction on // options.put("variableType", MESSAGE_TYPE_SET_REQ.V_STATUS);
      no wonder no sensors where show
      [/edit]
      Hi I had to re copy the examples at top again, as I'd modified the origional, not a good idea i know if I wanted to fix something.

      I've re inserted the example js and html template above, and no longer get the error I'd posted however still no sensor variables show.

      Here are some screen shots
      (0_1519807954237_scriptedit.png
      (0_1519807964086_templateedit.png
      (0_1519807973680_customwidget.png
      (0_1519807987336_customerwidgetoutput.png
      (0_1519807997880_topology.png

      Thanks again for any help

      posted in General Discussion
      R
      RMF69
    • RE: Widget - Running Sensors

      @jkandasa sure, if I knew or had a better idea of what I was looking for, the script and template, the ones I've inserted exist... but where do I need to look for rest api ?

      posted in General Discussion
      R
      RMF69
    • RE: Resource->Rule save button disabled

      @jkandasa Thanks, so dampening isn't a required field, however the save button isn't enabled, until I've turned dampening on, then off again. That was the point I was trying to make. 🙂

      posted in Comments & Feedback
      R
      RMF69
    • RE: Widget - Running Sensors

      Has something change on the 1,2,0.Final ? This example worked with the previous, but now I get

      angular.js:10661 GET https://localhost:8443/mc/rest/templates/getHtml?script=operations%2Flast-seen-nodes.js&scriptBindings=%7B%7D&template=last-seen-nodes.html 400 (Bad request)
      

      I don't have mc in side www... I'm sure I don't understand whats going on 🙂 or should be

      Thanks

      posted in General Discussion
      R
      RMF69
    • RE: Broardcast message to all nodes ?

      I've started to find the information I needed link text and the api for the scripts here link text

      I reply to myself 🙂

      posted in General Discussion
      R
      RMF69
    • RE: Resource->Rule save button disabled

      A bit more infomation and 3 screen shots

      1. 0_1519658959102_Screenshot_2018-02-26_15-27-17.png I didn't select any dampening... and save was disabled

      2. 0_1519659006322_Screenshot_2018-02-26_15-27-48.png I selected dampening now the save is enabled.

      3. then I went on and unslected the dampening and the save button is still ENABLED.

      Is dampening required to create a rule ? Or is this just some small bug, or funny behaviour ?

      Thanks for the reply

      posted in Comments & Feedback
      R
      RMF69
    • RE: Broardcast message to all nodes ?

      Just trying to understand, don't rules what for changes in values ? Is it possible for 1 rule to watch the value of many sensors, say an announcement value and then in a script send this announcment to all nodes ?

      In a script can you iterate over all nodes programaticly... i.e get a list of all current nodes ? Really sorry if this is documented somewhere.

      posted in General Discussion
      R
      RMF69
    • Resource->Rule save button disabled

      I can't work out why its so differcult to get the SAVE button to be enabled and clickable when creating new RULES, what is the depandacy I'm missing ?![alt text](0_1519637999459_Screenshot_2018-02-26_09-39-35.png image url)

      posted in Comments & Feedback
      R
      RMF69
    • RE: resourses->operation to turn off a light - dosn't update status of light on mycontroller

      @jkandasa I feel a bit stupid now, because I got it working, but can't describe 100% why. Which is bad because it dosn't garantee that I don't make the same mistake again. I think I was connecting the button to the wrong sensor value that needed changing to turn the led on and off.

      posted in Troubleshooting
      R
      RMF69