Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/Appliance/AirConditioner/AirConditioner.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class AirConditioner : public ApplianceBase {
Preset getPreset() const { return this->m_preset; }
const Capabilities &getCapabilities() const { return this->m_capabilities; }
void displayToggle() { this->m_displayToggle(); }
void setPowerUsagePolling(bool enable) { this->m_powerUsagePolling = enable; }
protected:
void m_getPowerUsage();
void m_getCapabilities();
Expand All @@ -59,6 +60,7 @@ class AirConditioner : public ApplianceBase {
Preset m_lastPreset{Preset::PRESET_NONE};
StatusData m_status{};
bool m_sendControl{};
bool m_powerUsagePolling{true};
};

} // namespace ac
Expand Down
4 changes: 4 additions & 0 deletions src/Appliance/AirConditioner/AirConditioner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ void AirConditioner::setPowerState(bool state) {
}

void AirConditioner::m_getPowerUsage() {
if (!this->m_powerUsagePolling)
return;
if (this->m_autoconfStatus == AUTOCONF_OK && !this->m_capabilities.powerCal())
return;
QueryPowerData data{};
LOG_D(TAG, "Enqueuing a GET_POWERUSAGE(0x41) request...");
this->m_queueRequest(FrameType::DEVICE_QUERY, std::move(data),
Expand Down