HX711 Load Cell Amplifier

See Application::make_hx711_sensor().

API Reference

class HX711Sensor : public sensor::PollingSensorComponent

Public Functions

HX711Sensor(const std::string &name, GPIOPin *dout, GPIOPin *sck, uint32_t update_interval = 15000)
void setup()

Where the component’s initialization should happen.

Analogous to Arduino’s setup(). This method is guaranteed to only be called once. Defaults to doing nothing.

void dump_config()
float get_setup_priority() const

priority of setup().

higher -> executed earlier

Defaults to 0.

Return
The setup priority of this component

void update()
void set_gain(HX711Gain gain)
std::string unit_of_measurement()

Override this to set the Home Assistant unit of measurement for this sensor.

Return “” to disable this feature.

Return
The icon of this sensor, for example “°C”.

std::string icon()

Override this to set the Home Assistant icon for this sensor.

Return “” to disable this feature.

Return
The icon of this sensor, for example “mdi:battery”.

int8_t accuracy_decimals()

Return the accuracy in decimals for this sensor.

Protected Functions

bool read_sensor_(uint32_t *result)

Protected Attributes

GPIOPin *dout_pin_
GPIOPin *sck_pin_
HX711Gain gain_ = {HX711_GAIN_128}