It is currently March 28th, 2024, 10:02 pm

Weather about to break Kaelri's Enigma skin (again)?

Get help with creating, editing & fixing problems with skins
Bubble.gum
Posts: 2
Joined: January 1st, 2019, 12:52 am

Weather about to break Kaelri's Enigma skin (again)?

Post by Bubble.gum »

A while back I noticed that the weather on Kaelri's Enigma skin (https://www.kaelri.com/project/enigma/) was broken. The reason was because Yahoo was requiring requiring OAuth authentication, or something like that. Cokefriend on reddit posted a fix for this that I used to get weather working again and this fix worked for me (https://www.reddit.com/r/Rainmeter/comments/4ggr2v/just_fixed_the_weather_api_problem_not_a_skin_dev/). I have installed rainmeter and enigma on a new system and when I went to follow Cokefriend's reddit instructions to get weather working I noticed that I could not use the yahoo developer tools at this link: https://developer.yahoo.com/weather/ . It looks like they are retiring the existing api infrastrucure, or something, on January the third, in fact. It looks like you have to apply to use their api now? Am I going to have to apply to use their api in order to get weather on Kaelri's enigma working again or is there some other workaround?
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Weather about to break Kaelri's Enigma skin (again)?

Post by eclectic-tech »

Converting Enigma Weather skins to use Weather.com

VARIABLE CHANGES
You need to manually change some weather variables in the 'Enigma\@Resources\User\Options.inc' file because the Yahoo lookup skin is not working.

1.) You need to set the 'WeatherCode' variable to your zipcode or your Weather.com code; e.g; UKXX0085 is the code for London UK.

2.) Change the 'World1WeatherCode' to the code for your 1st world city. Repeat for the 2nd and 3rd cities. You can add the other details manually if desired: Name, Lat, Lon, etc.

3.) The 'Unit' variable needs to be set; set the value to m for celsius(metric) or i for fahrenheit(imperial).

REPLACING YAHOO WEATHER MEASURES FILE
All weather skins use this same included file for data; so replacing it should get all of them working.

This can be done by replacing the 'YahooWeather.inc' file that is located in the 'Enigma\@Resources\Measures' folder with the code below.

If you want to undo this, you should copy the original file to another location, or rename it before saving this code as 'YahooWeather.inc'.

YahooWeather.inc

Code: Select all

; Modified to use WXData from Weather.com by Eclectic Tech Jan 7, 2019
[MeasureYahooWeather]
Measure=Plugin
Plugin=WebParser
Url=https://wxdata.weather.com/wxdata/weather/local/#CurrentCode#?cc=*&unit=#unit#&dayf=6
RegExp="(?siU)<ut>(.*)</ut>.*<ud>(.*)</ud>.*<us>(.*)</us>.*<up>(.*)</up>.*<ur>(.*)</ur>.*<lat>(.*)</lat>.*<lon>(.*)</lon>.*<zone>(.*)</zone>.*<lsup>(.*)</lsup>.*<obst>(.*)</obst>.*<tmp>(.*)</tmp>.*<flik>(.*)</flik>.*<t>(.*)</t>.*<icon>(.*)</icon>.*<r>(.*)</r>.*<d>(.*)</d>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<d>(.*)</d>.*<t>(.*)</t>.*<hmid>(.*)</hmid>.*<vis.(.*)</vis>.*<i>(.*)</i>.*<t>(.*)</t>.*<dewp>(.*)</dewp>.*<icon>(.*)</icon>.*<t>(.*)</t>.*<dayf>.*<day d="0" t="(.*)" dt="(.*)">.*<hi>(.*)</hi>.*<low>(.*)</low>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>.*<icon>(.*)</icon>.*<t>(.*)</t>.*<day d="1" t="(.*)" dt="(.*)">.*<hi>(.*)</hi>.*<low>(.*)</low>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>.*<icon>(.*)</icon>.*<t>(.*)</t>.*<day d="2" t="(.*)" dt="(.*)">.*<hi>(.*)</hi>.*<low>(.*)</low>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>.*<icon>(.*)</icon>.*<t>(.*)</t>.*<day d="3" t="(.*)" dt="(.*)">.*<hi>(.*)</hi>.*<low>(.*)</low>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>.*<icon>(.*)</icon>.*<t>(.*)</t>.*<day d="4" t="(.*)" dt="(.*)">.*<hi>(.*)</hi>.*<low>(.*)</low>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>.*<icon>(.*)</icon>.*<t>(.*)</t>.*<day d="5" t="(.*)" dt="(.*)">.*<hi>(.*)</hi>.*<low>(.*)</low>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>.*<icon>(.*)</icon>.*<t>(.*)</t>.*"
ErrorString="woops"
UpdateRate=1800

;-----------------------
; LOCATION

[MeasureWeatherCity]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=10
RegExpSubstitute=1
Substitute="^(.*), (.*), (.*)$":"\1"

[MeasureWeatherRegion]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=10
RegExpSubstitute=1
Substitute="^(.*), (.*), (.*)$":"\2"

[MeasureWeatherCountry]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=10
RegExpSubstitute=1
Substitute="^(.*), (.*), (.*)$":"\3"

;-----------------------
; UNITS

[MeasureWeatherUnitTemp]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=1

[MeasureWeatherUnitDistance]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=2

[MeasureWeatherUnitPressure]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=4

[MeasureWeatherUnitSpeed]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=3

;-----------------------
; WIND

[MeasureWeatherWindChill]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=12

[MeasureWeatherWindDirection]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=19

[MeasureWeatherWindDirectionCardinal]
Measure=Calc
Formula=FLOOR(((MeasureWeatherWindDirection/11.25)+1.5) < 33 ? ((MeasureWeatherWindDirection/11.25)+1.5) : ((MeasureWeatherWindDirection/11.25)+1.5)-32)
Substitute="10":"EbS","11":"ESE","12":"SEbE","13":"SE","14":"SEbS","15":"SSE","16":"SbE","17":"S","18":"SbW","19":"SSW","20":"SWbS","21":"SW","22":"SWbW","23":"WSW","24":"WbSW","25":"W","26":"WbN","27":"WNW","28":"NWbW","29":"NW","30":"NWbN","31":"NNW","32":"NbW","1":"N","2":"NbE","3":"NNE","4":"NEbN","5":"NE","6":"NEbE","7":"ENE","8":"EbN","9":"E"

[MeasureWeatherWindSpeed]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=17

;-----------------------
; ATMOSPHERE

[MeasureWeatherAtmoHumidity]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=21

[MeasureWeatherAtmoVisibility]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=22

[MeasureWeatherAtmoPressure]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=15

[MeasureWeatherAtmoRising]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=16

;--------------------------------
; SUN

[MeasureWeatherSunrise]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=31

[MeasureWeatherSunset]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=32

;--------------------------------
; REGION

[MeasureWeatherTimeZone]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=8

[MeasureWeatherLatitude]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=6

[MeasureWeatherLongitude]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=7


;--------------------------------
; CURRENT

[MeasureWeatherDesc]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=13

[MeasureWeatherIcon]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=14

[MeasureWeatherTemp]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=11

;-------------------------
; DAY 2

[MeasureWeatherDay2Date]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=36
;Substitute="Sun":"Sunday","Mon":"Monday","Tue":"Tuesday","Wed":"Wednesday","Thu":"Thursday","Fri":"Friday","Sat":"Saturday"

[MeasureWeatherDay2Low]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=39

[MeasureWeatherDay2High]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=38

[MeasureWeatherDay2Average]
Measure=Calc
Formula=ROUND((MeasureWeatherDay2Low+MeasureWeatherDay2High)/2)

[MeasureWeatherDay2Desc]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=43

[MeasureWeatherDay2Icon]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=42

;-------------------------
; DAY 3

[MeasureWeatherDay3Date]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=44
;Substitute="Sun":"Sunday","Mon":"Monday","Tue":"Tuesday","Wed":"Wednesday","Thu":"Thursday","Fri":"Friday","Sat":"Saturday"

[MeasureWeatherDay3Low]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=47

[MeasureWeatherDay3High]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=46

[MeasureWeatherDay3Average]
Measure=Calc
Formula=ROUND((MeasureWeatherDay3Low+MeasureWeatherDay3High)/2)

[MeasureWeatherDay3Desc]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=51

[MeasureWeatherDay3Icon]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=50

;-----------------------
; LOGO
; Weather.com requires that any application which uses their API include the logo and a link to their website. This section will automatically insert those elements into any skin which uses this measure module. Please do not remove these elements if you are redistributing this file with your own skin.

[YahooWeatherLogo]
Meter=IMAGE
MeterStyle=Style#Variant#Icon
Group=EnigmaMouseover
ImageName=#@#Images\MoxaWeather\Logo.png
H=25
W=25
Hidden=1
LeftMouseUpAction=["http://weather.com/"][!Redraw]
ToolTipText=Powered by Weather.com
WORLD TIMEZONE FIX
The world times are not being displayed properly due to changes at the original site to get timezone info. You can correct this by Replacing one measure in the two (Taskbar/Sidebar versions) 'world.inc' files.

Open 'Enigma\Taskbar\World\World.inc' file and replace the [MeasureTimeZone] section with the section code below. Do the same for the 'Enigma\Sidebar\World\World.inc' file (replace the same section).

Code: Select all

[MeasureTimeZone]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=8

; [MeasureTimeZone]
; Measure=Plugin
; Plugin=WebParser
; UpdateRate=3600
; Url=http://ws.geonames.org/timezone?lat=#CurrentCodeLat#&lng=#CurrentCodeLon#
; RegExp=<gmtOffset>(.*)</gmtOffset>
; StringIndex=1
Lastly, it would be good to replace the Yahoo Logo with The Weather Channel Logo. The image is stored at 'Enigma\@Resources\Images\MoxaWeather\logo.png'.

Here is TWC logo image:
Logo.png
enigmaweather2.png
If you follow this guide, all the variant weather skin should be working pretty well.
I am not responsible for anything you mess up... back things up if you are unsure about changes. :great:

Addendum
The Weather.com visibility measure is in distance (not percentage), so to display the distance measure correctly, you need to modify 'Enigma\Sidebar\Weather\Weather.inc'.

Locate the [AtmoVisibility] section in that skin and replace it with the code below.

Code: Select all

[AtmoVisibility]
Meter=STRING
MeasureName=MeasureWeatherAtmoVisibility
MeasureName2=MeasureWeatherUnitDistance
MeterStyle=StyleWeather#Variant#Text | StyleWeather#Variant#TextSub
Text=%1 %2
;Postfix="%"
EDIT: In the [MeasureYahooWeather] section of 'YahooWeather.inc', I changed the Webparser plugin syntax so it will work with older versions of Rainmeter.
You do not have the required permissions to view the files attached to this post.
Bubble.gum
Posts: 2
Joined: January 1st, 2019, 12:52 am

Re: Weather about to break Kaelri's Enigma skin (again)?

Post by Bubble.gum »

Hey, thanks for your help. I followed all of your steps but unfortunately I still can't get it to work. I checked the log and there are errors associated with the world and weather ini files which say: "Measure="WebParser is no valid in [MeasureYahooWeather]." Do you have any idea what the problem might be. I double checked that I followed all the steps and don't see what I could have done wrong.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weather about to break Kaelri's Enigma skin (again)?

Post by balala »

Bubble.gum wrote: January 3rd, 2019, 6:33 am I followed all of your steps but unfortunately I still can't get it to work. I checked the log and there are errors associated with the world and weather ini files which say: "Measure="WebParser is no valid in [MeasureYahooWeather]." Do you have any idea what the problem might be. I double checked that I followed all the steps and don't see what I could have done wrong.
Probably you're using an older Rainmeter version. I think this, because WebParser became a measure not too much ago, before, it was a plugin. Based on your post it seems the error is related only to the [MeasureYahooWeather] measure, not to the others, too, which are used as Plugin measures. If I'm right, try to either upgrade your Rainmeter to the newest version, or to replace the Measure=WebParser option in [MeasureYahooWeather] measure with:

Code: Select all

[MeasureYahooWeather]
Measure=Plugin
Plugin=WebParser
...
(anyway I recommend to upgrade your Rainmeter).
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Weather about to break Kaelri's Enigma skin (again)?

Post by eclectic-tech »

Balala beat me with the answer...
I modified the code in the first post so it works for older versions. :thumbup:

See this post for details
User avatar
Knightmare
Posts: 8
Joined: January 6th, 2019, 8:34 am

Re: Weather about to break Kaelri's Enigma skin (again)?

Post by Knightmare »

eclectic-tech wrote: January 1st, 2019, 5:50 am Converting Enigma Weather skins to use Weather.com

VARIABLE CHANGES
You need to manually change some weather variables in the 'Enigma\@Resources\User\Options.inc' file because the Yahoo lookup skin is not working.

1.) You need to set the 'WeatherCode' vari...
Thank you so much for the guide! I made the switch and everything looks good so far. I only have a couple of minor issues that I hope you got an answer for; is there a way to edit the city names on world clocks (as there seems to be more text than required in the name field), the other minor issue is related to the sidebar weather, where it is showing Day 2 as today (Sunday) -instead of tomorrow-, and Day 3 as tomorrow -instead of after tomorrow-.

Thank you again for the guide!

p.s. i attached a couple of screenshots
You do not have the required permissions to view the files attached to this post.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Weather about to break Kaelri's Enigma skin (again)?

Post by eclectic-tech »

Knightmare wrote: January 6th, 2019, 9:15 am ... I only have a couple of minor issues that I hope you got an answer for; is there a way to edit the city names on world clocks (as there seems to be more text than required in the name field)
The names are the weather site names from weather.com (not just the city); e.g.: NYC/Central Park, New York, US ... I use RegExpSubstitute on that value to return the City, Region, and Country in separate child measures. If the site name is long it will be clipped by the skin.

You should be able to find the meter for the city display and modify it to use any portion of those returned values or use a different one.
Knightmare wrote: January 6th, 2019, 9:15 amthe other minor issue is related to the sidebar weather, where it is showing Day 2 as today (Sunday) -instead of tomorrow-, and Day 3 as tomorrow -instead of after tomorrow-.

Thank you again for the guide!
You caught me! :o
I inadvertently used Today's index values. I modified the code above for YahooWeather.inc to show the proper conditions for Day 2 and Day 3. The only change I made was to increased the index numbers for Day2 and Day3 measures to properly show the info.

Simply save the modified YahooWeather.inc code in the above post and save it as before.

Thanks for catching that! :thumbup:
enigmaweather3.png
For Reference in Modifying Yahoo weather skins, the spoiler contains a list of the Index number and value returned by the RegExp used in the [MeasureYahooWeather] measure.

Code: Select all

; 1=temp unit
; 2=dist unit
; 3=speed unit
; 4=pressure unit
; 5=barometer unit
; 6=latitude
; 7=longitude
; 8=timezone
; 9=update date
; 10=city, region, country
; 11=current temp
; 12=Feel Like
; 13=condition
; 14=condition icon
; 15=barometer
; 16=Barometer state
; 17=Wind Speed
; 18=Gusts
; 19=Degrees Direction
; 20=Compass Direction
; 21=Humidity
; 22=Visibility
; 23=UV
; 24=Pollen
; 25=Dew Point
; 26=Moon Icon
; 27=Moon Phase Text
; 28=Today's Weekday
; 29=Short Month and Day (Jan 5)
; 30=Today's High Temp
; 31=Today's Low Temp
; 32=Sunrise
; 33=Sunset
; 34=Condition Icon
; 35=Today's Condition
; 36=Tomorrow's Weekday
; 37=Short Month and Day (Jan 6)
; 38=Tomorrow's High Temp
; 39=Tomorrow's Low Temp
; 40=Sunrise
; 41=Sunset
; 42=Condition Icon
; 43=Tomorrow's Condition
; 44=ThirdDay's Weekday
; 45=Short Month and Day (Jan 7)
; 46=ThirdDay's High Temp
; 47=ThirdDay's Low Temp
; 48=Sunrise
; 49=Sunset
; 50=Condition Icon
; 51=ThirdDay's Condition
; 52=FourthDay's Weekday
; 53=Short Month and Day (Jan 8)
; 54=FourthDay's High Temp
; 55=FourthDay's Low Temp
; 56=Sunrise
; 57=Sunset
; 58=Condition Icon
; 59=FourthDay's Condition
; 60=FifthDay's Weekday
; 61=Short Month and Day (Jan 9)
; 62=FifthDay's High Temp
; 63=FifthDay's Low Temp
; 64=Sunrise
; 65=Sunset
; 66=Condition Icon
; 67=FifthDay's Condition
; 68=SixthDay's Weekday
; 69=Short Month and Day (Jan 10)
; 70=SixthDay's High Temp
; 71=SixthDay's Low Temp
; 72=Sunrise
; 73=Sunset
; 74=Condition Icon
; 75=SixthDay's Condition
You do not have the required permissions to view the files attached to this post.
User avatar
Knightmare
Posts: 8
Joined: January 6th, 2019, 8:34 am

Re: Weather about to break Kaelri's Enigma skin (again)?

Post by Knightmare »

No worries, thanks for your reply. I got the weather fixed now ^^

I believe this is the part you're referring to for city names, right?

Code: Select all

; LOCATION

[MeasureWeatherCity]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=10
RegExpSubstitute=1
Substitute="^(.*), (.*), (.*)$":"\1"

[MeasureWeatherRegion]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=10
RegExpSubstitute=1
Substitute="^(.*), (.*), (.*)$":"\2"

[MeasureWeatherCountry]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=10
RegExpSubstitute=1
Substitute="^(.*), (.*), (.*)$":"\3"
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Weather about to break Kaelri's Enigma skin (again)?

Post by eclectic-tech »

Yes, those measures will return the Weather.com site name in [MeasureWeatherCity], the State or Region in [MeasureWeatherRegion], and the Country in [MeasureWeatherCountry].

You could modify the current RegExpSubstitute to get a 'cleaner' city display or creating a new String measure with RegExpSubstitute to pick out the info desired.
But consider, If you create a new string measure, you would also have to change the meters in ALL the weather skins to point to that new string measure instead. :uhuh:

Finally, you could modify the skin(s) to use your own text, or a variable, with the info you want to display.

Glad to hear you got it working 8-)
User avatar
Knightmare
Posts: 8
Joined: January 6th, 2019, 8:34 am

Re: Weather about to break Kaelri's Enigma skin (again)?

Post by Knightmare »

eclectic-tech wrote: January 7th, 2019, 1:31 am Finally, you could modify the skin(s) to use your own text, or a variable, with the info you want to display.
If it's not too much of a hassle, could you please -and just briefly- point to which file/line do I need to replace with my custom text for the sidebar worlds?

I tried my luck editing the skin, but none of the lines I experimented with seem to do the trick.