# Possible Bug - WebSocket API Missing Data Sometimes

**URL:** <https://community.tempest.earth/t/possible-bug-websocket-api-missing-data-sometimes/8863>\
**Category:** Developers\
**Created:** [August 23, 2020, 2:54pm UTC](https://community.tempest.earth/t/possible-bug-websocket-api-missing-data-sometimes/8863 "2020-08-23T14:54:02Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmeglio](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@dmeglio](https://community.tempest.earth/u/dmeglio)\
**Post date:** [August 23, 2020, 2:54pm UTC](https://community.tempest.earth/t/possible-bug-websocket-api-missing-data-sometimes/8863/1 "2020-08-23T14:54:02Z")

</div>

Has anyone noticed that sometimes the Tempest observation data is missing fields?

For example, I just received:

`"status":{"status_code":0,"status_message":"SUCCESS"},"device_id":XXXXX,"type":"obs_st","source":"cache","summary":{"pressure_trend":"steady","strike_count_1h":0,"strike_count_3h":0,"precip_total_1h":0.0,"strike_last_dist":29,"strike_last_epoch":1598124138,"precip_accum_local_yesterday":0.0,"precip_analysis_type_yesterday":0,"feels_like":23.5,"heat_index":23.5,"wind_chill":23.5},"obs":[[1598194076,0,0,0,null,60,981.6,23.6,86,17432,1.05,145,0,0,0,0,2.39,1,0,null,null,0]]}`

Notice the nulls in the rain data and wind lull. Rebooting the tempest seems to fix it.

---

<div class="post-metadata">

**Author:** ![vinceskahan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/vinceskahan/32/2785_2.png) [@vinceskahan](https://community.tempest.earth/u/vinceskahan)\
**Post date:** [August 23, 2020, 5:21pm UTC](https://community.tempest.earth/t/possible-bug-websocket-api-missing-data-sometimes/8863/2 "2020-08-23T17:21:19Z")

</div>

We’d have to see your device\_status and hub\_status messages I think, to look for the sensor status. I notice the voltage looks pretty low which might be part of the issue. My recollection the Tempest starts shedding sensors as the voltage gets low on the unit. There was a long post a month or two ago about what it does and when.

---

<div class="post-metadata">

**Author:** ![vinceskahan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/vinceskahan/32/2785_2.png) [@vinceskahan](https://community.tempest.earth/u/vinceskahan)\
**Post date:** [August 23, 2020, 5:22pm UTC](https://community.tempest.earth/t/possible-bug-websocket-api-missing-data-sometimes/8863/3 "2020-08-23T17:22:31Z")

</div>

Here it is - [Tempest data collectionn during low battery conditions](https://community.tempest.earth/t/tempest-data-collectionn-during-low-battery-conditions/7446/3)

---

<div class="post-metadata">

**Author:** ![dmeglio](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@dmeglio](https://community.tempest.earth/u/dmeglio)\
**Post date:** [August 23, 2020, 7:03pm UTC](https://community.tempest.earth/t/possible-bug-websocket-api-missing-data-sometimes/8863/4 "2020-08-23T19:03:16Z")

</div>

Not sure I follow, my devices is at 2.4v according to the post says I’m in Mode 2 and nothing is disabled?

Edit: Also if it’s battery related and not a bug, seems odd that rebooting the tempest fixes it?

---

<div class="post-metadata">

**Author:** ![peter](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/peter/32/1365_2.png) [@peter](https://community.tempest.earth/u/peter)\
**Post date:** [August 23, 2020, 7:50pm UTC](https://community.tempest.earth/t/possible-bug-websocket-api-missing-data-sometimes/8863/5 "2020-08-23T19:50:25Z")

</div>

Hi @dmeglio, I think there may be some misunderstanding over what observations the nulls correspond to. The first null (index 4 in the obs array; counting starts from 0) corresponds to the wind direction. The wind direction is null because the wind speed is zero. The direction is undefined if the wind speed is zero. The last two nulls (index 19 and 20) are rain accumulation values after RainCheck has been applied. As RainCheck is applied retrospectively to your station data, they are always going to be null in the real time websocket data.

You can see which fields are which here: [https://weatherflow.github.io/SmartWeather/api/swagger/](https://weatherflow.github.io/SmartWeather/api/swagger/). Click “expand operations” in the top right.

---

<div class="post-metadata">

**Author:** ![dmeglio](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@dmeglio](https://community.tempest.earth/u/dmeglio)\
**Post date:** [August 23, 2020, 8:03pm UTC](https://community.tempest.earth/t/possible-bug-websocket-api-missing-data-sometimes/8863/6 "2020-08-23T20:03:24Z")

</div>

Yeah I see that now, unfortunately it was because obs\_st is undocumented in the WebSocket API… I guess I was supposed to look at the REST API to get the documentation…

Anyway, you’re correct about the rain but that doesn’t seem to be the case about wind speed. Right now wind speed is 0 and I get a 0 in the data: 1598212884,0.0,0.0,0.0,0,6,979.5,27.4,62,18342,1.08,153,0.0,0,0,0,2.4,1,0.0,null,null,0

The null only happens sometimes. And as a note, the article about the battery level changes doesn’t mention the wind sensor ever being disabled.

---

<div class="post-metadata">

**Author:** ![peter](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/peter/32/1365_2.png) [@peter](https://community.tempest.earth/u/peter)\
**Post date:** [August 23, 2020, 8:13pm UTC](https://community.tempest.earth/t/possible-bug-websocket-api-missing-data-sometimes/8863/7 "2020-08-23T20:13:26Z")

</div>

Yea the WeatherFlow team are aware that the documentation for the Websocket is missing, but I think that they are so snowed under at the moment it’s not their top priority.

It is interesting that the wind direction is only null sometimes. I wonder whether it is null only when the average 1 minute wind speed is truly zero, whereas other times the average 1 minute windspeed is very light and rounds to 0.0, but the direction is then defined.

You are right that the wind sensor is never disabled, but the sampling interval gets a lot longer (3 seconds, then 6 seconds, then 1 minute, then 5 minutes). This makes it more likely for the average 1 minute windspeed to be zero.

Can you share your station ID? Might help to see what is going on.

---

<div class="post-metadata">

**Author:** ![dmeglio](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@dmeglio](https://community.tempest.earth/u/dmeglio)\
**Post date:** [August 23, 2020, 8:16pm UTC](https://community.tempest.earth/t/possible-bug-websocket-api-missing-data-sometimes/8863/8 "2020-08-23T20:16:03Z")

</div>

> [@peter](#):
>
> It is interesting that the wind direction is only null sometimes. I wonder whether it is null only when the average 1 minute wind speed is truly zero, whereas other times the average 1 minute windspeed is very light and rounds to 0.0, but the direction is then defined.

It was reporting null for 3 days straight. I powered the Tempest off/on and immediately it went to 0.0. Not really sure what to say, just know it’s screwing up math in a program I was using because I didn’t know null was even a valid value.

---

<div class="post-metadata">

**Author:** ![GaryFunk](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/garyfunk/32/5729_2.png) [@GaryFunk](https://community.tempest.earth/u/GaryFunk)\
**Post date:** [August 23, 2020, 8:18pm UTC](https://community.tempest.earth/t/possible-bug-websocket-api-missing-data-sometimes/8863/9 "2020-08-23T20:18:20Z")

</div>

Null is valid for every value.

---

<div class="post-metadata">

**Author:** ![peter](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/peter/32/1365_2.png) [@peter](https://community.tempest.earth/u/peter)\
**Post date:** [August 23, 2020, 8:29pm UTC](https://community.tempest.earth/t/possible-bug-websocket-api-missing-data-sometimes/8863/10 "2020-08-23T20:29:34Z")

</div>

I’m not sure I know the answer I’m afraid. There is some discussion in this thread: [Calculate wind vector-direction](https://community.tempest.earth/t/calculate-wind-vector-direction/921/37) and this thread: [Wind Direction when winds are calm should not be zero](https://community.tempest.earth/t/wind-direction-when-winds-are-calm-should-not-be-zero/2170/36), but I don’t know whether any changes were ever made. As Gary said though, null is definitely a valid value, so the simplest solution is to allow your code to handle that value correctly.

---

<div class="post-metadata">

**Author:** ![vinceskahan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/vinceskahan/32/2785_2.png) [@vinceskahan](https://community.tempest.earth/u/vinceskahan)\
**Post date:** [August 23, 2020, 8:37pm UTC](https://community.tempest.earth/t/possible-bug-websocket-api-missing-data-sometimes/8863/11 "2020-08-23T20:37:08Z")

</div>

> [@dmeglio](#):
>
> And as a note, the article about the battery level changes doesn’t mention the wind sensor ever being disabled.

Agree, but it does say the sensor sample period can back off to greater than 60 seconds, so you have a chance of there being no wind reading in a particular obs\_st. There is usually a lot of discussion regarding what direction stations should report when there is zero wind. Some folks want null (no data). Some folks want the previous reading (I guess figuring a physical sensor wouldn’t have moved).

---

<div class="post-metadata">

**Author:** ![GaryFunk](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/garyfunk/32/5729_2.png) [@GaryFunk](https://community.tempest.earth/u/GaryFunk)\
**Post date:** [August 23, 2020, 8:46pm UTC](https://community.tempest.earth/t/possible-bug-websocket-api-missing-data-sometimes/8863/12 "2020-08-23T20:46:40Z")

</div>

> [@vinceskahan](#):
>
> Some folks want the previous reading (I guess figuring a physical sensor wouldn’t have moved).

That is the most logical value since that’s been the standard for over 2000 years.

---

<div class="post-metadata">

**Author:** ![vinceskahan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/vinceskahan/32/2785_2.png) [@vinceskahan](https://community.tempest.earth/u/vinceskahan)\
**Post date:** [August 23, 2020, 9:19pm UTC](https://community.tempest.earth/t/possible-bug-websocket-api-missing-data-sometimes/8863/13 "2020-08-23T21:19:49Z")

</div>

obligatory xkcd - [https://xkcd.com/927/](https://xkcd.com/927/)
