ESPHome 2025.5.0
Loading...
Searching...
No Matches
modbus_textsensor.h
Go to the documentation of this file.
1#pragma once
2
6
7#include <vector>
8
9namespace esphome {
10namespace modbus_controller {
11
12enum class RawEncoding { NONE = 0, HEXBYTES = 1, COMMA = 2, ANSI = 3 };
13
15 public:
17 uint16_t response_bytes, RawEncoding encode, uint16_t skip_updates, bool force_new_range) {
18 this->register_type = register_type;
19 this->start_address = start_address;
20 this->offset = offset;
21 this->response_bytes = response_bytes;
22 this->register_count = register_count;
23 this->encode_ = encode;
24 this->skip_updates = skip_updates;
25 this->bitmask = 0xFFFFFFFF;
27 this->force_new_range = force_new_range;
28 }
29
30 void dump_config() override;
31
32 void parse_and_publish(const std::vector<uint8_t> &data) override;
34 std::function<optional<std::string>(ModbusTextSensor *, std::string, const std::vector<uint8_t> &)>;
36
37 protected:
39
41};
42
43} // namespace modbus_controller
44} // namespace esphome
void parse_and_publish(const std::vector< uint8_t > &data) override
ModbusTextSensor(ModbusRegisterType register_type, uint16_t start_address, uint8_t offset, uint8_t register_count, uint16_t response_bytes, RawEncoding encode, uint16_t skip_updates, bool force_new_range)
std::function< optional< std::string >(ModbusTextSensor *, std::string, const std::vector< uint8_t > &)> transform_func_t
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
const nullopt_t nullopt((nullopt_t::init()))