soundExec problem
-
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
-
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 linefor 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 forNO 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 yourshopping_list
commandand 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 -
@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