ESPHome 2025.12.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
9namespace esphome {
10namespace modbus_controller {
11
13 public:
15 uint16_t skip_updates, bool force_new_range) {
16 this->register_type = register_type;
17 this->start_address = start_address;
18 this->offset = offset;
19 this->bitmask = bitmask;
21 this->skip_updates = skip_updates;
22 this->force_new_range = force_new_range;
23
25 this->register_count = offset + 1;
26 } else {
27 this->register_count = 1;
28 }
29 }
30
31 void parse_and_publish(const std::vector<uint8_t> &data) override;
32 void set_state(bool state) { this->state = state; }
33
34 void dump_config() override;
35
36 using transform_func_t = optional<bool> (*)(ModbusBinarySensor *, bool, const std::vector<uint8_t> &);
38
39 protected:
41};
42
43} // namespace modbus_controller
44} // namespace esphome
Base class for all binary_sensor-type classes.
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
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
const nullopt_t nullopt((nullopt_t::init()))