What's the difference?


  • Module Developer

    What’s the difference between these two? This is my guess. That sendSocketNotification communicates with the node_helper and that sendNotification broadcasts to all modules?

    Or, am I so wrong that you’re laughing at me? 🙂

    Please shed some light on this for me. Thanks y’all!

    Peace!




  • Module Developer

    @strawberry-3.141

    Thank you, mate! 🙂


  • Module Developer

    @strawberry-3.141

    I spent a day with the docs that you suggested and I successfully broadcast a notification from MMM-voice using this.sendNotification('HIDE_LUCY'). I successfully received that notification in MMM-EasyPix (test module) this way:

    if (notification === 'HIDE_LUCY') {
        MM.getModules().enumerate((module) => {
                    module.hide(1000);
                });
    

    However, this resulted in ALL modules being hidden, not just MMM-EasyPix, which was my intention. I then tried
    moduleA.show(0, {force: true});

    if (notification === 'HIDE_LUCY') {
        MMM-EasyPix.hide(0, {force: true});
    

    and

    if (notification === 'HIDE_LUCY') {
        module_0_MMM-EasyPix.hide(0, {force: true});
    

    Nothing changed.

    module_0_MMM-EasyPix I got from examining the elements in dev console. MMM-voice in these trials is module_6_MMM-voice.

    I then removed all edits to MMM-EasyPix. Instead of trying to have MMM-EasyPix hide itself when it receives a notification, I tried to have MMM-voice hide MMM-EasyPix directly using moduleA.hide(0, {lockString: "module_b_identifier"});. One is commented out but both do not work as expected

    else if (notification === 'HIDE_LUCY') {
        //    MMM-EasyPix.hide(0, {lockString: "module_6_MMM-voice"});
              module_0_MMM-EasyPix.hide(0, {lockString: "module_6_MMM-voice"});    
            }
    

    I know I’m going about it the wrong way. That’s painfully obvious, but I thought if I could get it to work then I would continue to find a more efficient way of doing it.

    MMM-voice works amazingly well on some laptops that I’m experimenting with. It very intelligently added “LUCY” to the words.json file and the MMM-voice.dic file automatically. I determined this was done in the node_helper via the generateDicLM() and fs.writeFile() functions when all I did was add ‘HIDE LUCY’ and ‘SHOW LUCY’ to the sentences array. Fantastic!

    And lastly, the only other modification I made was to the socketNotificationReceived function of the MMM-voice.js file here

    else if (notification === 'HIDE_MODULES') {
                MM.getModules().enumerate((module) => {
                    module.hide(1000);
                });
            } else if (notification === 'SHOW_MODULES') {
                MM.getModules().enumerate((module) => {
                    module.show(1000);
                });
    

    and here

    else if (notification === 'HIDE_LUCY') {
        //    MMM-EasyPix.hide(0, {lockString: "module_6_MMM-voice"});
              module_0_MMM-EasyPix.hide(0, {lockString: "module_6_MMM-voice"});    
            }
            
            else if (notification === 'SHOW_LUCY') {
         //     MMM-EasyPix.show(0, {lockString: "module_6_MMM-voice"});
                module_0_MMM-EasyPix.show(0, {lockString: "module_6_MMM-voice"});
            }
    

    So, if you care to give me some pointers, or point me in the right direction, or simply point out my mistakes so that I might try to correct them, I would greatly and humbly appreciate it. 🙂

    Peace!



  • @Mykle1 just do that in easypix

    if (notification === 'HIDE_LUCY') {
        this.hide(1000);
    }
    

  • Module Developer

    @strawberry-3.141 said in What’s the difference?:

    just do that in easypix

    Success! 🙂

    Now I plan to do it the right way. I’ll take another look at the DEVELOPER document and learn how to properly register my modules with MMM-voice.

    Thank you!

    Peace!


  • Module Developer

    @strawberry-3.141

    Is there any way to run the bash dependencies.sh command on a Windows machine? I see that it requires sudo, which Windows does not have, so the installation fails immediately.


  • Module Developer

    @strawberry-3.141

    This is what I tried to get MMM-voice working under windows:
    I successfully installed MMM-voice on a laptop that is running ubuntu. It works just fine there. So I copied the MMM-voice folder, the pocketsphinx folder and the sphinxbase folder from the ubuntu machine and pasted them in their respective directories on the Windows machine. I did get an “initializing” message once before getting the dreaded “ERROR” message. I tried microphone: 2, (numbers 1 thru 5) but all failed.

    Anyway, if there is a way to install this under Windows I would really appreciate some direction. Thanks.

    Peace!



  • @Mykle1 never tried to install it on windows, you need ti install all dependencies manually if they even exist for windows, then make sure when they get used that the path etc is correct


  • Module Developer

    @strawberry-3.141

    Ok, thanks. I’m looking into that right now