ESP Home: Does anyone have a working custom i2c configuration? Can I learn from it?

It is hard to be a newbie and get stuck.
I try to operate a custom i2c device at an esp8266.
Trust me. I have read the docs I found. I googled the whole web. But no success!

If you interested in, I can show all my tries in yaml and headers. It would not help. At the moment I am confused with components and devices, output and outputs, inheritance, float and custom float.

Maybe your working ESP Home custom i2c device config helps me out.

Thank you in advance
Christian

Here is a working example with i2c and dallas:
EDIT: Sorry I did not read “custom” before answer so this is probably not what you asked for…

esphome:
  name: rp1
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: "xxxx"
  password: "00000"
  output_power: 17.0

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
# i2c sensors
i2c:
  sda: 4
  scl: 5
  scan: True

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: True
    name: "RP1-Button"
    on_press:
      - switch.toggle: relay

switch:
  - platform: gpio
    name: "RP1-Relay"
    pin: GPIO12
    id: relay

status_led:
  pin:
    number: GPIO13
    inverted: yes

ads1115:
  - address: 0x48

dallas:
  - pin: GPIO14

sensor:
  - platform: dallas
    address: 0xE00517A04E52FF28
    name: "RP1-OutTemp"

# Temp and Hum
  - platform: bme280
    temperature:
      name: "RP1-InTemp"
      oversampling: 16x
    pressure:
      name: "RP1-In-Pressure"
    humidity:
      name: "RP1-In-Humidity"
    address: 0x76
    update_interval: 60s
  - platform: ina219
    address: 0x40
    shunt_resistance: 0.001 ohm
    current:
      name: "RP1-SolarAmp"
      unit_of_measurement: A
      filters:
        - multiply: 20
      accuracy_decimals: 2
    power:
      name: "RP1-SolarWatt"
      unit_of_measurement: W
      filters:
        - multiply: 20
      accuracy_decimals: 2
    bus_voltage:
      name: "RP1-SolarVolt"
      filters:
        - multiply: 1.0
      accuracy_decimals: 2
    shunt_voltage:
      name: "RP1-SolarShunt-mV"
      unit_of_measurement: mV
      filters:
        - multiply: 1000
    max_voltage: 32.0V
    max_current: 3.2A
    update_interval: 5s
# Alog VCC
  - platform: adc
    pin: VCC
    name: "RP1-Vcc-A0"
    update_interval: 30s
    accuracy_decimals: 2
# Alog in
  - platform: ads1115
    multiplexer: 'A0_GND'
    gain: 6.144
    name: "RP1-HouseBatt-Volt"
    update_interval: 5s
    accuracy_decimals: 2
    unit_of_measurement: V
    filters:
      - multiply: 5.688
  - platform: ads1115
    multiplexer: 'A1_GND'
    gain: 6.144
    name: "RP1-CarBatt-Volt"
    update_interval: 10s
    accuracy_decimals: 2
    unit_of_measurement: V
    filters:
      - multiply: 5.709
  - platform: ads1115
    multiplexer: 'A2_A3'
    gain: 0.256
    name: "RP1-Charge-Amp"
    update_interval: 1s
    accuracy_decimals: 2
    unit_of_measurement: A
    filters:
      - multiply: 2000
      - sliding_window_moving_average:
          window_size: 5
          send_every: 5

You probably already checked here? https://esphome.io/custom/i2c.html

Thank you for your answers.
I can not get the example to work.
My yaml:

esphome:
  name: ac_dimmer
  platform: ESP8266
  board: nodemcuv2
  includes: my_custom_component.h  # example from the docs
    
wifi:
  ssid: "SSID"
  password: "WIFIPASS"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

i2c: 
    sda: D2
    scl: D1
    scan: True

light:
  - platform: monochromatic
    name: "Kitchen Lights"
    output: output_component1

output:
  - platform: custom
    type: float
    id: output_component1
    lambda: |-
      return nullptr;
    outputs:
      id: custom_float

The compiler keeps claiming:
“ID ‘output_component1’ of type custom::CustomFloatOutputConstructor doesn’t inherit from output::FloatOutput”
I googled this phrase the whole web. Do not know where to read to fix this.

I haven’t tried any custom components yet, but from my previous Googling, these are some examples I had book marked:



Hopefully one of them can help you out!

Here are three examples of custom I2C components I have implemented/collected: https://github.com/exxamalte/esphome-customisations