This commit is contained in:
2026-06-24 17:05:10 -04:00
parent 1d018db749
commit 968cd1a669

View File

@@ -166,14 +166,12 @@ export async function get24HourForecast(currentSensors) {
precipitation_chance: Math.round(weather.precipChance * (1 - i * 0.02) * 100), // confidence decays
};
Object.assign(snapshot, getCelestialForecast(coords.latitude, coords.longitude, time))
return Object.assign(snapshot, getWeatherCondition(snapshot));
});
// Pass through getCelestialForecast to enrich sun/moon data
const enriched = getCelestialForecast(coords.latitude, coords.longitude, slots);
// Second pass — apply solar heating now that we have sun_elevation per slot
for (const slot of enriched) {
for (const slot of slots) {
if (slot.sunrise && slot.sunset) {
const t = slot.time instanceof Date ? slot.time.getTime() : new Date(slot.time).getTime();
const rise = slot.sunrise instanceof Date ? slot.sunrise.getTime() : new Date(slot.sunrise).getTime();
@@ -193,7 +191,7 @@ export async function get24HourForecast(currentSensors) {
slot.humidity_abs = absoluteHumidity(slot.temperature, slot.humidity);
}
return enriched;
return slots;
}
function summarise(slots) {