ESPHome 2025.5.0
Loading...
Searching...
No Matches
bedjet_sensor.cpp
Go to the documentation of this file.
1#include "bedjet_sensor.h"
2#include "esphome/core/log.h"
3
4namespace esphome {
5namespace bedjet {
6
7std::string BedjetSensor::describe() { return "BedJet Sensor"; }
8
10 ESP_LOGCONFIG(TAG, "BedJet Sensor:");
11 LOG_SENSOR(" ", "Outlet Temperature", this->outlet_temperature_sensor_);
12 LOG_SENSOR(" ", "Ambient Temperature", this->ambient_temperature_sensor_);
13}
14
15void BedjetSensor::on_bedjet_state(bool is_ready) {}
16
18 if (this->outlet_temperature_sensor_ != nullptr) {
19 float converted_temp = bedjet_temp_to_c(data->actual_temp_step);
20 if (converted_temp > 0) {
21 this->outlet_temperature_sensor_->publish_state(converted_temp);
22 }
23 }
24
25 if (this->ambient_temperature_sensor_ != nullptr) {
26 float converted_temp = bedjet_temp_to_c(data->ambient_temp_step);
27 if (converted_temp > 0) {
28 this->ambient_temperature_sensor_->publish_state(converted_temp);
29 }
30 }
31}
32
33} // namespace bedjet
34} // namespace esphome
void on_status(const BedjetStatusPacket *data) override
void on_bedjet_state(bool is_ready) override
sensor::Sensor * ambient_temperature_sensor_
sensor::Sensor * outlet_temperature_sensor_
std::string describe() override
void publish_state(float state)
Publish a new state to the front-end.
Definition sensor.cpp:39
float bedjet_temp_to_c(uint8_t temp)
Converts a BedJet temp step into degrees Celsius.
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
The format of a BedJet V3 status packet.
uint8_t actual_temp_step
Actual temp of the air blown by the BedJet fan; value represents 2 * /< degrees_celsius.
uint8_t ambient_temp_step
Current ambient air temp.