ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
mopeka_std_check.h
Go to the documentation of this file.
1#pragma once
3#include <cinttypes>
4#include <vector>
9
11
13 STANDARD = 0x02,
14 XL = 0x03,
16 ETRAILER = 0x46,
17};
18
19// 4 values in one struct so it aligns to 8 byte. One `mopeka_std_values` is 40 bit long.
20struct mopeka_std_values { // NOLINT(readability-identifier-naming,altera-struct-pack-align)
21 u_int16_t time_0 : 5;
22 u_int16_t value_0 : 5;
23 u_int16_t time_1 : 5;
24 u_int16_t value_1 : 5;
25 u_int16_t time_2 : 5;
26 u_int16_t value_2 : 5;
27 u_int16_t time_3 : 5;
28 u_int16_t value_3 : 5;
29} __attribute__((packed));
30
31struct mopeka_std_package { // NOLINT(readability-identifier-naming,altera-struct-pack-align)
32 u_int8_t data_0 : 8;
33 u_int8_t data_1 : 8;
34 u_int8_t raw_voltage : 8;
35
36 u_int8_t raw_temp : 6;
38 bool sync_pressed : 1;
39
41} __attribute__((packed));
42
44 SUB_SENSOR(level)
45 SUB_SENSOR(temperature)
46 SUB_SENSOR(battery_level)
47 SUB_SENSOR(distance)
48
49 public:
50 void set_address(uint64_t address) { address_ = address; };
51
52 bool parse_device(const ble_device_base::ESPBTDevice &device) override;
53 void dump_config() override;
54
55 void set_propane_butane_mix(float val) { this->propane_butane_mix_ = val; };
56 void set_tank_full(float full) { this->full_mm_ = full; };
57 void set_tank_empty(float empty) { this->empty_mm_ = empty; };
58
59 protected:
60 uint64_t address_;
61
65
69};
70
71} // namespace esphome::mopeka_std_check
int8_t parse_temperature_(const mopeka_std_package *message)
uint8_t parse_battery_level_(const mopeka_std_package *message)
const LogString * message
Definition component.cpp:35
mopeka_std_values val[3]
esphome::mopeka_std_check::MopekaStdCheck __attribute__
static void uint32_t
uint16_t temperature
Definition sun_gtil2.cpp:12