15 static const float BL0939_IREF = 324004 * 1 / 1.218;
16 static const float BL0939_UREF = 79931 * 0.51 * 1000 / (1.218 * (5 * 390 + 0.51));
17 static const float BL0939_PREF = 4046 * 1 * 0.51 * 1000 / (1.218 * 1.218 * (5 * 390 + 0.51));
18 static const float BL0939_EREF = 3.6e6 * 4046 * 1 * 0.51 * 1000 / (1638.4 * 256 * 1.218 * 1.218 * (5 * 390 + 0.51));
73 void update()
override;
74 void setup()
override;
75 void dump_config()
override;
90 float power_reference_ = BL0939_PREF;
92 float voltage_reference_ = BL0939_UREF;
94 float current_reference_ = BL0939_IREF;
96 float energy_reference_ = BL0939_EREF;
102 static bool validate_checksum(
const DataPacket *data);
104 void received_package_(
const DataPacket *data)
const;
void set_power_sensor_2(sensor::Sensor *power_sensor_2)
void set_voltage_sensor(sensor::Sensor *voltage_sensor)
esphome::bl0939::BL0939 __attribute__
void set_current_sensor_2(sensor::Sensor *current_sensor_2)
This class simplifies creating components that periodically check a state.
void set_power_sensor_1(sensor::Sensor *power_sensor_1)
void set_energy_sensor_2(sensor::Sensor *energy_sensor_2)
void set_current_sensor_1(sensor::Sensor *current_sensor_1)
constexpr int32_t to_int32_t(sbe24_t input)
constexpr uint32_t to_uint32_t(ube24_t input)
Implementation of SPI Controller mode.
Base-class for all sensors.
void set_energy_sensor_1(sensor::Sensor *energy_sensor_1)
void set_energy_sensor_sum(sensor::Sensor *energy_sensor_sum)