n0bel / PiClock

A Fancy Clock built around a monitor and a Raspberry Pi
MIT License
566 stars 182 forks source link

API’s not working. #120

Closed grayeagle57 closed 5 years ago

grayeagle57 commented 5 years ago

I did this project 2 years ago. Lately the map and radar section haven’t been working. I attempted the updated build but ran into issues where API keys are installed. I am not familiar with python or writing code. Having said that, I probably do not understand the instructions for putting the keys into the file. I put them in between the quotation marks as indicated. Nothing happens. So Any help would be appreciated in helping me to get this fantastic clock working again

n0bel commented 5 years ago

I'll give you some general things.

  1. Check the log. Maybe there are some hints there.

    cd PiClock/Clock
    cat PyQtPiClock.1.log
  2. Review the update instructions. https://github.com/n0bel/PiClock/blob/master/Documentation/Install.md#updating-to-newerupdated-versions

  3. Review the instructions for setting up API Keys. https://github.com/n0bel/PiClock/blob/master/Documentation/Install.md#configure-the-piclock-api-keys

  4. Possibly start over with a new api key file.

    cd PiClock/Clock
    cp cp ApiKeys-example.py ApiKeys.py
    nano ApiKeys.py

    Put in your API keys as indicated. A sample completed ApiKeys.py file might look like the following. Note that the keys given won't work, they are just examples. Note that I omitted the Google Maps API since this example uses Mapbox. So its just an empty string (two single quotes)

    #change this to your API keys
    # DarkSky API key
    dsapi = '498135d8b3c3f7c8d02fc12c8ac01b55f257c176'
    # Map API keys -- only needs 1 of the following
    # Google Maps API key (if usemapbox is not set in Config)
    googleapi = ''
    # Mapbox API key (access_token) [if usemapbox is set in Config]
    mbapi = 'pk.VBTLUhMbnDuxdzXfJHlgCGpqkviQOjWtryYcIRNsmAZawFSPKoJHlgCGpqkviQOj.MbnDuxdzX'
  5. The last set of changes were made on December 26th. Most are minor. One had to do with the 'satellite' flag, which is now removed but was causing some people some issues. If you've not updated to the latest version, you'll want to do that.

Hope this helps.

grayeagle57 commented 5 years ago

Well I have the clock, radar looks like it’s trying to work , but no maps or weather data.

Sent from my iPad

On Jan 6, 2019, at 11:47 AM, Kevin Uhlir notifications@github.com<mailto:notifications@github.com> wrote:

I'll give you some general things.

  1. Check the log. Maybe there are some hints there.

cd PiClock/Clock cat PyQtPiClock.1.log

  1. Review the update instructions. https://github.com/n0bel/PiClock/blob/master/Documentation/Install.md#updating-to-newerupdated-versions

  2. Review the instructions for setting up API Keys. https://github.com/n0bel/PiClock/blob/master/Documentation/Install.md#configure-the-piclock-api-keys

  3. Possibly start over with a new api key file.

cd PiClock/Clock cp cp ApiKeys-example.py ApiKeys.py nano ApiKeys.py

Put in your API keys as indicated. A sample completed ApiKeys.py file might look like the following. Note that the keys given won't work, they are just examples. Note that I omitted the Google Maps API since this example uses Mapbox. So its just an empty string (two single quotes)

change this to your API keys

DarkSky API key

dsapi = '498135d8b3c3f7c8d02fc12c8ac01b55f257c176 '

Map API keys -- only needs 1 of the following

Google Maps API key (if usemapbox is not set in Config)

googleapi = ''

Mapbox API key (access_token) [if usemapbox is set in Config]

mbapi = 'pk.VBTLUhMbnDuxdzXfJHlgCGpqkviQOjWtryYcIRNsmAZawFSPKoJHlgCGpqkviQOj.MbnDuxdzX'

  1. The last set of changes were made on December 26th. Most are minor. One had to do with the 'satellite' flag, which is now removed but was causing some people some issues. If you've not updated to the latest version, you'll want to do that.

Hope this helps.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/n0bel/PiClock/issues/120#issuecomment-451756025, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AXMPY9mlz6NVmEKDgT3bgbBD11_56QJuks5vAiiXgaJpZM4ZyQ2F.

togatown commented 5 years ago

Did you sign up for the two new APIs?

DarkSky has replaced Weather Underground and Mapbox has replaced Google Maps https://darksky.net/dev https://www.mapbox.com/signup/

If you haven't heavily customized the clock, I would rename the PiClock folder and start again with a fresh install instead of an update.

Since you've already had it running once, skip right to the Get the PiClock Software section.

Then skip to the Configure the PiClock api keys section DarkSky is required. Google Maps and Mapbox or an either/or, choose one but I would use Mapbox.

Then jump down to the Configure your PiClock section

You should be able to skip the rest. This should at least get you running and then you can change options in your config to match your old one in the renamed folder. You may find it more comfortable to edit the apikeys and config files in a text editor instead of the nano command line editor. Check out this link

grayeagle57 commented 5 years ago

After I put the API keys into the file, what’s supposed to happen? When I do that do then go straight to “configure “? Either way nothing happens. If I close the file editor and then go to “configure”, doesn’t that erase the API’s?

Sent from my iPad

On Jan 8, 2019, at 10:26 AM, togatown notifications@github.com<mailto:notifications@github.com> wrote:

Did you sign up for the two new APIs?

DarkSky has replaced Weather Underground and Mapbox has replaced Google Maps https://darksky.net/dev https://www.mapbox.com/signup/

If you haven't heavily customized the clock, I would rename the PiClock folder and start again with a fresh install instead of an update.

Since you've already had it running once, skip right to the Get the PiClock Softwarehttps://github.com/n0bel/PiClock/blob/master/Documentation/Install.md#get-the-piclock-software section.

Then skip to the Configure the PiClock api keyshttps://github.com/n0bel/PiClock/blob/master/Documentation/Install.md#configure-the-piclock-api-keys section DarkSky is required. Google Maps and Mapbox or an either/or, choose one but I would use Mapbox.

Then jump down to the Configure your PiClockhttps://github.com/n0bel/PiClock/blob/master/Documentation/Install.md#configure-your-piclock section

You should be able to skip the rest. This should at least get you running and then you can change options in your config to match your old one in the renamed folder. You may find it more comfortable to edit the apikeys and config files in a text editor instead of the nano command line editor. Check out this linkhttps://itsfoss.com/notepad-alternatives-for-linux/

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/n0bel/PiClock/issues/120#issuecomment-452338294, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AXMPY6vxG4l82mDj6tH5lPMlNY0isA38ks5vBLiigaJpZM4ZyQ2F.

togatown commented 5 years ago

After I put the API keys into the file, what’s supposed to happen?

Did you start from scratch by shutting down the clock, renaming the PiClock folder and getting a fresh copy or are you still working from the updated copy?

If I close the file editor and then go to “configure”, doesn’t that erase the API’s?

Are you using the nano command line editor to put the API keys in? If so, are you saving the file before exiting?

grayeagle57 commented 5 years ago

I started from scratch; a new image of Raspbian Stretch. Then followed the instructions from github. Still no joy.

Sent from my iPad

On Jan 10, 2019, at 11:18 AM, togatown notifications@github.com<mailto:notifications@github.com> wrote:

After I put the API keys into the file, what’s supposed to happen?

Did you start from scratch by shutting down the clock, renaming the PiClock folder and getting a fresh copy or are you still working from the updated copy?

If I close the file editor and then go to “configure”, doesn’t that erase the API’s?

Are you using the nano command line editor to put the API keys in? If so, are you saving the file before exiting?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/n0bel/PiClock/issues/120#issuecomment-453155406, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AXMPY5t4jL_iwGCLhxmHJOIHonX7YxMnks5vB2e3gaJpZM4ZyQ2F.

togatown commented 5 years ago

Check my profile and send me an email. It'll be easier to communicate

n0bel commented 5 years ago

The best place to start is to see what is showing errors in the log file, as given in the first comment.

It can also log to the terminal as shown in the instructions here: https://github.com/n0bel/PiClock/blob/master/Documentation/Install.md#run-it

n0bel commented 5 years ago

@togatown Thanks for the help!

grayeagle57 commented 5 years ago

I'm sorry I just don't know how to do that.

From: togatown [mailto:notifications@github.com] Sent: Saturday, January 12, 2019 3:17 PM To: n0bel/PiClock Cc: grayeagle57; Author Subject: Re: [n0bel/PiClock] API’s not working. (#120)

Check my profile and send me an email. It'll be easier to communicate

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/n0bel/PiClock/issues/120#issuecomment-453777788, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AXMPY7pHMJeYDHR8tNDs_eIDQSBN2xnVks5vCkKjgaJpZM4ZyQ2F.

grayeagle57 commented 5 years ago

This is what I found: libpng warning: known incorrect sRGB profile. Also: ValueError: NO JSON object could be decoded. Let me emphasize that I really appreciate your help. But I know nothing about Python or writing/ understanding code. From: Kevin Uhlir [mailto:notifications@github.com] Sent: Saturday, January 12, 2019 5:56 PM To: n0bel/PiClock Cc: grayeagle57; Author Subject: Re: [n0bel/PiClock] API’s not working. (#120)

The best place to start is to see what is showing errors in the log file, as given in the first comment.

It can also log to the terminal as shown in the instructions here: https://github.com/n0bel/PiClock/blob/master/Documentation/Install.md#run-it

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/n0bel/PiClock/issues/120#issuecomment-453787302, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AXMPY8sOXOH3wufjjhOObYKo_t6HZxewks5vCmgYgaJpZM4ZyQ2F.

n0bel commented 5 years ago

There should be more in the log file..
NO JSON object could be decoded. Its either a problem with your api key for darksky or a problem with your latitude and longitude for the current conditions. Just above the error, you'll see a url to darksky.net. It'll be best if we can see that. Hide/scramble the portion that shows the api key.

grayeagle57 commented 5 years ago

https://api.darksky.net/forecast/YOUR DARK SKY KEY/44.9764016, -93.2486732?units=us&lang=en&r=0.436586280869 This is what I’mseeing.

Sent from my iPad

On Jan 12, 2019, at 7:31 PM, Kevin Uhlir notifications@github.com<mailto:notifications@github.com> wrote:

There should be more in the log file.. NO JSON object could be decoded. Its either a problem with your api key for darksky or a problem with your latitude and longitude for the current conditions. Just above the error, you'll see a url to darksky.nethttp://darksky.net. It'll be best if we can see that. Hide/scramble the portion that shows the api key.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/n0bel/PiClock/issues/120#issuecomment-453792011, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AXMPY9mAzN4hXuy8suYVLWyQQGUKRNBDks5vCn57gaJpZM4ZyQ2F.

togatown commented 5 years ago

Pasting the URL into a browser and subbing in my API key works. I did notice you are using the default coordinates from the config file which leads me to believe that you are not saving your files properly after editing them unless you are coincidentally in the same exact location the config was setup for!

I can only assume from your posts that you are using the nano command line editor to alter the config and apikeys files like this:

nano ApiKeys.py

and

nano Config.py

I don't think you are saving the files after editing them. After making your edits, press Ctrl+o and then Enter to save the files. Then use Ctrl+x to exit the editor.

You could also use the File Browser on the Pi, the Folder Icon next to the Raspberry in the top left corner of the screen, to browse to home > pi > PiClock > Clock and double click on the ApiKeys.py and Config.py files to edit them in and GUI based editor instead of using the 'nano' command to edit them. This may be more comfortable to you as it will be more like Windows or OSx which you probably are more familiar with.

grayeagle57 commented 5 years ago

Where should I get the coordinates?

From: togatown [mailto:notifications@github.com] Sent: Saturday, January 12, 2019 10:03 PM To: n0bel/PiClock Cc: grayeagle57; Author Subject: Re: [n0bel/PiClock] API’s not working. (#120)

Pasting the URL into a browser and subbing in my API key works. I did notice you are using the default coordinates from the config file which leads me to believe that you are not saving your files properly after editing them unless you are coincidentally in the same exact location the config was setup for!

I can only assume from your posts that you are using the nano command line editor to alter the config and apikeys files like this:

nano ApiKeys.py

and

nano Config.py

I don't think you are saving the files after editing them. After making your edits, press Ctrl+o and then Enter to save the files. Then use Ctrl+x to exit the editor.

You could also use the File Browser on the Pi, the Folder Icon next to the Raspberry in the top left corner of the screen, to browse to home > pi > PiClock > Clock and double click on the ApiKeys.py and Config.py files to edit them in and GUI based editor instead of using the 'nano' command to edit them. This may be more comfortable to you as it will be more like Windows or OSx which you probably are more familiar with.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/n0bel/PiClock/issues/120#issuecomment-453797896, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AXMPY_Ci-seAiUpbFDODu-tK0SQQhN2aks5vCqHJgaJpZM4ZyQ2F.

grayeagle57 commented 5 years ago

Found a website to get the coordinates. All is well. Thank you immensely for your help and guidance. Love this clock.

From: togatown [mailto:notifications@github.com] Sent: Saturday, January 12, 2019 10:03 PM To: n0bel/PiClock Cc: grayeagle57; Author Subject: Re: [n0bel/PiClock] API’s not working. (#120)

Pasting the URL into a browser and subbing in my API key works. I did notice you are using the default coordinates from the config file which leads me to believe that you are not saving your files properly after editing them unless you are coincidentally in the same exact location the config was setup for!

I can only assume from your posts that you are using the nano command line editor to alter the config and apikeys files like this:

nano ApiKeys.py

and

nano Config.py

I don't think you are saving the files after editing them. After making your edits, press Ctrl+o and then Enter to save the files. Then use Ctrl+x to exit the editor.

You could also use the File Browser on the Pi, the Folder Icon next to the Raspberry in the top left corner of the screen, to browse to home > pi > PiClock > Clock and double click on the ApiKeys.py and Config.py files to edit them in and GUI based editor instead of using the 'nano' command to edit them. This may be more comfortable to you as it will be more like Windows or OSx which you probably are more familiar with.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/n0bel/PiClock/issues/120#issuecomment-453797896, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AXMPY_Ci-seAiUpbFDODu-tK0SQQhN2aks5vCqHJgaJpZM4ZyQ2F.