INA226 - new options added for ADC configuration; Fixed improper work with signed values (#3608)

This commit is contained in:
Anton Viktorov 2024-02-19 02:25:02 +01:00 committed by GitHub
parent 8fd1f43376
commit 7d8c3c757a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 22 additions and 15 deletions

View File

@ -7,10 +7,8 @@ INA226 DC current and power sensor
:keywords: ina226
The ``ina226`` sensor platform allows you to use your INA226 DC Current and Power Sensor
(`datasheet <http://www.ti.com/lit/ds/symlink/ina226.pdf>`__,
`eBay`_) sensors with
ESPHome. The :ref:`I²C Bus <i2c>` is
required to be set up in your configuration for this sensor to work.
(`datasheet <http://www.ti.com/lit/ds/symlink/ina226.pdf>`__, `eBay`_) sensors with ESPHome.
The :ref:`I²C Bus <i2c>` is required to be set up in your configuration for this sensor to work.
.. figure:: images/ina226-full.jpg
@ -28,6 +26,8 @@ required to be set up in your configuration for this sensor to work.
- platform: ina226
address: 0x40
shunt_resistance: 0.1 ohm
max_current: 3.2A
update_interval: 60s
current:
name: "INA226 Current"
power:
@ -36,28 +36,35 @@ required to be set up in your configuration for this sensor to work.
name: "INA226 Bus Voltage"
shunt_voltage:
name: "INA226 Shunt Voltage"
max_current: 3.2A
update_interval: 60s
Configuration variables:
------------------------
- **address** (*Optional*, int): Manually specify the I²C address of the sensor. Defaults to ``0x40``.
- **address** (*Optional*, integer): Manually specify the I²C address of the sensor. Defaults to ``0x40``.
- **shunt_resistance** (*Optional*, float): The value of the shunt resistor on the board for current calculation.
Defaults to ``0.1 ohm``.
- **max_current** (*Optional*, float): The maximum current you are expecting. ESPHome will use this to
configure the sensor optimally. Defaults to ``3.2A``.
- **current** (*Optional*): Use the current value of the sensor in amperes. All options from
:ref:`Sensor <config-sensor>`.
- **power** (*Optional*): Use the power value of the sensor in watts. All options from
:ref:`Sensor <config-sensor>`.
- **bus_voltage** (*Optional*): Use the bus voltage (voltage of the high side contact) value of the sensor in V.
All options from :ref:`Sensor <config-sensor>`.
- **shunt_voltage** (*Optional*): Use the shunt voltage (voltage across the shunt resistor) value of the sensor in V.
All options from :ref:`Sensor <config-sensor>`.
- **adc_time** (*Optional*, :ref:`config-time`): The time in microseconds to perform a single ADC conversion.
Defaults to ``1100us``. Valid values are ``140us``, ``204us``, ``332us``, ``588us``, ``1100us``, ``2116us``,
``4156us``, ``8244us``.
- **adc_averaging** (*Optional*, integer): Selects ADC sample averaging count. Defaults to ``4``. Valid values are
``1``, ``4``, ``16``, ``64``, ``128``, ``256``, ``512``, ``1024``.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``60s``.
Sensors
-------
The component offers four sensors. You can configure all or any subset of them. Each configured sensor
is reported separately on each update_interval. The ``name`` option is required for each sensor configured.
All other options from :ref:`Sensor <config-sensor>`.
- **current** (*Optional*): Calculated current output, Amperes.
- **power** (*Optional*): Calculated power output, Watts.
- **bus_voltage** (*Optional*): Bus voltage output (voltage of the high side contact), Volts.
- **shunt_voltage** (*Optional*): Shunt voltage (voltage across the shunt resistor) value of the sensor, Volts.
See Also
--------