MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Volvo on Call

    Scheduled Pinned Locked Moved Solved Troubleshooting
    34 Posts 4 Posters 9.6k Views 4 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.
    • MZ-BERM Offline
      MZ-BER @MZ-BER
      last edited by MZ-BER

      @mz-ber Oh I guess I understand. If the function is not getting the right details than -> e if everything is okay than -> sdo

      S 1 Reply Last reply Reply Quote 0
      • S Offline
        sdetweil @MZ-BER
        last edited by sdetweil

        @mz-ber exec(“voc list”, (e, sdo, sde)=

        execs the command “voc list”
        and the exec function returns
        error (e)
        stdout (sdo)
        and stderr(sde)

        so if no error (e is null)

        it sends the command output to the listResults function

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        MZ-BERM 1 Reply Last reply Reply Quote 0
        • MZ-BERM Offline
          MZ-BER @sdetweil
          last edited by

          @sdetweil Thank you for the explanation. Is the function executing voc list in the terminal? If I’m doing manually voc list I’m getting a result.

          Is there a way to see what the script is getting back in detail?

          Again, thank you very much!

          S 1 Reply Last reply Reply Quote 0
          • S Offline
            sdetweil @MZ-BER
            last edited by

            @mz-ber yes executing just like on console

            nothing built in to show results.

            but you could add a

            console.log(sdo)

            before the call to listResults()

            and see it where u start mm
            npm start

            it should be the same outout

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            MZ-BERM 1 Reply Last reply Reply Quote 0
            • MZ-BERM Offline
              MZ-BER @sdetweil
              last edited by MZ-BER

              @sdetweil Alright, I added the console.log before the call listResult() and it is getting the details from my car. I feel sooo close to get this running but I dont know where it is stuck. :anguished_face:

              91d24ae5-cc19-4460-8dca-fae88fc947e2-image.png

              Is maybe the regex search not getting the details viewed?

              listResult: function(output) {
                  var re = /^([^ ]+)\s\(([^\)]+)\)\s([^ ]+)$/gm
              
              S 1 Reply Last reply Reply Quote 0
              • S Offline
                sdetweil @MZ-BER
                last edited by

                @mz-ber so the regular expression isn’t finding your text

                /^([^ ]+)\s\(([^\)]+)\)\s([^ ]+)$/gm
                

                I use this for building and testing rejects

                https://regex101.com/

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                MZ-BERM 1 Reply Last reply Reply Quote 0
                • MZ-BERM Offline
                  MZ-BER @sdetweil
                  last edited by

                  @sdetweil Yes, I also checked that with regex101. Can I just parse in the details I have?

                  listResult: function(output) {
                      var re = B-PY 186 (V90) XVASS123345
                  
                  S 2 Replies Last reply Reply Quote 0
                  • S Offline
                    sdetweil @MZ-BER
                    last edited by

                    @mz-ber the regex returns an array of matched things

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    1 Reply Last reply Reply Quote 0
                    • S Offline
                      sdetweil @MZ-BER
                      last edited by sdetweil

                      @mz-ber i think the regex is not expecting the 186

                      try ths one

                      /^([^ ]+)\s.*\(([^\/]+)\/([^\)]+)\)$/gm
                      

                      start of string ^
                      capture up to the 1st space ([^ ]+)
                      skip everything to (and including) the open paren \s.*(
                      get the two things in the parens, separated by /, not including the parens
                      capture up to the slash ([^/]+)
                      skip the slash /
                      capture up to the close pareen ([^)]+)
                      skip the close paren )
                      end of string $

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      MZ-BERM 1 Reply Last reply Reply Quote 0
                      • MZ-BERM Offline
                        MZ-BER @sdetweil
                        last edited by

                        @sdetweil Your one is not working. Here are the details I try to get:

                        B-PY 186 (V90/2019) YV1PWAKUDK1XXXXXX

                        I also played a bit with the expression and removed the white space:

                        before:

                        listResult: function(output) {
                            var re = /^([^ ]+)\s\(([^\)]+)\)\s([^ ]+)$/gm
                        

                        after:

                        listResult: function(output) {
                            var re = /^([^]+)\s\(([^\)]+)\)\s([^]+)$/gm
                        

                        That is working based on regex101 and I dont get the error anymore. But nothing is loaded into the MM

                        S 1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 3
                        • 4
                        • 2 / 4
                        • First post
                          Last post
                        Enjoying MagicMirror? Please consider a donation!
                        MagicMirror created by Michael Teeuw.
                        Forum managed by Sam, technical setup by Karsten.
                        This forum is using NodeBB as its core | Contributors
                        Contact | Privacy Policy