Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: Client Side Weather Station Conditions Values #308

Open
4 of 8 tasks
garthvh opened this issue Feb 5, 2023 · 3 comments
Open
4 of 8 tasks

[Feature Request]: Client Side Weather Station Conditions Values #308

garthvh opened this issue Feb 5, 2023 · 3 comments
Assignees
Labels
backlog Put off for now enhancement New feature or request

Comments

@garthvh
Copy link
Member

garthvh commented Feb 5, 2023

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.

  • 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
  • Create a WeatherConditions Enum
  • Heat index calculation

Display Helpers

  • Weather Condition Symbol & Current Temperature
  • AQI line display like is available in the weather details Maps.
  • Small Circle AQI Display like like the quick glance in maps

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%)

Apple Weather Conditon Symbol Name BME680
.clear sun.max *
.cloudy cloud *
.foggy cloud.fog
.haze sun.haze
.mostlyClear sun.min
.partlyCloudy cloud.sun
.smoky smoke *
.breezy wind
.windy wind
.drizzle cloud.drizzle
.heavyRain cloud.heavyrain
.isolatedThunderstorms cloud.bolt
.rain cloud.rain *
.sunShower cloud.sun.rain
.scatteredThunderstorms cloud.sun.bolt
.strongStorms cloud.bolt.rain
.thunderstorms cloud.bolt.rain
.frigid thermometer.snowflake *
.hail cloud.hail
.hot thermometer.sun.fill *
.flurries cloud.snow
.sleet cloud.hail
.snow cloud.snow *
.sunFlurries cloud.sun.rain
.wintryMix cloud.snow
.blizzard cloud.snow.fill
.blowingSnow wind.snow
.freezingDrizzle cloud.hail
.freezingRain cloud.hail
.heavySnow cloud.snow
.hurricane hurricane
.tropicalStorm tropicalstorm

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

@garthvh garthvh added the enhancement New feature or request label Feb 5, 2023
@rcarteraz
Copy link
Member

rcarteraz commented Feb 5, 2023

This looks awesome! Looking forward to seeing what you come up with.

@asjmcguire
Copy link

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.

@garthvh
Copy link
Member Author

garthvh commented Aug 3, 2024

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
}

@github-actions github-actions bot added the Stale Marked stale by the bot, will be closed automatically soon label Nov 9, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 17, 2024
@garthvh garthvh added backlog Put off for now and removed Stale Marked stale by the bot, will be closed automatically soon labels Nov 18, 2024
@garthvh garthvh reopened this Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Put off for now enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants