NPI-19 Pressure sensor - Help Porting Arduino Code to External Component

I have a NPI-19 i2c pressure sensor I want to add to ESPHome.
I’m able to read the Temperature and Pressure with an Arduino but I’m not able to wrap my head arround how the External Components are working.

Can someone help me understand how I can translate the following code to a External Component.

#include <Wire.h>

#define SENSOR_ADDR 0x28

byte aa,bb,cc,dd,ee;
float pressure,temperature;

void setup() {
Wire.begin();
Serial.begin(9600);
}

void loop() {
byte data[4];
uint16_t pressure_bits = 0;
uint16_t temperature_bits = 0;
double pressure = 0.0;
double psi = 0.0;
double temperature = 0;

Wire.requestFrom(SENSOR_ADDR, 4);
data[0] = Wire.read();
data[1] = Wire.read();
data[2] = Wire.read();
data[3] = Wire.read();

pressure_bits = ((data[0] & 0b00111111) << 8) | data[1];
temperature_bits = (data[2] << 3) | (data[3] >> 5);

Serial.print("|Raw Values - Pressure: “);
Serial.print(pressure_bits, HEX);
Serial.print(”, Temperature: ");
Serial.print(temperature_bits, HEX);

//P_min = 0 hPa, P_max = 30 psi = 2068.428 hPa, Out_min = 1638, Out_max = 14745
pressure = ((pressure_bits - 1638) / (14745.0 - 1638.0)) * (2068.428 - 0.0);
psi = pressure * 0.0145037738;
temperature = ((temperature_bits * 200.0) / 2048.0) - 50.0;

Serial.print(" | Processed Values - Pressure:“);
Serial.print(pressure, DEC);
Serial.print(” hPa, PSI: “);
Serial.print(psi, DEC);
Serial.print(” psi, Temperature: “);
Serial.print(temperature, DEC);
Serial.print(” °C |\r\n");
delay(1000);

}

I created the file structure for a local component.
/homeassistant/esphome/my_components/npi19/init.py
/homeassistant/esphome/my_components/npi19/npi19_i2c.cpp
/homeassistant/esphome/my_components/npi19/npi19_i2c.h
/homeassistant/esphome/my_components/npi19/sensor.py

But I’m having difficulty figuring what I should put in the files.