Closed DMBlakeley closed 1 year ago
Now seeing additional error:
[2/9/2023, 5:19:18 PM] [WeatherFlow Tempest Platform] TypeError: Cannot read properties of undefined (reading 'air_temperature') at TemperatureSensor.getCurrentTemperature (/usr/local/lib/node_modules/homebridge-weatherflow-tempest/src/platformAccessory.ts:43:76) at Timeout._onTimeout (/usr/local/lib/node_modules/homebridge-weatherflow-tempest/src/platformAccessory.ts:29:75) at listOnTimeout (node:internal/timers:569:17) at processTimers (node:internal/timers:512:7)
Which repeats for each of the configured sensors.
The first issue happens when the WeatherFlow Tempest REST API fails to respond - it's a networking error.
You can always trying manually calling the API and confirming your station responds with the correct JSON structure. There should be a top level key called obs
that contains the "observation" data for station that this plugin relies on.
curl https://swd.weatherflow.com/swd/rest/observations/station/{insert your station id} --header "Authorization: Bearer {insert your token}"
As for your second exception I'm not sure yet, I'll take a look.
Hello Chase,
Thanks for making this plugin available and the detailed response.
In my home automation setup, I believe that #3 is the most likely for producing the error. My thoughts are:
curl
provided the expected JSON response for the obs
key.My current theory is that with two different WeatherFlow apps polling the WeatherFlow server there is a pretty good chance that they could be sampling at the same time resulting in one app being rejected.
I am in the process of verifying this theory and understand best way to address. Will get back to you with my findings.
Regards, Doug
I had this error. I found the token had a trailing space and that was enough to reject the request and cause the obs missing error. Check that your token is copied exactly. Working fine ever since. KevinSent from my iPadOn Feb 27, 2023, at 12:02 AM, Doug B @.***> wrote: Hello Chase, Thanks for making this plugin available and the detailed response. In my home automation setup, I believe that #3 is the most likely for producing the error. My thoughts are:
I have no indiction from the Tempest app that the PWS is going off line. I checked that the suggested curl provided the expected JSON response for the obs key. I do, however, also have have an instance of Home-Assistant running with the WeatherFlow integration.
My current theory is that with two different WeatherFlow apps polling the WeatherFlow server there is a pretty good chance that they could be sampling at the same time resulting in one app being rejected. I am in the process of verifying this theory and understand best way to address. Will get back to you with my findings. Regards, Doug
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>
@kskenyon, thanks for the suggestion. Checked and the token has no trailing space. The error occurrence is pretty random and the Tempest data as viewed through homebridge or HomeKit is correct.
Hello Chase,
I have spent quite a bit of time trying to understand these errors.
I agree with you that the Response missing "obs" data
is most likely a Server error. I added a check into the axios
call in the getStationObservation
function call to check that the Server is online before resolving. Error still happens occasionally but is handled in a clean manner so not really a big issue.
The second undefined
error is really puzzling. The best hypothesis that I have come up with is that one sampling loop which is the Observation
array. In parallel there are multiple sampling loops which are updating air_temperatuer
, relative_humidity
, brightness
and wind_avg
. If the parallel loops overlap the sampling loops you find yourself in an undefined
condition.
I also have a homebridge plugin (homebridge-awair2
) which takes a different approach of sampling and then updating. Believe this approach would address the issue but it is a pretty big change to your coding approach. I am certainly not a software engineer by any means and like the elegance of your approach but just cannot see a straight forward way to address.
Regards, Doug
I believe I have been able to address and found additional error in the process. Will be submitting a Pull Request this week for your consideration.
Regards, Doug
@DMBlakeley thanks looking forward to reviewing it!
@chasenicholl I have submitted a change request to address the runtime errors. Changes are summarized in the CHANGE.MD file which I created. The second error noted above is now being trapped. I am not 100% sure of the root cause and my changes may trigger some thought on your part. A possible issue is that getStationCurrentObservation
will create a nested subroutine until retry_count
is exhausted.
Something else that needs to be addressed is that deleted Accessories are not removed if you delete or rename in the config file.
Looking forward to your feedback.
Regards, Doug
Describe Your Problem:
Several times per day I receive the error shown in the logs below. The plugin is configured as a Child Bridge and starts without issue. Data being reported seems correct. Would like to understand how to eliminate this error.
I also have a Home-Assistant plugin also polling the Weatherflow-Tempest data.
Logs:
Plugin Config:
Screenshots:
Environment: