It is currently March 29th, 2024, 2:02 am

Gadgets 7.6.0 - inspired by AddGadgets.com Sidebar Gadgets

A package of skins with a "theme" or by a single author
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Gadgets 2.2.0 - inspired by AddGadgets.com Sidebar Gadgets

Post by fonpaolo »

The matching error is normal, given that weather.com has completely removed the alerts from his rss feed.

I say this because I was trying to adapt a skin I made, using another resource, but it's limited only to Europe, weather.com was the easiest alternative, their recent "update" has broken everything...
User avatar
SilverAzide
Rainmeter Sage
Posts: 2588
Joined: March 23rd, 2015, 5:26 pm

Re: Gadgets 2.2.0 - inspired by AddGadgets.com Sidebar Gadgets

Post by SilverAzide »

Area51 wrote:I'm seeing errors on the Weather app related to Alerts:

I keep getting errors from the Weather screen about the Alert function. Is that normal?

MeasureAlerts gets RegExp matching error (-1)

There aren't any alerts on weather.com at the time I'm seeing this. I don't know if it works of there are as there haven't been any alerts since I've been testing.
As fonpaolo indicates, this is normal. I have not been able to come up with a way to avoid this error message when there are no weather alerts, due to the way that weather.com puts alerts into their feed. There might be a way to suppress this message in Rainmeter 4.0, but I have not looked into it yet. JSMorley has a way to handle this using a LUA script in his WXWeatherData skin, but I have not gone quite that far yet.

If you want to see if the alerts are working, go to weather.com and use their map to find a storm someplace (does not matter where). The site will usually indicate on the map if there is an alert. Find a city near (or in) the storm area and use that location code in the Gadget to view the weather. You should see something like this: http://sta.sh/027dqxpamj09
Gadgets Wiki GitHub More Gadgets...
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Gadgets 2.2.0 - inspired by AddGadgets.com Sidebar Gadgets

Post by jsmorley »

SilverAzide wrote:As fonpaolo indicates, this is normal. I have not been able to come up with a way to avoid this error message when there are no weather alerts, due to the way that weather.com puts alerts into their feed. There might be a way to suppress this message in Rainmeter 4.0, but I have not looked into it yet. JSMorley has a way to handle this using a LUA script in his WXWeatherData skin, but I have not gone quite that far yet.

If you want to see if the alerts are working, go to weather.com and use their map to find a storm someplace (does not matter where). The site will usually indicate on the map if there is an alert. Find a city near (or in) the storm area and use that location code in the Gadget to view the weather. You should see something like this: http://sta.sh/027dqxpamj09
I suspect that with Rainmeter 4.0 you can beat this with regular expression by using a lookahead assertion to avoid the matching error, and then LogSubstringErrors to avoid the "not enough substrings" errors on the child measures.

I haven't really messed with it in this context, as the Lua script handles it quite well for me. The biggest advantage to the Lua in this case is that I don't need to decide what the "maximum" number of alerts I am going to handle is, and set up that many WebParser child measures, dealing with an actual number less than that as above. Instead, I can use Lua to "count" the number of alerts, and use a for/next loop to read them and set the output information in a ToolTip no matter how many there are or are not. If there are none, I just hide the alert meter(s) entirely, and voila, no errors...

Code: Select all

function Initialize()
	
	weatherParent = SKIN:GetMeasure('WeatherParent')
	
end

function Update()

	weatherData = weatherParent:GetStringValue()
	
	alertData = string.match(weatherData, '<swa>(.-)</swa>')
	alertString = '\n'
	startPosition = 1
	
	if alertData then
		dummyValue, alertCount = string.gsub(alertData, '(<t>)', "")
		for i = 1, alertCount do
			alertString = alertString .. tostring(i) .. ' - ' .. string.match(alertData, '<t>(.-)</t>', startPosition) .. '\n'
			startPosition = startPosition + string.len(alertString) - string.len(tostring(i)) - 3
		end
		SKIN:Bang('!SetOption', 'MeterAlert', 'Hidden', '0')
		SKIN:Bang('!SetOption', 'MeterAlert', 'ToolTipText', alertString)
	else
		SKIN:Bang('!SetOption', 'MeterAlert', 'Hidden', '1')
		SKIN:Bang('!SetOption', 'MeterAlert', 'ToolTipText', '')
		alertCount = 0
	end
	
	return(alertCount)
	
end
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Gadgets 2.2.0 - inspired by AddGadgets.com Sidebar Gadgets

Post by fonpaolo »

Since we are on the subject, please forgive me for hijacking this thread, do you still have alert notifications using weather.com xml?

I've almost given up to "adapt" my weather skin for non EU users,(and release it), since I can't get any alert and I haven't found another acceptable source*.

* read it as "one source for all" and not one source for nation/continent...
Last edited by fonpaolo on October 18th, 2016, 12:05 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Gadgets 2.2.0 - inspired by AddGadgets.com Sidebar Gadgets

Post by jsmorley »

fonpaolo wrote:Since we are on the subject, please forgive me for hijacking this thread, do you still have alert notifications using weather.com xml?

I've almost given up to "adapt" my weather skin for non EU users,(and release it), since I can't get any alert and I haven't found another acceptable source.
I live in the US, but yeah, there is a <swa>...</swa> section in the feed when there are weather alerts, with that section being entirely missing when there are not. I have no idea if it is different outside of any particular area though. You might try testing with a variety of locations, some where you know there are weather alerts for that location on the Weather.com web site.

In any case, if you code it so that if there are no weather alerts in the WXDATA feed, you deal with that gracefully, it doesn't really matter much...
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Gadgets 2.2.0 - inspired by AddGadgets.com Sidebar Gadgets

Post by fonpaolo »

Thanks jsmorley, I ask this because I'm using another source and I don't have an alert anymore from weather.com xml, until the last "change", I had alerts and I was converting my skin, but now I'm in a dead end.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Gadgets 2.2.0 - inspired by AddGadgets.com Sidebar Gadgets

Post by jsmorley »

fonpaolo wrote:Thanks jsmorley, I ask this because I'm using another source and I don't have an alert anymore from weather.com xml, until the last "change", I had alerts and I was converting my skin, but now I'm in a dead end.
As far as I know, I'm still getting alerts using a URL like:

Code: Select all

https://wxdata.weather.com/wxdata/weather/local/#LocationCode#?cc=*&unit=#UnitOfMeasure#&dayf=#DaysFeed#
As I said though, if they did / do remove severe weather alerts from the feed, as long as you are dealing with their absence gracefully, I guess it doesn't matter.

Hard to say for me, since my weather is currently 55 degrees F and sunny and about as good as it gets...
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Gadgets 2.2.0 - inspired by AddGadgets.com Sidebar Gadgets

Post by jsmorley »

It still works...

If I change to USNC0820, which is Princeville, North Carolina, I get the weather alerts for the current flooding situation there.
1.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Gadgets 2.2.0 - inspired by AddGadgets.com Sidebar Gadgets

Post by fonpaolo »

Well, at least now I know that the missing alerts are based on location/country, not worldwide.
I still have to find where they're available and where they're not... :uhuh:
...and I doubt asking this to weather.com I could have an answer. :lol:

The idea, from the beginning, was to create two different skins, based if you live in EU or not.
Obviously, if I have to make more "variations" on the theme, or one for almost every country... :thumbdown:

Ok, sorry SilverAzide for having hijacked your thread.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Gadgets 2.2.0 - inspired by AddGadgets.com Sidebar Gadgets

Post by jsmorley »

fonpaolo wrote:Well, at least now I know that the missing alerts are based on location/country, not worldwide.
I still have to find where they're available and where they're not... :uhuh:
...and I doubt asking this to weather.com I could have an answer. :lol:

The idea, from the beginning, was to create two different skins, based if you live in EU or not.
Obviously, if I have to make more "variations" on the theme, or one for almost every country... :thumbdown:

Ok, sorry SilverAzide for having hijacked your thread.
I guess I don't understand. If there are alerts, then ok, do something with them. Unhide some meters, set a ToolTip, whatever you like. If there are not, then uhm, Don't. No reason why you need to have different skins for different regions ore really worry about this at all.