Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix tile labels, add sunrise/sunset and report sensor failure (#285)
* Add support to report failing Tempest sensors Fix #279 Fully parse the sensor failure number, and log the failure. Add support to report SensorFault to HomeKit. There are only two options, No failure or General Failure. Tested by setting random numbers for message.sensor_status, and verifying that failures appeared in the log, and that Eve app reports general error to the user. Apple's Home app doesn't seem to expose Sensor Fault. * Ignore other values from sensor_status #279 While testing, I noticed that sometimes my Tempest unit would have values in the sensor_status that are not documented. The documentation does say to ignore them. * Update Tile text with value #247 The value for unsupported fields were being reported in the title of a sensor. It seems this functionality broke in iOS 16, when they changed the behaviour of Characteristic.Name. To fix this, we need to use Characteristic.ConfiguredName. * Drop duplicate messages Seeing duplicate UDP messages events, though duplicates are not appearing on the wire/network. Duplicate messages are a problem for rain totals, as the rain amount is added twice. Add some code to drop duplicate messages. * Add Openweather Sunrise & Sunset support #240 Sunrise/Sunset Openweather API 2.5 has Sunrise and Sunset values. This patch adds support for it. I also saw that 3.0 API also has support for it for the current conditions. This patch also adds support for that too. * Update config.schema.json Fix for #122 * Add Tempest forecast support Add the support for Tempest weather station forecasts. The weather station broadcasts new current conditions each minute so the refresh interval is hardcoded to 1 minute. However forecasts don't update that frequently, so I have forecast updating each hour. * Improve error reporting for OpenWeatherMap fails To help diagnose #282 and to help with general debugging, log not just the result but the error when OpenWeatherMap fails to load the URL. * Add light level history Fix #287 Through fakegato "custom" history support, the light level (lux) history is now supported. Adjust history logging to include light level. Tested with Tempest weather station and OpenWeatherMap V2.5 API (that does *not* include light level). * Remove unsupported Yahoo weather. #45 Yahoo doesn't provide weather information anymore. Support for the Yahoo weather service has been removed, so remove the api file. Update the packages.json file, remove yahoo. Add the company that makes the Tempest weather station, Weatherflow. * Add better error handling to Weather Underground. Debug #246 Add a check to see if WeatherUnderground it returning correctly, but the PWS is offline. * Increase maximum UV Index value Australia's outback has higher UV Index values than 12. I see it hit 13 at times. * Add rain sensor for weather underground Fix: #112 Add support for the rain sensor (RainBool). If the current precipitation rate is greater than zero, then it is raining. Also, always use metric values. Conversion from metric to desired unit happens during rendering the value. Tested with both an offline PWS and online PWS. * Report values even for sensor failed Fix #288 Even if the sensor has been reported as failed, it has been observed that values may still be good. As the values could be out of range, don't use them for calculations. * Calculate values only if numbers in range #285 Patch feedback. Calculate the calculated values only if temperature and humidity values are within range. The values may be out of range if the sensors have failed. * Log sensor failures once an hour #285. Patch feedback Log is spammed if a sensor fails, so only log once every hour. Also, don't need to track Temperature and Humidity sensor failures specifically anymore as calculations are bounds checked. * Revert "Log sensor failures once an hour" This reverts commit e8ca350. * Log sensor failures once an hour #285. Patch feedback Log is spammed if a sensor fails, so only log once every hour. As sensor status for AIR unit could be ok, but the sensor status for SKY unit be bad, I need to track sensor logging separately. I also overload the AIR unit to report Tempest unit data. Also, don't need to track Temperature and Humidity sensor failures specifically anymore as calculations are bounds checked. * Fix forecasts to be error resilient #285 Patch feedback Fix crash when the apiKey and/or stationId is missing. Use the lastForecastUpdate variable to indicate if we have valid parameters at all. If they are not set, don't define the variable, and as such never attempt to fetch a forecast. This is a valid configuration so I don't log this state. If invalid apiKey and/or stationId is used, then the URL request will fail with a response code other than 200 (OK). If that happens, fail with an error. This error will get logged. As the forecast is only fetched every hour, this error will only appear once an hour and won't spam the logs. * Sensor error string format #285 Patch feedback Add better formatting for sensor error logs, so that each failing sensor is comma delimited. Also fix range checking for calculated values, allow temperatures to be between -100 to +100 degC. * Fix battery reporting for AIR/SKY #285 Patch feedback Move battery reporting/handling to one place, in the observation messages. Tempest handling was already correct. Add reporting for AIR/SKY battery level. As the levels can be different but we only have one battery value we can report, report the lowest one. Change AIR/SKY battery percentage calculator to be the same as Tempest. * AIR/SKY battery level never goes up I should not compare to the previous reported value, as it will never increase. I need to compare Sky battery with Air battery and vice versa when determining the lowest value to report. * Increase robustness of Forecast Patch feedback #285 Even though the server says it returned forecast ok with a 200 OK status code, parsing sometimes fails and crashes. Catch this error and print it out if it happens, including the full received result and the parse error. * Forecast not updating Patch feedback #285 Forecast wasn't updating when it clocked over to the new year. The code was testing for an undefined variable incorrectly. * Forecast said there will be rain when there won't be Patch feedback #285 Should not use the precipitation icons for snow and rain state as the chance precipitation can be zero, but there are still icons. Instead do the same as OpenWeatherMap, normalize the conditions to the condition details numbered values, then check to see if there will be rain or snow. * Fix crash when Wunderground server unreachable There could be no response object if the internet and/or weather underground server is not reachable. So before trying to read the response from the server, make sure that there is a response. * Fix today's forecast Today's forecast isn't sent after around 11pm. To detect this, make sure that the current month day is the same as the month day of the forecast. If they are different, then offset the forecasts. Save the current day forecast, so that when it is not available, the last forecast can be inserted into the forecasts array.
- Loading branch information