mirror of
https://github.com/esphome/esphome.git
synced 2026-05-21 12:13:50 +08:00
Merge remote-tracking branch 'upstream/dev' into integration
# Conflicts: # tests/components/time/posix_tz_parser.cpp
This commit is contained in:
@@ -102,12 +102,12 @@ jobs:
|
||||
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||
|
||||
- name: Log in to docker hub
|
||||
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
|
||||
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USER }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
- name: Log in to the GitHub container registry
|
||||
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
|
||||
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
@@ -182,13 +182,13 @@ jobs:
|
||||
|
||||
- name: Log in to docker hub
|
||||
if: matrix.registry == 'dockerhub'
|
||||
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
|
||||
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USER }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
- name: Log in to the GitHub container registry
|
||||
if: matrix.registry == 'ghcr'
|
||||
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
|
||||
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
|
||||
@@ -11,7 +11,7 @@ ci:
|
||||
repos:
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
# Ruff version.
|
||||
rev: v0.15.8
|
||||
rev: v0.15.9
|
||||
hooks:
|
||||
# Run the linter.
|
||||
- id: ruff
|
||||
|
||||
+1
-1
@@ -142,7 +142,7 @@ esphome/components/dlms_meter/* @SimonFischer04
|
||||
esphome/components/dps310/* @kbx81
|
||||
esphome/components/ds1307/* @badbadc0ffee
|
||||
esphome/components/ds2484/* @mrk-its
|
||||
esphome/components/dsmr/* @glmnet @PolarGoose @zuidwijk
|
||||
esphome/components/dsmr/* @glmnet @PolarGoose
|
||||
esphome/components/duty_time/* @dudanov
|
||||
esphome/components/ee895/* @Stock-M
|
||||
esphome/components/ektf2232/touchscreen/* @jesserockz
|
||||
|
||||
@@ -210,6 +210,7 @@ async def to_code(config):
|
||||
data = _get_data()
|
||||
if data.flac_support:
|
||||
cg.add_define("USE_AUDIO_FLAC_SUPPORT")
|
||||
add_idf_component(name="esphome/micro-flac", ref="0.1.1")
|
||||
if data.mp3_support:
|
||||
cg.add_define("USE_AUDIO_MP3_SUPPORT")
|
||||
if data.opus_support:
|
||||
|
||||
@@ -84,13 +84,10 @@ esp_err_t AudioDecoder::start(AudioFileType audio_file_type) {
|
||||
switch (this->audio_file_type_) {
|
||||
#ifdef USE_AUDIO_FLAC_SUPPORT
|
||||
case AudioFileType::FLAC:
|
||||
this->flac_decoder_ = make_unique<esp_audio_libs::flac::FLACDecoder>();
|
||||
// CRC check slows down decoding by 15-20% on an ESP32-S3. FLAC sources in ESPHome are either from an http source
|
||||
// or built into the firmware, so the data integrity is already verified by the time it gets to the decoder,
|
||||
// making the CRC check unnecessary.
|
||||
this->flac_decoder_->set_crc_check_enabled(false);
|
||||
this->flac_decoder_ = make_unique<micro_flac::FLACDecoder>();
|
||||
this->free_buffer_required_ =
|
||||
this->output_transfer_buffer_->capacity(); // Adjusted and reallocated after reading the header
|
||||
this->decoder_buffers_internally_ = true;
|
||||
break;
|
||||
#endif
|
||||
#ifdef USE_AUDIO_MP3_SUPPORT
|
||||
@@ -268,59 +265,45 @@ AudioDecoderState AudioDecoder::decode(bool stop_gracefully) {
|
||||
|
||||
#ifdef USE_AUDIO_FLAC_SUPPORT
|
||||
FileDecoderState AudioDecoder::decode_flac_() {
|
||||
if (!this->audio_stream_info_.has_value()) {
|
||||
// Header hasn't been read
|
||||
auto result = this->flac_decoder_->read_header(this->input_buffer_->data(), this->input_buffer_->available());
|
||||
size_t bytes_consumed, samples_decoded;
|
||||
|
||||
if (result > esp_audio_libs::flac::FLAC_DECODER_HEADER_OUT_OF_DATA) {
|
||||
// Serrious error reading FLAC header, there is no recovery
|
||||
return FileDecoderState::FAILED;
|
||||
micro_flac::FLACDecoderResult result = this->flac_decoder_->decode(
|
||||
this->input_buffer_->data(), this->input_buffer_->available(), this->output_transfer_buffer_->get_buffer_end(),
|
||||
this->output_transfer_buffer_->free(), bytes_consumed, samples_decoded);
|
||||
|
||||
if (result == micro_flac::FLAC_DECODER_SUCCESS) {
|
||||
if (samples_decoded > 0 && this->audio_stream_info_.has_value()) {
|
||||
this->output_transfer_buffer_->increase_buffer_length(
|
||||
this->audio_stream_info_.value().samples_to_bytes(samples_decoded));
|
||||
}
|
||||
|
||||
size_t bytes_consumed = this->flac_decoder_->get_bytes_index();
|
||||
this->input_buffer_->consume(bytes_consumed);
|
||||
} else if (result == micro_flac::FLAC_DECODER_HEADER_READY) {
|
||||
// Header just parsed, stream info now available
|
||||
const auto &info = this->flac_decoder_->get_stream_info();
|
||||
this->audio_stream_info_ = audio::AudioStreamInfo(info.bits_per_sample(), info.num_channels(), info.sample_rate());
|
||||
|
||||
if (result == esp_audio_libs::flac::FLAC_DECODER_HEADER_OUT_OF_DATA) {
|
||||
return FileDecoderState::MORE_TO_PROCESS;
|
||||
}
|
||||
|
||||
// Reallocate the output transfer buffer to the smallest necessary size
|
||||
this->free_buffer_required_ = flac_decoder_->get_output_buffer_size_bytes();
|
||||
// Reallocate the output transfer buffer to the required size
|
||||
this->free_buffer_required_ = this->flac_decoder_->get_output_buffer_size_samples() * info.bytes_per_sample();
|
||||
if (!this->output_transfer_buffer_->reallocate(this->free_buffer_required_)) {
|
||||
// Couldn't reallocate output buffer
|
||||
return FileDecoderState::FAILED;
|
||||
}
|
||||
|
||||
this->audio_stream_info_ =
|
||||
audio::AudioStreamInfo(this->flac_decoder_->get_sample_depth(), this->flac_decoder_->get_num_channels(),
|
||||
this->flac_decoder_->get_sample_rate());
|
||||
|
||||
return FileDecoderState::MORE_TO_PROCESS;
|
||||
}
|
||||
|
||||
uint32_t output_samples = 0;
|
||||
auto result = this->flac_decoder_->decode_frame(this->input_buffer_->data(), this->input_buffer_->available(),
|
||||
this->output_transfer_buffer_->get_buffer_end(), &output_samples);
|
||||
|
||||
if (result == esp_audio_libs::flac::FLAC_DECODER_ERROR_OUT_OF_DATA) {
|
||||
// Not an issue, just needs more data that we'll get next time.
|
||||
return FileDecoderState::POTENTIALLY_FAILED;
|
||||
}
|
||||
|
||||
size_t bytes_consumed = this->flac_decoder_->get_bytes_index();
|
||||
this->input_buffer_->consume(bytes_consumed);
|
||||
|
||||
if (result > esp_audio_libs::flac::FLAC_DECODER_ERROR_OUT_OF_DATA) {
|
||||
// Corrupted frame, don't retry with current buffer content, wait for new sync
|
||||
return FileDecoderState::POTENTIALLY_FAILED;
|
||||
}
|
||||
|
||||
// We have successfully decoded some input data and have new output data
|
||||
this->output_transfer_buffer_->increase_buffer_length(
|
||||
this->audio_stream_info_.value().samples_to_bytes(output_samples));
|
||||
|
||||
if (result == esp_audio_libs::flac::FLAC_DECODER_NO_MORE_FRAMES) {
|
||||
this->input_buffer_->consume(bytes_consumed);
|
||||
} else if (result == micro_flac::FLAC_DECODER_END_OF_STREAM) {
|
||||
this->input_buffer_->consume(bytes_consumed);
|
||||
return FileDecoderState::END_OF_FILE;
|
||||
} else if (result == micro_flac::FLAC_DECODER_NEED_MORE_DATA) {
|
||||
this->input_buffer_->consume(bytes_consumed);
|
||||
return FileDecoderState::MORE_TO_PROCESS;
|
||||
} else if (result == micro_flac::FLAC_DECODER_ERROR_OUTPUT_TOO_SMALL) {
|
||||
// Reallocate to decode the frame on the next call
|
||||
const auto &info = this->flac_decoder_->get_stream_info();
|
||||
this->free_buffer_required_ = this->flac_decoder_->get_output_buffer_size_samples() * info.bytes_per_sample();
|
||||
if (!this->output_transfer_buffer_->reallocate(this->free_buffer_required_)) {
|
||||
return FileDecoderState::FAILED;
|
||||
}
|
||||
} else {
|
||||
ESP_LOGE(TAG, "FLAC decoder failed: %d", static_cast<int>(result));
|
||||
return FileDecoderState::POTENTIALLY_FAILED;
|
||||
}
|
||||
|
||||
return FileDecoderState::MORE_TO_PROCESS;
|
||||
|
||||
@@ -16,14 +16,16 @@
|
||||
#include "esp_err.h"
|
||||
|
||||
// esp-audio-libs
|
||||
#ifdef USE_AUDIO_FLAC_SUPPORT
|
||||
#include <flac_decoder.h>
|
||||
#endif
|
||||
#ifdef USE_AUDIO_MP3_SUPPORT
|
||||
#include <mp3_decoder.h>
|
||||
#endif
|
||||
#include <wav_decoder.h>
|
||||
|
||||
// micro-flac
|
||||
#ifdef USE_AUDIO_FLAC_SUPPORT
|
||||
#include <micro_flac/flac_decoder.h>
|
||||
#endif
|
||||
|
||||
// micro-opus
|
||||
#ifdef USE_AUDIO_OPUS_SUPPORT
|
||||
#include <micro_opus/ogg_opus_decoder.h>
|
||||
@@ -119,7 +121,7 @@ class AudioDecoder {
|
||||
std::unique_ptr<esp_audio_libs::wav_decoder::WAVDecoder> wav_decoder_;
|
||||
#ifdef USE_AUDIO_FLAC_SUPPORT
|
||||
FileDecoderState decode_flac_();
|
||||
std::unique_ptr<esp_audio_libs::flac::FLACDecoder> flac_decoder_;
|
||||
std::unique_ptr<micro_flac::FLACDecoder> flac_decoder_;
|
||||
#endif
|
||||
#ifdef USE_AUDIO_MP3_SUPPORT
|
||||
FileDecoderState decode_mp3_();
|
||||
|
||||
@@ -126,7 +126,7 @@ def set_reference_values(config):
|
||||
config.setdefault(CONF_POWER_REFERENCE, DEFAULT_BL0940_LEGACY_PREF)
|
||||
config.setdefault(CONF_ENERGY_REFERENCE, DEFAULT_BL0940_LEGACY_EREF)
|
||||
else:
|
||||
vref = config.get(CONF_VOLTAGE_REFERENCE, DEFAULT_BL0940_VREF)
|
||||
vref = config.get(CONF_REFERENCE_VOLTAGE, DEFAULT_BL0940_VREF)
|
||||
r_one = config.get(CONF_RESISTOR_ONE, DEFAULT_BL0940_R1)
|
||||
r_two = config.get(CONF_RESISTOR_TWO, DEFAULT_BL0940_R2)
|
||||
r_shunt = config.get(CONF_RESISTOR_SHUNT, DEFAULT_BL0940_RL)
|
||||
|
||||
@@ -88,7 +88,7 @@ async def to_code(config):
|
||||
)
|
||||
cg.add(var.set_char_uuid128(uuid128))
|
||||
|
||||
if descriptor_uuid := config:
|
||||
if descriptor_uuid := config.get(CONF_DESCRIPTOR_UUID):
|
||||
if len(descriptor_uuid) == len(esp32_ble_tracker.bt_uuid16_format):
|
||||
cg.add(var.set_descr_uuid16(esp32_ble_tracker.as_hex(descriptor_uuid)))
|
||||
elif len(descriptor_uuid) == len(esp32_ble_tracker.bt_uuid32_format):
|
||||
|
||||
@@ -400,7 +400,7 @@ async def setup_climate_core_(var, config):
|
||||
)
|
||||
) is not None:
|
||||
cg.add(
|
||||
mqtt_.set_custom_target_temperature_state_topic(
|
||||
mqtt_.set_custom_target_temperature_low_state_topic(
|
||||
target_temperature_low_state_topic
|
||||
)
|
||||
)
|
||||
|
||||
@@ -266,8 +266,7 @@ CONFIG_SCHEMA = cv.All(
|
||||
cv.Optional(CONF_WAKEUP_PIN): validate_wakeup_pin,
|
||||
cv.Optional(CONF_WAKEUP_PIN_MODE): cv.All(
|
||||
cv.only_on([PLATFORM_ESP32, PLATFORM_BK72XX]),
|
||||
cv.enum(WAKEUP_PIN_MODES),
|
||||
upper=True,
|
||||
cv.enum(WAKEUP_PIN_MODES, upper=True),
|
||||
),
|
||||
cv.Optional(CONF_ESP32_EXT1_WAKEUP): cv.All(
|
||||
cv.only_on_esp32,
|
||||
|
||||
@@ -4,7 +4,7 @@ from esphome.components import uart
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import CONF_ID, CONF_RECEIVE_TIMEOUT, CONF_UART_ID
|
||||
|
||||
CODEOWNERS = ["@glmnet", "@zuidwijk", "@PolarGoose"]
|
||||
CODEOWNERS = ["@glmnet", "@PolarGoose"]
|
||||
|
||||
MULTI_CONF = True
|
||||
|
||||
@@ -16,6 +16,7 @@ CONF_DECRYPTION_KEY = "decryption_key"
|
||||
CONF_DSMR_ID = "dsmr_id"
|
||||
CONF_GAS_MBUS_ID = "gas_mbus_id"
|
||||
CONF_WATER_MBUS_ID = "water_mbus_id"
|
||||
CONF_THERMAL_MBUS_ID = "thermal_mbus_id"
|
||||
CONF_MAX_TELEGRAM_LENGTH = "max_telegram_length"
|
||||
CONF_REQUEST_INTERVAL = "request_interval"
|
||||
CONF_REQUEST_PIN = "request_pin"
|
||||
@@ -35,6 +36,7 @@ CONFIG_SCHEMA = cv.All(
|
||||
cv.Optional(CONF_CRC_CHECK, default=True): cv.boolean,
|
||||
cv.Optional(CONF_GAS_MBUS_ID, default=1): cv.int_,
|
||||
cv.Optional(CONF_WATER_MBUS_ID, default=2): cv.int_,
|
||||
cv.Optional(CONF_THERMAL_MBUS_ID, default=3): cv.int_,
|
||||
cv.Optional(CONF_MAX_TELEGRAM_LENGTH, default=1500): cv.int_,
|
||||
cv.Optional(CONF_REQUEST_PIN): pins.gpio_output_pin_schema,
|
||||
cv.Optional(
|
||||
@@ -64,6 +66,7 @@ async def to_code(config):
|
||||
|
||||
cg.add_build_flag("-DDSMR_GAS_MBUS_ID=" + str(config[CONF_GAS_MBUS_ID]))
|
||||
cg.add_build_flag("-DDSMR_WATER_MBUS_ID=" + str(config[CONF_WATER_MBUS_ID]))
|
||||
cg.add_build_flag("-DDSMR_THERMAL_MBUS_ID=" + str(config[CONF_THERMAL_MBUS_ID]))
|
||||
|
||||
# DSMR Parser
|
||||
cg.add_library("esphome/dsmr_parser", "1.1.0")
|
||||
|
||||
@@ -132,6 +132,7 @@ async def to_code(config):
|
||||
if wifi_channel := config.get(CONF_CHANNEL):
|
||||
cg.add(var.set_wifi_channel(wifi_channel))
|
||||
|
||||
cg.add(var.set_enable_on_boot(config[CONF_ENABLE_ON_BOOT]))
|
||||
cg.add(var.set_auto_add_peer(config[CONF_AUTO_ADD_PEER]))
|
||||
|
||||
for peer in config.get(CONF_PEERS, []):
|
||||
|
||||
@@ -118,6 +118,6 @@ async def set_heater_level_to_code(config, action_id, template_arg, args):
|
||||
async def set_heater_to_code(config, action_id, template_arg, args):
|
||||
var = cg.new_Pvariable(action_id, template_arg)
|
||||
await cg.register_parented(var, config[CONF_ID])
|
||||
status_ = await cg.templatable(config[CONF_LEVEL], args, bool)
|
||||
status_ = await cg.templatable(config[CONF_STATUS], args, bool)
|
||||
cg.add(var.set_status(status_))
|
||||
return var
|
||||
|
||||
@@ -94,6 +94,9 @@ _STATE_CONDITIONS = [
|
||||
PlayMediaAction = media_player_ns.class_(
|
||||
"PlayMediaAction", automation.Action, cg.Parented.template(MediaPlayer)
|
||||
)
|
||||
EnqueueMediaAction = media_player_ns.class_(
|
||||
"EnqueueMediaAction", automation.Action, cg.Parented.template(MediaPlayer)
|
||||
)
|
||||
VolumeSetAction = media_player_ns.class_(
|
||||
"VolumeSetAction", automation.Action, cg.Parented.template(MediaPlayer)
|
||||
)
|
||||
@@ -168,20 +171,17 @@ MEDIA_PLAYER_CONDITION_SCHEMA = automation.maybe_simple_id(
|
||||
)
|
||||
|
||||
|
||||
@automation.register_action(
|
||||
"media_player.play_media",
|
||||
PlayMediaAction,
|
||||
cv.maybe_simple_value(
|
||||
{
|
||||
cv.GenerateID(): cv.use_id(MediaPlayer),
|
||||
cv.Required(CONF_MEDIA_URL): cv.templatable(cv.url),
|
||||
cv.Optional(CONF_ANNOUNCEMENT, default=False): cv.templatable(cv.boolean),
|
||||
},
|
||||
key=CONF_MEDIA_URL,
|
||||
),
|
||||
synchronous=True,
|
||||
_MEDIA_URL_ACTION_SCHEMA = cv.maybe_simple_value(
|
||||
{
|
||||
cv.GenerateID(): cv.use_id(MediaPlayer),
|
||||
cv.Required(CONF_MEDIA_URL): cv.templatable(cv.url),
|
||||
cv.Optional(CONF_ANNOUNCEMENT, default=False): cv.templatable(cv.boolean),
|
||||
},
|
||||
key=CONF_MEDIA_URL,
|
||||
)
|
||||
async def media_player_play_media_action(config, action_id, template_arg, args):
|
||||
|
||||
|
||||
async def _media_action_handler(config, action_id, template_arg, args):
|
||||
var = cg.new_Pvariable(action_id, template_arg)
|
||||
await cg.register_parented(var, config[CONF_ID])
|
||||
media_url = await cg.templatable(config[CONF_MEDIA_URL], args, cg.std_string)
|
||||
@@ -191,6 +191,21 @@ async def media_player_play_media_action(config, action_id, template_arg, args):
|
||||
return var
|
||||
|
||||
|
||||
automation.register_action(
|
||||
"media_player.play_media",
|
||||
PlayMediaAction,
|
||||
_MEDIA_URL_ACTION_SCHEMA,
|
||||
synchronous=True,
|
||||
)(_media_action_handler)
|
||||
|
||||
automation.register_action(
|
||||
"media_player.enqueue",
|
||||
EnqueueMediaAction,
|
||||
_MEDIA_URL_ACTION_SCHEMA,
|
||||
synchronous=True,
|
||||
)(_media_action_handler)
|
||||
|
||||
|
||||
def _snake_to_camel(name):
|
||||
return "".join(word.capitalize() for word in name.split("_"))
|
||||
|
||||
|
||||
@@ -55,17 +55,23 @@ using GroupJoinAction = MediaPlayerCommandAction<MediaPlayerCommand::MEDIA_PLAYE
|
||||
template<typename... Ts>
|
||||
using ClearPlaylistAction = MediaPlayerCommandAction<MediaPlayerCommand::MEDIA_PLAYER_COMMAND_CLEAR_PLAYLIST, Ts...>;
|
||||
|
||||
template<typename... Ts> class PlayMediaAction : public Action<Ts...>, public Parented<MediaPlayer> {
|
||||
template<MediaPlayerCommand Command, typename... Ts>
|
||||
class MediaPlayerMediaAction : public Action<Ts...>, public Parented<MediaPlayer> {
|
||||
TEMPLATABLE_VALUE(std::string, media_url)
|
||||
TEMPLATABLE_VALUE(bool, announcement)
|
||||
void play(const Ts &...x) override {
|
||||
this->parent_->make_call()
|
||||
.set_media_url(this->media_url_.value(x...))
|
||||
.set_announcement(this->announcement_.value(x...))
|
||||
.perform();
|
||||
auto call = this->parent_->make_call();
|
||||
if constexpr (Command != MediaPlayerCommand::MEDIA_PLAYER_COMMAND_PLAY)
|
||||
call.set_command(Command);
|
||||
call.set_media_url(this->media_url_.value(x...)).set_announcement(this->announcement_.value(x...)).perform();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename... Ts>
|
||||
using PlayMediaAction = MediaPlayerMediaAction<MediaPlayerCommand::MEDIA_PLAYER_COMMAND_PLAY, Ts...>;
|
||||
template<typename... Ts>
|
||||
using EnqueueMediaAction = MediaPlayerMediaAction<MediaPlayerCommand::MEDIA_PLAYER_COMMAND_ENQUEUE, Ts...>;
|
||||
|
||||
template<typename... Ts> class VolumeSetAction : public Action<Ts...>, public Parented<MediaPlayer> {
|
||||
TEMPLATABLE_VALUE(float, volume)
|
||||
void play(const Ts &...x) override { this->parent_->make_call().set_volume(this->volume_.value(x...)).perform(); }
|
||||
|
||||
@@ -130,9 +130,6 @@ async def to_code(config):
|
||||
await cg.register_component(var, config)
|
||||
await i2c.register_i2c_device(var, config)
|
||||
|
||||
if CONF_DRDY_PIN in config:
|
||||
pin = await cg.gpio_pin_expression(config[CONF_DRDY_PIN])
|
||||
cg.add(var.set_drdy_pin(pin))
|
||||
cg.add(var.set_gain(GAIN[config[CONF_GAIN]]))
|
||||
cg.add(var.set_oversampling(config[CONF_OVERSAMPLING]))
|
||||
cg.add(var.set_filter(config[CONF_FILTER]))
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
#include "esphome/core/automation.h"
|
||||
#include "nextion.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace nextion {
|
||||
namespace esphome::nextion {
|
||||
|
||||
template<typename... Ts> class NextionSetBrightnessAction : public Action<Ts...> {
|
||||
public:
|
||||
@@ -91,5 +90,4 @@ template<typename... Ts> class NextionPublishBoolAction : public Action<Ts...> {
|
||||
NextionComponent *component_;
|
||||
};
|
||||
|
||||
} // namespace nextion
|
||||
} // namespace esphome
|
||||
} // namespace esphome::nextion
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
#include "esphome/core/util.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace nextion {
|
||||
namespace esphome::nextion {
|
||||
|
||||
static const char *const TAG = "nextion_binarysensor";
|
||||
|
||||
@@ -64,5 +63,4 @@ void NextionBinarySensor::set_state(bool state, bool publish, bool send_to_nexti
|
||||
ESP_LOGN(TAG, "Write: %s=%s", this->variable_name_.c_str(), ONOFF(this->state));
|
||||
}
|
||||
|
||||
} // namespace nextion
|
||||
} // namespace esphome
|
||||
} // namespace esphome::nextion
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
#include "../nextion_component.h"
|
||||
#include "../nextion_base.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace nextion {
|
||||
namespace esphome::nextion {
|
||||
|
||||
class NextionBinarySensor;
|
||||
|
||||
class NextionBinarySensor : public NextionComponent,
|
||||
@@ -38,5 +38,4 @@ class NextionBinarySensor : public NextionComponent,
|
||||
protected:
|
||||
uint8_t page_id_;
|
||||
};
|
||||
} // namespace nextion
|
||||
} // namespace esphome
|
||||
} // namespace esphome::nextion
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
#include "esphome/core/log.h"
|
||||
#include "esphome/core/util.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace nextion {
|
||||
namespace esphome::nextion {
|
||||
|
||||
static const char *const TAG = "nextion";
|
||||
|
||||
@@ -1290,5 +1289,4 @@ void Nextion::set_writer(const nextion_writer_t &writer) { this->writer_ = write
|
||||
|
||||
bool Nextion::is_updating() { return this->connection_state_.is_updating_; }
|
||||
|
||||
} // namespace nextion
|
||||
} // namespace esphome
|
||||
} // namespace esphome::nextion
|
||||
|
||||
@@ -21,8 +21,7 @@
|
||||
#endif // USE_ESP32 vs USE_ESP8266
|
||||
#endif // USE_NEXTION_TFT_UPLOAD
|
||||
|
||||
namespace esphome {
|
||||
namespace nextion {
|
||||
namespace esphome::nextion {
|
||||
|
||||
class Nextion;
|
||||
class NextionComponentBase;
|
||||
@@ -1547,5 +1546,4 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe
|
||||
uint16_t max_q_age_ms_ = 8000; ///< Maximum age for queue items in ms
|
||||
};
|
||||
|
||||
} // namespace nextion
|
||||
} // namespace esphome
|
||||
} // namespace esphome::nextion
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
#include "esphome/core/defines.h"
|
||||
#include "esphome/core/color.h"
|
||||
#include "nextion_component_base.h"
|
||||
namespace esphome {
|
||||
namespace nextion {
|
||||
|
||||
namespace esphome::nextion {
|
||||
|
||||
#ifdef ESPHOME_LOG_HAS_VERY_VERBOSE
|
||||
#define NEXTION_PROTOCOL_LOG
|
||||
@@ -61,5 +61,4 @@ class NextionBase {
|
||||
bool is_detected_ = false;
|
||||
};
|
||||
|
||||
} // namespace nextion
|
||||
} // namespace esphome
|
||||
} // namespace esphome::nextion
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
#include "esphome/core/log.h"
|
||||
#include <cinttypes>
|
||||
|
||||
namespace esphome {
|
||||
namespace nextion {
|
||||
namespace esphome::nextion {
|
||||
|
||||
static const char *const TAG = "nextion";
|
||||
|
||||
// Sleep safe commands
|
||||
@@ -340,5 +340,4 @@ void Nextion::set_nextion_rtc_time(ESPTime time) {
|
||||
this->add_no_result_to_queue_with_printf_("rtc5", "rtc5=%u", time.second);
|
||||
}
|
||||
|
||||
} // namespace nextion
|
||||
} // namespace esphome
|
||||
} // namespace esphome::nextion
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "nextion_component.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace nextion {
|
||||
namespace esphome::nextion {
|
||||
|
||||
void NextionComponent::set_background_color(Color bco) {
|
||||
if (this->variable_name_ == this->variable_name_to_send_) {
|
||||
@@ -110,5 +109,4 @@ void NextionComponent::update_component_settings(bool force_update) {
|
||||
this->component_flags_.font_id_needs_update = false;
|
||||
}
|
||||
}
|
||||
} // namespace nextion
|
||||
} // namespace esphome
|
||||
} // namespace esphome::nextion
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
#include "esphome/core/color.h"
|
||||
#include "nextion_base.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace nextion {
|
||||
namespace esphome::nextion {
|
||||
|
||||
class NextionComponent;
|
||||
|
||||
class NextionComponent : public NextionComponentBase {
|
||||
@@ -80,5 +80,4 @@ class NextionComponent : public NextionComponentBase {
|
||||
uint16_t reserved : 3;
|
||||
} component_flags_;
|
||||
};
|
||||
} // namespace nextion
|
||||
} // namespace esphome
|
||||
} // namespace esphome::nextion
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
#include <vector>
|
||||
#include "esphome/core/defines.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace nextion {
|
||||
namespace esphome::nextion {
|
||||
|
||||
enum NextionQueueType {
|
||||
NO_RESULT = 0,
|
||||
@@ -102,5 +101,4 @@ class NextionComponentBase {
|
||||
|
||||
bool needs_to_send_update_;
|
||||
};
|
||||
} // namespace nextion
|
||||
} // namespace esphome
|
||||
} // namespace esphome::nextion
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#include "esphome/core/application.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace nextion {
|
||||
namespace esphome::nextion {
|
||||
|
||||
static const char *const TAG = "nextion.upload";
|
||||
|
||||
bool Nextion::upload_end_(bool successful) {
|
||||
@@ -33,7 +33,6 @@ bool Nextion::upload_end_(bool successful) {
|
||||
return successful;
|
||||
}
|
||||
|
||||
} // namespace nextion
|
||||
} // namespace esphome
|
||||
} // namespace esphome::nextion
|
||||
|
||||
#endif // USE_NEXTION_TFT_UPLOAD
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
#include "esphome/core/log.h"
|
||||
#include "esphome/core/util.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace nextion {
|
||||
namespace esphome::nextion {
|
||||
|
||||
static const char *const TAG = "nextion.upload.arduino";
|
||||
static constexpr size_t NEXTION_MAX_RESPONSE_LOG_BYTES = 16;
|
||||
|
||||
@@ -342,8 +342,7 @@ WiFiClient *Nextion::get_wifi_client_() {
|
||||
}
|
||||
#endif // USE_ESP8266
|
||||
|
||||
} // namespace nextion
|
||||
} // namespace esphome
|
||||
} // namespace esphome::nextion
|
||||
|
||||
#endif // NOT USE_ESP32
|
||||
#endif // USE_NEXTION_TFT_UPLOAD
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
#include "esphome/core/log.h"
|
||||
#include "esphome/core/util.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace nextion {
|
||||
namespace esphome::nextion {
|
||||
|
||||
static const char *const TAG = "nextion.upload.esp32";
|
||||
static constexpr size_t NEXTION_MAX_RESPONSE_LOG_BYTES = 16;
|
||||
|
||||
@@ -344,8 +344,7 @@ bool Nextion::upload_tft(uint32_t baud_rate, bool exit_reparse) {
|
||||
return this->upload_end_(true);
|
||||
}
|
||||
|
||||
} // namespace nextion
|
||||
} // namespace esphome
|
||||
} // namespace esphome::nextion
|
||||
|
||||
#endif // USE_ESP32
|
||||
#endif // USE_NEXTION_TFT_UPLOAD
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
#include "esphome/core/util.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace nextion {
|
||||
namespace esphome::nextion {
|
||||
|
||||
static const char *const TAG = "nextion_sensor";
|
||||
|
||||
@@ -108,5 +107,4 @@ void NextionSensor::wave_update_() {
|
||||
this->nextion_->add_addt_command_to_queue(this);
|
||||
}
|
||||
|
||||
} // namespace nextion
|
||||
} // namespace esphome
|
||||
} // namespace esphome::nextion
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
#include "../nextion_component.h"
|
||||
#include "../nextion_base.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace nextion {
|
||||
namespace esphome::nextion {
|
||||
|
||||
class NextionSensor;
|
||||
|
||||
class NextionSensor : public NextionComponent, public sensor::Sensor, public PollingComponent {
|
||||
@@ -44,5 +44,4 @@ class NextionSensor : public NextionComponent, public sensor::Sensor, public Pol
|
||||
bool send_last_value_ = true;
|
||||
void wave_update_();
|
||||
};
|
||||
} // namespace nextion
|
||||
} // namespace esphome
|
||||
} // namespace esphome::nextion
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
#include "esphome/core/util.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace nextion {
|
||||
namespace esphome::nextion {
|
||||
|
||||
static const char *const TAG = "nextion_switch";
|
||||
|
||||
@@ -48,5 +47,4 @@ void NextionSwitch::set_state(bool state, bool publish, bool send_to_nextion) {
|
||||
|
||||
void NextionSwitch::write_state(bool state) { this->set_state(state); }
|
||||
|
||||
} // namespace nextion
|
||||
} // namespace esphome
|
||||
} // namespace esphome::nextion
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
#include "../nextion_component.h"
|
||||
#include "../nextion_base.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace nextion {
|
||||
namespace esphome::nextion {
|
||||
|
||||
class NextionSwitch;
|
||||
|
||||
class NextionSwitch : public NextionComponent, public switch_::Switch, public PollingComponent {
|
||||
@@ -30,5 +30,4 @@ class NextionSwitch : public NextionComponent, public switch_::Switch, public Po
|
||||
protected:
|
||||
void write_state(bool state) override;
|
||||
};
|
||||
} // namespace nextion
|
||||
} // namespace esphome
|
||||
} // namespace esphome::nextion
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
#include "esphome/core/util.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace nextion {
|
||||
namespace esphome::nextion {
|
||||
|
||||
static const char *const TAG = "nextion_textsensor";
|
||||
|
||||
void NextionTextSensor::process_text(const std::string &variable_name, const std::string &text_value) {
|
||||
@@ -45,5 +45,4 @@ void NextionTextSensor::set_state(const std::string &state, bool publish, bool s
|
||||
ESP_LOGN(TAG, "Write: %s='%s'", this->variable_name_.c_str(), state.c_str());
|
||||
}
|
||||
|
||||
} // namespace nextion
|
||||
} // namespace esphome
|
||||
} // namespace esphome::nextion
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
#include "../nextion_component.h"
|
||||
#include "../nextion_base.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace nextion {
|
||||
namespace esphome::nextion {
|
||||
|
||||
class NextionTextSensor;
|
||||
|
||||
class NextionTextSensor : public NextionComponent, public text_sensor::TextSensor, public PollingComponent {
|
||||
@@ -28,5 +28,4 @@ class NextionTextSensor : public NextionComponent, public text_sensor::TextSenso
|
||||
this->set_state(state_value, publish, send_to_nextion);
|
||||
}
|
||||
};
|
||||
} // namespace nextion
|
||||
} // namespace esphome
|
||||
} // namespace esphome::nextion
|
||||
|
||||
@@ -94,7 +94,7 @@ async def to_code(config):
|
||||
SetOutputAction,
|
||||
cv.Schema(
|
||||
{
|
||||
cv.Required(CONF_ID): cv.use_id(CONF_ID),
|
||||
cv.Required(CONF_ID): cv.use_id(PipsolarOutput),
|
||||
cv.Required(CONF_VALUE): cv.templatable(cv.positive_float),
|
||||
}
|
||||
),
|
||||
|
||||
@@ -108,7 +108,6 @@ async def to_code(config):
|
||||
cg.add(var.set_optimistic(config[CONF_OPTIMISTIC]))
|
||||
cg.add(var.set_assumed_state(config[CONF_ASSUMED_STATE]))
|
||||
cg.add(var.set_restore_mode(config[CONF_RESTORE_MODE]))
|
||||
cg.add(var.set_has_position(config[CONF_HAS_POSITION]))
|
||||
|
||||
|
||||
@automation.register_action(
|
||||
|
||||
@@ -503,7 +503,7 @@ def validate_thermostat(config):
|
||||
# If restoring default preset on boot is true then ensure we have a default preset
|
||||
if (
|
||||
CONF_ON_BOOT_RESTORE_FROM in config
|
||||
and config[CONF_ON_BOOT_RESTORE_FROM] is OnBootRestoreFrom.DEFAULT_PRESET
|
||||
and config[CONF_ON_BOOT_RESTORE_FROM] == "DEFAULT_PRESET"
|
||||
and CONF_DEFAULT_PRESET not in config
|
||||
):
|
||||
raise cv.Invalid(
|
||||
|
||||
@@ -34,25 +34,43 @@ bool is_leap_year(int year) { return (year % 4 == 0 && year % 100 != 0) || (year
|
||||
// Get days in year (avoids duplicate is_leap_year calls)
|
||||
static inline int days_in_year(int year) { return is_leap_year(year) ? 366 : 365; }
|
||||
|
||||
// Convert days since epoch to year, updating days to remainder
|
||||
static int __attribute__((noinline)) days_to_year(int64_t &days) {
|
||||
int year = 1970;
|
||||
int diy;
|
||||
while (days >= (diy = days_in_year(year)) && year < 2200) {
|
||||
days -= diy;
|
||||
// Count leap years in [1, year] (i.e. up to and including year)
|
||||
static constexpr int count_leap_years_up_to(int year) { return year / 4 - year / 100 + year / 400; }
|
||||
|
||||
constexpr int EPOCH_YEAR = 1970;
|
||||
constexpr int LEAP_YEARS_BEFORE_EPOCH = count_leap_years_up_to(EPOCH_YEAR - 1);
|
||||
constexpr int DAYS_PER_YEAR = 365;
|
||||
constexpr int SECONDS_PER_DAY = 86400;
|
||||
|
||||
// Days from epoch (Jan 1 1970) to Jan 1 of given year — O(1)
|
||||
static inline int64_t days_to_year_start(int year) {
|
||||
return static_cast<int64_t>(DAYS_PER_YEAR) * (year - EPOCH_YEAR) +
|
||||
(count_leap_years_up_to(year - 1) - LEAP_YEARS_BEFORE_EPOCH);
|
||||
}
|
||||
|
||||
// Convert days since epoch to year, updating days to day-of-year remainder.
|
||||
// The initial estimate from days/365 can overshoot by multiple years for
|
||||
// far-future dates (e.g., year 5000+) due to accumulated leap days,
|
||||
// so we use loops rather than single-step correction.
|
||||
static int days_to_year(int64_t &days) {
|
||||
int year = static_cast<int>(EPOCH_YEAR + days / DAYS_PER_YEAR);
|
||||
int64_t year_start = days_to_year_start(year);
|
||||
while (days < year_start) {
|
||||
year--;
|
||||
year_start = days_to_year_start(year);
|
||||
}
|
||||
while (days >= year_start + days_in_year(year)) {
|
||||
year_start += days_in_year(year);
|
||||
year++;
|
||||
}
|
||||
while (days < 0 && year > 1900) {
|
||||
year--;
|
||||
days += days_in_year(year);
|
||||
}
|
||||
days -= year_start;
|
||||
return year;
|
||||
}
|
||||
|
||||
// Extract just the year from a UTC epoch
|
||||
// Extract just the year from a UTC epoch — O(1)
|
||||
static int epoch_to_year(time_t epoch) {
|
||||
int64_t days = epoch / 86400;
|
||||
if (epoch < 0 && epoch % 86400 != 0)
|
||||
int64_t days = epoch / SECONDS_PER_DAY;
|
||||
if (epoch < 0 && epoch % SECONDS_PER_DAY != 0)
|
||||
days--;
|
||||
return days_to_year(days);
|
||||
}
|
||||
@@ -87,11 +105,11 @@ int __attribute__((noinline)) day_of_week(int year, int month, int day) {
|
||||
|
||||
void __attribute__((noinline)) epoch_to_tm_utc(time_t epoch, struct tm *out_tm) {
|
||||
// Days since epoch
|
||||
int64_t days = epoch / 86400;
|
||||
int32_t remaining_secs = epoch % 86400;
|
||||
int64_t days = epoch / SECONDS_PER_DAY;
|
||||
int32_t remaining_secs = epoch % SECONDS_PER_DAY;
|
||||
if (remaining_secs < 0) {
|
||||
days--;
|
||||
remaining_secs += 86400;
|
||||
remaining_secs += SECONDS_PER_DAY;
|
||||
}
|
||||
|
||||
out_tm->tm_sec = remaining_secs % 60;
|
||||
@@ -280,17 +298,6 @@ static int __attribute__((noinline)) days_from_year_start(int year, int month, i
|
||||
return days;
|
||||
}
|
||||
|
||||
// Calculate days from epoch to Jan 1 of given year (for DST transition calculations)
|
||||
// Only supports years >= 1970. Timezone is either compiled in from YAML or set by
|
||||
// Home Assistant, so pre-1970 dates are not a concern.
|
||||
static int64_t __attribute__((noinline)) days_to_year_start(int year) {
|
||||
int64_t days = 0;
|
||||
for (int y = 1970; y < year; y++) {
|
||||
days += days_in_year(y);
|
||||
}
|
||||
return days;
|
||||
}
|
||||
|
||||
time_t __attribute__((noinline)) calculate_dst_transition(int year, const DSTRule &rule, int32_t base_offset_seconds) {
|
||||
int month, day;
|
||||
|
||||
@@ -339,7 +346,7 @@ time_t __attribute__((noinline)) calculate_dst_transition(int year, const DSTRul
|
||||
int64_t days = days_to_year_start(year) + days_from_year_start(year, month, day);
|
||||
|
||||
// Convert to epoch and add transition time and base offset
|
||||
return days * 86400 + rule.time_seconds + base_offset_seconds;
|
||||
return days * SECONDS_PER_DAY + rule.time_seconds + base_offset_seconds;
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
||||
@@ -255,26 +255,25 @@ void ZigbeeComponent::factory_reset() {
|
||||
ZB_SCHEDULE_APP_CALLBACK(zb_bdb_reset_via_local_action, 0);
|
||||
}
|
||||
|
||||
static void log_reporting_info(zb_zcl_reporting_info_t *rep_info) {
|
||||
auto now = millis();
|
||||
ESP_LOGD(TAG, "Reporting: endpoint %d, cluster_id 0x%04X, attr_id 0x%04X, flags 0x%02X, report in %ums", rep_info->ep,
|
||||
rep_info->cluster_id, rep_info->attr_id, rep_info->flags,
|
||||
ZB_ZCL_GET_REPORTING_FLAG(rep_info, ZB_ZCL_REPORT_TIMER_STARTED)
|
||||
? ZB_TIME_BEACON_INTERVAL_TO_MSEC(rep_info->run_time) - now
|
||||
: 0);
|
||||
ESP_LOGD(TAG, " min_interval %ds, max_interval %ds, def_min_interval %ds, def_max_interval %ds",
|
||||
rep_info->u.send_info.min_interval, rep_info->u.send_info.max_interval,
|
||||
rep_info->u.send_info.def_min_interval, rep_info->u.send_info.def_max_interval);
|
||||
}
|
||||
|
||||
void ZigbeeComponent::dump_reporting_() {
|
||||
#ifdef ESPHOME_LOG_HAS_VERBOSE
|
||||
auto now = millis();
|
||||
bool first = true;
|
||||
for (zb_uint8_t j = 0; j < ZCL_CTX().device_ctx->ep_count; j++) {
|
||||
if (ZCL_CTX().device_ctx->ep_desc_list[j]->reporting_info) {
|
||||
zb_zcl_reporting_info_t *rep_info = ZCL_CTX().device_ctx->ep_desc_list[j]->reporting_info;
|
||||
for (zb_uint8_t i = 0; i < ZCL_CTX().device_ctx->ep_desc_list[j]->rep_info_count; i++) {
|
||||
if (!first) {
|
||||
ESP_LOGV(TAG, "");
|
||||
}
|
||||
first = false;
|
||||
ESP_LOGV(TAG, "Endpoint: %d, cluster_id %d, attr_id %d, flags %d, report in %ums", rep_info->ep,
|
||||
rep_info->cluster_id, rep_info->attr_id, rep_info->flags,
|
||||
ZB_ZCL_GET_REPORTING_FLAG(rep_info, ZB_ZCL_REPORT_TIMER_STARTED)
|
||||
? ZB_TIME_BEACON_INTERVAL_TO_MSEC(rep_info->run_time) - now
|
||||
: 0);
|
||||
ESP_LOGV(TAG, "Min_interval %ds, max_interval %ds, def_min_interval %ds, def_max_interval %ds",
|
||||
rep_info->u.send_info.min_interval, rep_info->u.send_info.max_interval,
|
||||
rep_info->u.send_info.def_min_interval, rep_info->u.send_info.def_max_interval);
|
||||
log_reporting_info(rep_info);
|
||||
rep_info++;
|
||||
}
|
||||
}
|
||||
@@ -282,9 +281,38 @@ void ZigbeeComponent::dump_reporting_() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void ZigbeeComponent::after_reporting_info(zb_zcl_configure_reporting_req_t *config_rep_req,
|
||||
zb_zcl_attr_addr_info_t *attr_addr_info) {
|
||||
#ifdef ESPHOME_LOG_HAS_DEBUG
|
||||
auto *rep_info =
|
||||
zb_zcl_find_reporting_info_manuf(attr_addr_info->src_ep, attr_addr_info->cluster_id, attr_addr_info->cluster_role,
|
||||
config_rep_req->attr_id, attr_addr_info->manuf_code);
|
||||
if (rep_info == nullptr) {
|
||||
ESP_LOGE(TAG,
|
||||
"Failed to resolve reporting info (src_ep=%u cluster_id=0x%04x role=%u attr_id=0x%04x manuf_code=0x%04x)",
|
||||
attr_addr_info->src_ep, attr_addr_info->cluster_id, attr_addr_info->cluster_role, config_rep_req->attr_id,
|
||||
attr_addr_info->manuf_code);
|
||||
return;
|
||||
}
|
||||
log_reporting_info(rep_info);
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace esphome::zigbee
|
||||
|
||||
extern "C" void zboss_signal_handler(zb_uint8_t param) {
|
||||
esphome::zigbee::global_zigbee->zboss_signal_handler_esphome(param);
|
||||
extern "C" {
|
||||
void zboss_signal_handler(zb_uint8_t param) { esphome::zigbee::global_zigbee->zboss_signal_handler_esphome(param); }
|
||||
|
||||
// NOLINTBEGIN(readability-identifier-naming,bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
|
||||
extern zb_ret_t __real_zb_zcl_put_reporting_info_from_req(zb_zcl_configure_reporting_req_t *config_rep_req,
|
||||
zb_zcl_attr_addr_info_t *attr_addr_info);
|
||||
|
||||
zb_ret_t __wrap_zb_zcl_put_reporting_info_from_req(zb_zcl_configure_reporting_req_t *config_rep_req,
|
||||
zb_zcl_attr_addr_info_t *attr_addr_info) {
|
||||
zb_ret_t ret = __real_zb_zcl_put_reporting_info_from_req(config_rep_req, attr_addr_info);
|
||||
esphome::zigbee::global_zigbee->after_reporting_info(config_rep_req, attr_addr_info);
|
||||
return ret;
|
||||
}
|
||||
// NOLINTEND(readability-identifier-naming,bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -76,6 +76,7 @@ class ZigbeeComponent : public Component {
|
||||
}
|
||||
template<typename F> void add_join_callback(F &&cb) { this->join_cb_.add(std::forward<F>(cb)); }
|
||||
void zboss_signal_handler_esphome(zb_bufid_t bufid);
|
||||
void after_reporting_info(zb_zcl_configure_reporting_req_t *config_rep_req, zb_zcl_attr_addr_info_t *attr_addr_info);
|
||||
void factory_reset();
|
||||
Trigger<> *get_join_trigger() { return &this->join_trigger_; };
|
||||
void force_report();
|
||||
|
||||
@@ -166,6 +166,8 @@ async def zephyr_to_code(config: ConfigType) -> None:
|
||||
zephyr_add_prj_conf("NET_IP_ADDR_CHECK", False)
|
||||
zephyr_add_prj_conf("NET_UDP", False)
|
||||
|
||||
cg.add_build_flag("-Wl,--wrap=zb_zcl_put_reporting_info_from_req")
|
||||
|
||||
if CONF_IEEE802154_VENDOR_OUI in config:
|
||||
zephyr_add_prj_conf("IEEE802154_VENDOR_OUI_ENABLE", True)
|
||||
random_number = config[CONF_IEEE802154_VENDOR_OUI]
|
||||
|
||||
@@ -244,6 +244,8 @@ RESERVED_IDS = [
|
||||
"open",
|
||||
"setup",
|
||||
"loop",
|
||||
"spi0",
|
||||
"spi1",
|
||||
"uart0",
|
||||
"uart1",
|
||||
"uart2",
|
||||
|
||||
@@ -3,6 +3,8 @@ dependencies:
|
||||
version: "7.4.2"
|
||||
esphome/esp-audio-libs:
|
||||
version: 2.0.4
|
||||
esphome/micro-flac:
|
||||
version: 0.1.1
|
||||
esphome/micro-opus:
|
||||
version: 0.3.6
|
||||
espressif/esp-dsp:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
pylint==4.0.5
|
||||
flake8==7.3.0 # also change in .pre-commit-config.yaml when updating
|
||||
ruff==0.15.8 # also change in .pre-commit-config.yaml when updating
|
||||
ruff==0.15.9 # also change in .pre-commit-config.yaml when updating
|
||||
pyupgrade==3.21.2 # also change in .pre-commit-config.yaml when updating
|
||||
pre-commit
|
||||
|
||||
|
||||
@@ -13,3 +13,4 @@ dsmr:
|
||||
request_pin: ${request_pin}
|
||||
request_interval: 20s
|
||||
receive_timeout: 100ms
|
||||
thermal_mbus_id: 3
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
sensor:
|
||||
- platform: htu21d
|
||||
id: htu21d_sensor
|
||||
i2c_id: i2c_bus
|
||||
model: htu21d
|
||||
temperature:
|
||||
@@ -9,3 +10,14 @@ sensor:
|
||||
heater:
|
||||
name: Heater
|
||||
update_interval: 15s
|
||||
|
||||
button:
|
||||
- platform: template
|
||||
name: "Test HTU21D Actions"
|
||||
on_press:
|
||||
- htu21d.set_heater:
|
||||
id: htu21d_sensor
|
||||
status: true
|
||||
- htu21d.set_heater_level:
|
||||
id: htu21d_sensor
|
||||
level: 5
|
||||
|
||||
@@ -61,3 +61,8 @@ media_player:
|
||||
- media_player.volume_up:
|
||||
- media_player.volume_down:
|
||||
- media_player.volume_set: 50%
|
||||
- media_player.enqueue: http://localhost/media.mp3
|
||||
- media_player.enqueue: !lambda 'return "http://localhost/media.mp3";'
|
||||
- media_player.enqueue:
|
||||
media_url: http://localhost/media.mp3
|
||||
announcement: true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
packages:
|
||||
uart: !include ../../test_build_components/common/uart_9600_even/esp32-idf.yaml
|
||||
uart_9600_even: !include ../../test_build_components/common/uart_9600_even/esp32-idf.yaml
|
||||
|
||||
<<: !include common.yaml
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
packages:
|
||||
uart: !include ../../test_build_components/common/uart_9600_even/esp8266-ard.yaml
|
||||
uart_9600_even: !include ../../test_build_components/common/uart_9600_even/esp8266-ard.yaml
|
||||
|
||||
<<: !include common.yaml
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user