Websocket Documentation issue

When requesting data from the WF websocket endopoint, what are the ‘device_id’ and ‘id’ parameters?
–Sam

1 Like

The device_id is the ID of the device that corresponds to the serial_number of the device. When you register a device (Air, Hub and Sky) it is assigned a device_id in the WeatherFlow database. You can see the device_id by looking at the data from the web and phone applications.

The id parameter is an ID that you assign and it is returned with each packet that you subscribed to. If you assign an ID of “air_01” then the packet will contain an ID of “air_01” when it is sent to you. This way you can code your application to know why the data was sent and what your application should do with the packet.

5 Likes

Thanks Gary. I was assuming it was along those lines, but wanted to verify.
–Sam

1 Like

Thanks for clarifying this! I’d always wondered what the id field was, and had never looked close enough to see that it was returned in the websocket packet.

Glad my stupid question was able to help more than just me!

1 Like

It is not a stupid question. I spent hours testing and researching.

I did discover an issue with the server. If you issue a we socket Ping, the server replies with as Ping instead of as Pong. In my book, that’s just wrong.

3 Likes

Ok… next question…

If I put in my SKY sn for the device_id on a listen_start command… I’ll get obs_sky and rapid_wind messages back. Correct?

And if I use my HUB sn, I’ll get all messages?
–Sam

1 Like

No. You subscribe to each dataset you want using the correct device_id. If you want to subscribe to rapid wind you have to subscribe to “listen_rapud_start” and use the device_id of the Sky.

Ugh… Just saw that… my Blonde got the better of me.

1 Like