Bugsounet Coding

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

    Recpie Question?

    Recipes
    4
    19
    301
    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.
    • K
      Kala Donators last edited by bugsounet

      Hi guys i wrote a Recpie but if i start MM Fatal error recepie ligtcontrol.py come on the display

      i checked my recpie but cant finde the mistake can you guys spot it?

      //Backgroundlightning v.1
      var recipe = {
        transcriptionHooks: {
          "GA_GPIO_true": {
            pattern: "licht bitte ein",
            command: "GA_GPIO_true"
          },
          "GA_GPIO_false": {
            pattern: "licht bitte aus",
            command: "GA_GPIO_false"
          },
      
        },
      
        commands: {
          "GA_GPIO_true": {
            soundExec: {
              chime: "open",
            },
            shellExec: {
              exec: "/home/pi/MagicMirror/lighton.py"
            }
          },
          "GA_GPIO_false": {
            soundExec: {
              chime: "close",
            },
            shellExec: {
              exec: "/home/pi/MagicMirror/lightoff.py"
            }
          },
        }
      }
      
      
      
      exports.recipe = recipe // Don't remove this line.
      

      Edit  [@bugsounet]: add js code tag

      1 Reply Last reply Reply Quote 0
      • K
        Kala Donators last edited by

        my goal with this recpie is to say “licht bitte ein” and it starts a pythonscript

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

          naturally it’s possible !

          but it’s need some manipulation 😕

          1 Reply Last reply Reply Quote 0
          • K
            Kala Donators last edited by

            what i have to add or change?

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

              1. ask the assistant to repeat the desired sentence

              sample:
              Jarvis (or ok google) … repeat afte me: licht bitte ein

              “repeat after me” or equal in your language

              1. turn off your mirror
              2. navigate to : ~/MagicMirror/modules/MMM-GoogleAssistant/tmp
                you will see and .mp3 file
                you can play it … Wow ! it’s the last reponse of google !!!
              3. copy this file to an usb key (or transfert it with ftp or else …)
              4. go to your computer
              5. open with an sound editor
              6. delete the not needed content (“You have says …” in english)
              7. save your new mp3 file

              Repeat it for next recipe response
              when done … I will explain what you have to add in your recipe 🙂
              just beep me 🙂

              when done humm… 95% of job done !

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

                1. upload for mp3 files to ~/MagicMirror/modules/MMM-GoogleAssistant/resources directory
                2. now we don’t use chime feature in soundExec. We will use sound !
                3. transform chime to sound

                From:

                ...
                     soundExec: {
                        chime: "open",
                      },
                ...
                

                to:

                ...
                     soundExec: {
                        sound: "you file.mp3",
                      },
                ...
                
                1. save your recipe !
                2. restart your mirror !
                3. ‘et voila!’
                1 Reply Last reply Reply Quote 0
                • bugsounet
                  bugsounet Main Coder last edited by bugsounet

                  😮

                  I just see that is not your question 😕

                  you have forget the python command !

                  //Backgroundlightning v.1
                  var recipe = {
                    transcriptionHooks: {
                      "GA_GPIO_true": {
                        pattern: "licht bitte ein",
                        command: "GA_GPIO_true"
                      },
                      "GA_GPIO_false": {
                        pattern: "licht bitte aus",
                        command: "GA_GPIO_false"
                      },
                  
                    },
                  
                    commands: {
                      "GA_GPIO_true": {
                        soundExec: {
                          chime: "open",
                        },
                        shellExec: {
                          exec: "python /home/pi/MagicMirror/lighton.py"
                        }
                      },
                      "GA_GPIO_false": {
                        soundExec: {
                          chime: "close",
                        },
                        shellExec: {
                          exec: "python /home/pi/MagicMirror/lightoff.py"
                        }
                      },
                    }
                  }
                  exports.recipe = recipe // Don't remove this line.
                  

                  don’t forget to verify if the path is correct of exec is correct

                  in all case you can tunning the response ! 😁 😁

                  1 Reply Last reply Reply Quote 0
                  • K
                    Kala Donators last edited by

                    This post is deleted!
                    1 Reply Last reply Reply Quote 0
                    • K
                      Kala Donators last edited by

                      it worked out 🙂 thx very much

                      1 Reply Last reply Reply Quote 0
                      • K
                        Kala Donators last edited by

                        just a Question because im interested i have an idea to make PIR sensor who detects me and triggers GA to say: “Hello How are you”
                        is that possible?
                        with the recepies?

                        1 Reply Last reply Reply Quote 0
                        • K
                          Kala Donators last edited by

                          its like revers what i did. i have to read a GPIO to turning HIGH and after it triggers GoogeAssistans to say something.
                          Or i write a recpie who autostart a script. the main function of the scrip is waiting to turn a GPIO HIGH. If a GPIO is HIGH it starts a mp3 file
                          maybe a easier way?

                          ? 1 Reply Last reply Reply Quote 0
                          • ?
                            A Former User @Kala last edited by

                            This post is deleted!
                            1 Reply Last reply Reply Quote 0
                            • ?
                              A Former User last edited by

                              This post is deleted!
                              1 Reply Last reply Reply Quote 0
                              • Referenced by  A abdelhadj 
                              • A
                                Anthony Donators @Kala last edited by

                                Hello @bugsounet. I hope you are well. I did all steps you mention above for vocal answers in the recipes but besides that they all work fine GA does not answer accordinly Please Check the recipe for possible error. Thanks in advance

                                var recipe = {
                                  transcriptionHooks: {
                                    "redfm": {
                                      pattern: "play red fm",
                                      command: "red fm"
                                    },
                                    "athensdeejay": {
                                      pattern: "play athens deejay",
                                      command: "athens deejay"
                                    },
                                    "sferafm": {
                                      pattern: "play sfera fm",
                                      command: "sfera fm"
                                    },
                                    "rebelfm": {
                                      pattern: "play rebel fm",
                                      command: "rebel fm"
                                    }
                                  },
                                
                                  commands: {
                                    "red fm": {
                                      notificationExec: {
                                        notification: "EXT_RADIO-START",
                                        payload: (params) => {
                                          return {
                                            img: "modules/EXT-RadioPlayer/Logos/GR/redfm.jpeg",
                                            link: "https://stream.radiojar.com/redfm963"
                                          }
                                        }
                                      },
                                      displayResponse: true,
                                      soundExec: {
                                        sound: "modules/MMM-GoogleAssistant/resources/answers/enjoy.mp3"
                                      }
                                    },
                                    "sfera fm": {
                                      notificationExec: {
                                        notification: "EXT_RADIO-START",
                                        payload: (params) => {
                                          return {
                                            img: "modules/EXT-RadioPlayer/Logos/GR/sfairafm.png",
                                            link: "http://sfera.live24.gr:80/sfera4132"
                                          }
                                        }
                                      },
                                      displayResponse: true,
                                      soundExec: {
                                        sound: "modules/MMM-GoogleAssistant/resources/answers/enjoy.mp3"
                                      }
                                    },
                                    "athens deejay": {
                                      notificationExec: {
                                        notification: "EXT_RADIO-START",
                                        payload: (params) => {
                                          return {
                                            img: "modules/EXT-RadioPlayer/Logos/GR/athensdj.png",
                                            link: "http://netradio.live24.gr:80/athensdeejay"
                                          }
                                        }
                                      },
                                      displayResponse: true,
                                      soundExec: {
                                        sound: "modules/MMM-GoogleAssistant/resources/answers/enjoy.mp3"
                                      }
                                    },
                                    "rebel fm": {
                                      notificationExec: {
                                        notification: "EXT_RADIO-START",
                                        payload: (params) => {
                                          return {
                                            img: "modules/EXT-RadioPlayer/Logos/GR/rebelfm.png",
                                            link: "http://netradio.live24.gr/rebel1052"
                                          }
                                        }
                                      },
                                      displayResponse: true,
                                      soundExec: {
                                        sound: "modules/MMM-GoogleAssistant/resources/answers/enjoy.mp3"
                                      }
                                    }
                                    }
                                
                                }
                                exports.recipe = recipe
                                
                                1 Reply Last reply Reply Quote 0
                                • bugsounet
                                  bugsounet Main Coder last edited by

                                  Hi, set displayResponse: false,

                                  displayResponse: true,: will display in visual and play vocal purpose by google. So, in your case … it’s not needed

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

                                    OK but i change that in a try to make it work. So the problem is something else because GA does not reply to me when it opens the station

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

                                      ah, sound feature not set correctly

                                      the path is already set from modules/MMM-GoogleAssistant/resources/ in main core
                                      so just set it like this : sound: "answers/enjoy.mp3" (if your sound in resources/answers of GA directory and named enjoy.mp3)

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

                                        Thank you so much. Possibly you already know it but I would like to inform you that I had my paypal set up again and made a donation to your project.

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

                                          Just see, Thanks 😉

                                          why ? I have renew my computer this week (UEFI… multi OSs / dual boot take me head ! 🙂 )

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