Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Replace Yahoo weather API with OpenWeatherMap #56

Open
ahmadnassri opened this issue Mar 11, 2020 · 10 comments
Open

Replace Yahoo weather API with OpenWeatherMap #56

ahmadnassri opened this issue Mar 11, 2020 · 10 comments

Comments

@ahmadnassri
Copy link

ahmadnassri commented Mar 11, 2020

If you're running the "bleeding edge" version (i.e. from master branch ) it seems the weather widget is not working, due to needing an API key, which doesn't have a UI element to fill it's value yet, there is a workaround to get this functional ...

Here's how you can fix it:

  1. create an account (free, no payment needed) at https://home.openweathermap.org/
  2. create an API key: https://home.openweathermap.org/api_keys
  3. open the weather.ini file in an editor, and look for: #WeatherAppID#
  4. replace #WeatherAppID# with the key you got in step 3
  5. enjoy.

keep in mind, this is workaround, and by using the master branch you're running potentially unstable code :)

@BoscoDomingo
Copy link

I don't see the #WeatherAppID# field you mentioned in the latest release. Did you do additional changes to the files?

@marcopixel
Copy link
Owner

marcopixel commented Mar 11, 2020

It's because i didn't implement it 😅

I'll assume @ahmadnassri wanted to show me on how to implement OpenWeatherMap into the skin. Actually i was working on a prototype but since i didn't had much time until recently i've kinda forgot about it.

EDIT: I did upload the prototype to master it seems 😅 If you clone this repo and replace all files, you'll be able to get weather working again with the guide above. Keep in mind that this is actually an "workaround" since i'll probably rework this skin from scratch and this will be replaced by a better version in the future.

If you click on "Subscribe" on the right, you will be notified of any future changes/updates for this issue. :)

@ahmadnassri
Copy link
Author

ahmadnassri commented Mar 11, 2020

@marcopixel indeed, I'm running on master :)

and it seems to work nicely! also, yes, this is a temporary workaround, i'll update my note to reflect as much!

@forellenfilet
Copy link

Hey! Could someone give me a step by step tutorial? It seems i cant get my weather running whatsoever. How do i replace API with with open weather map?what you mean under " clone repo"? where should i replace my files? how do i make this work only for the weather? any codes just to copy could work?
Newbie here, please excuse me! :D thanks

@BoscoDomingo
Copy link

Hey! Could someone give me a step by step tutorial? It seems i cant get my weather running whatsoever. How do i replace API with with open weather map?what you mean under " clone repo"? where should i replace my files? how do i make this work only for the weather? any codes just to copy could work?
Newbie here, please excuse me! :D thanks

Backup everything on Rainmeter and then exit it.
Go to the "Code" section of this repository. Top right you should see a "clone" button. Click and then "Download ZIP". Save it and extract it to your Documents/Rainmeter/Skins folder (if you already had a previous version I suggest you rename it and append "-old" or whatever at the end, so you have an extra backup).
Open Rainmeter again. With the new one loaded you can do 2 things:

  1. Simply re-configure everything as you please with the in-built settings, or
  2. Open both the old and the new one's variables.ini (inside the folder "@Resources") and copy whatever variables you need from the old version.

After setting everything back up, go to the weather folder of the new version, and open weather.ini. In there, simply use the Find function (usually Ctrl + F) to locate the #WeatherAppID# string, and replace it with the new API key you generated (should be a bunch of letters and numbers). Save the file, refresh skin and voilá.

Note: Icons are not working for me, but temperature is, so it's better than nothing!

@forellenfilet
Copy link

Gonna get into it soon, thanks for the help! Ill let you know if it didnt work. 🗡️

@forellenfilet
Copy link

Hey, so me again. It is not working for some reason for me. What am I doing wrong?

I followed every step but no success. All i could achieve is instead of having that annoying "N/A" show, now my skin shows 0 degrees. Maybe the code for my place is missing? In the settings tab everything shows that the selected area is my city. Help!
My code in weather.ini

"[Rainmeter]
Group=SysDash | Weather
Update=10000
AccurateText=1
BackgroundMode=2
SolidColor=0,0,0,1

; = IMPORTANT =
; = For configuring the rainmeter skin, right-click the visualizer and click on "Open settings".
; = You can also open the variables.ini file located in:
; = "My Documents\Rainmeter\Skins\SysDash@Resources"

; Small context menu when you right-click the skin
ContextTitle=" Open settings"
ContextAction=[!ActivateConfig "#ROOTCONFIG#\Settings" "general.ini"]
ContextTitle2=" Open variables file"
ContextAction2=["#@#variables.ini"]

[Metadata]
Name=SysDash Dashboard
Author=marcopixel
License=MIT License
Information=An minimalistic, still stylish dashboard-like skin with modular components.

[Variables]
; Includes the variables used for the skin.
@include=#@#variables.ini
@include2=#@#include\MeterStyles.inc

; Measure to get the weather data and properly parse it
[MeasureCalcTemperatureUnit]
Measure=String
String=#WeatherTemperatureUnit#
IfMatch=C
IfMatchAction=[!SetVariable WeatherUnit "metric"][!EnableMeasure MeasureWeather]
IfMatch2=F
IfMatchAction2=[!SetVariable WeatherUnit "imperial"][!EnableMeasure MeasureWeather]
UpdateDivider=-1

[MeasureWeather]
Measure=Plugin
Plugin=WebParser
URL=http://api.openweathermap.org/data/2.5/weather?q=#WeatherLocation#&APPID=ba906b5ab4bcaff89f9c7f7783982783&mode=xml&units=#WeatherUnit#&lang=#WeatherLanguage#
RegExp=(?siU).(.)</country>..
UpdateRate=100
FinishAction=[!Update]
Disabled=1
DynamicVariables=1

[MeasureCurrentCity]
Measure=Plugin
Plugin=WebParser
URL=[MeasureWeather]
StringIndex=2
[MeasureCurrentIcon]
Measure=Plugin
Plugin=WebParser
URL=[MeasureWeather]
StringIndex=10
Substitute="":"na"
[MeasureCurrentCode]
Measure=Plugin
Plugin=WebParser
URL=[MeasureWeather]
StringIndex=8
Substitute="":"na"
[MeasureCurrentTemp]
Measure=Plugin
Plugin=WebParser
URL=[MeasureWeather]
StringIndex=4
[MeasureTempString]
Measure=Calc
Formula=[MeasureCurrentTemp]
DynamicVariables=1
Substitute="":"N/A"
[MeasureCurrentDesc]
Measure=Plugin
Plugin=WebParser
URL=[MeasureWeather]
StringIndex=9

[MeterWeatherIcon]
Meter=Image
MeasureName=MeasureCurrentIcon
Path=#@#images\weather
X=(#Margin##Scale#)
Y=(20
#Scale#)
W=(40*#Scale#)
H=(40*#Scale#)
Padding=0,0,0,(20*#Scale#)
ImageTint=#MainColor#
ImageCrop=-30,-30,61,61,5

[MeterWeatherTempText]
Meter=String
MeasureName=MeasureTempString
MeterStyle=StyleValue
X=(15*#Scale#)R
Y=((80/2)#Scale#)
W=((#Width#-170)
#Scale#)
ClipString=2
Postfix=[\x00B0]
NumOfDecimals=0

[MeterWeatherCityText]
Meter=String
MeasureName=MeasureCurrentCity
MeterStyle=StyleSecondary
X=((#Width#+#Margin#)#Scale#)
Y=(30
#Scale#)
W=((#Width#-170)*#Scale#)
ClipString=2
InlineSetting4=Color | #FontColor#,255
[MeterWeatherDescText]
Meter=String
MeasureName=MeasureCurrentDesc
MeterStyle=StyleSecondary
X=0r
Y=0R
"

@badgerisop
Copy link

Anyone figure out how to get the weather icon working w/ Open Weather? You can see it briefly pop up before disappearing so seems like it should be fixable.

@MeloriTensei
Copy link

Note: Icons are not working for me, but temperature is, so it's better than nothing!

You may call me an idiot if I got something wrong but something got me wondering. For someone who can't code from scratch but can read and edit. I found that editing this section of weather.ini...

[MeasureCurrentIcon]
Measure=Plugin
Plugin=WebParser
URL=[MeasureWeather]
StringIndex=10
Substitute="":"na"   <====HERE

to add more substitutions to adopt the new icon code could be a good temporary fix while still using the same icon set you have in "@Resources"....

[MeasureCurrentIcon]
Measure=Plugin
Plugin=WebParser
URL=[MeasureWeather]
StringIndex=10
Substitute="01d":"32","01n":"31","02d":"28","02n":"27","03d":"26","03n":"26","04d":"19","04n":"19","09d":"13","09n":"13","10d":"17","10n":"17","11d":"37","11n":"37","13d":"25","13n":"25","50d":"19","50n":"19","":"na"

@frguerin
Copy link

weather.OpenWeatherMap.ini.zip
working fine thanks to above help. You can edit to change language and temperatures unit

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants