I've recently been having issues with BI tools (causing slowdown, TLS update issue), and since I am only using it for weather overlay, I decided to see if I could find an alternative and was wondering if there is any interest in what I threw together.
First, I'm pretty much a n00b with BI so forgive me if this is a waste. I'm also not sure if installing BI Tools and running once and uninstalling (or just not running) is required, but I believe for my current setup it is. So, that's the first thing, I ran BI tools and checked to set temp data. My reason is I will be using the temperature.txt and %1 macro. I then uninstalled BI Tools. From here on out everything is just about modifying that txt file. So I have chosen to use OpenWeatherMap API and powershell to get the data I wanted.
Steps:
*Why do it this way? Since I am using a script and using task scheduler (vs creating a service), we have no way to check if things have hung. By limiting the script to every 5 minutes (task scheduler min. re-run time) we can limit our potential time between auto-restart
github.com
First, I'm pretty much a n00b with BI so forgive me if this is a waste. I'm also not sure if installing BI Tools and running once and uninstalling (or just not running) is required, but I believe for my current setup it is. So, that's the first thing, I ran BI tools and checked to set temp data. My reason is I will be using the temperature.txt and %1 macro. I then uninstalled BI Tools. From here on out everything is just about modifying that txt file. So I have chosen to use OpenWeatherMap API and powershell to get the data I wanted.
Steps:
- Head over to Сurrent weather and forecast - OpenWeatherMap and sign up for their free API access to current weather data. This allows for 1,000,000 free API calls per month.
- If we poll every 10 seconds we would have a maximum of (on 31-day months): [(60 seconds/min) * (60 min/hr) * (24 hr/day) * (31 days/month)]/(1 Poll /10 seconds) = 267,840 calls per month.
- Note - You can modify the $pollSec value in Get-Weather.ps1 to change the poll frequency (in seconds)
- Copy the API key (sent via email when ready)
- If we poll every 10 seconds we would have a maximum of (on 31-day months): [(60 seconds/min) * (60 min/hr) * (24 hr/day) * (31 days/month)]/(1 Poll /10 seconds) = 267,840 calls per month.
- Find your locations "CityID". Easiest way is to search for your city and then find the ID in the URL:
- EX: https:// openweathermap.org/city/5393052
- Grab the current scripts from here jamjen831/Get-Weather and place in C:\Scripts (or elsewhere and update paths in the script) :
- Get-Weather.psm1 is the module that contains the Get-Weather function that does all the actual work
- Get-Weather.ps1 is the script we run that calls the Get-Weather function (Get-Weather.psm1) every 10 seconds
- Enable Powershell scripts
- Open Powershell As Admin
- Run command "Set-ExecutionPolicy -Unrestricted"
- Edit Get-Weather.psm1 (Module\Function)
- Set $cityID to the City ID found in step 2.1
- Set $ apiKey with your API key from 1.2
- Setup Windows Scheduled Task to run every 5 minutes (The script repeats the function every 10 seconds for 4min 50 sec the quits*):
1. Open Windows task Scheduler
2. Right-Click on "Task Scheduler Library" and chose "Create task"
3. General Tab: Select "Run whether user is logged on or not"
4. Trigger Tab: Click New
5. Setting: Daily
6. Advanced Settings: Repeat Task Every: 5 minutes for Duration of: 1 day
7. Check "enabled"
8. Actions Tab: Click New
9. Program script: Powershell.exe
10. Add Argument: -File c:\script\Get-Weather.ps1 (or wherever you have placed the script)
11. Save (you will likely be prompted for a username and password, this will be used to run the task - Check the temperature.txt to make sure it's being updated, if not, check the persmissions for the file, as BI tools likes to lock write permissions.
*Why do it this way? Since I am using a script and using task scheduler (vs creating a service), we have no way to check if things have hung. By limiting the script to every 5 minutes (task scheduler min. re-run time) we can limit our potential time between auto-restart
GitHub - jamjen831/Get-Weather: Get OpenWeather info for BlueIris Overlay
Get OpenWeather info for BlueIris Overlay . Contribute to jamjen831/Get-Weather development by creating an account on GitHub.
Last edited: