antonverburg / ha-pca9685

Home Assistant Raspberry Pi GPIO PWM Integration

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Home Assistant PCA9685 PWM custom integration

This is a spin-off from an original Home Assistant integration which was removed in Home Assistant Core 2022.4. The original rpi_gpi_pwm was stored here but due to changes in 2022.7.5 support for pca9685 PWM devices was dropped. This module brings back support for the pca9685 PWM LED driver in a separate component.

GitHub Release GitHub Activity License

hacs Project Maintenance

Discord Community Forum

Description.

The pca9685 component allows to control multiple lights using pulse-width modulation, for example LED strips. It supports one-color, RGB and RGBW LEDs driven by pca9685 devices. A PWM output can also be configured as a number. Connection to the pca9685 devices is made via the I2C bus.

For more details about the pca9685 I2C PWM LED controller you can find the datasheets here:

This integration can set up the following platforms.

Platform Description
light Write LED signal to digital PWM outputs.
number Writes signal represented by a number to PWM outputs.

HACS (Preferred)

  1. Add the custom integration repository: https://github.com/antonverburg/ha-pca9685
  2. Select PCA9685 in the Integration tab and click download
  3. Restart Home Assistant
  4. Done!

Manual

  1. Using the tool of choice open the directory (folder) for your HA configuration (where you find configuration.yaml).
  2. If you do not have a custom_components directory (folder) there, you need to create it.
  3. In the custom_components directory (folder) create a new folder called pca9685.
  4. Download all the files from the custom_components// directory (folder) in this repository.
  5. Place the files you downloaded in the new directory (folder) you created.
  6. Restart Home Assistant

Configuration via user interface:

  • Configuration via user interface is not yet supported

YAML Configuration

This integration can be configured and set up manually via YAML. To enable the light or number in your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry

light:
  - platform: pca9685
    leds:
      - name: Lightstrip Cupboard
        pins: 10

number:
  - platform: pca9685
    numbers:
      - name: Test number
        pin: 12

Configuration parameters

Generic settings:

  • name: Name of the LED.

    required: true | type: string

  • frequency: The PWM frequency.

    required: false | type: int

  • address: I2C address of the LED driver

    required: false | default: 0x40 | type: int

Light specific settings:

  • leds: List of LEDs.

    required: true | type: map

  • pins: The pins connected to the LED as a list. For single LED, assign one integer, for RGB assign 3 integers, for RGBW assign 4. Numbering starts from 0 up to 15.

    required: true | type: [int]

number specific settings:

  • numbers: List of the numbers.

    required: true | type: map

  • pin: The pin connected to the number. Numbering starts from 0 up to 15.

    required: true | type: int

  • invert: Invert signal of the PWM generator (only available for the number platform)

    required: false | default: false | type: boolean

  • minimum: Minimal (clipping) value of the number.

    required: false | default: 0 | type: float

  • maximum: Maximal (clipping) value of the number.

    required: false| default: 100 | type: float

  • normalize_lower: Lower value to normalize the output of the PWM signal on.

    required: false | default: 0 | type: float

  • normalize_upper: Upper value to normalize the output of the PWM output on.

    required: false | default: 100 | type: float

Full configuration example

light:
- platform: pca9685
    leds:
      - name: Lightstrip Simple
        pins: 10
        address: 65
      - name: Lightstrip RGB
        pins: [2,5,9]
        address: 65
      - name: Lightstrip RGBW
        pins: [1,2,4,6]
        address: 65

number:
  - platform: pca9685
    numbers:
      - name: Test number
        pin: 12
        frequency: 1000
        invert: true
        minimum: 11.5
        maximum: 75.7
        normalize_lower: -10.8
        normalize_upper: 200.5
        address: 65

Contributions are welcome!

If you want to contribute to this please read the Contribution guidelines


About

Home Assistant Raspberry Pi GPIO PWM Integration

License:MIT License


Languages

Language:Python 94.3%Language:Shell 5.7%