MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. NPX78
    3. Best
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    N
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 6
    • Groups 0

    Posts

    Recent Best Controversial
    • RE: MM and Kalliope: make Kalliope speaking

      :::

      Spoiler Text

      :::

      Hello

      So my solution.

      :::

      Kalliope Side :

      :::

      //-- settings.yml file
      
      # ---------------------------
      # Rest API
      # ---------------------------
      rest_api:
        active: True
        port: 5000
        password_protected: False
        login: admin
        password: secret
        allowed_cors_origin: "*" 
      
      

      active:True allows using the Rest API
      password_protected: False allows anonymous connections
      allowed_cors_origin: allows connections from other sites. This option is mandatory because the MM site is localhost:8080 and kalliope 127.0.0.1:5000

      Concerning the brain.yml file

        - name: "repeat"
          signals:
            - order: "repeat after me {{sentence}}"
          neurons:
            - say:
                message: "{{sentence}}"
      
      

      This synapse allows Kalliope repeat a sentence.

      :::

      Magic Mirror side :

      :::

      The following lines could be inserted in a module file

      //-- Create the Request object.
      const Http   = new XMLHttpRequest();
      
      //-- Url to call fo our synapse.
      const url    = 'http://localhost:5000/synapses/start/id/repeat';
      
      //-- Build our data to send as parameters of our request.
      var sent     = 'This is the text I want Kalliope repeat';    //-- You can modify it
      var data     = {"parameters" : {'sentence':sent}};
      var dataJson = JSON.stringify(data);
      
      //-- Launch the request.                
      Http.open("POST",url);
      Http.setRequestHeader("Content-type","application/json");
      Http.send(dataJson);
      
      

      I hope to be clear :)
      I mark the post as Solved.

      Thank you a lot for your time and ideas.

      Regards

      Nicolas

      posted in Troubleshooting
      N
      NPX78
    • 1 / 1