You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to extrapolate a few weather station glance values from locally available sensors if weather telemetry modules are available on a device.
To start with I want to have a conditions symbol, current temperature, and AQI with color dot if there is a connected Air Quality sensor. These values will replace the weather kit forecast on node details if sensor data is available for that node.
Simple current conditions icon like the WeatherKit currentConditions with basic condition types we can calculate from a BME680 should be able to do clear, cloudy, hot, rain, frigid and snow with a reasonable amount of accuracy
Indoor Air Quality for BME680
Air Quality Index calculation for more advanced sensors
dew point = Tc - ((100 - RH)/5.)
Dew point = Temp in celcius - (( 100 - humidity) /5)
Dew point is a better calculation for snow, because the dew point needs to be close to freezing. The humidity does not need to be anywhere close to 98% for snow.
dew point = Tc - ((100 - RH)/5.) Dew point = Temp in celcius - (( 100 - humidity) /5)
Dew point is a better calculation for snow, because the dew point needs to be close to freezing. The humidity does not need to be anywhere close to 98% for snow.
Wound up using the Magnus formula as it seems to get me a little closer to what I was seeing in weather kit, seems to be pretty good
/// Magnus Formula
func calculateDewPoint(temp: Float, relativeHumidity: Float) -> Double {
let a: Float = 17.27
let b: Float = 237.7
let alpha = ((a * temp) / (b + temp)) + log(relativeHumidity / 100.0)
let dewPoint = (b * alpha) / (a - alpha)
let dewPointUnit = Measurement<UnitTemperature>(value: Double(dewPoint), unit: .celsius)
let locale = NSLocale.current as NSLocale
let localeUnit = locale.object(forKey: NSLocale.Key(rawValue: "kCFLocaleTemperatureUnitKey"))
var format: UnitTemperature = .celsius
if localeUnit! as? String == "Fahrenheit" {
format = .fahrenheit
}
return dewPointUnit.converted(to: format).value
}
OS
iOS, iPadOS, macOS
Description
I want to extrapolate a few weather station glance values from locally available sensors if weather telemetry modules are available on a device.
To start with I want to have a conditions symbol, current temperature, and AQI with color dot if there is a connected Air Quality sensor. These values will replace the weather kit forecast on node details if sensor data is available for that node.
Display Helpers
Potential Conditions Calculations
.clear
.cloudy (humidity is > 70% and temp < 70)
.frigid (temp < freezing)
.hot (temp > 80F)
.rain (temp > freezing and humidity is > 98%)
.snow (temp < freezing and humidity is > 98%)
Links
Weather Kit Weather Conditions Values
https://www.airnow.gov/aqi/aqi-calculator-concentration/
https://github.com/blueskyanalytics/aqi-calculator
https://www.kaggle.com/code/rohanrao/calculating-aqi-air-quality-index-tutorial
https://github.com/BoschSensortec/BSEC-Arduino-library
https://www.circuitschools.com/interfacing-bme680-with-arduino-also-measure-indoor-air-quality-index/
https://developer.apple.com/documentation/foundation/unitpressure
Potential Advanced Calculations
Zambretti Weather Forcasting
Heat Index
The text was updated successfully, but these errors were encountered: