ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
ina219.h
Go to the documentation of this file.
1#pragma once
2
6
7#include <cinttypes>
8
9namespace esphome::ina219 {
10
11class 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:
32};
33
34} // namespace esphome::ina219
virtual void setup()
Where the component's initialization should happen.
Definition component.cpp:84
This class simplifies creating components that periodically check a state.
Definition component.h:532
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:144
static void uint32_t