TechSmartSolutions / 0-10v-lighting-controller-for-Home-Assistant

The purpose of this repo is to explain how you can build 0-10v controllers that can be used for controlling lighting and other compatible devices (such as certain dehumidifiers and air conditioners) using an ESP, ESPhome and Home Assistant.
16 stars 2 forks source link

DFRobots 2 Channel i2c 0-10v DAC is now working in ESPHome #7

Open inspectorgrowadmin opened 1 year ago

inspectorgrowadmin commented 1 year ago

Just thought I would let you all know that Jesse kindly integrated the module into ESPHome. Its not part of the main branch yet but you can see the PR here: https://github.com/esphome/esphome/pull/4495

You can pull it from the git using this at the start of your ESPHome config.yaml:

# Testing 2 Channel 0-10v I2C DAC GP8403
external_components:
  - source: github://pr#4495
    components: gp8403
    refresh: 1min

i2c:
  scan: true
  frequency: 400000Hz

output:
  - platform: gp8403
    channel: 0
    id: gp8403_0
    address: 0x5F
  - platform: gp8403
    channel: 1
    id: gp8403_1
    address: 0x5F

light:
  - platform: monochromatic
    name: "LED 1 Test V2"
    output: gp8403_0
    gamma_correct: 1.2

  - platform: monochromatic
    name: "LED 2 Test V2"
    output: gp8403_1
    gamma_correct: 1.2

Link to the module: https://wiki.dfrobot.com/SKU_DFR0971_2_Channel_I2C_0_10V_DAC_Module

grssll commented 1 year ago

How do you set voltage in the dac?

lpojzl commented 1 year ago

I had a success with following:

fan:

The example at github (below) did not work well - the voltage change was not linear to the slider.

light:

grssll commented 1 year ago

Can you post full code please?? Also, how do you set 0-10v or 0-5v in the dac?? Thanks

inspectorgrowadmin commented 1 year ago

I have updated the original post with the full code. I haven't checked if its been merged into the ESPHome branch yet so adding the external GitHub still might be needed.

jayme-github commented 1 month ago

FWIW the gp8403 component is in esphome upstream and you'll get a linear output voltage by setting gamma_correct: 0.