It is currently October 1st, 2022, 7:19 am

How do I automatically turn a skin on or off based on weather information?

Get help with creating, editing & fixing problems with skins
User avatar
tass_co
Posts: 365
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

Re: How do I automatically turn a skin on or off based on weather information?

Post by tass_co »

Pyuahowaito wrote: August 7th, 2022, 4:50 pm thank you for Tass_co letting me know another way. :rosegift:
:thumbup:
I don't know where i going from here, but i promise it won't be boring... :great:
User avatar
Pyuahowaito
Posts: 38
Joined: January 3rd, 2022, 2:44 pm

Re: How do I automatically turn a skin on or off based on weather information?

Post by Pyuahowaito »

balala wrote: August 7th, 2022, 6:26 pm
Balala I'm currently having 2 issues, the skin is suddenly not working, the logs show: RegExp matching error (-1), I tried to replace the API Key provided by weatherbit.io but it did not work. I tried to refer to Rainmeter's documentation tutorial to get the skin to use Weather.com weather information, but it was much more difficult than I thought when modifying it. What should I do?

Secondly, when I added the following code for Weather .ini and modified the Windows time test, I found that when it automatically starts the Rain skin, [MeasureWeather] no longer automatically gets the weather information of the weatherbit.io website, and needs to manually refresh the Weather .ini to work properly, how can I make it work fully automatically?

Code: Select all

[MeasureTime]
Measure=Time
Format=%#m
IfCondition=(#CURRENTSECTION#>=2)&&(#CURRENTSECTION#<4)
IfTrueAction=[!DeactivateConfig "#ROOTCONFIG#\RainSnow" "Rain.ini"]
IfCondition2=(#CURRENTSECTION#>=10)&&(#CURRENTSECTION#<12)
IfTrueAction2=[!DeactivateConfig "#ROOTCONFIG#\RainSnow" "Rain.ini"]
User avatar
balala
Rainmeter Sage
Posts: 14568
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How do I automatically turn a skin on or off based on weather information?

Post by balala »

Pyuahowaito wrote: August 10th, 2022, 8:00 am Balala I'm currently having 2 issues, the skin is suddenly not working, the logs show: RegExp matching error (-1), I tried to replace the API Key provided by weatherbit.io but it did not work. I tried to refer to Rainmeter's documentation tutorial to get the skin to use Weather.com weather information, but it was much more difficult than I thought when modifying it. What should I do?
Yep, the AestheticWeather skin seems not to working here either. Since that's a skin I have no idea about, just tried and used the one proposed by you, I can't say too much about it, especially that it uses the data provided by a not-known provider (at least it's not known for me).
I'd propose you to choose another skin from the Weather section, one which uses weather.com as data provider. You'll have much less troubles with it. If you did choose such a skin, I'm gonna adapt it as well.
Sorry, but don't really know what else to say. Modifying the existing AestheticWeather skin to use weather.com, is extremely difficult, don't recommend.
Pyuahowaito wrote: August 10th, 2022, 8:00 am Secondly, when I added the following code for Weather .ini and modified the Windows time test, I found that when it automatically starts the Rain skin, [MeasureWeather] no longer automatically gets the weather information of the weatherbit.io website, and needs to manually refresh the Weather .ini to work properly, how can I make it work fully automatically?

Code: Select all

[MeasureTime]
Measure=Time
Format=%#m
IfCondition=(#CURRENTSECTION#>=2)&&(#CURRENTSECTION#<4)
IfTrueAction=[!DeactivateConfig "#ROOTCONFIG#\RainSnow" "Rain.ini"]
IfCondition2=(#CURRENTSECTION#>=10)&&(#CURRENTSECTION#<12)
IfTrueAction2=[!DeactivateConfig "#ROOTCONFIG#\RainSnow" "Rain.ini"]
To be honest I can't follow you. Don't really understand what are you trying to do. What Windows time test did you modify? The above [MeasureTime] measure returns the month as a number. According to the IfConditions, when the month is from 2 to 3 (February and March), or from 10 to 11 (October and November), you get the Rain.ini skin deactivated. That's all. The skin is not activated, at least not in the posted code snippet. And since there are two two month long periods, this makes not too much sense. I doubt this is what you wanted to achieve, however some details are needed.

Additional tip: !DeactivateConfig, unlike !ActivateConfig, doesn't require two parameters. The name of the config is completely enough, no need to add the name of the skin as well. !ActivateConfig requires the name of the skin as well, to know which skin to activate from the specified config, if there are more. But !DeactivateConfig deactivates the only active skin of the config. That's why the name of the skin is not needed in this case. Additionally even the !ActivateConfig can work with only the config name, but in such a case, Rainmeter decides which skin of the specified config to activate (if there are more). So the [!DeactivateConfig "#ROOTCONFIG#\RainSnow" "Rain.ini"] bang should be only [!DeactivateConfig "#ROOTCONFIG#\RainSnow"]
User avatar
Pyuahowaito
Posts: 38
Joined: January 3rd, 2022, 2:44 pm

Re: How do I automatically turn a skin on or off based on weather information?

Post by Pyuahowaito »

balala wrote: August 10th, 2022, 12:03 pm
Balala This is the weather skin I need to modify: https://www.deviantart.com/eclectic-tech/art/MiniWeather-780701124
If you can, please help me modify the ini inside the Just the Icon folder, (I just need to let it act as a simple automatic switch)

Secondly sorry balala I don't know if the way the text is easy to understand.
I want to add the above code to weather .ini so that Rain .ini is turned off for a period of time, For example, it is closed from February to April, the rest of the time it will be turned on normally to adapt to my other skins, to achieve the desired effect.

If it is currently raining in the city, modify the Windows time to 2022 3 31 23:59, Rain .ini is inactive according to [MeasureTime], the time comes to 2022 4 1 0:00, [MeasureWeather] should activate Rain.ini but it does not,Here's the problem, I need to manually refresh the skin [MeasureWeather] to get to work

Thank you for the tip, I get it.
Last edited by Pyuahowaito on August 12th, 2022, 9:14 am, edited 1 time in total.
User avatar
balala
Rainmeter Sage
Posts: 14568
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How do I automatically turn a skin on or off based on weather information?

Post by balala »

Pyuahowaito wrote: August 11th, 2022, 2:21 am Secondly sorry balala I don't know if the way the text is easy to understand.
I want to add the above code to weather .ini so that Rain .ini is turned off for a period of time, For example, it is closed from February to April, the rest of the time it will be turned on normally to adapt to my other skins, to achieve the desired effect.
So, let's summarize a little bit, because I'm still not entirely sure I completely understand what you want. So my assumption is that you'd like to activate the Rain (or Snow) skin when it's raining or snowing, but only outside of the specified interval (from February to April, for instance). From February to April the Rain (and Snow) skin shouldn't be activated at all, no matter if it's raining / snowing or not.
Am I right?
User avatar
Pyuahowaito
Posts: 38
Joined: January 3rd, 2022, 2:44 pm

Re: How do I automatically turn a skin on or off based on weather information?

Post by Pyuahowaito »

balala wrote: August 11th, 2022, 7:21 pm So, let's summarize a little bit, because I'm still not entirely sure I completely understand what you want. So my assumption is that you'd like to activate the Rain (or Snow) skin when it's raining or snowing, but only outside of the specified interval (from February to April, for instance). From February to April the Rain (and Snow) skin shouldn't be activated at all, no matter if it's raining / snowing or not.
Am I right?
Yes, the problem now is that [MeasureWeather] and [MeasureTime] can't work at the same time
User avatar
balala
Rainmeter Sage
Posts: 14568
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How do I automatically turn a skin on or off based on weather information?

Post by balala »

Pyuahowaito wrote: August 12th, 2022, 5:48 am Yes, the problem now is that [MeasureWeather] and [MeasureTime] can't work at the same time
They definitely can. There is another problem.
I added a few sections (measures to be precise), to the @Resources\Base.ini file in eclectic-tech's MiniWeather package. See the [MeasureMonth] and [MeasureRainSnow] measures. I also added two new variables to the [Variables] section of the @Resources\Variables.inc file (namely the StartingMonth and EndingMonth variables), which are the limits in which you'd like to let the Rain and Snow skins not activated (I set them to StartingMonth=2 and EndingMonth=4, but obviously you can modify them, as needed). To understand how the conditions are checked, please follow the IfConditions of the [MeasureRainSnow] measure (in the @Resources\Base.ini file). You have to know that the [MeasureRainSnow] measure checks the number retuned by the [MeasureWeatherCurrentCode] measure. This number is used to show the appropriate icon in the skins belonging to the package (in fact this is the same as the number retuned by the [@CurrentIcon] measure). The [MeasureRainSnow] returns 0 if there is not raining, nor snowing, 1 if it's raining and 2 if it's snowing (yep, I know the Formula is a little bit long and more or less sofisticated, but that's it). If the measure is returning 0, the Rain and Snow skins are deactivated (I put them into a group of skins, which I named RainSnow - see the Group=RainSnow option in the [Rainmeter] section of the skins within the RainSnow folder). If it's returning 1 or 2, another condition related to the month (to be precise, related to the [MeasureMonth] measure) has to be checked. Any of the skins is activated if the [MeasureRainSnow] is 1 or 2 AND the month is between #StartingMonth# and #EndingMonth#. If any of these conditions is not meet, the group of skins is deactivated.
Two further comments:
  • Unfortunately due to a lack of time, I didn't test the skin deeply. Please test it and let me know if there are problems (along with a description of the problem, if you find any).
  • Since the MiniWeather skins are eclectic-tech's work, I strongly recommend you to ask his permission to use them. I doubt he'll have objections, however it is nice to let him know you're using his skin, as part of another one. This is true ESPECIALLY if you'll distribute the skin, but in other cases as well. And also would be nice to mention him as author of the MiniWeather.
So I'm attaching the package, which you'll have to install and test. Please let me know your opinion.
You do not have the required permissions to view the files attached to this post.
User avatar
Pyuahowaito
Posts: 38
Joined: January 3rd, 2022, 2:44 pm

Re: How do I automatically turn a skin on or off based on weather information?

Post by Pyuahowaito »

balala wrote: August 12th, 2022, 6:17 pm
Thank you very much for your professional explanation and tips, let me understand a lot of things, thank you Balala! :rosegift:
The skin works very stable and perfectly, there are no problems found at the moment, I am just a little worried that the API Key will lose its effect one day.

I chose eclectic-tech skin because I like his weather icon and it's the same as the AestheticWeather skin, and although I don't know much about eclectic-tech skin code, I believe his work is absolutely professional and mature. (Secondly, his avatar is also very cute and will change style from time to time)
User avatar
balala
Rainmeter Sage
Posts: 14568
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How do I automatically turn a skin on or off based on weather information?

Post by balala »

Pyuahowaito wrote: August 13th, 2022, 3:13 pm Thank you very much for your professional explanation and tips, let me understand a lot of things, thank you Balala! :rosegift:
The skin works very stable and perfectly, there are no problems found at the moment, I am just a little worried that the API Key will lose its effect one day.
Alright, I'm glad if it's working well. Keep testing it and come back if you find anything wrong. In any case, if the API key "loses its effect", the same will apply for all skins using weather.com as source and this will be notified here on the forum for sure, so don't worry about this.
Pyuahowaito wrote: August 13th, 2022, 3:13 pm I chose eclectic-tech skin because I like his weather icon and it's the same as the AestheticWeather skin, and although I don't know much about eclectic-tech code, I believe his work is absolutely professional and mature. (Secondly, his avatar is also very cute and will change style from time to time)
Yep, he used to change his avatar frequently and uses a lot of funny penguins (or the same penguin in many circumstances). However I strongly recommend you to either write him a PM, or at least post a message on the MiniWeather's section of this forum, from where you've downloaded it. Not for something else, but it's a common sense to let him know if you're using and modifying his skin.
User avatar
Pyuahowaito
Posts: 38
Joined: January 3rd, 2022, 2:44 pm

Re: How do I automatically turn a skin on or off based on weather information?

Post by Pyuahowaito »

balala wrote: August 13th, 2022, 3:34 pm
I forgot to reply to you, sorry Balala, I get it, but rest assured I've sent him a private message earlier