DAC7678
=======

.. seo::
    :description: Instructions for setting up the DAC7678.
    :image: dac7678.svg
    :keywords: DAC7678

.. _dac7678-component:

Component/Hub
-------------

The DAC7678 component represents a DAC7678 12-bit 8 channel DAC with internal reference
(`datasheet <https://www.ti.com/lit/ds/symlink/dac7678.pdf>`__) in ESPHome. It
uses the :ref:`I²C Bus <i2c>` for communication.

To use the channels of this components, you first need to setup the
global ``dac7678`` hub and give it an id, and then define the
:ref:`individual output channels <dac7678-output>`.

.. code-block:: yaml

    # Example configuration entry
    dac7678:
        address: 0x4A
        id: dac7678_hub1
        internal_reference: true

    # Individual outputs
    output:
      - platform: dac7678
        dac7678_id: 'dac7678_hub1'
        channel: 0

Configuration variables:
************************

-  **address** (*Optional*, int): The I²C address of the driver.
   Defaults to ``0x48``.
-  **id** (*Optional*, :ref:`config-id`): The id to use for
   this dac7678 component. Use this if you have multiple DAC7678s connected at the same time
-  **internal_reference** (*Optional*, bool): State of the internal reference.
   Defaults to ``false``.

.. _dac7678-output:

DAC7678 Output
--------------

The DAC7678 output component exposes a DAC7678 DAC channel of a global
:ref:`DAC7678 hub <dac7678-component>` as a float
output.

.. code-block:: yaml

    # Example configuration entry
    dac7678:
        address: 0x4A
        id: dac7678_hub1
        internal_reference: true

    # Individual outputs
    output:
      - platform: dac7678
        dac7678_id: 'dac7678_hub1'
        channel: 0
        id: 'dac7678_1_ch0'
      - platform: dac7678
        dac7678_id: 'dac7678_hub1'
        channel: 1
        id: 'dac7678_1_ch1'
      - platform: dac7678
        dac7678_id: 'dac7678_hub1'
        channel: 2
        id: 'dac7678_1_ch2'
      - platform: dac7678
        dac7678_id: 'dac7678_hub1'
        channel: 3
        id: 'dac7678_1_ch3'
      - platform: dac7678
        dac7678_id: 'dac7678_hub1'
        channel: 4
        id: 'dac7678_1_ch4'
      - platform: dac7678
        dac7678_id: 'dac7678_hub1'
        channel: 5
        id: 'dac7678_1_ch5'
      - platform: dac7678
        dac7678_id: 'dac7678_hub1'
        channel: 6
        id: 'dac7678_1_ch6'
      - platform: dac7678
        dac7678_id: 'dac7678_hub1'
        channel: 7
        id: 'dac7678_1_ch7'


Configuration variables:
************************

- **id** (**Required**, :ref:`config-id`): The id to use for this output component.
- **channel** (**Required**, int): Chose the channel of the DAC7678 of
  this output component. Must be in range from 0 to 7.
- **dac7678_id** (*Optional*, :ref:`config-id`): Manually specify the ID of the
  :ref:`DAC7678 hub <dac7678-component>`.
  Use this if you have multiple DAC7678 devices.
- All other options from :ref:`Output <config-output>`.

See Also
--------

- :doc:`/components/output/index`
- :ghedit:`Edit`
