# Trying to decode a protobuf file using node-red-contrib-protobuf

**URL:** <https://discourse.nodered.org/t/trying-to-decode-a-protobuf-file-using-node-red-contrib-protobuf/60465>\
**Category:** General\
**Created:** [28 March 2022 16:26 UTC](https://discourse.nodered.org/t/trying-to-decode-a-protobuf-file-using-node-red-contrib-protobuf/60465 "2022-03-28T16:26:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rakgupta](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rakgupta/32/42535_2.png) [@rakgupta](https://discourse.nodered.org/u/rakgupta)\
**Post date:** [28 March 2022 16:26 UTC](https://discourse.nodered.org/t/trying-to-decode-a-protobuf-file-using-node-red-contrib-protobuf/60465/1 "2022-03-28T16:26:24Z")

</div>

Hello - I am not having any success trying to decode a protobuf load from my Tesla Powerwall+. The .proto file (see below) has multiple message types and I am not sure whether the contrib node handles that or I have some other problem.

I know it is reading the .proto file as I get an error message and the contents of the .proto in the debug pane if I specify a value that is not defined in it (eg. "Any" instead of "DeviceVital").

 ![Screen Shot 2022-03-28 at 11.16.13 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/0/20fd3ae2a738477d5babaa1c75632b5f486b6e0f.png)

If I specify "DeviceVital" in the "Type" in the decode node configuration, I get "processed" in the node status but the payload output still appears to be encrypted:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/8/28a28e850a9b180e7f084fd93bfbfbe07232d494.png)

My http request node is configured to return a binary payload.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/1/c1091af6e06703801e241fe9a892a448df6cadf6.png)

I have downloaded the binary file but since it has some proprietary data (serial #s etc.), I don't want to post it here. If you can help, I can PM it to you.

Thanks for your help.

**EDIT:**  
Node-RED v 1.3.5  
Node v 14.15.5  
MacOS Catalina 10.15.7

```auto
// Tesla Protocol Buffer definition (tesla.proto) 
// Used to decode /api/devices/vitals
//
// Credit and thanks to @brianhealey

syntax = "proto3";

package teslapower;

import "google/protobuf/timestamp.proto";

message DeviceVital {
    optional string name = 1;
    oneof value {
        int64 intValue = 3;
        double floatValue = 4;
        string stringValue = 5;
        bool boolValue = 6;
    }
}

message StringValue {
    string value = 1;
}

message UInt32Value {
    uint32 value = 1;
}

message ConnectionParameters {
    optional string ipAddress = 1;
    optional string serialPort = 2;
    optional string serialBaud = 3;
    optional uint32 modbusId = 4;
}

message TeslaHardwareId {
    optional UInt32Value pcbaId = 1;
    optional UInt32Value assemblyId = 2;
    optional UInt32Value usageId = 3;
}

message TeslaEnergyEcuAttributes {
    optional int32 ecuType = 1;
    optional TeslaHardwareId hardwareId = 2;
}

message GeneratorAttributes {
    optional uint64 nameplateRealPowerW = 1;
    optional uint64 nameplateApparentPowerVa = 2;
}

message PVInverterAttributes {
    optional uint64 nameplateRealPowerW = 1;
}

message MeterAttributes {
    repeated uint32 meterLocation = 1;
}

message DeviceAttributes {
    oneof deviceAttributes {
        TeslaEnergyEcuAttributes teslaEnergyEcuAttributes = 1;
        GeneratorAttributes generatorAttributes = 2;
        PVInverterAttributes pvInverterAttributes = 3;
        MeterAttributes meterAttributes = 4;
    };
}

message Device {
    optional StringValue din = 1;
    optional StringValue partNumber = 2;
    optional StringValue serialNumber = 3;
    optional StringValue manufacturer = 4;
    optional StringValue siteLabel = 5;
    optional StringValue componentParentDin = 6;
    optional StringValue firmwareVersion = 7;
    optional google.protobuf.Timestamp firstCommunicationTime = 8;
    optional google.protobuf.Timestamp lastCommunicationTime = 9;
    optional ConnectionParameters connectionParameters = 10;
    repeated DeviceAttributes deviceAttributes = 11;
}

message SiteControllerConnectedDevice {
    optional Device device = 1;
}

message SiteControllerConnectedDeviceWithVitals {
    repeated SiteControllerConnectedDevice device = 1;
    repeated DeviceVital vitals = 2;
    repeated string alerts = 3;
}

message DevicesWithVitals {
    repeated SiteControllerConnectedDeviceWithVitals devices = 1;
}

```

---

<div class="post-metadata">

**Author:** ![nerdasaur](https://avatars.discourse-cdn.com/v4/letter/n/e47c2d/32.png) [@nerdasaur](https://discourse.nodered.org/u/nerdasaur)\
**Post date:** [25 May 2022 19:33 UTC](https://discourse.nodered.org/t/trying-to-decode-a-protobuf-file-using-node-red-contrib-protobuf/60465/2 "2022-05-25T19:33:37Z")

</div>

I'm having an identical problem, although using a separate proto file. did you get any resolution to this problem?

---

<div class="post-metadata">

**Author:** ![rakgupta](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rakgupta/32/42535_2.png) [@rakgupta](https://discourse.nodered.org/u/rakgupta)\
**Post date:** [26 May 2022 11:14 UTC](https://discourse.nodered.org/t/trying-to-decode-a-protobuf-file-using-node-red-contrib-protobuf/60465/3 "2022-05-26T11:14:42Z")

</div>

Unfortunately, I haven't found a solution.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [25 July 2022 11:14 UTC](https://discourse.nodered.org/t/trying-to-decode-a-protobuf-file-using-node-red-contrib-protobuf/60465/4 "2022-07-25T11:14:47Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
