ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
modbus_binarysensor.h
Go to the documentation of this file.
1#pragma once
2
6
7#include <vector>
8
10
12 public:
14 uint16_t skip_updates, bool force_new_range) {
15 this->register_type = register_type;
16 this->start_address = start_address;
17 this->offset = offset;
18 this->bitmask = bitmask;
20 this->skip_updates = skip_updates;
21 this->force_new_range = force_new_range;
22
24 this->register_count = offset + 1;
25 } else {
26 this->register_count = 1;
27 }
28 }
29
30 void parse_and_publish(const std::vector<uint8_t> &data) override;
31 void set_state(bool state) { this->state = state; }
32
33 void dump_config() override;
34
35 using transform_func_t = optional<bool> (*)(ModbusBinarySensor *, bool, const std::vector<uint8_t> &);
37
38 protected:
39 optional<transform_func_t> transform_func_{nullopt};
40};
41
42} // namespace esphome::modbus_controller
ESPDEPRECATED("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.", "2026.2.0") void set_retry(const std uint32_t uint8_t std::function< RetryResult(uint8_t)> && f
Definition component.h:437
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.
optional< bool >(*)(ModbusBinarySensor *, bool, const std::vector< uint8_t > &) transform_func_t
ModbusBinarySensor(ModbusRegisterType register_type, uint16_t start_address, uint8_t offset, uint32_t bitmask, uint16_t skip_updates, bool force_new_range)
void parse_and_publish(const std::vector< uint8_t > &data) override
const std::vector< uint8_t > & data
static void uint32_t