ESPHome
2026.11.0b6
Loading...
Searching...
No Matches
esphome
components
ina219
ina219.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
esphome/core/component.h
"
4
#include "
esphome/components/sensor/sensor.h
"
5
#include "
esphome/components/i2c/i2c.h
"
6
7
#include <cinttypes>
8
9
namespace
esphome::ina219
{
10
11
class
INA219Component
final :
public
PollingComponent
,
public
i2c::I2CDevice
{
12
SUB_SENSOR(bus_voltage)
13
SUB_SENSOR(shunt_voltage)
14
SUB_SENSOR(current)
15
SUB_SENSOR(power)
16
17
public
:
18
void
setup
()
override
;
19
void
dump_config()
override
;
20
void
update()
override
;
21
void
on_powerdown()
override
;
22
23
void
set_shunt_resistance_ohm(
float
shunt_resistance_ohm) {
shunt_resistance_ohm_
= shunt_resistance_ohm; }
24
void
set_max_current_a(
float
max_current_a) {
max_current_a_
= max_current_a; }
25
void
set_max_voltage_v(
float
max_voltage_v) {
max_voltage_v_
= max_voltage_v; }
26
27
protected
:
28
float
shunt_resistance_ohm_
;
29
float
max_current_a_
;
30
float
max_voltage_v_
;
31
uint32_t
calibration_lsb_
;
32
};
33
34
}
// namespace esphome::ina219
esphome::Component::setup
virtual void setup()
Where the component's initialization should happen.
Definition
component.cpp:84
esphome::PollingComponent
This class simplifies creating components that periodically check a state.
Definition
component.h:532
esphome::i2c::I2CDevice
This Class provides the methods to read/write bytes from/to an i2c device.
Definition
i2c.h:144
esphome::ina219::INA219Component
Definition
ina219.h:11
esphome::ina219::INA219Component::max_voltage_v_
float max_voltage_v_
Definition
ina219.h:30
esphome::ina219::INA219Component::shunt_resistance_ohm_
float shunt_resistance_ohm_
Definition
ina219.h:28
esphome::ina219::INA219Component::calibration_lsb_
uint32_t calibration_lsb_
Definition
ina219.h:31
esphome::ina219::INA219Component::max_current_a_
float max_current_a_
Definition
ina219.h:29
component.h
i2c.h
esphome::ina219
Definition
ina219.cpp:5
uint32_t
static void uint32_t
Definition
crash_handler.cpp:153
sensor.h
Generated by
1.12.0