void set_template(transform_func_t f)
optional< float >(*)(ModbusSensor *, float, std::span< const uint8_t >) transform_func_t
void parse_and_publish(std::span< const uint8_t > data) override
optional< transform_func_t > transform_func_
ModbusSensor(modbus::EntityType register_type, uint16_t start_address, uint8_t offset, uint32_t bitmask, SensorValueType value_type, RangeReuse reuse_previous_range)
void dump_config() override
modbus::EntityType register_type
RangeReuse reuse_previous_range
void set_address(uint16_t address)
Sets the configured address, and points the range base at it.
void set_offset_from_start_address(uint8_t offset)
Records the offset as configured, and seeds the resolved position with it.
SensorValueType sensor_value_type
uint8_t offset
Position of this sensor's data within its range's response - a byte offset for registers,...
Base-class for all sensors.
const std::vector< uint8_t > & data
RangeReuse
How an item relates to the register range built just before it (same register type,...