15 SUB_SENSOR(battery_level)
17 SUB_SENSOR(remaining_capacity)
18 SUB_SENSOR(full_charge_capacity)
19 SUB_SENSOR(time_to_empty)
20 SUB_SENSOR(state_of_health)
23 void setup()
override;
24 void update()
override;
25 void dump_config()
override;
32 if (sensor ==
nullptr)
virtual void setup()
Where the component's initialization should happen.
This class simplifies creating components that periodically check a state.
bool read_word_(uint8_t reg, uint16_t &value)
void publish_(sensor::Sensor *sensor, uint8_t reg, bool &ok, F convert)
Read a standard command register and publish it through the sensor, if one is configured.
This Class provides the methods to read/write bytes from/to an i2c device.
I2CRegister reg(uint8_t a_register)
calls the I2CRegister constructor
Base-class for all sensors.
void publish_state(float state)
Publish a new state to the front-end.