Base class for all binary_sensor-type classes.
bool state
The current state of this binary sensor. Also used as the backing storage for StatefulEntityBase.
void set_state(bool state)
uint16_t entity_count() const override
On the bit-addressed tables the bit sits at start_address + offset, so the read must span offset + 1 ...
void dump_config() override
optional< bool >(*)(ModbusBinarySensor *, bool, std::span< const uint8_t >) transform_func_t
ModbusBinarySensor(modbus::EntityType register_type, uint16_t start_address, uint8_t offset, uint32_t bitmask, RangeReuse reuse_previous_range)
void set_template(transform_func_t f)
void parse_and_publish(std::span< const uint8_t > data) override
optional< transform_func_t > transform_func_
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,...
uint8_t offset_from_start_address
The offset exactly as configured: measured from this sensor's own start_address, where offset is meas...
bool is_entity_type_binary(EntityType type)
Coils and discrete inputs are the bit-addressed entity tables; the other types are 16-bit registers.
const std::vector< uint8_t > & data
RangeReuse
How an item relates to the register range built just before it (same register type,...