Deezer Config



Add your Deezer user number in the config.yaml under the Deezer: and Userid. In the config.yaml, under Googlecloudapikey: replace ENTER-YOUR-GOOGLE-CLOUD-API-KEY-HERE with the key from Google Cloud Console. Command Syntax: To play the playlists added to your Deezer account. Select Settings (displayed on the top-right corner on any of your Deezer tabs).

  1. Deezer Commercial
  2. Deezer On Fitbit
  3. Deezer Configuracion
  4. Deezer Community
  5. Deezer Configure

Enabling or Disabling Custom Actions¶

Major custom actions have been provided with a control key or switch in the config.yaml.Set it to Enabled to enable the custom actions and set it to Disabled to disable them.

Using Custom Actions in Non-English Languages¶

  1. Languages supported: French, Italian, Spanish, Dutch, German and Swedish.
  2. In the config.yaml file, under the Languages and Choice option set your desired language.
  3. Use the Translated versions of the English syntaxes given for all the custom actions.
  4. You can change the keywords/trigger words for the custom actions in the keywords file.

Controlling Sonoff-Tasmota, Domoticz devices from Google Home¶

  1. This has been implemented using Adafruit_IO.
  2. Create an acount and a feed in adafruit.io website.
  3. Enter those details in the config.yaml file.
  4. Register or login into IFTTT and create an applet to send commands from google assistant to adafruit_io feed.
  5. For controlling domoticz and sonoff devices, the adafruit.io command should match the syntaxes for the respective custom actions.

Using the Interpreter Mode¶

Note

Google has the interpreter feature enabled in the cloud. That is, you can use the interpreter without this customization hack. You can leave this feature disabled in the config.yaml.

Note

This uses GOOGLE CLOUD SPEECH API. Free usage is limited to 60MINS/MONTH.

  1. Go to the projects page on your Google Cloud Console.
  2. Select your project from the list.
  3. On the left top corner, click on the hamburger icon or three horizontal stacked lines.
  4. From the API and services option, select library and in the search bar type speech, select Cloud Speech API and click on “ENABLE”.
  5. You will be prompted to create a billing account if you already have not created one. Follow the onscreen instructions to create a billing account and then Enable the API.
  6. Create a service account and generate credentials.
  7. Copy the downloaded the JSON key and place it /home/pi/ directory DO NOT RENAME.
  8. Enter the path to the Key along with the key name Eg: /home/pi/xxxx.json in the config.yaml file in the “Google_Cloud_Speech_Credentials_Path” field under “Speechtotext”.You can use one key for Cloud Speech and Cloud Text to Speech, but should enter the same path seperately in config.yaml

Command Syntax:

To start the interpreter:

To stop the interpreter:

Using Google Cloud Text to Speech¶

Note

GOOGLE CLOUD TEXT TO SPEECH API has limited free access. Once the quota is exceeded, the program will automatically switch to gTTS.

  1. Go to the projects page on your Google Cloud Console.
  2. Select your project from the list.
  3. On the left top corner, click on the hamburger icon or three horizontal stacked lines.
  4. “From the API and services” option, select library and in the search bar type text, select “Cloud Text-to-Speech API” and click on “ENABLE”.
  5. In the API window, click on “Credentials” and then on “+ Create Credential”.
  6. In the “Add credentials to your project” window, in step-1 under “Which API are you using?” drop down choose “Cloud Text-to-Speech API” and down below choose “No, I’m not using them”. Then click on “What credentials do I need?”
  7. In step-2 give your service account a name and on the right in the “Role” drop down choose Project–>Owner and under “Key Type” select “JSON” and click “Continue”.
  8. Copy the downloaded key and place it /home/pi/ directory DO NOT RENAME.
  9. Enter the path to the Key along with the key name Eg: /home/pi/xxxx.json in the config.yaml file in the Google_Cloud_TTS_Credentials_Path field.

Note

You can use one key for Cloud Speech and Cloud Text to Speech, but should enter the same path seperately in config.yaml

Adding Custom Search API and Generating API Key¶

  1. Go to the projects page on your Google Cloud Console.
  2. Select your project from the list.
  3. On the left top corner, click on the hamburger icon or three horizontal stacked lines.
  4. Move your mouse pointer over API and services and choose Credentials.
  5. Click on create credentials and select API Key and choose close. Make a note of the created API Key and enter it in the config.yaml script at the indicated location.
  6. “From the API and services” option, select library and in the search bar type search, select Custom Search API API and click on “ENABLE”.
  7. In the API window, click on “All API Credentials” and in the drop down, make sure to have a tick (check mark) against the API Key that you just generated.

Adding YouTube Data API and Generating API Key¶

  1. Go to the projects page on your Google Cloud Console.
  2. Select your project from the list.
  3. On the left top corner, click on the hamburger icon or three horizontal stacked lines.
  4. Move your mouse pointer over API and services and choose Credentials.
  5. Click on create credentials and select API Key and choose close. Make a note of the created API Key and enter it in the config.yaml script at the indicated location.
  6. “From the API and services” option, select library and in the search bar type youtube, select YouTube Data API v3 API and click on “ENABLE”.
  7. In the API window, click on “All API Credentials” and in the drop down, make sure to have a tick (check mark) against the API Key that you just generated.

Note

If a custom action uses both Custom Search and YouTube API, you need to enable both the APIs but only one API KEY needs to be generated.

Note

The same API key can be used for all the associated custom actions.

Controlling Assistant or Sending Preset Commands Using IR Remote¶

  1. Connect the IR Receiver according to the wiring diagram given below.

Note

The diagram given is for GPIO 17, if you are using another GPIO, please make the suitable changes to the connection.

  1. Run the sample IR receiver script to get the codes for your desired buttons:

  2. In the config.yaml under IR, list your codes and corresponding queries/actions. The number of queries should match the number of codes listed.

  3. If you want to execute the custom actions like Spotify, YouTube playback, Domoticz Control etc, prefix the word custom.

    Eg:

  4. If you are sending a command to be processed by google assistant, there is no need to prefix custom.

    Eg:

Video for reference:

Sending Commands or Queries to Google Assistant Over MQTT¶

  1. Set up your desired MQTT broker.If you are setting up Raspberry Pi as a MQTT broker, follow the guide below.

  2. Enter the MQTT broker credentials and subscription topic in the provided config.yaml file.

  3. Set the MQTT_Control to Enabled.

  4. Now, you can send queries or commands to google assistant over MQTT.

  5. If you are sending a command for custom actions, prefix custom in the payload.

    Eg:

  6. If you are sending a command to be processed by google assistant, there is no need to prefix custom.

    Eg:

  7. To turn on/off microphone just send the simple command mute.

    Eg:

For more details on the how to use this feature, refer to the video below:

Streaming Music from Deezer¶

Note

Deezer Commercial

  • As a roundabout approach, I have programmed the assistant to get the playlist details using Deezer API and then fetch those tracks from YouTube.
  • This feature uses a YouTube Data API v3.
  • Click here for guidelines to add YouTube Data API to the project and to generate the required key.
  1. Add your Deezer user number in the config.yaml under the Deezer: and User_id.
  2. In the config.yaml, under Google_cloud_api_key: replace ENTER-YOUR-GOOGLE-CLOUD-API-KEY-HERE with the key from Google Cloud Console.

Command Syntax:

To play the playlists added to your Deezer account:

Example:

Streaming Music from Gaana.com¶

Note

  • As a roundabout approach, I have programmed the assistant to get the playlist details using Deezer API and then fetch those tracks from YouTube.
  • This feature uses both YouTube Data API v3 and Custom Search API.
  • Click here for guidelines to add YouTube Data API to the project and to generate the required key.
  • Click here for guidelines to add Custom Search API to the project and to generate the required key.
  1. Add your playlists in the config.yaml under Gaana: and Playlists:.
  2. In the config.yaml, under Google_cloud_api_key: replace ENTER-YOUR-GOOGLE-CLOUD-API-KEY-HERE with the key from Google Cloud Console.

Command Syntax:

  1. To play the playlists added in config.yaml file:

    Example:

  2. To play other playlists:

Controlling Domoticz Devices¶

Note

As of today, you can control lights and switches only, more controls will be added in the future.

  1. In the config.yaml file under Domoticz: change Domoticz_Control: from Disabled to Enabled.
  2. List the device names and the ids that you want to control in the config.yaml file.The names should be the same as the ones in the domoticz server.

Command Syntax:

  1. To On/Off/Toggle:

    Example:

  2. To Change Brightness (between 0 and 100):

    Example:

  3. To Change Colour (refer to the list of available colors):

    Example:

Custom Conversations¶

  1. Customize the assistant’s reply to a specific question.
  2. Add the list of questions and answers in config.yaml under the Conversation: option.
  3. There must be only one question, but corresponding answers can be as many.
  4. Sample questions and answers has been provided, please follow the same pattern.

Custom Wakeword Activation¶

  1. You can choose to either Enable or Disable the custom wakeword activation in the config.yaml file.
  2. In the config.yaml file, under Wakewords, change the “Custom_Wakeword” to ‘Enabled’ if you want to use the custom wakeword or set it to ‘Disabled’ if you dont want to use the custom wakeword option.
  3. You have a choice between Snowboy and Picovoice for the custom wakeword engine.
  4. For Snowboy, change “Wakeword_Engine” to Snowboy and for Picovoice, change “Wakeword_Engine” to Picovoice.
  5. For changes to take effect, you need to restart the assistant. Changing status while an instance of assistant is already running will not cause any change.
  6. Create your custom snowboy model here. Add the models to /GassistPi/src/resources/snowboy_models directory.
  7. Sample Snowboy and Picovoice models have been provided and placed in the /GassistPi/src/resources/ folder. Set your desired models by setting their paths in the config.yaml file.
  8. To disable the default “Ok Google” hotword, set the Ok_Google option to “Disabled”.

Note

If you turn off the default Ok Google wakeword/hotword, everytime you invoke the assistant using the custom wakeword, you will get a prompt for the Mic being turned Off and On.

  1. Users using pushbutton.py or Pi Zero users have an option between using custom wakeword and GPIO trigerring. If custom wakeword is enabled, then GPIO trigger will not work. To enable GPIO triggering, set custom wakeword to ‘Disabled’.

Playing Spotify Playlist¶

Deezer On Fitbit

Note

  • Spotify API currently only supports playback in a web browser, but DRM content is being blocked in the Raspberry Pi.
  • As a roundabout approach, I have programmed the assistant to get the playlist details using Spotipy API and then fetch those tracks from YouTube. This custom program has a better accuracy than spotify playlist playback using mpsyt.
  • This feature uses a YouTube Data API v3.
  • Click here for guidelines to add YouTube Data API to the project and to generate the required key.
  1. Click here and register for a spotify developer account, if you already don’t have one.
  2. In the developer’s dashboard, choose CREATE A CLIENT ID. In the pop-up window provide the requested details.
  3. Click on the new app created and copy the CLIENT ID and CLIENT SECRET. Paste it in the config.yaml file in the indicated space.
  4. Access spotify here and copy the username to be entered in config.yaml.

Command Syntax:

To play your playlist:

Example:

Note

If your playlist name does not have the word playlist do not use that in the query.

Tracking Kickstarter Campaigns¶

A custom Google search engine for Kickstarter has been used. This requires an API to be added to your existing project.

Click here for guidelines to add Custom Search API to the project and to generate the required key.

Command Syntax:

To track a Kickstarter campaign:

Example:

Emulated Philips Hue Control¶

  1. Credits for the Emulated Hue to Marius Motea.

  2. Follow the guidelines given in the diyHue’s documents to setup the Emulated Hue Service.

  3. Download sketches for your NodeMCU/Wemos/ESP Devices from here.

  4. If the Hue config file is not in the default location, change the path to the Hue config file in the following lines of main.py script.

Command Syntax:

  1. To turn On/Off lights:

  2. To change light color:

  3. To change brightness:

Sending Voice Messages from Pi to Phone/Tablet¶

Note

For pushing voice messages, the GassistPi uses Pushbullet API.

  1. Download and install pushbullet app on your tablet/mobile device.
  2. Visit www.pushbullet.com register for new account or sign in with your existing account.
  3. Choose Settings–>Account and then choose Create access token.
  4. Copy this token and paste in config.yaml under Pushbullet and Pushbullet_API_KEY.

Command Syntax:

To send message:

Send SMS via Clickatell¶

  1. Create a free account with clickatell.com.
  2. Sign in to Clickatell SMS Platform.
  3. Create sms integration.
  4. Add your generated clickatell api number in config.yaml at the given point.

Command Syntax:

To send sms:

Get Recipe Messaged to Mobile/Tablet¶

Note

This feature uses the Pushbullet API for sending the recipes. Please first setup the Pushbullet feature as given here.

GassistPi uses Edamam for getting recipe details/info. To use this feature:
  1. Click here to visit the developers’ porta for Edamam.
  2. Signup as a developer/login with your existing account.
  3. In the Menubar at the top, Click on Dashboard–>Applications–>Create a new applicatiuon–>Recipe Search API and then create a new application.
  4. Copy the application id and application key and paste it in the actions.py script under the getrecipe function.

Note

While copying the application key, do not copy the “—”

Command Syntax:

To get recipes:

Control Magic Mirror by Voice¶

  1. You can control either Magic Mirror running on another Pi or Magic Mirror running on the same pi as GassistPi.
  2. As a prerequisite, you should have the remote control module installed in the Pi running Magic Mirror.
  3. Enter the Ip address of Pi running Magic Mirror in the config.yaml against the variable mmmip declared.

Command Syntax:

  1. To show/hide weather module:

  2. To turn magic mirror display on/off:

  3. To power off/reboot/restart Magic Mirror:

Indicators for Google Assistant’s Listening and Speaking Events¶

Note

Default GPIOs for the indicators are BCM GPIO05 and GPIO06. If you want to change the pins, change it in the config.yaml file.

Connect LEDs with colours of your choice to GPIO05 for Listening and GPIO06 for Speaking Events.

Pushbutton to Stop Music/Radio Playback and for Muting the Microphone¶

Note

Default GPIO for the pushbutton is BCM GPIO23. If you want to change the pins, change it in the config.yaml file.

Connect a pushbutton between GPIO23 and Ground. Single press mutes microphone and double press stops music streaming.

Voice Control of GPIOs, Servo Motor and Safe Shutdown of Pi¶

Note

  • This feature uses a combination of two keywords to prevent false positives. These can be changed in the keywords.yaml file.
  • The default main keyword is trigger.
  • The default keyword for servo motor control is servo.
  • The default keyword for safe shutdown is shutdown.
  • Names for devices connected to the GPIOs should be assigned in the config.yaml file.

Command Syntax:

  1. To turn device connected to GPIO on/off:

  2. To turn servo motor (example by 90 degrees):

  3. To power off the Pi:

Check out the demo in the video below:

Voice Control of NodeMCU¶

NodeMCU control has been implemented in two ways:

  1. Control of NodeMCU running a webserver.
  2. Control of NodeMCU running Sonoff-Tasmota Firmware.

Controlling NodeMCU Running Webserver¶

  1. Download the Arduino IDE code for Nodemcu from here.
  2. Add the wifi credentials, make the desired changes and upload the Arduino code onto the NodeMCU and get the IP address from the serial monitor.
  3. Add the NodeMCU’s IP address in the config.yaml under the ESP and IP.
  4. Set device names in the config.yaml under ESP and devicename.
  5. The default keyword for NodeMCU control is Wireless. You can change this in the keywords.yaml file.

Command Syntax:

To turn the device or ESP Pin on/off:

Controlling NodeMCU Running Sonoff-Tasmota Firmware¶

  1. Download the Tasmota firmware from this link.

Note

This is an old firmware. You can upgrade to the latest firmware from this one.

  1. Upload the firmware properly. You can use this video for reference.

  2. Set your Tasmota details in the under Tasmota_devicelist in config.yaml file.

Command Syntax:

To turn the Tasmota device on/off:

Casting YouTube Videos to Chromecast and Chromecast Control¶

Note

  • This feature uses a YouTube Data API v3. Click here for guidelines to add YouTube Data API to the project and to generate the required key.

  • The default keyword is Chromecast. You can change that in the main.py script at #if'chromecast'.lower()instr(usrcmd).lower():.

  • The IP address of Chromecast can be set in the actions.py file at:

  • Google has permitted the Chromecast control on its own. So this feature has been disabled. It can be enabled, if Google disables chromecast control in the future.

Command Syntax:

  1. To Play Video on Chromecast:

  2. To Stop Playback:

  3. To Change volume:

Controlling Media or Music Streaming by Voice¶

You can change volume, play, pause, change music/radio. Command syntaxes have been given below with the keyword within * symbols.

Command Syntax:

  1. To Pause:

  2. To Resume:

  3. To Increase/Decrease volume:

  4. To Set Volume:

  5. To Set Volume to Maximum/Minimum:

  6. To Change to Previous Track:

  7. To Change to Next Track:

Music Streaming from YouTube¶

  1. Music playback from YouTube is facilitated by the YouTube Data API v3.
  2. Click here for guidelines to add YouTube Data API to the project and to generate the required key.

Command Syntax:

  1. To Play a Song:

  2. To Play and Song and Related 10 Songs:

  3. To Play a Song from a Playlist:

  4. To Play 10 Songs from a Playlist:

  5. To Play a Song from a Channel:

  6. To Play 10 Songs from a Channel:

Note

Depending upon the internet and the system/board specification, the features that involve 10 tracks will take some time to fetch the track list.

Music Streaming from Google Music¶

..note:: Due to Google shutting down the Google Music service/app, the parts of codes pertaining to this feature have been commented out.

The music streaming from Google Music is facilitated by using gmusicapi.

First you need to authorize the api to access your Google Music data. Run the following script to authorize prior to starting the assistant.

Command Syntax:

  1. To Play All Songs in Loop:

  2. To Play a Playlist:

Note

Playlists are sorted by date created, if you have multiple playlists, use a similar syntax replacing first with second, third etc

  1. To Play Songs by a Particular Artist:

  2. To Play Songs from a Particular Album:

Run Custom Scripts¶

  1. By default, running custom scripts is disabled.
  2. To enable it, change Script_Control: in config.yaml from Disabled to Enabled.

Note

The number of script names mentioned should match the number of script commands in config.yaml.

Command Syntax:

To Run a Script:

Playing Radio Channels¶

Radio station names and the associated links are to be set in the config.yaml file

Deezer Config

Note

The number of radio station names mentioned should match the number of radio station links in config.yaml.

Command Syntax:

To Play a Radio Station:

Tracking Parcels¶

  1. Regsiter for a free account with Aftership.
  2. Generate an API number and add parcels to the tracking list.
  3. Add the API number in the actions.py file

For a better understanding follow the attached youtube video.

Command Syntax:

To Track Parcels:

RSS Feeds Streaming¶

Note

Deezer Configuracion

numfeeds variable within the feed function in actions.py file is the feed limit. Certain RSS feeds can have upto 60 items and numfeeds variable limits the number of items to stream. The default value has been set to 10, which if you want can change.

Command Syntax:

To Play Feeds:

Note

You can interrupt the feed playback using the Stop Pushbutton

KODI Control¶

Note

Deezer Community

By default, the KODI control is disabled. To enable, in the config.yaml, under kodi, change control option from ‘Disabled’ to ‘Enabled’.

  1. Music playback from YouTube is facilitated by the YouTube Data API v3.
  2. Click here for guidelines to add YouTube Data API to the project and to generate the required key.
  3. Enable HTTP COntrol in KODIi. Settings → Services → Control → Allow remote control via HTTP.ii. Set the port number to 8080, username to kodi and password to kodi (username and password should be in lowercase).
  4. For Kodi to play the YouTube video, you need to add and enable the YouTube Plugin on Kodi.

Command Syntax:

Deezer Configure

Command SyntaxWhat it does
Hey Google, Shuffle my songs on kodiShuffles all the songs added to the kodi library
Hey Google, Play songs from _Album name_ on kodiPlays all the songs under the mentioned Album name
Hey Google, Play songs by, _Artist name_ on kodiPlays all the songs rendered by the mentioned artist
Hey Google, Play _Song name_ song on kodiPlays the requested song, if it has been added to the library
Hey Google, Play _Movie name_ movie on kodiPlays the requested movie, if it has been added to the library
Hey Google, From YouTube, Play _Youtube Video_ on kodiFetches the YouTube video and plays it on kodi
Hey Google, What is playing? on kodiTells you by voice as to what is currently playing
Hey Google, Repeat this or Repeat one on kodiRepeats the current track playing
Hey Google, Repeat all on kodiChanges repeat mode to all
Hey Google, Repeat off on kodiTurns off Repeat
Hey Google, Turn Shuffle On on kodiTurns on shuffle mode
Hey Google, Turn Shuffle Off on kodiTurns off shuffle mode
Hey Google, Play Next on kodiPlays the next track
Hey Google, Play Previous on kodiPlays the previous track
Hey Google, Scroll a bit forward on kodiFast forwards a movie/music by a small amount
Hey Google, Scroll forward on kodiFast forwards a movie/track by a large margin
Hey Google, Scroll a bit backward on kodiRewinds a movie/track by a small amount
Hey Google, Scroll backward on kodiRewinds a movie/track by a large margin
Hey Google, Set volume _Between 0 and 100_ on kodiSets the volume to the mentioned number
Hey Google, Get volume on kodiTells you the current volume level by voice
Hey Google, Toggle mute on kodiEither mutes or unmutes, depending on mute status
Hey Google, Pause on kodiPauses the current video/track
Hey Google, Resume on kodiResumes playing the video/track
Hey Google, Stop on kodiStops playing and closes the player
Hey Goolge, goto _Home_ on kodiOpens the appropriate menu or window mentioned
Hey Goolge, goto _Settings_ on kodiOpens the settings menu or window
Hey Goolge, goto _Videos_ on kodiOpens the videos menu or window
Hey Goolge, goto _Weather_ on kodiOpens the weather menu or window
Hey Google, goto _Music_ on kodiOpens the music menu or window
Hey Google, Move Up on kodiMoves selection pointer up
Hey Google, Move Down on kodiMoves selection pointer down
Hey Google, Move Left on kodiMoves selection pointer left
Hey Google, Move Right on kodiMoves selection pointer right
Hey Google, Move Back on kodiGoes back, equivalent to esc key
Hey Google, Move Select on kodiMakes a selection, equivalent to enter key