mirror of
https://github.com/esphome/esphome.git
synced 2025-07-28 14:16:40 +00:00
[esp32_hall] Remove esp32_hall (#9117)
This commit is contained in:
parent
5ffe50381a
commit
78c8447d1e
@ -1,25 +0,0 @@
|
||||
#ifdef USE_ESP32
|
||||
#include "esp32_hall.h"
|
||||
#include "esphome/core/log.h"
|
||||
#include "esphome/core/hal.h"
|
||||
#include <driver/adc.h>
|
||||
|
||||
namespace esphome {
|
||||
namespace esp32_hall {
|
||||
|
||||
static const char *const TAG = "esp32_hall";
|
||||
|
||||
void ESP32HallSensor::update() {
|
||||
adc1_config_width(ADC_WIDTH_BIT_12);
|
||||
int value_int = hall_sensor_read();
|
||||
float value = (value_int / 4095.0f) * 10000.0f;
|
||||
ESP_LOGD(TAG, "'%s': Got reading %.0f µT", this->name_.c_str(), value);
|
||||
this->publish_state(value);
|
||||
}
|
||||
std::string ESP32HallSensor::unique_id() { return get_mac_address() + "-hall"; }
|
||||
void ESP32HallSensor::dump_config() { LOG_SENSOR("", "ESP32 Hall Sensor", this); }
|
||||
|
||||
} // namespace esp32_hall
|
||||
} // namespace esphome
|
||||
|
||||
#endif
|
@ -1,23 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/components/sensor/sensor.h"
|
||||
|
||||
#ifdef USE_ESP32
|
||||
|
||||
namespace esphome {
|
||||
namespace esp32_hall {
|
||||
|
||||
class ESP32HallSensor : public sensor::Sensor, public PollingComponent {
|
||||
public:
|
||||
void dump_config() override;
|
||||
|
||||
void update() override;
|
||||
|
||||
std::string unique_id() override;
|
||||
};
|
||||
|
||||
} // namespace esp32_hall
|
||||
} // namespace esphome
|
||||
|
||||
#endif
|
@ -1,24 +0,0 @@
|
||||
import esphome.codegen as cg
|
||||
from esphome.components import sensor
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import ICON_MAGNET, STATE_CLASS_MEASUREMENT, UNIT_MICROTESLA
|
||||
|
||||
DEPENDENCIES = ["esp32"]
|
||||
|
||||
esp32_hall_ns = cg.esphome_ns.namespace("esp32_hall")
|
||||
ESP32HallSensor = esp32_hall_ns.class_(
|
||||
"ESP32HallSensor", sensor.Sensor, cg.PollingComponent
|
||||
)
|
||||
|
||||
CONFIG_SCHEMA = sensor.sensor_schema(
|
||||
ESP32HallSensor,
|
||||
unit_of_measurement=UNIT_MICROTESLA,
|
||||
icon=ICON_MAGNET,
|
||||
accuracy_decimals=1,
|
||||
state_class=STATE_CLASS_MEASUREMENT,
|
||||
).extend(cv.polling_component_schema("60s"))
|
||||
|
||||
|
||||
async def to_code(config):
|
||||
var = await sensor.new_sensor(config)
|
||||
await cg.register_component(var, config)
|
@ -1,3 +0,0 @@
|
||||
sensor:
|
||||
- platform: esp32_hall
|
||||
name: ESP32 Hall Sensor
|
Loading…
x
Reference in New Issue
Block a user