ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
xiaomi_body_scale.h
Go to the documentation of this file.
1#pragma once
2
7
9
11 SUB_SENSOR(weight)
12 SUB_SENSOR(impedance_low)
13 SUB_SENSOR(impedance_high)
14 SUB_SENSOR(heart_rate)
15 SUB_SENSOR(profile_id)
16 SUB_BINARY_SENSOR(stabilized)
17
18 public:
19 XiaomiBodyScale(uint64_t address, const char *bindkey);
20
21 bool parse_device(const ble_device_base::ESPBTDevice &device) override;
22 void dump_config() override;
23
24 protected:
25 bool decrypt_(const uint8_t *frame, uint8_t *plaintext) const;
26 void publish_s400_(uint32_t packed);
27 void publish_stabilized_(bool stabilized);
28
29 uint64_t address_;
30 uint8_t bindkey_[16];
31 uint16_t last_frame_count_{0x100}; // outside the 8-bit range, so the first frame always passes
32};
33
34} // namespace esphome::xiaomi_body_scale
bool decrypt_(const uint8_t *frame, uint8_t *plaintext) const
static void uint32_t