Fix
This commit is contained in:
@@ -24,7 +24,7 @@ namespace esphome
|
||||
void KQM6600TAComponent::update()
|
||||
{
|
||||
uint8_t response[KQM6600TA_RESPONSE_LENGTH];
|
||||
this->read_array(&response, KQM6600TA_RESPONSE_LENGTH);
|
||||
this->read_array(response, KQM6600TA_RESPONSE_LENGTH);
|
||||
if (response[0] != 0x5F)
|
||||
{
|
||||
ESP_LOGW(TAG, "Invalid preamble from KQM6600TA!");
|
||||
@@ -45,7 +45,6 @@ namespace esphome
|
||||
const uint32_t formaldehyde = ((uint16_t(response[3]) << 8) | response[4]) * 10;
|
||||
const uint16_t co2 = ((uint16_t(response[5]) << 8) | response[6]) * 10;
|
||||
|
||||
|
||||
ESP_LOGD(TAG, "KQM6600TA Received VOC=%f Formaldehyde=%dmg/m³ CO₂=%dppm", voc, formaldehyde, co2);
|
||||
if (this->voc_sensor_ != nullptr)
|
||||
this->voc_sensor_->publish_state(voc);
|
||||
|
@@ -5,10 +5,13 @@
|
||||
#include "esphome/components/sensor/sensor.h"
|
||||
#include "esphome/components/uart/uart.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace kqm6600ta {
|
||||
namespace esphome
|
||||
{
|
||||
namespace kqm6600ta
|
||||
{
|
||||
|
||||
class KQM6600TAComponent : public PollingComponent, public uart::UARTDevice {
|
||||
class KQM6600TAComponent : public PollingComponent, public uart::UARTDevice
|
||||
{
|
||||
public:
|
||||
float get_setup_priority() const override;
|
||||
|
||||
@@ -21,11 +24,10 @@ class KQM6600TAComponent : public PollingComponent, public uart::UARTDevice {
|
||||
void set_co2_sensor(sensor::Sensor *co2_sensor) { co2_sensor_ = co2_sensor; }
|
||||
|
||||
protected:
|
||||
|
||||
sensor::Sensor *formaldehyde_sensor_{nullptr};
|
||||
sensor::Sensor *voc_sensor_{nullptr};
|
||||
sensor::Sensor *co2_sensor_{nullptr};
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace kqm6600ta
|
||||
} // namespace kqm6600ta
|
||||
} // namespace esphome
|
Reference in New Issue
Block a user