mirror of
https://github.com/esphome/esphome.git
synced 2025-09-14 01:02:19 +01:00
Merge branch 'bump_ruff_precommit' into integration
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
# Ruff version.
|
# Ruff version.
|
||||||
rev: v0.11.10
|
rev: v0.12.0
|
||||||
hooks:
|
hooks:
|
||||||
# Run the linter.
|
# Run the linter.
|
||||||
- id: ruff
|
- id: ruff
|
||||||
|
@@ -1643,6 +1643,7 @@ enum VoiceAssistantEvent {
|
|||||||
VOICE_ASSISTANT_STT_VAD_END = 12;
|
VOICE_ASSISTANT_STT_VAD_END = 12;
|
||||||
VOICE_ASSISTANT_TTS_STREAM_START = 98;
|
VOICE_ASSISTANT_TTS_STREAM_START = 98;
|
||||||
VOICE_ASSISTANT_TTS_STREAM_END = 99;
|
VOICE_ASSISTANT_TTS_STREAM_END = 99;
|
||||||
|
VOICE_ASSISTANT_INTENT_PROGRESS = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
message VoiceAssistantEventData {
|
message VoiceAssistantEventData {
|
||||||
|
@@ -516,6 +516,8 @@ template<> const char *proto_enum_to_string<enums::VoiceAssistantEvent>(enums::V
|
|||||||
return "VOICE_ASSISTANT_TTS_STREAM_START";
|
return "VOICE_ASSISTANT_TTS_STREAM_START";
|
||||||
case enums::VOICE_ASSISTANT_TTS_STREAM_END:
|
case enums::VOICE_ASSISTANT_TTS_STREAM_END:
|
||||||
return "VOICE_ASSISTANT_TTS_STREAM_END";
|
return "VOICE_ASSISTANT_TTS_STREAM_END";
|
||||||
|
case enums::VOICE_ASSISTANT_INTENT_PROGRESS:
|
||||||
|
return "VOICE_ASSISTANT_INTENT_PROGRESS";
|
||||||
default:
|
default:
|
||||||
return "UNKNOWN";
|
return "UNKNOWN";
|
||||||
}
|
}
|
||||||
|
@@ -208,6 +208,7 @@ enum VoiceAssistantEvent : uint32_t {
|
|||||||
VOICE_ASSISTANT_STT_VAD_END = 12,
|
VOICE_ASSISTANT_STT_VAD_END = 12,
|
||||||
VOICE_ASSISTANT_TTS_STREAM_START = 98,
|
VOICE_ASSISTANT_TTS_STREAM_START = 98,
|
||||||
VOICE_ASSISTANT_TTS_STREAM_END = 99,
|
VOICE_ASSISTANT_TTS_STREAM_END = 99,
|
||||||
|
VOICE_ASSISTANT_INTENT_PROGRESS = 100,
|
||||||
};
|
};
|
||||||
enum VoiceAssistantTimerEvent : uint32_t {
|
enum VoiceAssistantTimerEvent : uint32_t {
|
||||||
VOICE_ASSISTANT_TIMER_STARTED = 0,
|
VOICE_ASSISTANT_TIMER_STARTED = 0,
|
||||||
|
@@ -12,8 +12,8 @@ from esphome.const import (
|
|||||||
CONF_OVERSAMPLING,
|
CONF_OVERSAMPLING,
|
||||||
CONF_PRESSURE,
|
CONF_PRESSURE,
|
||||||
CONF_TEMPERATURE,
|
CONF_TEMPERATURE,
|
||||||
DEVICE_CLASS_HUMIDITY,
|
|
||||||
DEVICE_CLASS_ATMOSPHERIC_PRESSURE,
|
DEVICE_CLASS_ATMOSPHERIC_PRESSURE,
|
||||||
|
DEVICE_CLASS_HUMIDITY,
|
||||||
DEVICE_CLASS_TEMPERATURE,
|
DEVICE_CLASS_TEMPERATURE,
|
||||||
ICON_GAS_CYLINDER,
|
ICON_GAS_CYLINDER,
|
||||||
STATE_CLASS_MEASUREMENT,
|
STATE_CLASS_MEASUREMENT,
|
||||||
|
@@ -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)
|
|
@@ -29,7 +29,9 @@ Component = esphome_ns.class_("Component")
|
|||||||
ComponentPtr = Component.operator("ptr")
|
ComponentPtr = Component.operator("ptr")
|
||||||
PollingComponent = esphome_ns.class_("PollingComponent", Component)
|
PollingComponent = esphome_ns.class_("PollingComponent", Component)
|
||||||
Application = esphome_ns.class_("Application")
|
Application = esphome_ns.class_("Application")
|
||||||
optional = esphome_ns.class_("optional")
|
# Create optional with explicit namespace to avoid ambiguity with std::optional
|
||||||
|
# The generated code will use esphome::optional instead of just optional
|
||||||
|
optional = global_ns.namespace("esphome").class_("optional")
|
||||||
arduino_json_ns = global_ns.namespace("ArduinoJson")
|
arduino_json_ns = global_ns.namespace("ArduinoJson")
|
||||||
JsonObject = arduino_json_ns.class_("JsonObject")
|
JsonObject = arduino_json_ns.class_("JsonObject")
|
||||||
JsonObjectConst = arduino_json_ns.class_("JsonObjectConst")
|
JsonObjectConst = arduino_json_ns.class_("JsonObjectConst")
|
||||||
|
@@ -200,7 +200,7 @@ build_unflags =
|
|||||||
; This are common settings for the LibreTiny (all variants) using Arduino.
|
; This are common settings for the LibreTiny (all variants) using Arduino.
|
||||||
[common:libretiny-arduino]
|
[common:libretiny-arduino]
|
||||||
extends = common:arduino
|
extends = common:arduino
|
||||||
platform = libretiny
|
platform = libretiny@1.9.1
|
||||||
framework = arduino
|
framework = arduino
|
||||||
lib_deps =
|
lib_deps =
|
||||||
droscy/esp_wireguard@0.4.2 ; wireguard
|
droscy/esp_wireguard@0.4.2 ; wireguard
|
||||||
|
@@ -120,10 +120,12 @@ select = [
|
|||||||
|
|
||||||
ignore = [
|
ignore = [
|
||||||
"E501", # line too long
|
"E501", # line too long
|
||||||
|
"PLC0415", # `import` should be at the top-level of a file
|
||||||
"PLR0911", # Too many return statements ({returns} > {max_returns})
|
"PLR0911", # Too many return statements ({returns} > {max_returns})
|
||||||
"PLR0912", # Too many branches ({branches} > {max_branches})
|
"PLR0912", # Too many branches ({branches} > {max_branches})
|
||||||
"PLR0913", # Too many arguments to function call ({c_args} > {max_args})
|
"PLR0913", # Too many arguments to function call ({c_args} > {max_args})
|
||||||
"PLR0915", # Too many statements ({statements} > {max_statements})
|
"PLR0915", # Too many statements ({statements} > {max_statements})
|
||||||
|
"PLW1641", # Object does not implement `__hash__` method
|
||||||
"PLR2004", # Magic value used in comparison, consider replacing {value} with a constant variable
|
"PLR2004", # Magic value used in comparison, consider replacing {value} with a constant variable
|
||||||
"PLW2901", # Outer {outer_kind} variable {name} overwritten by inner {inner_kind} target
|
"PLW2901", # Outer {outer_kind} variable {name} overwritten by inner {inner_kind} target
|
||||||
"UP038", # https://github.com/astral-sh/ruff/issues/7871 https://github.com/astral-sh/ruff/pull/16681
|
"UP038", # https://github.com/astral-sh/ruff/issues/7871 https://github.com/astral-sh/ruff/pull/16681
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
pylint==3.3.7
|
pylint==3.3.7
|
||||||
flake8==7.2.0 # also change in .pre-commit-config.yaml when updating
|
flake8==7.2.0 # also change in .pre-commit-config.yaml when updating
|
||||||
ruff==0.11.13 # also change in .pre-commit-config.yaml when updating
|
ruff==0.12.0 # also change in .pre-commit-config.yaml when updating
|
||||||
pyupgrade==3.20.0 # also change in .pre-commit-config.yaml when updating
|
pyupgrade==3.20.0 # also change in .pre-commit-config.yaml when updating
|
||||||
pre-commit
|
pre-commit
|
||||||
|
|
||||||
|
@@ -66,5 +66,5 @@ def test_text_config_lamda_is_set(generate_main):
|
|||||||
main_cpp = generate_main("tests/component_tests/text/test_text.yaml")
|
main_cpp = generate_main("tests/component_tests/text/test_text.yaml")
|
||||||
|
|
||||||
# Then
|
# Then
|
||||||
assert "it_4->set_template([=]() -> optional<std::string> {" in main_cpp
|
assert "it_4->set_template([=]() -> esphome::optional<std::string> {" in main_cpp
|
||||||
assert 'return std::string{"Hello"};' in main_cpp
|
assert 'return std::string{"Hello"};' in main_cpp
|
||||||
|
@@ -1,3 +0,0 @@
|
|||||||
sensor:
|
|
||||||
- platform: esp32_hall
|
|
||||||
name: ESP32 Hall Sensor
|
|
Reference in New Issue
Block a user