MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord

    UNSOLVED Nobody knows???

    Troubleshooting
    3
    16
    227
    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.
    • F
      fischi87 last edited by

      Hello again, I don’t think that nobody knows how to fix this problem. please help me.

      my problem is still the Access-Control-Allow-Origin error. how can I or where I have to write down the access control allow? the problem is, chromium block my request (chrome) is loaded but not chromium to display my request.

      thank guys

      S karsten13 2 Replies Last reply Reply Quote 0
      • S
        sdetweil @fischi87 last edited by

        @fischi87 this is servers rejecting requests from clients who do not have dns entries matching their IP address (cross origin)

        sometimes there is a proxy server on the web that can reissue your request from a known server.

        in the next MM release is a built in service that appears to do that for you.

        U have to download the develop branch and add a new config parm to enable it for a module.

        Sam

        Create a working config
        How to add modules

        karsten13 1 Reply Last reply Reply Quote 0
        • karsten13
          karsten13 @fischi87 last edited by

          @fischi87

          you provide no infos related to your problem, we are not clairvoyant

          F 1 Reply Last reply Reply Quote 0
          • karsten13
            karsten13 @sdetweil last edited by

            @sdetweil

            if you refer to this PR: The new config param is only valid for the internal weather providers, foreign modules can use the proxy by adding the mentioned url.

            S F 2 Replies Last reply Reply Quote 0
            • S
              sdetweil @karsten13 last edited by

              @karsten13 ok.

              Sam

              Create a working config
              How to add modules

              1 Reply Last reply Reply Quote 0
              • F
                fischi87 @karsten13 last edited by fischi87

                @karsten13

                i will send u my code part and the error later. thanks for ur reply!

                i hope we can fix this problem.

                1 Reply Last reply Reply Quote 0
                • F
                  fischi87 @karsten13 last edited by

                  @karsten13

                  var stromRequest = new XMLHttpRequest();
                            var requestURL = 'http://192.168.178.44/cm?cmnd=var1';
                            stromRequest.onreadystatechange = function () {
                              if (stromRequest.readyState === XMLHttpRequest.DONE) {
                                if(stromRequest.status === 200) {
                                  var json_parse = JSON.parse(stromRequest.responseText).Var1
                                  var stromverbrauch = Number(json_parse * 0.30)//.toFixed(2);
                                  var verbrauch = stromverbrauch.toFixed(2);
                  

                  this is my request and the error:

                  Bildschirmfoto 2022-02-25 um 19.47.26.png

                  karsten13 1 Reply Last reply Reply Quote 0
                  • karsten13
                    karsten13 @fischi87 last edited by

                    @fischi87

                    so I assume the code snippet is from the module.js (not from node_helper.js). The url with IP 192.168.178.44 is pointing to another device in your network and is therefore different to the IP where mm is running?

                    If mm has the same IP you could try localhost instead, if the IP’s are different you can try this:

                    var requestURL = location.protocol + "//" + location.host + "/cors?url=http://192.168.178.44/cm?cmnd=var1";
                    

                    The 2. option with the cors url works only with the develop branch of mm (will be in the next official relase coming 1. April).

                    F 1 Reply Last reply Reply Quote 0
                    • F
                      fischi87 @karsten13 last edited by fischi87

                      @karsten13

                      thats right, its from the module.js. i read i can fix this issue with the node_helper.js but i dont know how to write the code down in the node_helper.js to get the result from my url.

                      i will try ur answer later.

                      i know how to write code in the node_helper.js form the request?

                      thanks

                      1 Reply Last reply Reply Quote 0
                      • F
                        fischi87 last edited by fischi87

                        @karsten13 said in Nobody knows???:

                        var requestURL = location.protocol + “//” + location.host + “/cors?url=http://192.168.178.44/cm?cmnd=var1”;

                        now I get this error:

                        Bildschirmfoto 2022-02-26 um 10.51.05.png

                        cannot get /cors.

                        karsten13 S 2 Replies Last reply Reply Quote 0
                        • 1
                        • 2
                        • 1 / 2
                        • First post
                          Last post
                        Enjoying MagicMirror? Please consider a donation!
                        MagicMirror created by Michael Teeuw.
                        Forum managed by Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
                        This forum is using NodeBB as its core | Contributors
                        Contact | Privacy Policy