Custom server
Hello!
I'm trying to write a custom telemetry server to process data from Tesla.
Note that I'm NOT using fleet-telemetry at all.
I have few questions:
- Can you please add the flatbuffers definitions (not the compile Go ones) in the repository)?
- I'm not really into Go code, so I need to know the following: do we need to confirm receipt of a message via
StreamAckMessageor we just receiveStreamMessageand that's it?
Thanks!
I've also looked into this a little bit so will contribute what I know:
The protobuf definitions are all here (compiled pb.go and uncompiled .proto) https://github.com/teslamotors/fleet-telemetry/tree/main/protos
I dont know for sure, but I believe the vehicle is expecting messages to be ack'ed because I have seen vehicles retransmit messages to my fleet-telmetery instances.
Out of interest what language are you writing it in? I started a NodeJS version but gave up very quickly.
Thanks for your input! Yup, I see the proto there but it seems the message receives them embedded a in a flatbuffer structure. I hope they publish this.
I'm writing them in Node.js (see at my profile and you'll get why ;)). I'm using @fastify/websocket which makes the process pretty easy.
@ShogunPanda are you able to make it work? We are trying to build using Node/Express and hosting it using Google Cloud Run behind a load balancer.
One of our cars is connecting using Websocket and sending some messages, but we are stuck trying to convert the message to a JSON using protobufJS(https://www.npmjs.com/package/protobufjs)
We did some tests creating a custom proto file, sending a message using Websocket and decoding the message and it worked, but we are failing miserable using the proto files provided on this project.
Unfortunately not. I ended up installing the Go fleet-telemetry and getting it via the JSON stdout log
Here is what I have, this definition is successfully decoding a FlatbuffersStream message. Comments derived via LLM of this file https://github.com/teslamotors/fleet-telemetry/blob/main/messages/stream_message.go . Working fbs definition found by manually inspecting the binary protocol, comparing with the go source, and working with LLM.
namespace tesla;
// Stream message containing telemetry data
table FlatbuffersStream {
created_at:uint32; // timestamp
sender_id:[ubyte] (deprecated); // deprecated: use combination of device_type + device_id
payload:[ubyte]; // the protobuf encoded payload
device_type:[ubyte]; // device identity coming from the certificate derived of Issuer CN
device_id:[ubyte]; // device identity coming from the certificate derived of Subject CN
delivered_at_epoch_ms:uint64; // timestamp (in milliseconds) at which the message reached the backend
}
// Acknowledgment message
table FlatbuffersStreamAck {
// empty ack message
}
// Define the union with explicit values matching the Message enum
union Message {
FlatbuffersStream = 4,
FlatbuffersStreamAck = 5
}
// Main message envelope that wraps all messages
table FlatbuffersEnvelope {
txid:[ubyte]; // unique transaction id of this message
topic:[ubyte]; // used for routing messages to backend queues
message:Message; // the actual message content as a union
message_id:[ubyte]; // unique id of the message
}
root_type FlatbuffersEnvelope;
@ShogunPanda @rafadalosto could u guys share with me what you have so far, I am also exploring having a nodejs server for that.
See flatbuffers definition https://github.com/teslamotors/fleet-telemetry/blob/main/messages/stream_message.go