Update for multiple cd74hc4067 (#1833)
This commit is contained in:
parent
c1322525ed
commit
bb18559af9
|
@ -14,7 +14,7 @@ and there are also some guides around like the one from `Adam Meyer <http://adam
|
|||
|
||||
Actually, the chip is bidirectional and could also be used as output, but this is not supported by the component yet.
|
||||
|
||||
First, you need to configure the component with the digital pins that control the multiplexer.
|
||||
First, you need to configure the component with the digital pins that control the multiplexer.
|
||||
Then you need to set up a voltage sensor source (e.g. :doc:`ADC sensor <adc>`) and pass it to the cd74hc4067 sensors with the ``sensor`` option.
|
||||
Each cd74hc4067 sensor is configured for one of the 16 input pins of the multiplexer.
|
||||
|
||||
|
@ -22,20 +22,21 @@ Each cd74hc4067 sensor is configured for one of the 16 input pins of the multipl
|
|||
|
||||
# Example configuration entry
|
||||
cd74hc4067:
|
||||
pin_s0: D0
|
||||
pin_s1: D1
|
||||
pin_s2: D2
|
||||
pin_s3: D3
|
||||
- id: cd74hc4067_1
|
||||
pin_s0: D0
|
||||
pin_s1: D1
|
||||
pin_s2: D2
|
||||
pin_s3: D3
|
||||
|
||||
sensor:
|
||||
- platform: adc
|
||||
- platform: adc
|
||||
id: adc_sensor
|
||||
pin: A0
|
||||
- platform: cd74hc4067
|
||||
- platform: cd74hc4067
|
||||
id: adc_0
|
||||
number: 0
|
||||
sensor: adc_sensor
|
||||
- platform: cd74hc4067
|
||||
- platform: cd74hc4067
|
||||
id: adc_1
|
||||
number: 1
|
||||
sensor: adc_sensor
|
||||
|
@ -56,13 +57,14 @@ Configuration Variables:
|
|||
************************
|
||||
|
||||
- **sensor** (**Required**, :ref:`config-id`): The source sensor to measure voltage values from, e.g. :doc:`ADC sensor <adc>`.
|
||||
- **cd74hc4067_id** (**Required**, :ref:`config-id`): The id of the cd74hc4067 component to use for this sensor.
|
||||
- **number** (*Required*, int): The number of the cd74hc4067 input pin (0-15)
|
||||
- All other options from :ref:`Sensor <config-sensor>`.
|
||||
|
||||
Application Example
|
||||
-------------------
|
||||
|
||||
In this example, the component is used to measure the AC power output of two solar inverters to integrate them
|
||||
In this example, the component is used to measure the AC power output of two solar inverters to integrate them
|
||||
as energy sources in `Home Assistant <https://www.home-assistant.io/docs/energy/solar-panels/>`__.
|
||||
|
||||
For this purpose, :doc:`CT clamp sensors <ct_clamp>` are attached on each of the sensors.
|
||||
|
@ -72,42 +74,43 @@ The ``adc`` and ``cd74hc4067`` sensors updates are triggered by the ``ct_clamp``
|
|||
.. code-block:: yaml
|
||||
|
||||
cd74hc4067:
|
||||
pin_s0: D0
|
||||
pin_s1: D1
|
||||
pin_s2: D2
|
||||
pin_s3: D3
|
||||
- id: cd74hc4067_1
|
||||
pin_s0: D0
|
||||
pin_s1: D1
|
||||
pin_s2: D2
|
||||
pin_s3: D3
|
||||
|
||||
sensor:
|
||||
- platform: adc
|
||||
- platform: adc
|
||||
id: adc_sensor
|
||||
pin: A0
|
||||
update_interval: 3600s
|
||||
- platform: cd74hc4067
|
||||
- platform: cd74hc4067
|
||||
id: solar_1_raw
|
||||
number: 0
|
||||
sensor: adc_sensor
|
||||
update_interval: 3600s
|
||||
- platform: cd74hc4067
|
||||
- platform: cd74hc4067
|
||||
id: solar_2_raw
|
||||
number: 1
|
||||
sensor: adc_sensor
|
||||
update_interval: 3600s
|
||||
- platform: ct_clamp
|
||||
- platform: ct_clamp
|
||||
name: "SolarPower1"
|
||||
sensor: solar_1_raw
|
||||
update_interval: 5s
|
||||
unit_of_measurement: "W"
|
||||
device_class: "power"
|
||||
filters:
|
||||
- lambda: "return x > 0.001 ? x * 56221 : 0;"
|
||||
- platform: ct_clamp
|
||||
- lambda: "return x > 0.001 ? x * 56221 : 0;"
|
||||
- platform: ct_clamp
|
||||
name: "SolarPower2"
|
||||
sensor: solar_2_raw
|
||||
update_interval: 5s
|
||||
unit_of_measurement: "W"
|
||||
device_class: "power"
|
||||
filters:
|
||||
- lambda: "return x > 0.001 ? x * 57519 : 0;"
|
||||
- lambda: "return x > 0.001 ? x * 57519 : 0;"
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
|
Loading…
Reference in New Issue