Added ESP_LOGD chlorine-pump

This commit is contained in:
Nicolas Bachschwell 2024-05-27 17:06:53 +02:00
parent d21229fa73
commit cfd7c86235
Signed by: NBSgamesAT
GPG Key ID: 2D73288FF7AEED2F
2 changed files with 13 additions and 7 deletions

View File

@ -185,7 +185,7 @@ chlorine_pump:
id: chlorine_pump_component id: chlorine_pump_component
disable_clock: false disable_clock: false
proportional_band: 200 proportional_band: 200
target: 650 target: 700
# get_target: !lambda return id(chlorine_target).state; # get_target: !lambda return id(chlorine_target).state;
on_pump_value: on_pump_value:
- lambda: |- - lambda: |-

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "esphome/core/automation.h" #include "esphome/core/automation.h"
#include "esphome/components/gpio/output/gpio_binary_output.h" #include "esphome/components/output/binary_output.h"
static const char *const TAG = "chlorine_pump"; static const char *const TAG = "chlorine_pump";
@ -12,7 +12,7 @@ class ChlorinePump : public Component {
protected: protected:
sensor::Sensor *sensor_; sensor::Sensor *sensor_;
gpio::GPIOBinaryOutput *pump_out; output::BinaryOutput *pump_out;
int cycle_time; int cycle_time;
int prop_band; int prop_band;
bool state = true; bool state = true;
@ -42,7 +42,7 @@ class ChlorinePump : public Component {
void set_pump_time_divivder(float pump_time_divider){ void set_pump_time_divivder(float pump_time_divider){
this->tOn_divider_ = pump_time_divider; this->tOn_divider_ = pump_time_divider;
} }
void set_pump_out(gpio::GPIOBinaryOutput *pump_out){ void set_pump_out(output::BinaryOutput *pump_out){
this->pump_out = pump_out; this->pump_out = pump_out;
} }
void set_cycle_time(int time_in_sec){ void set_cycle_time(int time_in_sec){
@ -51,8 +51,8 @@ class ChlorinePump : public Component {
void set_prop_band(int prop_band){ void set_prop_band(int prop_band){
this->prop_band = prop_band; this->prop_band = prop_band;
} }
void set_target(int target){ void set_target(float target){
this->target_ = (float) target; this->target_ = target;
} }
void setup() override { void setup() override {
@ -171,7 +171,13 @@ class ChlorinePump : public Component {
} }
void dump_config() override { void dump_config() override {
ESP_LOGCONFIG(TAG, "Chlorine_pump controller");
ESP_LOGCONFIG(TAG, " Ticker: %s", disable_clock_ ? "using on_value from sensor" : "using internal");
//LOG_BINARY_OUTPUT(pump_out);
ESP_LOGCONFIG(TAG, " Cycle Time: %ds", cycle_time);
ESP_LOGCONFIG(TAG, " Proportional Band: %d", prop_band);
if(target_ != -1) ESP_LOGCONFIG(TAG, " Target: %.0fmV", target_);
else ESP_LOGCONFIG(TAG, " Target: Using get_target lambda");
} }
}; };