ESPHome 433mhz RF Receiver How to convert Binary to Decimal

I’ve created an RF transmitter to use as a door sensor. The sensor transmits 2 values. One for the number of the sensor (e.g. 1001) the second value represents the voltage of the battery supply to the sensor. I’m using the RCSwitch library to send the data. Here is the code:

#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();
int led = 2;

ADC_MODE(ADC_VCC);

long sensor_no = 1;
long packetA = 1000 + sensor_no;
long vcc = 0;

void setup() {
  mySwitch.enableTransmit(0);  // Using Pin #2
  pinMode(led,OUTPUT);
  digitalWrite(led,LOW); 

  vcc = ESP.getVcc();
     
}

void loop() {
  
  mySwitch.send(packetA, 24);
  delay(200);
  mySwitch.send(vcc, 24);
  delay(800);
  
}

On the receiving end I’m using ESPHome remote_receiver.
The yaml below properly captures the sensor number ‘1001’ in binary. What I need help with is how to convert the second value into decimal so I can evaluate the level of the battery. I figured some lambda code would work but I have no clue how to obtain the value to convert it.

If I can convert the binary to decimal then I could combine the data into a single value eg. 10013300 where the first four digits are the door number and the last four are the mV from the battery.

The output from the transmitter is working great and the receiver can clearly receive the data. I just need some code to be able to capture the data and process it. Even if I could send the raw data to HA I could then process it with a Node-Red function. I am trying to avoid MQTT if possible as I’m not using MQTT anywhere else.

Any Ideas?

remote_receiver:
  pin: 2
  dump: rc_switch
  tolerance: 50%
  filter: 10us
  idle: 10ms
  buffer_size: 500b

binary_sensor:
  - platform: remote_receiver
    name: "Front Door"
    id: front_door
    rc_switch_raw:
      protocol: 1
      code: "000000000000001111101001"

Sample output

[00:52:48][D][binary_sensor:036]: 'Front Door': Sending state ON
[00:52:48][D][binary_sensor:036]: 'Front Door': Sending state OFF
[00:52:49][D][remote.rc_switch:256]: Received RCSwitch Raw: protocol=1 data='000000000000110101101110'
[00:52:49][D][remote.rc_switch:256]: Received RCSwitch Raw: protocol=1 data='000000000000110101101110'
[00:52:49][D][remote.rc_switch:256]: Received RCSwitch Raw: protocol=1 data='000000000000110101101110'
[00:52:49][D][remote.rc_switch:256]: Received RCSwitch Raw: protocol=1 data='000000000000110101101110'
[00:52:49][D][remote.rc_switch:256]: Received RCSwitch Raw: protocol=1 data='000000000000110101101110'
[00:52:49][D][remote.rc_switch:256]: Received RCSwitch Raw: protocol=1 data='000000000000110101101110'

You could check out MySensors library instead of using ESPHome.