shivasiddharth / GassistPi

Google Assistant for Single Board Computers
Other
1.02k stars 303 forks source link

API key not valid. Please pass a valid API key #1090

Closed dilkhush21 closed 3 years ago

dilkhush21 commented 3 years ago

IMPORTANT NOTICE
If you do not complete the template below it is likely that your issue will not be addressed. When providing information about your issue please be as extensive as possible so that it can be solved by as little as possible responses.

FAILURE TO COMPLETE THE REQUESTED INFORMATION WILL RESULT IN YOUR ISSUE BEING CLOSED

Which branch of GassistPi are you using ?

Board and OS details:

Open a terminal and run

cat /proc/cpuinfo  
cat /etc/os-release  
cat /etc/rpi-issue
Paste your Board and OS details here.   
processor   : 0
model name  : ARMv7 Processor rev 3 (v7l)
BogoMIPS    : 108.00
Features    : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0xd08
CPU revision    : 3

processor   : 1
model name  : ARMv7 Processor rev 3 (v7l)
BogoMIPS    : 108.00
Features    : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0xd08
CPU revision    : 3

processor   : 2
model name  : ARMv7 Processor rev 3 (v7l)
BogoMIPS    : 108.00
Features    : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0xd08
CPU revision    : 3

processor   : 3
model name  : ARMv7 Processor rev 3 (v7l)
BogoMIPS    : 108.00
Features    : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0xd08
CPU revision    : 3

Hardware    : BCM2711
Revision    : b03114
Serial      : 10000000a3bd3534
Model       : Raspberry Pi 4 Model B Rev 1.4

PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Raspberry Pi reference 2020-12-02
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, cce27bd6f44a3b2e83855645986b3e21f771e852, stage4

Describe the bug:

I have enabled the youtube api on google console and create an api in credential ,restriction is none and entered the api in conf file but ---------------
whenever i say" ok google play vande matarm from youtube " or any song name it  encounters error and says please chceck the logs
Here's the output:----------------------------------
stopping vlc
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
    version 1.25.10; written and copyright by Michael Hipp and others
    free software (LGPL) without any warranty but with best wishes

Directory: /tmp/

Terminal control enabled, press 'h' for listing of keys and functions.

Playing MPEG stream 1 of 1: female-say.mp3 ...

MPEG 2.0 L III cbr32 24000 mono

[0:01] Decoding of female-say.mp3 finished.
youtube on youtub
<HttpError 400 when requesting https://www.googleapis.com/discovery/v1/apis/youtube/v3/rest?key=%3D+AIzaSyBWECUdMuRNMtOLODVjq1SS0x1K-MttJow returned "API key not valid. Please pass a valid API key.". Details: "[{'@type': 'type.googleapis.com/google.rpc.ErrorInfo', 'reason': 'API_KEY_INVALID', 'domain': 'googleapis.com', 'metadata': {'service': 'youtube.googleapis.com'}}]">
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
    version 1.25.10; written and copyright by Michael Hipp and others
    free software (LGPL) without any warranty but with best wishes

Did you go through or search the issues section to check if your issue was already discussed (either currently open issues or closed issues)?

Yes/No Yes

2. Is the issue related to assistant installation ?

Yes/No No

If answer to question 2 is Yes, then attach the contents of terminal as a file or paste it below.

If answer to question 2 is No, then proceed further.

3. Does the assistant service start normally?

Yes/No no,manually start

4. Is the assistant service restarting automatically?

Yes/No NO

If answer to question 4 is Yes, then paste the contents of the terminal below.

If answer to question 4 is No, then proceed further.

Manually start the assistant. For guidelines to start the assistant manually refer this

Paste the command below, that crashed the assistant

Paste the contents of the terminal below

shivasiddharth commented 3 years ago

It is what it says. I am not sure as to how I can be of help if the key is invalid. Please double check the key that you have entered.

dilkhush21 commented 3 years ago
  1. what step should i follow to remove this error.In how many files should i give the api key rather than config key. please help me
  2. I am facing issue that whenever i try to import python3 supporting library in action.py file it says import module error
dilkhush21 commented 3 years ago

sorry i was referring to python2 library ,not python3

shivasiddharth commented 3 years ago

There is no way you are using python2 unless you have modified something. By default, GassistPi is in python3 environment. API key should be listed only in the config file. Paste the config file, i will take a look, but its not going to help much. Please double or triple check the API key creating process and the API key itself. Thats all I can say.

dilkhush21 commented 3 years ago

how to import adafuit_dht DHT22 sensor library in action.py file, when i import adafruit_dht in action.py file and manually start gassistpi using command /home/${USER}/env/bin/python -u /home/${USER}/GassistPi/src/main.py --project_id raspberry-pi-g-d6aa8 --device_model_id raspberry-pi-g-d6aa8-raspberrypi4-t8y7ht ,it shows------ import adafruit_dht ModuleNotFoundError: No module named 'adafruit_dht'

while 'import adafruit_dht' works in python3

shivasiddharth commented 3 years ago

You would have installed the python2 package and not the python3 version. This place is not for discussing your personal customisations. Please use gitter for that.

shivasiddharth commented 3 years ago

First get some clarity. One place you are saying that importing python3 works and in another place python2 works.

dilkhush21 commented 3 years ago

bro please help me regrading youtube api key is invalid, and i have sorted out other python 2 python 3 issue using activating env

dilkhush21 commented 3 years ago

please help me regrading youtube key invalid issue

shivasiddharth commented 3 years ago

I asked you to double check the API key from the cloud console and the API key that you have entered in the config file have you done that ?

Also I asked you to paste the config file here.

dilkhush21 commented 3 years ago

credential youtube api

I am attaching youtube api screenshot for your refrence

Config file for declaring custom actions'parameters. The parameters have been listed here in alphabetical order (A-Z).

Adafruit_IO. Sending commands from Genuine Google Home/Assistant Devices to control Domoticz Tasmota etc.

ADAFRUIT_IO: ADAFRUIT_IO_CONTROL: 'Disabled' ADAFRUIT_IO_USERNAME: 'ENTER YOUR ADAFRUIT_IO USERNAME HERE' ADAFRUIT_IO_KEY: 'ENTER YOUR ADAFRUIT_IO KEY HERE' FEEDNAME: 'ENTER YOUR ADAFRUIT_IO FEEDNAME THAT YOU WANT TO MONITOR HERE'

Custom conversation. Add your queries and expected assistant response. Do not add symbols or special charecters.

Conversation: Conversation_Control: 'Enabled' question: 1:

Send sms with clickatell

Clickatell: Clickatell_Control: 'Disabled' Clickatell_API: 'ENTER_YOUR_CLICKATELL_API' Name:

Deezer user credentials

Deezer: Deezer_Control: 'Enabled' User_id: '2247762504'

DIY-HUE declarations

DIYHUE: DIYHUE_Control: 'Enabled'

Domoticz declarations

Domoticz:

Set this to 'Enabled' to control devices registered to Domoticz server.

Domoticz_Control: 'Disabled' Server_IP:

If you are running the server on the Pi itself, then change the ip to 'localhost'

- '192.168.0.10'

Server_port:

ESP control declarations. Follow a similar pattern to add your own list.

ESP: ESP_Control: 'Enabled' IP: 'xxxxxxxxxxxx' #Enter your ESP's IP here. devicename:

Streaming songs from Gaana.com

Gaana: Gaana_Control: 'Enabled' Playlist:

Enter your desired playlists

- 'https://gaana.com/playlist/gaana-dj-bollywood-top-50-1'
- 'https://gaana.com/playlist/alka-yagnik-bday'

Enter your Google Login Credentials

Gmusicapi: Gmusic_Control: 'Enabled'

Pushbullet

Pushbullet: Pushbullet_Control: 'Enabled'

API Key for YouTube and Kickstarter Search Engine

Google_cloud_api_key: = "AIzaSyBWECUdMuRNMtOLODVjq1SS0x1K-MttJow"

GPIOS used in the project. Feel free to change in case.

Gpios: AIY_indicator:

KODI custom declarations change IP, music directory and video directory according to your device

Kodi: Kodi_Control: 'Disabled' ip: 192.168.88.226 port: 8080 username: kodi password: kodi musicdirectory: '/home/osmc/Music/' videodirectory: '/home/osmc/Movies/' windowcmd:

Change you language. Default is english

Language: Choice: 'en-US' Language options:

Enter your Magic Mirror IP

Mmmip: 'ENTER_YOUR_MAGIC_MIRROR_IP'

MQTT credentials

MQTT: MQTT_Control: 'Disabled' IP: 'Enter your MQTT IP ADDRESS here' UNAME: 'Enter your MQTT USERNAME here' PSWRD: 'Enter your MQTT PASSWORD here' TOPIC: 'ENTER your MQTT TOPIC here'

Text to speak notifications (replay after me workaround for mqtt).

You can change command word to something else if your command is mixed with native functions

Notify_TTS: Notify_TTS_Control: 'Enabled'

Pushbullet

Pushbullet: Pushbullet_API_KEY: 'ENTER YOUR PUSHBULLET KEY HERE' Pushbullet_Control: 'Enabled'

Radio station declarations. Follow a similar pattern to add your own stations.

Google may not pickup the pronunciation of radio station names, hence 'Radio 1' etc is required.

Radio_stations: Radio_Control: 'Enabled' stationnames:

Pi GPIO control declarations. Follow a similar pattern to add your own list of GPIOs

Raspberrypi_GPIO_Control: GPIO_Control: 'Enabled' lightnames:

Custom scripts. Add your scripts commands.

Script: Script_Control: 'Enabled' scriptname:

Speech to text conversion

Speechtotext: Google_Cloud_Speech: Cloud_Speech_Control: 'Disabled' Google_Cloud_Speech_Credentials_Path: "ENTER THE PATH TO YOUR CLOUD SPEECH CREDENTIALS FILE HERE"

Spotify credentials. Register for a spotify developer and get the credentials.

Spotify: Spotify_Control: 'Enabled' client_id: 'ENTER YOUR SPOTIFY CLIENT ID HERE' client_secret: 'ENTER YOUR SPOTIFY CLIENT SECRET HERE' username: 'ENTER YOUR SPOTIFY USERNAME HERE'

Enter your Tasmota Device details below

Tasmota_devicelist: Tasmota_Control: 'Enabled' friendly-names:

Text to speech conversation

TextToSpeech:

Set the choice to:

1. "gTTS" for quotaless text to speech conversion

2. "Google Cloud" for Google Cloud text to sppech conversion. Free limit 4 Million Characters/month

Choice: 'gTTS' Google_Cloud_TTS_Credentials_Path: "ENTER THE PATH TO YOUR TTS CREDENTIALS FILE HERE"

Voice for the "SAY" function or text to speech. Set it to 'Female' or 'Male' depending on your preference.

Note: This does not change Google's voice. this is only for the speech generated within custom actions.

Voice_Gender: 'Female'

Custom wakeword On/Off.

To enable custom wakeword, change status to Enabled and restart the assistant.

Wakewords: Ok_Google: 'Enabled' Custom_Wakeword: 'Enabled'

Set below to 'Picovoice' or 'Snowboy' as per your choice.

Wakeword_Engine: 'Snowboy' Snowboy_wakeword_models:

Wemo/Emulated Wemo devices

Wemo: Wemo_Control: 'Disabled' Wemo_Devices: IP_Address:

Youtube music streaming

YouTube: YouTube_Control: 'Enabled'

shivasiddharth commented 3 years ago

API Key for YouTube and Kickstarter Search Engine

Google_cloud_api_key: = "AIzaSyBWECUdMuRNMtOLODVjq1SS0x1K-MttJow"

I asked you to double check, triple check. Why do you have a "=" there in that line ?

Check the original config file. https://github.com/shivasiddharth/GassistPi/blob/cffe4a7fbb67fc1782f4d791db43f3690e01afdd/src/config.yaml#L99