Fix AS3935 sensor configuration issues (#1210)

* Fix AS3935 coniguration

* Increase verbosity
This commit is contained in:
Gediminas Šaltenis 2020-07-28 11:34:42 +03:00 committed by GitHub
parent 7d2fcf59fd
commit b270ff335d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 2 deletions

View File

@ -25,7 +25,7 @@ AS3935_SCHEMA = cv.Schema({
cv.Optional(CONF_SPIKE_REJECTION, default=2): cv.int_range(min=1, max=11),
cv.Optional(CONF_LIGHTNING_THRESHOLD, default=1): cv.one_of(1, 5, 9, 16, int=True),
cv.Optional(CONF_MASK_DISTURBER, default=False): cv.boolean,
cv.Optional(CONF_DIV_RATIO, default=0): cv.one_of(0, 16, 22, 64, 128, int=True),
cv.Optional(CONF_DIV_RATIO, default=0): cv.one_of(0, 16, 32, 64, 128, int=True),
cv.Optional(CONF_CAPACITANCE, default=0): cv.int_range(min=0, max=15),
})

View File

@ -26,6 +26,9 @@ void AS3935Component::setup() {
void AS3935Component::dump_config() {
ESP_LOGCONFIG(TAG, "AS3935:");
LOG_PIN(" Interrupt Pin: ", this->irq_pin_);
LOG_BINARY_SENSOR(" ", "Thunder alert", this->thunder_alert_binary_sensor_);
LOG_SENSOR(" ", "Distance", this->distance_sensor_);
LOG_SENSOR(" ", "Lightning energy", this->energy_sensor_);
}
float AS3935Component::get_setup_priority() const { return setup_priority::DATA; }

View File

@ -27,4 +27,4 @@ def to_code(config):
if CONF_LIGHTNING_ENERGY in config:
conf = config[CONF_LIGHTNING_ENERGY]
lightning_energy_sensor = yield sensor.new_sensor(conf)
cg.add(hub.set_distance_sensor(lightning_energy_sensor))
cg.add(hub.set_energy_sensor(lightning_energy_sensor))