Esphome pca9685 mix on/off and pwm

First of all I’m new with esphome.

My hardware : esp32-wroom, 2 multiplexer pcf8574 for reading the inputs, pca9685 for 16 outputs. All connected by I2c-bus.

All the lights are led 24 V as a mix from dimmable leds (pwm) and on/off leds.

I made some separate tests for the on/off lights and the dimmable lights and this works.

Now I will combine these 2 files in one yaml file, but then I receive a lot of error.

Is it possible to have a mix of on/off an pwm lights on the pca9685 ?

I also did not find a description what ‘platform’ really means.

I include both test files, hopefully someone can help me to combine these in one working file.

test on/off :

i2c:
sda: 4
scl: 16
scan: true
id: bus_a
frequency: 400kHz

pcf8574:

  • id: 'pcf8574_hub_in_1' # for input channel 1-8 maybe 0x22 / 0x3A
    address: 0x22

  • id: 'pcf8574_hub_in_2' # for input channel 9-16
    address: 0x21

pca9685:
id: 'pca9685_hub'
frequency: 50

output:

  • platform: pca9685
    id: relay_1_out
    channel: 0
    inverted: false

switch:

  • platform: output
    name: "ledstrip douche log.k"
    id: relay_switch
    output: relay_1_out

#3. Define the physical push button
binary_sensor:

  • platform: gpio
    name: "ap-input1"
    pin:
    pcf8574: pcf8574_hub_in_1
    number: 0
    mode: INPUT
    inverted: true
    id: light_1_touch
    on_press:
    then:
    • switch.toggle: relay_switch

test dimmer

i2c:
sda: 4
scl: 16
scan: true
id: bus_a

pcf8574:

  • id: 'pcf8574_hub_in_1' # for input channel 1-8 maybe 0x22 / 0x3A
    address: 0x22

  • id: 'pcf8574_hub_in_2' # for input channel 9-16
    address: 0x21

binary_sensor:

  • platform: gpio
    name: "ap-input1"
    pin:
    pcf8574: pcf8574_hub_in_1
    number: 0
    mode: INPUT
    inverted: true
    id: light_1_touch
    on_click:
    then:
    • if:
      condition:
      light.is_off: light_1
      then:
      light.turn_on:
      id: light_1
      brightness: 1.0
      else:
      light.turn_off: light_1
      on_press:
      then:
    • if:
      condition:
      light.is_off: light_1
      then:
      • delay: 0.5s
      • while:
        condition:
        binary_sensor.is_on: light_1_touch
        then:
        • light.dim_relative:
          id: light_1
          relative_brightness: 5%
          transition_length: 0.1s
        • delay: 0.1s
          else:
      • delay: 0.5s
      • while:
        condition:
        and:
        • binary_sensor.is_on: light_1_touch
        • light.is_on: light_1
          then:
        • light.dim_relative:
          id: light_1
          relative_brightness: -5%
          transition_length: 0.1s
        • delay: 0.1s
          pca9685:
          id: pca9685_hub
          frequency: 500
          #phase_balancer: none

output:

  • platform: pca9685
    pca9685_id: 'pca9685_hub'
    id: "PWM0"
    channel: 0
    light:
  • platform: monochromatic
    name: "Douche log.kamer"
    id: light_1
    output: PWM0
    web_server:
    port: 80

solved now