• Categories
    • Recent
    • Tags
    • Popular
    • Register
    • Login

    MyController V2.0 Can't enable Serial Gateway

    Scheduled Pinned Locked Moved Troubleshooting
    5 Posts 2 Posters 384 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G Offline
      giuseppez
      last edited by jkandasa

      I'm trying to setup a serial gateway with a node and 1 temperature sensor.
      The gateway has been configured without labels (see attached picture):
      Gateway_Labels.PNG
      No error in trying to enable the gateway, the status becomes green but I can't see any log that says that the serial connection is established and the gateway started. I also tried to send a paylod from the Fields section but nothing happens.
      I then started the go debugger delve and I saw that even if the gateway is without lables, internally it seems that the default label is still present:

         251:         return false
         252: }
         253:
         254: // IsMine verifies the supplied id and labels with valid list
         255: func IsMine(svcFilter *sfML.ServiceFilter, targetType, targetID string, targetLabels cmap.CustomStringMap) bool {
      => 256:         if !svcFilter.HasFilter() {
         257:                 return true
         258:         }
         259:
         260:         matches := make([]bool, 0)
         261:
      (dlv) print svcFilter
      *github.com/mycontroller-org/server/v2/pkg/model/service_filter.ServiceFilter {
              Disabled: false,
              MatchAll: false,
              Types: []string len: 0, cap: 0, [],
              IDs: []string len: 0, cap: 0, [],
              Labels: github.com/mycontroller-org/server/v2/pkg/model/cmap.CustomStringMap [
                      "location": "server",
              ],}
      (dlv) continue
      

      and that prevents the serial gateway to be started; if I delete from the debugger the Labels then the gateway starts and I am able to communicate with field:

      (dlv) set sf.Labels=nil
      (dlv) next
      > github.com/mycontroller-org/server/v2/pkg/utils/filter_sort.IsMine() /go/src/pkg/utils/filter_sort/utils_filter.go:256 (PC: 0xac42ab)
      Values returned:
              ~r0: false
      
         253:
         254: // IsMine verifies the supplied id and labels with valid list
         255: func IsMine(svcFilter *sfML.ServiceFilter, targetType, targetID string, targetLabels cmap.CustomStringMap) bool {
      => 256:         if !svcFilter.HasFilter() {
         257:                 return true
         258:         }
         259:
         260:         matches := make([]bool, 0)
         261:
      (dlv) next
      > github.com/mycontroller-org/server/v2/pkg/utils/filter_sort.IsMine() /go/src/pkg/utils/filter_sort/utils_filter.go:257 (PC: 0xac4378)
      
         252: }
         253:
         254: // IsMine verifies the supplied id and labels with valid list
         255: func IsMine(svcFilter *sfML.ServiceFilter, targetType, targetID string, targetLabels cmap.CustomStringMap) bool {
         256:         if !svcFilter.HasFilter() {
      => 257:                 return true
         258:         }
         259:
         260:         matches := make([]bool, 0)
         261:
         262:         if len(svcFilter.Types) > 0 {
      (dlv) continue
      
      2021-12-21T09:48:14.605Z        info    gateway/service.go:34   starting a gateway      {"id": "Serial_Gateway"}
      2021-12-21T09:48:14.613Z        info    protocol_serial/client.go:61    opening a serial port   {"gateway": "Serial_Gateway", "port": "/dev/ttyUSB0"}
      2021-12-21T09:48:14.658Z        info    gateway/service.go:47   started a gateway       {"id": "Serial_Gateway", "timeTaken": "53.016413ms"}
      

      sorry but I was not able to format in a better way the code snippets

      jkandasaJ 1 Reply Last reply Reply Quote 0
      • jkandasaJ Offline
        jkandasa @giuseppez
        last edited by jkandasa

        I then started the go debugger delve and I saw that even if the gateway is without lables, internally it seems that the default label is still present:

        By default the configuration file contains the label filter for the gateway and handlers
        https://github.com/mycontroller-org/server/blob/master/resources/sample-binary-server.yaml#L50~L62

          labels:
            location: server
        

        You can delete those labels, or add the label in your gateway configuration(GUI)
        The label idea is to run multiple gateways in different locations and filter those by labels.
        As the location: server, configured for server, it takes only the label with server.

        sorry but I was not able to format in a better way the code snippets

        no worries, you have to use Markdown format or just use </> in the text editor

        1 Reply Last reply Reply Quote 0
        • G Offline
          giuseppez
          last edited by

          Hi @jkandasa thanks for the explanation; I understood your idea; by the way that means that I can't remove the defualt label or I need to have at least one label for a gateway, right?

          jkandasaJ 1 Reply Last reply Reply Quote 0
          • jkandasaJ Offline
            jkandasa @giuseppez
            last edited by

            @giuseppez you can remove the default label in your yaml file.

            If you do not have any label and in future if you have multiple mycontroller-gateways, your serial gateway configuration will be loaded in all the mycontroller-gateways
            Here is the doc: https://v2.mycontroller.org/docs/user-interface/resources/gateway/#power-of-the-labels

            1 Reply Last reply Reply Quote 0
            • G Offline
              giuseppez
              last edited by

              Thank you for the link; I will read it more carefully

              1 Reply Last reply Reply Quote 0
              • First post
                Last post

              0

              Online

              586

              Users

              529

              Topics

              3.4k

              Posts
              Copyright © 2015-2025 MyController.org | Contributors | Localization