ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
xiaomi_body_scale.h
Go to the documentation of this file.
1#pragma once
2
7
9
11 public:
12 XiaomiBodyScale(uint64_t address, const char *bindkey);
13
14 bool parse_device(const ble_device_base::ESPBTDevice &device) override;
15 void dump_config() override;
16
17 void set_weight(sensor::Sensor *weight) { this->weight_ = weight; }
18 void set_impedance_low(sensor::Sensor *impedance_low) { this->impedance_low_ = impedance_low; }
19 void set_impedance_high(sensor::Sensor *impedance_high) { this->impedance_high_ = impedance_high; }
20 void set_heart_rate(sensor::Sensor *heart_rate) { this->heart_rate_ = heart_rate; }
21 void set_profile_id(sensor::Sensor *profile_id) { this->profile_id_ = profile_id; }
22 void set_stabilized(binary_sensor::BinarySensor *stabilized) { this->stabilized_ = stabilized; }
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];
37 uint16_t last_frame_count_{0x100}; // outside the 8-bit range, so the first frame always passes
38};
39
40} // namespace esphome::xiaomi_body_scale
uint8_t address
Definition bl0906.h:4
Base class for all binary_sensor-type classes.
Base-class for all sensors.
Definition sensor.h:47
XiaomiBodyScale(uint64_t address, const char *bindkey)
binary_sensor::BinarySensor * stabilized_
bool parse_device(const ble_device_base::ESPBTDevice &device) override
void set_impedance_low(sensor::Sensor *impedance_low)
void set_impedance_high(sensor::Sensor *impedance_high)
void set_heart_rate(sensor::Sensor *heart_rate)
void set_stabilized(binary_sensor::BinarySensor *stabilized)
bool decrypt_(const uint8_t *frame, uint8_t *plaintext) const
void set_profile_id(sensor::Sensor *profile_id)
static void uint32_t