Bugsounet Coding

    • Register
    • Login
    • Search
    This Forum is now reserved to registred users!

    Unsolved how to have multiple patterns in recipes

    Issues
    3
    6
    76
    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.
    • S
      sillen last edited by

      hey i want to show a pilot wheather website when i say open pilot or öppna pilot in my language and i got “öppna pilot” too work but ifi want multiple patterns how would i do that? here is my recipe:
      var recipe = {
      transcriptionHooks: {
      “WEB_DISPLAY”: {
      pattern: “öppna pilot”,
      command: “WEB_DISPLAY”
      }
      },

      commands: {
      “WEB_DISPLAY”: {
      notificationExec: {
      notification: “EXT_BROWSER-OPEN”,
      payload: (params) => {
      return “https://aro.lfv.se/tor/nswc2aro.gif?629203”
      }
      },
      soundExec: {
      chime: “open”
      },
      displayResponse: false
      }
      }
      }
      exports.recipe = recipe


      could i just do somthing like this maybe:
      Pattern: “öppna pilot”, “open pilot”,
      help on how to do this would be appreciated

      1 Reply Last reply Reply Quote 0
      • bugsounet
        bugsounet Main Coder last edited by

        Hi,

        something like this ?

        var recipe = {
          transcriptionHooks: {
            "WEB_DISPLAY": {
              pattern: "öppna pilot",
              command: "WEB_DISPLAY"
            },
            "WEB_DISPLAY2": {
              pattern: "open pilot",
              command: "WEB_DISPLAY"
            }  
          },
        
          commands: {
            "WEB_DISPLAY": {
              notificationExec: {
                notification: "EXT_BROWSER-OPEN",
                payload: (params) => {
                  return "https://aro.lfv.se/tor/nswc2aro.gif?629203"
                }
              },
              soundExec: {
                chime: "open"
              },
              displayResponse: false
            }
          }
        }
        exports.recipe = recipe
        
        1 Reply Last reply Reply Quote 0
        • S
          sillen last edited by

          hey this worked thank you so much. but now i have a new problem i cant seem to solve. so i wanted to also do this for showing a youtube live video from space when i say the hotword “Space” or in swedish “rymden” but when i use this code it doesnt work:

          var recipe = {
          transcriptionHooks: {
          “Iss”: {
          pattern: “rymden”,
          command: “iss”
          }
          },

          commands: {
          “íss”: {
          notificationExec: {
          notification: “iss_open”,
          payload: (params) => {
          return “https://www.youtube.com/embed/ddZu_1Z3BAc?ab_channel=SpaceVideos&autoplay=1”
          }
          },
          soundExec: {
          chime: “open”
          },
          displayResponse: false
          }
          }
          }
          exports.recipe = recipe

          when i say "rymden it shows me the little send icon. this one
          image.png
          but nothing shows up on the magicmirror. my error logs from gateway look like this:

          [06.01.2023 22:06.13.280] [LOG] [GA:AS] CONVERSATION:AUDIO 1600
          [06.01.2023 22:06.13.281] [LOG] [GA:AS] CONVERSATION:AUDIO 1600
          [06.01.2023 22:06.13.282] [LOG] [GA:AS] CONVERSATION:AUDIO 96
          [06.01.2023 22:06.13.302] [LOG] [GA:AS] CONVERSATION:SCREEN object
          [06.01.2023 22:06.13.304] [LOG] [GA:AS] CONVERSATION:ACTION { requestId: ‘63bba6e2-0000-20e6-be00-582429ca8a2c’ }
          [06.01.2023 22:06.13.305] [LOG] [GA:AS] CONVERSATION:RESPONSE
          [06.01.2023 22:06.13.747] [LOG] [GA:AS] CONVERSATION_ALL_RESPONSES_RECEIVED
          [06.01.2023 22:06.13.748] [LOG] [GA:AS] CONVERSATION_END:COMPLETED
          [06.01.2023 22:06.13.751] [LOG] [GA:AS] CONVERSATION_PP:RESPONSE_AUDIO_PROCESSED
          [06.01.2023 22:06.13.753] [LOG] [MP3] MP3 FILE CREATED 43296 bytes
          [06.01.2023 22:06.13.792] [LOG] [GATEWAY] [192.168.1.223][GET] /getEXTStatus
          [06.01.2023 22:06.13.796] [LOG] [GA:SP] CONVERSATION:SCREENOUTPUT_CREATED
          [06.01.2023 22:06.13.799] [LOG] [GA] ASSISTANT_RESULT {
          error: { error: null, message: null, audio: false },
          action: { requestId: ‘63bba6e2-0000-20e6-be00-582429ca8a2c’ },
          text: null,
          screen: {
          text: ‘.show_text_container{width:100%;padding:41px 0px 41px 112px;box-sizing:border-box}.show_text_content{font-size:1em;line-height:1.4em;width:24.7em;white-space:pre-wrap;color:#ffffff}#scroll-up{background-image:url(“https://www.gstatic.com/actions/devices_platform/expand-less.png”);background-size:48px 48px;color:#FFFFFF;height:48px;width:48px;margin-bottom:24px;display:none}#scroll-up:focus{background-color:#8e4e76}#scroll-down{background-image:url(“https://www.gstatic.com/actions/devices_platform/expand-more.png”);background-size:48px 48px;color:#FFFFFF;height:48px;width:48px;display:none}#scroll-down:focus{background-color:#8e4e76}.scroll-bar{left:32px;position:absolute;display:flex;flex-direction:column;margin-top:48px}.scroll_active{background-color:#424242}.scroll_inactive{opacity:0.3}\n’ +
          ‘.rLshyf,.BmP5tf{padding-top:56px;padding-bottom:56px}\n’ +
          ‘.YOx3Ab{padding-left:112px;}\n’ +
          ‘.w1C3Le,.BmP5tf,.G5NbBd,.CS4w5b{padding-left:112px;padding-right:112px;}\n’ +
          ‘.G5NbBd{padding-bottom:56px}\n’ +
          ‘.CS4w5b{padding-top:56px}\n’ +
          ‘.cRfwlf{overflow:auto}\n’ +
          ‘.AOjJcc{float:left;width:988px;margin-right:68px;white-space:nowrap}\n’ +
          ‘.nU2kRb{font-weight:500;margin-top:-8px}\n’ +
          ‘.LPaQ4{margin-top:24px}\n’ +
          ‘.LGg7le{margin-top:16px;height:104px;white-space:normal}\n’ +
          ‘.MwspK{margin-top:8px;white-space:nowrap}\n’ +
          ‘.i8drCf{float:right;box-shadow:0px 3px 3px #000}\n’ +
          ‘.ivcaNd{margin-left:16px}\n’ +
          ‘.eLlbVe{display:inline-block;border:1px solid;border-radius:5%;-webkit-transform:translateY(-1px);margin:4px 10px 4px 0;padding:2px 6px 0;box-sizing:border-box;font-size:22px;line-height:22px;color:rgba(255,255,255,.70)}\n’ +
          ‘.MUxGbd{font-size:28px;font-family:Roboto,sans-serif;line-height:40px;padding-top:2px;margin-bottom:-2px}\n’ +
          ‘.MUxGbd.ITUZi{font-size:40px;line-height:48px}\n’ +
          ‘.MUxGbd.H7ORec{color:#fff}\n’ +
          ‘.OSrXXb{overflow:hidden;text-overflow:ellipsis}\n’ +
          ‘.cHaqb{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n’ +
          ‘.aLF0Z{white-space:nowrap}\n’ +
          ‘.wuQ4Ob{color:#70757a}\n’ +
          ‘.WZ8Tjf{color:#70757a}\n’ +
          ‘.WZ8Tjf a:visited{color:#dadce0}\n’ +
          ‘.lyLwlc{color:#202124}\n’ +
          ‘.tP9Zud{display:inline-block;}\n’ +
          ‘.QzarWc{color:#3c4043}\n’ +
          ‘.MUxGbd.v0nnCb{font-size:20px;line-height:26px;padding-top:2px;margin-bottom:1px}\n’ +
          ‘.lEBKkf{display:-webkit-box;-webkit-box-orient:vertical;overflow:hidden}\n’ +
          ‘.L6lOSd{color:rgba(255,255,255,.50) !important}\n’ +
          ‘.L6lOSd svg{fill:rgba(255,255,255,.50);height:24px;width:24px;vertical-align:middle;margin-left:8px}\n’ +
          ‘.L6lOSd:hover{background-color:#202124;color:#fff !important}\n’ +
          ‘.L6lOSd:hover svg{fill:#fff}\n’ +
          ‘.L6lOSd:focus{background-color:#202124;color:#fff !important;outline:none}\n’ +
          ‘.L6lOSd:focus svg{fill:#fff}\n’ +
          ‘.MUxGbd.gbj1yb{font-size:24px;line-height:32px;padding-top:0px;margin-bottom:-8px}\n’ +
          ‘.U0Pagd{display:flex;margin-top:32px}\n’ +
          ‘.KU8Akd{margin-right:56px}\n’ +
          ‘.N2LAY{display:flex;margin-right:56px}\n’ +
          ‘.z6jPQ{margin-right:24px}\n’ +
          ‘.t6500d img{object-fit:cover}\n’ +
          ‘.UNi41c:focus{background-color:#202124}\n’ +
          ‘.UNi41c{border-radius:4;text-decoration:none}\n’ +
          ‘.wDx5De{position:relative}\n’ +
          ‘.wDx5De:hover .yGTdhf{opacity:1}\n’ +
          ‘.wDx5De:focus .yGTdhf{opacity:1}\n’ +
          ‘.wDx5De:focus{outline:none}\n’ +
          ‘.yGTdhf{width:calc(100% - 48px);opacity:0;position:absolute;bottom:0%;background-color:#202124;color:#fff;display:flex;align-items:center;padding:32px 24px;justify-content:flex-start}\n’ +
          ‘.cTs5cb{padding-right:16px}\n’ +
          ‘.Mwg5Ed{fill:#fff;flex-shrink:0}\n’ +
          ‘.SW5o1{flex:none;overflow:hidden}\n’ +
          ‘.Ac3v0e{display:block}\n’ +
          ‘Rymden\n’ +
          ‘Rymden, ibland yttre rymden eller världsrymden, är de relativt tomma områdena i universum som finns utanför himlakropparnas atmosfärer. Begreppet används ibland med den alternativa betydelsen universum.\n’ +
          (function(){var id='tsuid_1';document.getElementById(id).onclick=function(){var a=this.getAttribute("data-url"),b=this.getAttribute("data-follow-up-query"),c=this.getAttribute("data-json");a?window.parent.postMessage({url:{href:a}},"*"):b?window.parent.postMessage({query:{queryText:b}},"*"):c&&window.parent.postMessage(JSON.parse(c),"*")};})();\n +
          ‘Källa: Wikipedia\n’ +
          (function(){var id='tsuid_2';document.getElementById(id).onclick=function(){var a=this.getAttribute("data-url"),b=this.getAttribute("data-follow-up-query"),c=this.getAttribute("data-json");a?window.parent.postMessage({url:{href:a}},"*"):b?window.parent.postMessage({query:{queryText:b}},"*"):c&&window.parent.postMessage(JSON.parse(c),"*")};})();\n +
          ‘sv.wikipedia.org\n’ +
          ‘(function(){\n’ +
          ‘var d=this||self;var k=function(a){var b=this;this.g=[];this.h=0;this.setFocus=this.l;“interactive”===document.readyState||“complete”===document.readyState?e(this,a):document.addEventListener(“DOMContentLoaded”,function(){e(b,a)})};k.prototype.l=function(a){this.h=a;l(this)};var e=function(a,b){var f=document.getElementById(b);document.querySelectorAll(“.tv-focusable-element”).forEach(function(g){f&&f.contains(g)&&a.g.push(g)});b={};for(var h=0;h<a.g.length;b={i:b.i},h++)b.i=a.g[h],b.i.addEventListener(“keydown”,function(g){return function©{var m=g.i;d.event&&m&&(13===c.keyCode||“Enter”===c.code?m.click():39===c.keyCode||“ArrowRight”===c.code?n(a,!0):(37===c.keyCode||“ArrowLeft”===c.code)&&n(a,!1))}}(b));f&&f.addEventListener(“focus”,function(){l(a)});(b=window.registerHorizontalNavigationController)&&\n’ +
          “b(function(){a.j()});(b=window.registerHorizontalNavigationControllerHandledKeyCodes)&&b([39,37,13])};k.prototype.j=function(){l(this)};var l=function(a){a.g&&0<a.g.length&&a.g[a.h].focus()},n=function(a,b){a.g&&0!==a.g.length&&(b&&a.h<a.g.length-1?(a.h++,l(a)):!b&&0<a.h&&(a.h–,l(a)))};k.prototype.initializeFocus=k.prototype.j;d.createDpadFocusTvController=function(a){return new k(a)};}).call(this);createDpadFocusTvController(‘tv_knowledge_panel_source’);”,
          links: [
          ‘https://sv.m.wikipedia.org/wiki/Rymden’,
          ‘https://sv.wikipedia.org/wiki/Rymden’
          ],
          photos: [],
          path: ‘/home/pi/MagicMirror/modules/MMM-GoogleAssistant/tmp/responseOutput.html’,
          uri: ‘tmp/responseOutput.html’
          },
          audio: {
          path: ‘/home/pi/MagicMirror/modules/MMM-GoogleAssistant/tmp/lastResponse.mp3’,
          uri: ‘tmp/lastResponse.mp3’
          },
          transcription: { transcription: ‘rymden’, done: true },
          continue: false,
          volume: null,
          lastQuery: {
          type: ‘TEXT’,
          key: ‘rymden’,
          lang: ‘en-US’,
          status: ‘standby’,
          chime: true
          }
          }
          [06.01.2023 22:06.13.928] [LOG] [DETECTOR] Starts listening. 1 Models

          it seems that the assistant also tries to show the wiki but fails, could this be the issue with the live feed not showing? help would be greatly appreciated

          1 Reply Last reply Reply Quote 0
          • bugsounet
            bugsounet Main Coder last edited by

            GA rules with recipes ares:

            • Make entire dial with google server
            • make entire process for google response
            • check transcription:{} response part with your recipe (pattern)
              • if your pattern match with transcription.transcription value (and transcription.done == true)
                -> execute the recipe
                -> if your recipe have displayResponse: true: display google response (in other hand don’t display it [like your case])

            So in your case:

            • it’s executed and don’t display the result
            • it will send a notification to all module with iss_open with a youtube link

            So the main problem, i think:

            • check what’s module the the incoming notification iss_open
            • Warn: it’s an YT link and MagicMirror don’t allows to display it (Google Rules)
            1 Reply Last reply Reply Quote 0
            • J
              Jerome7440 Donators last edited by

              Bonjour à tous,
              J’ai un problème au niveau de magiemirror
              Quand je dit Jarvis
              J’ai une erreur 7.permission Google assistant api

              1 Reply Last reply Reply Quote 0
              • bugsounet
                bugsounet Main Coder last edited by

                Bonjour, quel est le rapport avec ce sujet ?
                Merci d’ouvrir votre propre sujet en cas de souci
                Merci 😉

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Powered by NodeBB | @bugsounet ©2022