1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-04 11:02:19 +01:00

Implement more dump_configs (#791)

This commit is contained in:
Otto Winter
2019-10-23 14:43:41 +02:00
committed by GitHub
parent d63cd8b4cd
commit 8ff742d9ab
32 changed files with 110 additions and 29 deletions

View File

@@ -47,6 +47,13 @@ void PZEMDC::on_modbus_data(const std::vector<uint8_t> &data) {
}
void PZEMDC::update() { this->send(PZEM_CMD_READ_IN_REGISTERS, 0, 8); }
void PZEMDC::dump_config() {
ESP_LOGCONFIG(TAG, "PZEMDC:");
ESP_LOGCONFIG(TAG, " Address: 0x%02X", this->address_);
LOG_SENSOR("", "Voltage", this->voltage_sensor_);
LOG_SENSOR("", "Current", this->current_sensor_);
LOG_SENSOR("", "Power", this->power_sensor_);
}
} // namespace pzemdc
} // namespace esphome

View File

@@ -19,6 +19,8 @@ class PZEMDC : public PollingComponent, public modbus::ModbusDevice {
void on_modbus_data(const std::vector<uint8_t> &data) override;
void dump_config() override;
protected:
sensor::Sensor *voltage_sensor_;
sensor::Sensor *current_sensor_;