Bugsounet_Coding();

    • Register
    • Login
    • Search

    soundExec problem

    Recipes
    2
    3
    62
    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.
    • A
      Anthony Donators last edited by

      Hello @bugsounet. I hope you are well. I recreated a recipe for MMM-pages to work like I want and it does. The only problem I have is the soundExec function. The recipe is excecuted perfectly but I do not get the sound answer. Please check the recipe and mention where my mistake is. Thank you in advance.

      var recipe = {
        transcriptionHooks: {
          "shopping_list": {
            pattern: "open shopping list",
            command: "shopping_list"
          },
          "astro": {
            pattern: "tell me my future",
            command: "astro"
          },
          "wifi": {
            pattern: "we have a guest",
            command: "wifi"
          },
          "MAIN_PAGE": {
            pattern: "main page",
            command: "MAIN_PAGE"
          },
        },    
        commands: {
          "shopping_list": {
            notificationExec: {
              notification: "PAGE_CHANGED",
              payload: 1,
                }
              }, 
              soundExec: {
              sound: "answers/add.mp3"
            }, 
          "astro": {
            notificationExec: {                                    // you can have as many pages as you want, just edit the payload with number page                                           
              notification: "PAGE_CHANGED",
              payload: 2,
                }
              },
              soundExec: {
              sound: "answers/horoscope.mp3"
            },
          "wifi": {
            notificationExec: {
              notification: "PAGE_CHANGED",
              payload: 3,
                }
              },
                   soundExec: {
              sound: "answers/welcome.mp3"
            },
            "MAIN_PAGE": {
            moduleExec: {
              module: (param) => {
                this.sendNotification("HOME_PAGE","");    
                }
              }
          },
          soundExec: {
              sound: "answers/oksir.mp3"
            }
          }
      }
      exports.recipe = recipe
      
      bugsounet 1 Reply Last reply Reply Quote 0
      • bugsounet
        bugsounet Main Coder @Anthony last edited by

        I have self ligned all {}

        the result if this:

        var recipe = {
          transcriptionHooks: {
            "shopping_list": {
              pattern: "open shopping list",
              command: "shopping_list"
            },
            "astro": {
              pattern: "tell me my future",
              command: "astro"
            },
            "wifi": {
              pattern: "we have a guest",
              command: "wifi"
            },
            "MAIN_PAGE": {
              pattern: "main page",
              command: "MAIN_PAGE"
            },
          },    
          commands: {
            "shopping_list": {
              notificationExec: {
                notification: "PAGE_CHANGED",
                payload: 1,
              }
            }, 
            soundExec: {
              sound: "answers/add.mp3"
            }, 
            "astro": {
              notificationExec: {                                          
                notification: "PAGE_CHANGED",
                payload: 2,
              }
            },
            soundExec: {
              sound: "answers/horoscope.mp3"
            },
            "wifi": {
              notificationExec: {
                notification: "PAGE_CHANGED",
                payload: 3,
              }
            },
            soundExec: {
              sound: "answers/welcome.mp3"
            },
            "MAIN_PAGE": {
              moduleExec: {
                module: (param) => {
                  this.sendNotification("HOME_PAGE","");    
                }
              }
            },
            soundExec: {
              sound: "answers/oksir.mp3"
            }
          }
        }
        exports.recipe = recipe
        

        a { start on a line and must stoped } on self ligned line

        for example you have done:

              notificationExec: {
                notification: "PAGE_CHANGED",
                payload: 1,
                  }
        

        That you can see start of { and end of } is not ligned
        It must be corrected for NO Position error with:

              notificationExec: {
                notification: "PAGE_CHANGED",
                payload: 1,
              }
        

        When all are self ligned … you see your error !
        soundExec is out of your main fonction!

        exemple with your shopping_list command:

            "shopping_list": { //< -- start of shopping_list
              notificationExec: { //// <--  start of notificationExec
                notification: "PAGE_CHANGED",
                payload: 1,
              } //// <-- end of notificationExec
            }, // <-- end of shopping_list
            soundExec: {
              sound: "answers/add.mp3"
            },
        

        so… just soundExec sub-command must be INSIDE your shopping_list command

        and is corrected with:

            "shopping_list": { //< -- start of shopping_list
              notificationExec: { //// <--  start of notificationExec
                notification: "PAGE_CHANGED",
                payload: 1,
              }, //// <-- end of notificationExec
              soundExec: { /////// <--- start of soundExec
                sound: "answers/add.mp3"
              } /////// <--- End of soundExec
            }, // <-- end of shopping_list
        

        Let’s try to correct it by yourself with this sample 🙂
        Donc forget to self ligned you {} like i do

        A 1 Reply Last reply Reply Quote 0
        • A
          Anthony Donators @bugsounet last edited by

          @bugsounet WOW! You couldn’t explain it more simple even for me. I understood it perfectly. Of course I will correct my mistake by myself now with no doubt. And I will not make the same mistake in the future. Thank you once again for help.

          PS: Enjoy your coffee 😉 😉 😉

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