diff --git a/.github/workflows/ci-docker.yml b/.github/workflows/ci-docker.yml index 65f847bc66..e156dbf1e2 100644 --- a/.github/workflows/ci-docker.yml +++ b/.github/workflows/ci-docker.yml @@ -37,7 +37,7 @@ jobs: strategy: fail-fast: false matrix: - arch: [amd64, armv7, aarch64] + arch: [amd64, aarch64] build_type: ["ha-addon", "docker", "lint"] steps: - uses: actions/checkout@v4.1.7 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ca266c1f2c..d406ee0069 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -80,7 +80,6 @@ jobs: matrix: platform: - linux/amd64 - - linux/arm/v7 - linux/arm64 steps: - uses: actions/checkout@v4.1.7 diff --git a/CODEOWNERS b/CODEOWNERS index 95abaf60a2..580f16d799 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -277,6 +277,7 @@ esphome/components/mics_4514/* @jesserockz esphome/components/midea/* @dudanov esphome/components/midea_ir/* @dudanov esphome/components/mitsubishi/* @RubyBailey +esphome/components/mixer/speaker/* @kahrendt esphome/components/mlx90393/* @functionpointer esphome/components/mlx90614/* @jesserockz esphome/components/mmc5603/* @benhoff @@ -343,6 +344,7 @@ esphome/components/radon_eye_rd200/* @jeffeb3 esphome/components/rc522/* @glmnet esphome/components/rc522_i2c/* @glmnet esphome/components/rc522_spi/* @glmnet +esphome/components/resampler/speaker/* @kahrendt esphome/components/restart/* @esphome/core esphome/components/rf_bridge/* @jesserockz esphome/components/rgbct/* @jesserockz @@ -499,5 +501,6 @@ esphome/components/xiaomi_mhoc401/* @vevsvevs esphome/components/xiaomi_rtcgq02lm/* @jesserockz esphome/components/xl9535/* @mreditor97 esphome/components/xpt2046/touchscreen/* @nielsnl68 @numo68 +esphome/components/xxtea/* @clydebarrow esphome/components/zhlt01/* @cfeenstra1024 esphome/components/zio_ultrasonic/* @kahrendt diff --git a/docker/Dockerfile b/docker/Dockerfile index 429f5c4a1f..1db1ee7b51 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -51,19 +51,7 @@ ENV \ # Store globally installed pio libs in /piolibs PLATFORMIO_GLOBALLIB_DIR=/piolibs -# Support legacy binaries on Debian multiarch system. There is no "correct" way -# to do this, other than using properly built toolchains... -# See: https://unix.stackexchange.com/questions/553743/correct-way-to-add-lib-ld-linux-so-3-in-debian RUN \ - if [ "$TARGETARCH$TARGETVARIANT" = "armv7" ]; then \ - ln -s /lib/arm-linux-gnueabihf/ld-linux-armhf.so.3 /lib/ld-linux.so.3; \ - fi - -RUN \ - # Ubuntu python3-pip is missing wheel - if [ "$TARGETARCH$TARGETVARIANT" = "armv7" ]; then \ - export PIP_EXTRA_INDEX_URL="https://www.piwheels.org/simple"; \ - fi; \ pip3 install \ --break-system-packages --no-cache-dir \ # Keep platformio version in sync with requirements.txt @@ -82,14 +70,6 @@ RUN --mount=type=tmpfs,target=/root/.cargo <ms_sample_rate_gcd_ = gcd(1000, this->sample_rate_); + this->bytes_per_sample_ = (this->bits_per_sample_ + 7) / 8; +} + +uint32_t AudioStreamInfo::frames_to_microseconds(uint32_t frames) const { + return (frames * 1000000 + (this->sample_rate_ >> 1)) / this->sample_rate_; +} + +uint32_t AudioStreamInfo::frames_to_milliseconds_with_remainder(uint32_t *total_frames) const { + uint32_t unprocessable_frames = *total_frames % (this->sample_rate_ / this->ms_sample_rate_gcd_); + uint32_t frames_for_ms_calculation = *total_frames - unprocessable_frames; + + uint32_t playback_ms = (frames_for_ms_calculation * 1000) / this->sample_rate_; + *total_frames = unprocessable_frames; + return playback_ms; +} + +bool AudioStreamInfo::operator==(const AudioStreamInfo &rhs) const { + return (this->bits_per_sample_ == rhs.get_bits_per_sample()) && (this->channels_ == rhs.get_channels()) && + (this->sample_rate_ == rhs.get_sample_rate()); +} + +const char *audio_file_type_to_string(AudioFileType file_type) { + switch (file_type) { +#ifdef USE_AUDIO_FLAC_SUPPORT + case AudioFileType::FLAC: + return "FLAC"; +#endif +#ifdef USE_AUDIO_MP3_SUPPORT + case AudioFileType::MP3: + return "MP3"; +#endif + case AudioFileType::WAV: + return "WAV"; + default: + return "unknown"; + } +} + +void scale_audio_samples(const int16_t *audio_samples, int16_t *output_buffer, int16_t scale_factor, + size_t samples_to_scale) { + // Note the assembly dsps_mulc function has audio glitches if the input and output buffers are the same. + for (int i = 0; i < samples_to_scale; i++) { + int32_t acc = (int32_t) audio_samples[i] * (int32_t) scale_factor; + output_buffer[i] = (int16_t) (acc >> 15); + } +} + +} // namespace audio +} // namespace esphome diff --git a/esphome/components/audio/audio.h b/esphome/components/audio/audio.h index caf325cf54..6f0f1aaa46 100644 --- a/esphome/components/audio/audio.h +++ b/esphome/components/audio/audio.h @@ -1,21 +1,139 @@ #pragma once +#include "esphome/core/defines.h" + #include #include namespace esphome { namespace audio { -struct AudioStreamInfo { - bool operator==(const AudioStreamInfo &rhs) const { - return (channels == rhs.channels) && (bits_per_sample == rhs.bits_per_sample) && (sample_rate == rhs.sample_rate); +class AudioStreamInfo { + /* Class to respresent important parameters of the audio stream that also provides helper function to convert between + * various audio related units. + * + * - An audio sample represents a unit of audio for one channel. + * - A frame represents a unit of audio with a sample for every channel. + * + * In gneneral, converting between bytes, samples, and frames shouldn't result in rounding errors so long as frames + * are used as the main unit when transferring audio data. Durations may result in rounding for certain sample rates; + * e.g., 44.1 KHz. The ``frames_to_milliseconds_with_remainder`` function should be used for accuracy, as it takes + * into account the remainder rather than just ignoring any rounding. + */ + public: + AudioStreamInfo() + : AudioStreamInfo(16, 1, 16000){}; // Default values represent ESPHome's audio components historical values + AudioStreamInfo(uint8_t bits_per_sample, uint8_t channels, uint32_t sample_rate); + + uint8_t get_bits_per_sample() const { return this->bits_per_sample_; } + uint8_t get_channels() const { return this->channels_; } + uint32_t get_sample_rate() const { return this->sample_rate_; } + + /// @brief Convert bytes to duration in milliseconds. + /// @param bytes Number of bytes to convert + /// @return Duration in milliseconds that will store `bytes` bytes of audio. May round down for certain sample rates + /// or values of `bytes`. + uint32_t bytes_to_ms(size_t bytes) const { + return bytes * 1000 / (this->sample_rate_ * this->bytes_per_sample_ * this->channels_); } + + /// @brief Convert bytes to frames. + /// @param bytes Number of bytes to convert + /// @return Audio frames that will store `bytes` bytes. + uint32_t bytes_to_frames(size_t bytes) const { return (bytes / (this->bytes_per_sample_ * this->channels_)); } + + /// @brief Convert bytes to samples. + /// @param bytes Number of bytes to convert + /// @return Audio samples that will store `bytes` bytes. + uint32_t bytes_to_samples(size_t bytes) const { return (bytes / this->bytes_per_sample_); } + + /// @brief Converts frames to bytes. + /// @param frames Number of frames to convert. + /// @return Number of bytes that will store `frames` frames of audio. + size_t frames_to_bytes(uint32_t frames) const { return frames * this->bytes_per_sample_ * this->channels_; } + + /// @brief Converts samples to bytes. + /// @param samples Number of samples to convert. + /// @return Number of bytes that will store `samples` samples of audio. + size_t samples_to_bytes(uint32_t samples) const { return samples * this->bytes_per_sample_; } + + /// @brief Converts duration to frames. + /// @param ms Duration in milliseconds + /// @return Audio frames that will store `ms` milliseconds of audio. May round down for certain sample rates. + uint32_t ms_to_frames(uint32_t ms) const { return (ms * this->sample_rate_) / 1000; } + + /// @brief Converts duration to samples. + /// @param ms Duration in milliseconds + /// @return Audio samples that will store `ms` milliseconds of audio. May round down for certain sample rates. + uint32_t ms_to_samples(uint32_t ms) const { return (ms * this->channels_ * this->sample_rate_) / 1000; } + + /// @brief Converts duration to bytes. May round down for certain sample rates. + /// @param ms Duration in milliseconds + /// @return Bytes that will store `ms` milliseconds of audio. May round down for certain sample rates. + size_t ms_to_bytes(uint32_t ms) const { + return (ms * this->bytes_per_sample_ * this->channels_ * this->sample_rate_) / 1000; + } + + /// @brief Computes the duration, in microseconds, the given amount of frames represents. + /// @param frames Number of audio frames + /// @return Duration in microseconds `frames` respresents. May be slightly inaccurate due to integer divison rounding + /// for certain sample rates. + uint32_t frames_to_microseconds(uint32_t frames) const; + + /// @brief Computes the duration, in milliseconds, the given amount of frames represents. Avoids + /// accumulating rounding errors by updating `frames` with the remainder after converting. + /// @param frames Pointer to uint32_t with the number of audio frames. Replaced with the remainder. + /// @return Duration in milliseconds `frames` represents. Always less than or equal to the actual value due to + /// rounding. + uint32_t frames_to_milliseconds_with_remainder(uint32_t *frames) const; + + // Class comparison operators + bool operator==(const AudioStreamInfo &rhs) const; bool operator!=(const AudioStreamInfo &rhs) const { return !operator==(rhs); } - size_t get_bytes_per_sample() const { return bits_per_sample / 8; } - uint8_t channels = 1; - uint8_t bits_per_sample = 16; - uint32_t sample_rate = 16000; + + protected: + uint8_t bits_per_sample_; + uint8_t channels_; + uint32_t sample_rate_; + + // The greatest common divisor between 1000 ms = 1 second and the sample rate. Used to avoid accumulating error when + // converting from frames to duration. Computed at construction. + uint32_t ms_sample_rate_gcd_; + + // Conversion factor derived from the number of bits per sample. Assumes audio data is aligned to the byte. Computed + // at construction. + size_t bytes_per_sample_; }; +enum class AudioFileType : uint8_t { + NONE = 0, +#ifdef USE_AUDIO_FLAC_SUPPORT + FLAC, +#endif +#ifdef USE_AUDIO_MP3_SUPPORT + MP3, +#endif + WAV, +}; + +struct AudioFile { + const uint8_t *data; + size_t length; + AudioFileType file_type; +}; + +/// @brief Helper function to convert file type to a const char string +/// @param file_type +/// @return const char pointer to the readable file type +const char *audio_file_type_to_string(AudioFileType file_type); + +/// @brief Scales Q15 fixed point audio samples. Scales in place if audio_samples == output_buffer. +/// @param audio_samples PCM int16 audio samples +/// @param output_buffer Buffer to store the scaled samples +/// @param scale_factor Q15 fixed point scaling factor +/// @param samples_to_scale Number of samples to scale +void scale_audio_samples(const int16_t *audio_samples, int16_t *output_buffer, int16_t scale_factor, + size_t samples_to_scale); + } // namespace audio } // namespace esphome diff --git a/esphome/components/audio/audio_decoder.cpp b/esphome/components/audio/audio_decoder.cpp new file mode 100644 index 0000000000..ab358ad805 --- /dev/null +++ b/esphome/components/audio/audio_decoder.cpp @@ -0,0 +1,361 @@ +#include "audio_decoder.h" + +#ifdef USE_ESP32 + +#include "esphome/core/hal.h" + +namespace esphome { +namespace audio { + +static const uint32_t DECODING_TIMEOUT_MS = 50; // The decode function will yield after this duration +static const uint32_t READ_WRITE_TIMEOUT_MS = 20; // Timeout for transferring audio data + +static const uint32_t MAX_POTENTIALLY_FAILED_COUNT = 10; + +AudioDecoder::AudioDecoder(size_t input_buffer_size, size_t output_buffer_size) { + this->input_transfer_buffer_ = AudioSourceTransferBuffer::create(input_buffer_size); + this->output_transfer_buffer_ = AudioSinkTransferBuffer::create(output_buffer_size); +} + +AudioDecoder::~AudioDecoder() { +#ifdef USE_AUDIO_MP3_SUPPORT + if (this->audio_file_type_ == AudioFileType::MP3) { + esp_audio_libs::helix_decoder::MP3FreeDecoder(this->mp3_decoder_); + } +#endif +} + +esp_err_t AudioDecoder::add_source(std::weak_ptr &input_ring_buffer) { + if (this->input_transfer_buffer_ != nullptr) { + this->input_transfer_buffer_->set_source(input_ring_buffer); + return ESP_OK; + } + return ESP_ERR_NO_MEM; +} + +esp_err_t AudioDecoder::add_sink(std::weak_ptr &output_ring_buffer) { + if (this->output_transfer_buffer_ != nullptr) { + this->output_transfer_buffer_->set_sink(output_ring_buffer); + return ESP_OK; + } + return ESP_ERR_NO_MEM; +} + +#ifdef USE_SPEAKER +esp_err_t AudioDecoder::add_sink(speaker::Speaker *speaker) { + if (this->output_transfer_buffer_ != nullptr) { + this->output_transfer_buffer_->set_sink(speaker); + return ESP_OK; + } + return ESP_ERR_NO_MEM; +} +#endif + +esp_err_t AudioDecoder::start(AudioFileType audio_file_type) { + if ((this->input_transfer_buffer_ == nullptr) || (this->output_transfer_buffer_ == nullptr)) { + return ESP_ERR_NO_MEM; + } + + this->audio_file_type_ = audio_file_type; + + this->potentially_failed_count_ = 0; + this->end_of_file_ = false; + + switch (this->audio_file_type_) { +#ifdef USE_AUDIO_FLAC_SUPPORT + case AudioFileType::FLAC: + this->flac_decoder_ = make_unique(); + this->free_buffer_required_ = + this->output_transfer_buffer_->capacity(); // We'll revise this after reading the header + break; +#endif +#ifdef USE_AUDIO_MP3_SUPPORT + case AudioFileType::MP3: + this->mp3_decoder_ = esp_audio_libs::helix_decoder::MP3InitDecoder(); + this->free_buffer_required_ = 1152 * sizeof(int16_t) * 2; // samples * size per sample * channels + break; +#endif + case AudioFileType::WAV: + this->wav_decoder_ = make_unique(); + this->wav_decoder_->reset(); + this->free_buffer_required_ = 1024; + break; + case AudioFileType::NONE: + default: + return ESP_ERR_NOT_SUPPORTED; + break; + } + + return ESP_OK; +} + +AudioDecoderState AudioDecoder::decode(bool stop_gracefully) { + if (stop_gracefully) { + if (this->output_transfer_buffer_->available() == 0) { + if (this->end_of_file_) { + // The file decoder indicates it reached the end of file + return AudioDecoderState::FINISHED; + } + + if (!this->input_transfer_buffer_->has_buffered_data()) { + // If all the internal buffers are empty, the decoding is done + return AudioDecoderState::FINISHED; + } + } + } + + if (this->potentially_failed_count_ > MAX_POTENTIALLY_FAILED_COUNT) { + if (stop_gracefully) { + // No more new data is going to come in, so decoding is done + return AudioDecoderState::FINISHED; + } + return AudioDecoderState::FAILED; + } + + FileDecoderState state = FileDecoderState::MORE_TO_PROCESS; + + uint32_t decoding_start = millis(); + + while (state == FileDecoderState::MORE_TO_PROCESS) { + // Transfer decoded out + if (!this->pause_output_) { + size_t bytes_written = this->output_transfer_buffer_->transfer_data_to_sink(pdMS_TO_TICKS(READ_WRITE_TIMEOUT_MS)); + if (this->audio_stream_info_.has_value()) { + this->accumulated_frames_written_ += this->audio_stream_info_.value().bytes_to_frames(bytes_written); + this->playback_ms_ += + this->audio_stream_info_.value().frames_to_milliseconds_with_remainder(&this->accumulated_frames_written_); + } + } else { + // If paused, block to avoid wasting CPU resources + delay(READ_WRITE_TIMEOUT_MS); + } + + // Verify there is enough space to store more decoded audio and that the function hasn't been running too long + if ((this->output_transfer_buffer_->free() < this->free_buffer_required_) || + (millis() - decoding_start > DECODING_TIMEOUT_MS)) { + return AudioDecoderState::DECODING; + } + + // Decode more audio + + size_t bytes_read = this->input_transfer_buffer_->transfer_data_from_source(pdMS_TO_TICKS(READ_WRITE_TIMEOUT_MS)); + + if ((this->potentially_failed_count_ > 0) && (bytes_read == 0)) { + // Failed to decode in last attempt and there is no new data + + if (this->input_transfer_buffer_->free() == 0) { + // The input buffer is full. Since it previously failed on the exact same data, we can never recover + state = FileDecoderState::FAILED; + } else { + // Attempt to get more data next time + state = FileDecoderState::IDLE; + } + } else if (this->input_transfer_buffer_->available() == 0) { + // No data to decode, attempt to get more data next time + state = FileDecoderState::IDLE; + } else { + switch (this->audio_file_type_) { +#ifdef USE_AUDIO_FLAC_SUPPORT + case AudioFileType::FLAC: + state = this->decode_flac_(); + break; +#endif +#ifdef USE_AUDIO_MP3_SUPPORT + case AudioFileType::MP3: + state = this->decode_mp3_(); + break; +#endif + case AudioFileType::WAV: + state = this->decode_wav_(); + break; + case AudioFileType::NONE: + default: + state = FileDecoderState::IDLE; + break; + } + } + + if (state == FileDecoderState::POTENTIALLY_FAILED) { + ++this->potentially_failed_count_; + } else if (state == FileDecoderState::END_OF_FILE) { + this->end_of_file_ = true; + } else if (state == FileDecoderState::FAILED) { + return AudioDecoderState::FAILED; + } else if (state == FileDecoderState::MORE_TO_PROCESS) { + this->potentially_failed_count_ = 0; + } + } + return AudioDecoderState::DECODING; +} + +#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_transfer_buffer_->get_buffer_start(), + this->input_transfer_buffer_->available()); + + if (result == esp_audio_libs::flac::FLAC_DECODER_HEADER_OUT_OF_DATA) { + return FileDecoderState::POTENTIALLY_FAILED; + } + + if (result != esp_audio_libs::flac::FLAC_DECODER_SUCCESS) { + // Couldn't read FLAC header + return FileDecoderState::FAILED; + } + + size_t bytes_consumed = this->flac_decoder_->get_bytes_index(); + this->input_transfer_buffer_->decrease_buffer_length(bytes_consumed); + + this->free_buffer_required_ = flac_decoder_->get_output_buffer_size_bytes(); + if (this->output_transfer_buffer_->capacity() < this->free_buffer_required_) { + // Output buffer is not big enough + 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_transfer_buffer_->get_buffer_start(), this->input_transfer_buffer_->available(), + reinterpret_cast(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_transfer_buffer_->decrease_buffer_length(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) { + return FileDecoderState::END_OF_FILE; + } + + return FileDecoderState::MORE_TO_PROCESS; +} +#endif + +#ifdef USE_AUDIO_MP3_SUPPORT +FileDecoderState AudioDecoder::decode_mp3_() { + // Look for the next sync word + int buffer_length = (int) this->input_transfer_buffer_->available(); + int32_t offset = + esp_audio_libs::helix_decoder::MP3FindSyncWord(this->input_transfer_buffer_->get_buffer_start(), buffer_length); + + if (offset < 0) { + // New data may have the sync word + this->input_transfer_buffer_->decrease_buffer_length(buffer_length); + return FileDecoderState::POTENTIALLY_FAILED; + } + + // Advance read pointer to match the offset for the syncword + this->input_transfer_buffer_->decrease_buffer_length(offset); + uint8_t *buffer_start = this->input_transfer_buffer_->get_buffer_start(); + + buffer_length = (int) this->input_transfer_buffer_->available(); + int err = esp_audio_libs::helix_decoder::MP3Decode(this->mp3_decoder_, &buffer_start, &buffer_length, + (int16_t *) this->output_transfer_buffer_->get_buffer_end(), 0); + + size_t consumed = this->input_transfer_buffer_->available() - buffer_length; + this->input_transfer_buffer_->decrease_buffer_length(consumed); + + if (err) { + switch (err) { + case esp_audio_libs::helix_decoder::ERR_MP3_OUT_OF_MEMORY: + // Intentional fallthrough + case esp_audio_libs::helix_decoder::ERR_MP3_NULL_POINTER: + return FileDecoderState::FAILED; + break; + default: + // Most errors are recoverable by moving on to the next frame, so mark as potentailly failed + return FileDecoderState::POTENTIALLY_FAILED; + break; + } + } else { + esp_audio_libs::helix_decoder::MP3FrameInfo mp3_frame_info; + esp_audio_libs::helix_decoder::MP3GetLastFrameInfo(this->mp3_decoder_, &mp3_frame_info); + if (mp3_frame_info.outputSamps > 0) { + int bytes_per_sample = (mp3_frame_info.bitsPerSample / 8); + this->output_transfer_buffer_->increase_buffer_length(mp3_frame_info.outputSamps * bytes_per_sample); + + if (!this->audio_stream_info_.has_value()) { + this->audio_stream_info_ = + audio::AudioStreamInfo(mp3_frame_info.bitsPerSample, mp3_frame_info.nChans, mp3_frame_info.samprate); + } + } + } + + return FileDecoderState::MORE_TO_PROCESS; +} +#endif + +FileDecoderState AudioDecoder::decode_wav_() { + if (!this->audio_stream_info_.has_value()) { + // Header hasn't been processed + + esp_audio_libs::wav_decoder::WAVDecoderResult result = this->wav_decoder_->decode_header( + this->input_transfer_buffer_->get_buffer_start(), this->input_transfer_buffer_->available()); + + if (result == esp_audio_libs::wav_decoder::WAV_DECODER_SUCCESS_IN_DATA) { + this->input_transfer_buffer_->decrease_buffer_length(this->wav_decoder_->bytes_processed()); + + this->audio_stream_info_ = audio::AudioStreamInfo( + this->wav_decoder_->bits_per_sample(), this->wav_decoder_->num_channels(), this->wav_decoder_->sample_rate()); + + this->wav_bytes_left_ = this->wav_decoder_->chunk_bytes_left(); + this->wav_has_known_end_ = (this->wav_bytes_left_ > 0); + return FileDecoderState::MORE_TO_PROCESS; + } else if (result == esp_audio_libs::wav_decoder::WAV_DECODER_WARNING_INCOMPLETE_DATA) { + // Available data didn't have the full header + return FileDecoderState::POTENTIALLY_FAILED; + } else { + return FileDecoderState::FAILED; + } + } else { + if (!this->wav_has_known_end_ || (this->wav_bytes_left_ > 0)) { + size_t bytes_to_copy = this->input_transfer_buffer_->available(); + + if (this->wav_has_known_end_) { + bytes_to_copy = std::min(bytes_to_copy, this->wav_bytes_left_); + } + + bytes_to_copy = std::min(bytes_to_copy, this->output_transfer_buffer_->free()); + + if (bytes_to_copy > 0) { + std::memcpy(this->output_transfer_buffer_->get_buffer_end(), this->input_transfer_buffer_->get_buffer_start(), + bytes_to_copy); + this->input_transfer_buffer_->decrease_buffer_length(bytes_to_copy); + this->output_transfer_buffer_->increase_buffer_length(bytes_to_copy); + if (this->wav_has_known_end_) { + this->wav_bytes_left_ -= bytes_to_copy; + } + } + return FileDecoderState::IDLE; + } + } + + return FileDecoderState::END_OF_FILE; +} + +} // namespace audio +} // namespace esphome + +#endif diff --git a/esphome/components/audio/audio_decoder.h b/esphome/components/audio/audio_decoder.h new file mode 100644 index 0000000000..2ca1d623fe --- /dev/null +++ b/esphome/components/audio/audio_decoder.h @@ -0,0 +1,135 @@ +#pragma once + +#ifdef USE_ESP32 + +#include "audio.h" +#include "audio_transfer_buffer.h" + +#include "esphome/core/defines.h" +#include "esphome/core/helpers.h" +#include "esphome/core/ring_buffer.h" + +#ifdef USE_SPEAKER +#include "esphome/components/speaker/speaker.h" +#endif + +#include "esp_err.h" + +// esp-audio-libs +#ifdef USE_AUDIO_FLAC_SUPPORT +#include +#endif +#ifdef USE_AUDIO_MP3_SUPPORT +#include +#endif +#include + +namespace esphome { +namespace audio { + +enum class AudioDecoderState : uint8_t { + DECODING = 0, // More data is available to decode + FINISHED, // All file data has been decoded and transferred + FAILED, // Encountered an error +}; + +// Only used within the AudioDecoder class; conveys the state of the particular file type decoder +enum class FileDecoderState : uint8_t { + MORE_TO_PROCESS, // Successsfully read a file chunk and more data is available to decode + IDLE, // Not enough data to decode, waiting for more to be transferred + POTENTIALLY_FAILED, // Decoder encountered a potentially recoverable error if more file data is available + FAILED, // Decoder encoutnered an uncrecoverable error + END_OF_FILE, // The specific file decoder knows its the end of the file +}; + +class AudioDecoder { + /* + * @brief Class that facilitates decoding an audio file. + * The audio file is read from a ring buffer source, decoded, and sent to an audio sink (ring buffer or speaker + * component). + * Supports wav, flac, and mp3 formats. + */ + public: + /// @brief Allocates the input and output transfer buffers + /// @param input_buffer_size Size of the input transfer buffer in bytes. + /// @param output_buffer_size Size of the output transfer buffer in bytes. + AudioDecoder(size_t input_buffer_size, size_t output_buffer_size); + + /// @brief Deallocates the MP3 decoder (the flac and wav decoders are deallocated automatically) + ~AudioDecoder(); + + /// @brief Adds a source ring buffer for raw file data. Takes ownership of the ring buffer in a shared_ptr. + /// @param input_ring_buffer weak_ptr of a shared_ptr of the sink ring buffer to transfer ownership + /// @return ESP_OK if successsful, ESP_ERR_NO_MEM if the transfer buffer wasn't allocated + esp_err_t add_source(std::weak_ptr &input_ring_buffer); + + /// @brief Adds a sink ring buffer for decoded audio. Takes ownership of the ring buffer in a shared_ptr. + /// @param output_ring_buffer weak_ptr of a shared_ptr of the sink ring buffer to transfer ownership + /// @return ESP_OK if successsful, ESP_ERR_NO_MEM if the transfer buffer wasn't allocated + esp_err_t add_sink(std::weak_ptr &output_ring_buffer); + +#ifdef USE_SPEAKER + /// @brief Adds a sink speaker for decoded audio. + /// @param speaker pointer to speaker component + /// @return ESP_OK if successsful, ESP_ERR_NO_MEM if the transfer buffer wasn't allocated + esp_err_t add_sink(speaker::Speaker *speaker); +#endif + + /// @brief Sets up decoding the file + /// @param audio_file_type AudioFileType of the file + /// @return ESP_OK if successful, ESP_ERR_NO_MEM if the transfer buffers fail to allocate, or ESP_ERR_NOT_SUPPORTED if + /// the format isn't supported. + esp_err_t start(AudioFileType audio_file_type); + + /// @brief Decodes audio from the ring buffer source and writes to the sink. + /// @param stop_gracefully If true, it indicates the file source is finished. The decoder will decode all the + /// reamining data and then finish. + /// @return AudioDecoderState + AudioDecoderState decode(bool stop_gracefully); + + /// @brief Gets the audio stream information, if it has been decoded from the files header + /// @return optional with the audio information. If not available yet, returns no value. + const optional &get_audio_stream_info() const { return this->audio_stream_info_; } + + /// @brief Returns the duration of audio (in milliseconds) decoded and sent to the sink + /// @return Duration of decoded audio in milliseconds + uint32_t get_playback_ms() const { return this->playback_ms_; } + + /// @brief Pauses sending resampled audio to the sink. If paused, it will continue to process internal buffers. + /// @param pause_state If true, audio data is not sent to the sink. + void set_pause_output_state(bool pause_state) { this->pause_output_ = pause_state; } + + protected: + std::unique_ptr wav_decoder_; +#ifdef USE_AUDIO_FLAC_SUPPORT + FileDecoderState decode_flac_(); + std::unique_ptr flac_decoder_; +#endif +#ifdef USE_AUDIO_MP3_SUPPORT + FileDecoderState decode_mp3_(); + esp_audio_libs::helix_decoder::HMP3Decoder mp3_decoder_; +#endif + FileDecoderState decode_wav_(); + + std::unique_ptr input_transfer_buffer_; + std::unique_ptr output_transfer_buffer_; + + AudioFileType audio_file_type_{AudioFileType::NONE}; + optional audio_stream_info_{}; + + size_t free_buffer_required_{0}; + size_t wav_bytes_left_{0}; + + uint32_t potentially_failed_count_{0}; + bool end_of_file_{false}; + bool wav_has_known_end_{false}; + + bool pause_output_{false}; + + uint32_t accumulated_frames_written_{0}; + uint32_t playback_ms_{0}; +}; +} // namespace audio +} // namespace esphome + +#endif diff --git a/esphome/components/audio/audio_reader.cpp b/esphome/components/audio/audio_reader.cpp new file mode 100644 index 0000000000..b93e4e74ea --- /dev/null +++ b/esphome/components/audio/audio_reader.cpp @@ -0,0 +1,308 @@ +#include "audio_reader.h" + +#ifdef USE_ESP_IDF + +#include "esphome/core/defines.h" +#include "esphome/core/hal.h" +#include "esphome/core/helpers.h" + +#if CONFIG_MBEDTLS_CERTIFICATE_BUNDLE +#include "esp_crt_bundle.h" +#endif + +namespace esphome { +namespace audio { + +static const uint32_t READ_WRITE_TIMEOUT_MS = 20; + +// The number of times the http read times out with no data before throwing an error +static const uint32_t ERROR_COUNT_NO_DATA_READ_TIMEOUT = 100; + +static const size_t HTTP_STREAM_BUFFER_SIZE = 2048; + +static const uint8_t MAX_REDIRECTION = 5; + +// Some common HTTP status codes - borrowed from http_request component accessed 20241224 +enum HttpStatus { + HTTP_STATUS_OK = 200, + HTTP_STATUS_NO_CONTENT = 204, + HTTP_STATUS_PARTIAL_CONTENT = 206, + + /* 3xx - Redirection */ + HTTP_STATUS_MULTIPLE_CHOICES = 300, + HTTP_STATUS_MOVED_PERMANENTLY = 301, + HTTP_STATUS_FOUND = 302, + HTTP_STATUS_SEE_OTHER = 303, + HTTP_STATUS_NOT_MODIFIED = 304, + HTTP_STATUS_TEMPORARY_REDIRECT = 307, + HTTP_STATUS_PERMANENT_REDIRECT = 308, + + /* 4XX - CLIENT ERROR */ + HTTP_STATUS_BAD_REQUEST = 400, + HTTP_STATUS_UNAUTHORIZED = 401, + HTTP_STATUS_FORBIDDEN = 403, + HTTP_STATUS_NOT_FOUND = 404, + HTTP_STATUS_METHOD_NOT_ALLOWED = 405, + HTTP_STATUS_NOT_ACCEPTABLE = 406, + HTTP_STATUS_LENGTH_REQUIRED = 411, + + /* 5xx - Server Error */ + HTTP_STATUS_INTERNAL_ERROR = 500 +}; + +AudioReader::~AudioReader() { this->cleanup_connection_(); } + +esp_err_t AudioReader::add_sink(const std::weak_ptr &output_ring_buffer) { + if (current_audio_file_ != nullptr) { + // A transfer buffer isn't ncessary for a local file + this->file_ring_buffer_ = output_ring_buffer.lock(); + return ESP_OK; + } + + if (this->output_transfer_buffer_ != nullptr) { + this->output_transfer_buffer_->set_sink(output_ring_buffer); + return ESP_OK; + } + + return ESP_ERR_INVALID_STATE; +} + +esp_err_t AudioReader::start(AudioFile *audio_file, AudioFileType &file_type) { + file_type = AudioFileType::NONE; + + this->current_audio_file_ = audio_file; + + this->file_current_ = audio_file->data; + file_type = audio_file->file_type; + + return ESP_OK; +} + +esp_err_t AudioReader::start(const std::string &uri, AudioFileType &file_type) { + file_type = AudioFileType::NONE; + + this->cleanup_connection_(); + + if (uri.empty()) { + return ESP_ERR_INVALID_ARG; + } + + esp_http_client_config_t client_config = {}; + + client_config.url = uri.c_str(); + client_config.cert_pem = nullptr; + client_config.disable_auto_redirect = false; + client_config.max_redirection_count = 10; + client_config.event_handler = http_event_handler; + client_config.user_data = this; + client_config.buffer_size = HTTP_STREAM_BUFFER_SIZE; + client_config.keep_alive_enable = true; + client_config.timeout_ms = 5000; // Shouldn't trigger watchdog resets if caller runs in a task + +#if CONFIG_MBEDTLS_CERTIFICATE_BUNDLE + if (uri.find("https:") != std::string::npos) { + client_config.crt_bundle_attach = esp_crt_bundle_attach; + } +#endif + + this->client_ = esp_http_client_init(&client_config); + + if (this->client_ == nullptr) { + return ESP_FAIL; + } + + esp_err_t err = esp_http_client_open(this->client_, 0); + + if (err != ESP_OK) { + this->cleanup_connection_(); + return err; + } + + int64_t header_length = esp_http_client_fetch_headers(this->client_); + if (header_length < 0) { + this->cleanup_connection_(); + return ESP_FAIL; + } + + int status_code = esp_http_client_get_status_code(this->client_); + + if ((status_code < HTTP_STATUS_OK) || (status_code > HTTP_STATUS_PERMANENT_REDIRECT)) { + this->cleanup_connection_(); + return ESP_FAIL; + } + + ssize_t redirect_count = 0; + + while ((esp_http_client_set_redirection(this->client_) == ESP_OK) && (redirect_count < MAX_REDIRECTION)) { + err = esp_http_client_open(this->client_, 0); + if (err != ESP_OK) { + this->cleanup_connection_(); + return ESP_FAIL; + } + + header_length = esp_http_client_fetch_headers(this->client_); + if (header_length < 0) { + this->cleanup_connection_(); + return ESP_FAIL; + } + + status_code = esp_http_client_get_status_code(this->client_); + + if ((status_code < HTTP_STATUS_OK) || (status_code > HTTP_STATUS_PERMANENT_REDIRECT)) { + this->cleanup_connection_(); + return ESP_FAIL; + } + + ++redirect_count; + } + + if (this->audio_file_type_ == AudioFileType::NONE) { + // Failed to determine the file type from the header, fallback to using the url + char url[500]; + err = esp_http_client_get_url(this->client_, url, 500); + if (err != ESP_OK) { + this->cleanup_connection_(); + return err; + } + + std::string url_string = str_lower_case(url); + + if (str_endswith(url_string, ".wav")) { + file_type = AudioFileType::WAV; + } +#ifdef USE_AUDIO_MP3_SUPPORT + else if (str_endswith(url_string, ".mp3")) { + file_type = AudioFileType::MP3; + } +#endif +#ifdef USE_AUDIO_FLAC_SUPPORT + else if (str_endswith(url_string, ".flac")) { + file_type = AudioFileType::FLAC; + } +#endif + else { + file_type = AudioFileType::NONE; + this->cleanup_connection_(); + return ESP_ERR_NOT_SUPPORTED; + } + } else { + file_type = this->audio_file_type_; + } + + this->no_data_read_count_ = 0; + + this->output_transfer_buffer_ = AudioSinkTransferBuffer::create(this->buffer_size_); + if (this->output_transfer_buffer_ == nullptr) { + return ESP_ERR_NO_MEM; + } + + return ESP_OK; +} + +AudioReaderState AudioReader::read() { + if (this->client_ != nullptr) { + return this->http_read_(); + } else if (this->current_audio_file_ != nullptr) { + return this->file_read_(); + } + + return AudioReaderState::FAILED; +} + +AudioFileType AudioReader::get_audio_type(const char *content_type) { +#ifdef USE_AUDIO_MP3_SUPPORT + if (strcasecmp(content_type, "mp3") == 0 || strcasecmp(content_type, "audio/mp3") == 0 || + strcasecmp(content_type, "audio/mpeg") == 0) { + return AudioFileType::MP3; + } +#endif + if (strcasecmp(content_type, "audio/wav") == 0) { + return AudioFileType::WAV; + } +#ifdef USE_AUDIO_FLAC_SUPPORT + if (strcasecmp(content_type, "audio/flac") == 0 || strcasecmp(content_type, "audio/x-flac") == 0) { + return AudioFileType::FLAC; + } +#endif + return AudioFileType::NONE; +} + +esp_err_t AudioReader::http_event_handler(esp_http_client_event_t *evt) { + // Based on https://github.com/maroc81/WeatherLily/tree/main/main/net accessed 20241224 + AudioReader *this_reader = (AudioReader *) evt->user_data; + + switch (evt->event_id) { + case HTTP_EVENT_ON_HEADER: + if (strcasecmp(evt->header_key, "Content-Type") == 0) { + this_reader->audio_file_type_ = get_audio_type(evt->header_value); + } + break; + default: + break; + } + return ESP_OK; +} + +AudioReaderState AudioReader::file_read_() { + size_t remaining_bytes = this->current_audio_file_->length - (this->file_current_ - this->current_audio_file_->data); + if (remaining_bytes > 0) { + size_t bytes_written = this->file_ring_buffer_->write_without_replacement(this->file_current_, remaining_bytes, + pdMS_TO_TICKS(READ_WRITE_TIMEOUT_MS)); + this->file_current_ += bytes_written; + + return AudioReaderState::READING; + } + + return AudioReaderState::FINISHED; +} + +AudioReaderState AudioReader::http_read_() { + this->output_transfer_buffer_->transfer_data_to_sink(pdMS_TO_TICKS(READ_WRITE_TIMEOUT_MS)); + + if (esp_http_client_is_complete_data_received(this->client_)) { + if (this->output_transfer_buffer_->available() == 0) { + this->cleanup_connection_(); + return AudioReaderState::FINISHED; + } + } else { + size_t bytes_to_read = this->output_transfer_buffer_->free(); + int received_len = + esp_http_client_read(this->client_, (char *) this->output_transfer_buffer_->get_buffer_end(), bytes_to_read); + + if (received_len > 0) { + this->output_transfer_buffer_->increase_buffer_length(received_len); + + this->no_data_read_count_ = 0; + } else if (received_len < 0) { + // HTTP read error + this->cleanup_connection_(); + return AudioReaderState::FAILED; + } else { + if (bytes_to_read > 0) { + // Read timed out + ++this->no_data_read_count_; + if (this->no_data_read_count_ >= ERROR_COUNT_NO_DATA_READ_TIMEOUT) { + // Timed out with no data read too many times, so the http read has failed + this->cleanup_connection_(); + return AudioReaderState::FAILED; + } + delay(READ_WRITE_TIMEOUT_MS); + } + } + } + + return AudioReaderState::READING; +} + +void AudioReader::cleanup_connection_() { + if (this->client_ != nullptr) { + esp_http_client_close(this->client_); + esp_http_client_cleanup(this->client_); + this->client_ = nullptr; + } +} + +} // namespace audio +} // namespace esphome + +#endif diff --git a/esphome/components/audio/audio_reader.h b/esphome/components/audio/audio_reader.h new file mode 100644 index 0000000000..90113e6dda --- /dev/null +++ b/esphome/components/audio/audio_reader.h @@ -0,0 +1,85 @@ +#pragma once + +#ifdef USE_ESP_IDF + +#include "audio.h" +#include "audio_transfer_buffer.h" + +#include "esphome/core/ring_buffer.h" + +#include "esp_err.h" + +#include + +namespace esphome { +namespace audio { + +enum class AudioReaderState : uint8_t { + READING = 0, // More data is available to read + FINISHED, // All data has been read and transferred + FAILED, // Encountered an error +}; + +class AudioReader { + /* + * @brief Class that facilitates reading a raw audio file. + * Files can be read from flash (stored in a AudioFile struct) or from an http source. + * The file data is sent to a ring buffer sink. + */ + public: + /// @brief Constructs an AudioReader object. + /// The transfer buffer isn't allocated here, but only if necessary (an http source) in the start function. + /// @param buffer_size Transfer buffer size in bytes. + AudioReader(size_t buffer_size) : buffer_size_(buffer_size) {} + ~AudioReader(); + + /// @brief Adds a sink ring buffer for audio data. Takes ownership of the ring buffer in a shared_ptr + /// @param output_ring_buffer weak_ptr of a shared_ptr of the sink ring buffer to transfer ownership + /// @return ESP_OK if successful, ESP_ERR_INVALID_STATE otherwise + esp_err_t add_sink(const std::weak_ptr &output_ring_buffer); + + /// @brief Starts reading an audio file from an http source. The transfer buffer is allocated here. + /// @param uri Web url to the http file. + /// @param file_type AudioFileType variable passed-by-reference indicating the type of file being read. + /// @return ESP_OK if successful, an ESP_ERR* code otherwise. + esp_err_t start(const std::string &uri, AudioFileType &file_type); + + /// @brief Starts reading an audio file from flash. No transfer buffer is allocated. + /// @param audio_file AudioFile struct containing the file. + /// @param file_type AudioFileType variable passed-by-reference indicating the type of file being read. + /// @return ESP_OK + esp_err_t start(AudioFile *audio_file, AudioFileType &file_type); + + /// @brief Reads new file data from the source and sends to the ring buffer sink. + /// @return AudioReaderState + AudioReaderState read(); + + protected: + /// @brief Monitors the http client events to attempt determining the file type from the Content-Type header + static esp_err_t http_event_handler(esp_http_client_event_t *evt); + + /// @brief Determines the audio file type from the http header's Content-Type key + /// @param content_type string with the Content-Type key + /// @return AudioFileType of the url, if it can be determined. If not, return AudioFileType::NONE. + static AudioFileType get_audio_type(const char *content_type); + + AudioReaderState file_read_(); + AudioReaderState http_read_(); + + std::shared_ptr file_ring_buffer_; + std::unique_ptr output_transfer_buffer_; + void cleanup_connection_(); + + size_t buffer_size_; + uint32_t no_data_read_count_; + + esp_http_client_handle_t client_{nullptr}; + + AudioFile *current_audio_file_{nullptr}; + AudioFileType audio_file_type_{AudioFileType::NONE}; + const uint8_t *file_current_{nullptr}; +}; +} // namespace audio +} // namespace esphome + +#endif diff --git a/esphome/components/audio/audio_resampler.cpp b/esphome/components/audio/audio_resampler.cpp new file mode 100644 index 0000000000..05e9ff6ca1 --- /dev/null +++ b/esphome/components/audio/audio_resampler.cpp @@ -0,0 +1,159 @@ +#include "audio_resampler.h" + +#ifdef USE_ESP32 + +#include "esphome/core/hal.h" + +namespace esphome { +namespace audio { + +static const uint32_t READ_WRITE_TIMEOUT_MS = 20; + +AudioResampler::AudioResampler(size_t input_buffer_size, size_t output_buffer_size) + : input_buffer_size_(input_buffer_size), output_buffer_size_(output_buffer_size) { + this->input_transfer_buffer_ = AudioSourceTransferBuffer::create(input_buffer_size); + this->output_transfer_buffer_ = AudioSinkTransferBuffer::create(output_buffer_size); +} + +esp_err_t AudioResampler::add_source(std::weak_ptr &input_ring_buffer) { + if (this->input_transfer_buffer_ != nullptr) { + this->input_transfer_buffer_->set_source(input_ring_buffer); + return ESP_OK; + } + return ESP_ERR_NO_MEM; +} + +esp_err_t AudioResampler::add_sink(std::weak_ptr &output_ring_buffer) { + if (this->output_transfer_buffer_ != nullptr) { + this->output_transfer_buffer_->set_sink(output_ring_buffer); + return ESP_OK; + } + return ESP_ERR_NO_MEM; +} + +#ifdef USE_SPEAKER +esp_err_t AudioResampler::add_sink(speaker::Speaker *speaker) { + if (this->output_transfer_buffer_ != nullptr) { + this->output_transfer_buffer_->set_sink(speaker); + return ESP_OK; + } + return ESP_ERR_NO_MEM; +} +#endif + +esp_err_t AudioResampler::start(AudioStreamInfo &input_stream_info, AudioStreamInfo &output_stream_info, + uint16_t number_of_taps, uint16_t number_of_filters) { + this->input_stream_info_ = input_stream_info; + this->output_stream_info_ = output_stream_info; + + if ((this->input_transfer_buffer_ == nullptr) || (this->output_transfer_buffer_ == nullptr)) { + return ESP_ERR_NO_MEM; + } + + if ((input_stream_info.get_bits_per_sample() > 32) || (output_stream_info.get_bits_per_sample() > 32) || + (input_stream_info_.get_channels() != output_stream_info.get_channels())) { + return ESP_ERR_NOT_SUPPORTED; + } + + if ((input_stream_info.get_sample_rate() != output_stream_info.get_sample_rate()) || + (input_stream_info.get_bits_per_sample() != output_stream_info.get_bits_per_sample())) { + this->resampler_ = make_unique( + input_stream_info.bytes_to_samples(this->input_buffer_size_), + output_stream_info.bytes_to_samples(this->output_buffer_size_)); + + // Use cascaded biquad filters when downsampling to avoid aliasing + bool use_pre_filter = output_stream_info.get_sample_rate() < input_stream_info.get_sample_rate(); + + esp_audio_libs::resampler::ResamplerConfiguration resample_config = { + .source_sample_rate = static_cast(input_stream_info.get_sample_rate()), + .target_sample_rate = static_cast(output_stream_info.get_sample_rate()), + .source_bits_per_sample = input_stream_info.get_bits_per_sample(), + .target_bits_per_sample = output_stream_info.get_bits_per_sample(), + .channels = input_stream_info_.get_channels(), + .use_pre_or_post_filter = use_pre_filter, + .subsample_interpolate = false, // Doubles the CPU load. Using more filters is a better alternative + .number_of_taps = number_of_taps, + .number_of_filters = number_of_filters, + }; + + if (!this->resampler_->initialize(resample_config)) { + // Failed to allocate the resampler's internal buffers + return ESP_ERR_NO_MEM; + } + } + + return ESP_OK; +} + +AudioResamplerState AudioResampler::resample(bool stop_gracefully, int32_t *ms_differential) { + if (stop_gracefully) { + if (!this->input_transfer_buffer_->has_buffered_data() && (this->output_transfer_buffer_->available() == 0)) { + return AudioResamplerState::FINISHED; + } + } + + if (!this->pause_output_) { + // Move audio data to the sink + this->output_transfer_buffer_->transfer_data_to_sink(pdMS_TO_TICKS(READ_WRITE_TIMEOUT_MS)); + } else { + // If paused, block to avoid wasting CPU resources + delay(READ_WRITE_TIMEOUT_MS); + } + + this->input_transfer_buffer_->transfer_data_from_source(pdMS_TO_TICKS(READ_WRITE_TIMEOUT_MS)); + + if (this->input_transfer_buffer_->available() == 0) { + // No samples available to process + return AudioResamplerState::RESAMPLING; + } + + const size_t bytes_free = this->output_transfer_buffer_->free(); + const uint32_t frames_free = this->output_stream_info_.bytes_to_frames(bytes_free); + + const size_t bytes_available = this->input_transfer_buffer_->available(); + const uint32_t frames_available = this->input_stream_info_.bytes_to_frames(bytes_available); + + if ((this->input_stream_info_.get_sample_rate() != this->output_stream_info_.get_sample_rate()) || + (this->input_stream_info_.get_bits_per_sample() != this->output_stream_info_.get_bits_per_sample())) { + esp_audio_libs::resampler::ResamplerResults results = + this->resampler_->resample(this->input_transfer_buffer_->get_buffer_start(), + this->output_transfer_buffer_->get_buffer_end(), frames_available, frames_free, -3); + + this->input_transfer_buffer_->decrease_buffer_length(this->input_stream_info_.frames_to_bytes(results.frames_used)); + this->output_transfer_buffer_->increase_buffer_length( + this->output_stream_info_.frames_to_bytes(results.frames_generated)); + + // Resampling causes slight differences in the durations used versus generated. Computes the difference in + // millisconds. The callback function passing the played audio duration uses the difference to convert from output + // duration to input duration. + this->accumulated_frames_used_ += results.frames_used; + this->accumulated_frames_generated_ += results.frames_generated; + + const int32_t used_ms = + this->input_stream_info_.frames_to_milliseconds_with_remainder(&this->accumulated_frames_used_); + const int32_t generated_ms = + this->output_stream_info_.frames_to_milliseconds_with_remainder(&this->accumulated_frames_generated_); + + *ms_differential = used_ms - generated_ms; + + } else { + // No resampling required, copy samples directly to the output transfer buffer + *ms_differential = 0; + + const size_t bytes_to_transfer = std::min(this->output_stream_info_.frames_to_bytes(frames_free), + this->input_stream_info_.frames_to_bytes(frames_available)); + + std::memcpy((void *) this->output_transfer_buffer_->get_buffer_end(), + (void *) this->input_transfer_buffer_->get_buffer_start(), bytes_to_transfer); + + this->input_transfer_buffer_->decrease_buffer_length(bytes_to_transfer); + this->output_transfer_buffer_->increase_buffer_length(bytes_to_transfer); + } + + return AudioResamplerState::RESAMPLING; +} + +} // namespace audio +} // namespace esphome + +#endif diff --git a/esphome/components/audio/audio_resampler.h b/esphome/components/audio/audio_resampler.h new file mode 100644 index 0000000000..7f4e987b4c --- /dev/null +++ b/esphome/components/audio/audio_resampler.h @@ -0,0 +1,101 @@ +#pragma once + +#ifdef USE_ESP32 + +#include "audio.h" +#include "audio_transfer_buffer.h" + +#include "esphome/core/defines.h" +#include "esphome/core/ring_buffer.h" + +#ifdef USE_SPEAKER +#include "esphome/components/speaker/speaker.h" +#endif + +#include "esp_err.h" + +#include // esp-audio-libs + +namespace esphome { +namespace audio { + +enum class AudioResamplerState : uint8_t { + RESAMPLING, // More data is available to resample + FINISHED, // All file data has been resampled and transferred + FAILED, // Unused state included for consistency among Audio classes +}; + +class AudioResampler { + /* + * @brief Class that facilitates resampling audio. + * The audio data is read from a ring buffer source, resampled, and sent to an audio sink (ring buffer or speaker + * component). Also supports converting bits per sample. + */ + public: + /// @brief Allocates the input and output transfer buffers + /// @param input_buffer_size Size of the input transfer buffer in bytes. + /// @param output_buffer_size Size of the output transfer buffer in bytes. + AudioResampler(size_t input_buffer_size, size_t output_buffer_size); + + /// @brief Adds a source ring buffer for audio data. Takes ownership of the ring buffer in a shared_ptr. + /// @param input_ring_buffer weak_ptr of a shared_ptr of the sink ring buffer to transfer ownership + /// @return ESP_OK if successsful, ESP_ERR_NO_MEM if the transfer buffer wasn't allocated + esp_err_t add_source(std::weak_ptr &input_ring_buffer); + + /// @brief Adds a sink ring buffer for resampled audio. Takes ownership of the ring buffer in a shared_ptr. + /// @param output_ring_buffer weak_ptr of a shared_ptr of the sink ring buffer to transfer ownership + /// @return ESP_OK if successsful, ESP_ERR_NO_MEM if the transfer buffer wasn't allocated + esp_err_t add_sink(std::weak_ptr &output_ring_buffer); + +#ifdef USE_SPEAKER + /// @brief Adds a sink speaker for decoded audio. + /// @param speaker pointer to speaker component + /// @return ESP_OK if successsful, ESP_ERR_NO_MEM if the transfer buffer wasn't allocated + esp_err_t add_sink(speaker::Speaker *speaker); +#endif + + /// @brief Sets up the class to resample. + /// @param input_stream_info The incoming sample rate, bits per sample, and number of channels + /// @param output_stream_info The desired outgoing sample rate, bits per sample, and number of channels + /// @param number_of_taps Number of taps per FIR filter + /// @param number_of_filters Number of FIR filters + /// @return ESP_OK if it is able to convert the incoming stream, + /// ESP_ERR_NO_MEM if the transfer buffers failed to allocate, + /// ESP_ERR_NOT_SUPPORTED if the stream can't be converted. + esp_err_t start(AudioStreamInfo &input_stream_info, AudioStreamInfo &output_stream_info, uint16_t number_of_taps, + uint16_t number_of_filters); + + /// @brief Resamples audio from the ring buffer source and writes to the sink. + /// @param stop_gracefully If true, it indicates the file decoder is finished. The resampler will resample all the + /// remaining audio and then finish. + /// @param ms_differential Pointer to a (int32_t) variable that will store the difference, in milliseconds, between + /// the duration of input audio used and the duration of output audio generated. + /// @return AudioResamplerState + AudioResamplerState resample(bool stop_gracefully, int32_t *ms_differential); + + /// @brief Pauses sending resampled audio to the sink. If paused, it will continue to process internal buffers. + /// @param pause_state If true, audio data is not sent to the sink. + void set_pause_output_state(bool pause_state) { this->pause_output_ = pause_state; } + + protected: + std::unique_ptr input_transfer_buffer_; + std::unique_ptr output_transfer_buffer_; + + size_t input_buffer_size_; + size_t output_buffer_size_; + + uint32_t accumulated_frames_used_{0}; + uint32_t accumulated_frames_generated_{0}; + + bool pause_output_{false}; + + AudioStreamInfo input_stream_info_; + AudioStreamInfo output_stream_info_; + + std::unique_ptr resampler_; +}; + +} // namespace audio +} // namespace esphome + +#endif diff --git a/esphome/components/audio/audio_transfer_buffer.cpp b/esphome/components/audio/audio_transfer_buffer.cpp new file mode 100644 index 0000000000..9b6067aac4 --- /dev/null +++ b/esphome/components/audio/audio_transfer_buffer.cpp @@ -0,0 +1,165 @@ +#include "audio_transfer_buffer.h" + +#ifdef USE_ESP32 + +#include "esphome/core/helpers.h" + +namespace esphome { +namespace audio { + +AudioTransferBuffer::~AudioTransferBuffer() { this->deallocate_buffer_(); }; + +std::unique_ptr AudioSinkTransferBuffer::create(size_t buffer_size) { + std::unique_ptr sink_buffer = make_unique(); + + if (!sink_buffer->allocate_buffer_(buffer_size)) { + return nullptr; + } + + return sink_buffer; +} + +std::unique_ptr AudioSourceTransferBuffer::create(size_t buffer_size) { + std::unique_ptr source_buffer = make_unique(); + + if (!source_buffer->allocate_buffer_(buffer_size)) { + return nullptr; + } + + return source_buffer; +} + +size_t AudioTransferBuffer::free() const { + if (this->buffer_size_ == 0) { + return 0; + } + return this->buffer_size_ - (this->buffer_length_ - (this->data_start_ - this->buffer_)); +} + +void AudioTransferBuffer::decrease_buffer_length(size_t bytes) { + this->buffer_length_ -= bytes; + this->data_start_ += bytes; +} + +void AudioTransferBuffer::increase_buffer_length(size_t bytes) { this->buffer_length_ += bytes; } + +void AudioTransferBuffer::clear_buffered_data() { + this->buffer_length_ = 0; + if (this->ring_buffer_.use_count() > 0) { + this->ring_buffer_->reset(); + } +} + +void AudioSinkTransferBuffer::clear_buffered_data() { + this->buffer_length_ = 0; + if (this->ring_buffer_.use_count() > 0) { + this->ring_buffer_->reset(); + } +#ifdef USE_SPEAKER + if (this->speaker_ != nullptr) { + this->speaker_->stop(); + } +#endif +} + +bool AudioTransferBuffer::has_buffered_data() const { + if (this->ring_buffer_.use_count() > 0) { + return ((this->ring_buffer_->available() > 0) || (this->available() > 0)); + } + return (this->available() > 0); +} + +bool AudioTransferBuffer::reallocate(size_t new_buffer_size) { + if (this->buffer_length_ > 0) { + // Already has data in the buffer, fail + return false; + } + this->deallocate_buffer_(); + return this->allocate_buffer_(new_buffer_size); +} + +bool AudioTransferBuffer::allocate_buffer_(size_t buffer_size) { + this->buffer_size_ = buffer_size; + + RAMAllocator allocator(ExternalRAMAllocator::ALLOW_FAILURE); + + this->buffer_ = allocator.allocate(this->buffer_size_); + if (this->buffer_ == nullptr) { + return false; + } + + this->data_start_ = this->buffer_; + this->buffer_length_ = 0; + + return true; +} + +void AudioTransferBuffer::deallocate_buffer_() { + if (this->buffer_ != nullptr) { + RAMAllocator allocator(ExternalRAMAllocator::ALLOW_FAILURE); + allocator.deallocate(this->buffer_, this->buffer_size_); + this->buffer_ = nullptr; + this->data_start_ = nullptr; + } + + this->buffer_size_ = 0; + this->buffer_length_ = 0; +} + +size_t AudioSourceTransferBuffer::transfer_data_from_source(TickType_t ticks_to_wait) { + // Shift data in buffer to start + if (this->buffer_length_ > 0) { + memmove(this->buffer_, this->data_start_, this->buffer_length_); + } + this->data_start_ = this->buffer_; + + size_t bytes_to_read = this->free(); + size_t bytes_read = 0; + if (bytes_to_read > 0) { + if (this->ring_buffer_.use_count() > 0) { + bytes_read = this->ring_buffer_->read((void *) this->get_buffer_end(), bytes_to_read, ticks_to_wait); + } + + this->increase_buffer_length(bytes_read); + } + return bytes_read; +} + +size_t AudioSinkTransferBuffer::transfer_data_to_sink(TickType_t ticks_to_wait) { + size_t bytes_written = 0; + if (this->available()) { +#ifdef USE_SPEAKER + if (this->speaker_ != nullptr) { + bytes_written = this->speaker_->play(this->data_start_, this->available(), ticks_to_wait); + } else +#endif + if (this->ring_buffer_.use_count() > 0) { + bytes_written = + this->ring_buffer_->write_without_replacement((void *) this->data_start_, this->available(), ticks_to_wait); + } + + this->decrease_buffer_length(bytes_written); + + // Shift unwritten data to the start of the buffer + memmove(this->buffer_, this->data_start_, this->buffer_length_); + this->data_start_ = this->buffer_; + } + return bytes_written; +} + +bool AudioSinkTransferBuffer::has_buffered_data() const { +#ifdef USE_SPEAKER + if (this->speaker_ != nullptr) { + return (this->speaker_->has_buffered_data() || (this->available() > 0)); + } +#endif + if (this->ring_buffer_.use_count() > 0) { + return ((this->ring_buffer_->available() > 0) || (this->available() > 0)); + } + return (this->available() > 0); +} + +} // namespace audio +} // namespace esphome + +#endif diff --git a/esphome/components/audio/audio_transfer_buffer.h b/esphome/components/audio/audio_transfer_buffer.h new file mode 100644 index 0000000000..4e461db56d --- /dev/null +++ b/esphome/components/audio/audio_transfer_buffer.h @@ -0,0 +1,139 @@ +#pragma once + +#ifdef USE_ESP32 +#include "esphome/core/defines.h" +#include "esphome/core/ring_buffer.h" + +#ifdef USE_SPEAKER +#include "esphome/components/speaker/speaker.h" +#endif + +#include "esp_err.h" + +#include + +namespace esphome { +namespace audio { + +class AudioTransferBuffer { + /* + * @brief Class that facilitates tranferring data between a buffer and an audio source or sink. + * The transfer buffer is a typical C array that temporarily holds data for processing in other audio components. + * Both sink and source transfer buffers can use a ring buffer as the sink/source. + * - The ring buffer is stored in a shared_ptr, so destroying the transfer buffer object will release ownership. + */ + public: + /// @brief Destructor that deallocates the transfer buffer + ~AudioTransferBuffer(); + + /// @brief Returns a pointer to the start of the transfer buffer where available() bytes of exisiting data can be read + uint8_t *get_buffer_start() const { return this->data_start_; } + + /// @brief Returns a pointer to the end of the transfer buffer where free() bytes of new data can be written + uint8_t *get_buffer_end() const { return this->data_start_ + this->buffer_length_; } + + /// @brief Updates the internal state of the transfer buffer. This should be called after reading data + /// @param bytes The number of bytes consumed/read + void decrease_buffer_length(size_t bytes); + + /// @brief Updates the internal state of the transfer buffer. This should be called after writing data + /// @param bytes The number of bytes written + void increase_buffer_length(size_t bytes); + + /// @brief Returns the transfer buffer's currently available bytes to read + size_t available() const { return this->buffer_length_; } + + /// @brief Returns the transfer buffers allocated bytes + size_t capacity() const { return this->buffer_size_; } + + /// @brief Returns the transfer buffer's currrently free bytes available to write + size_t free() const; + + /// @brief Clears data in the transfer buffer and, if possible, the source/sink. + virtual void clear_buffered_data(); + + /// @brief Tests if there is any data in the tranfer buffer or the source/sink. + /// @return True if there is data, false otherwise. + virtual bool has_buffered_data() const; + + bool reallocate(size_t new_buffer_size); + + protected: + /// @brief Allocates the transfer buffer in external memory, if available. + /// @return True is successful, false otherwise. + bool allocate_buffer_(size_t buffer_size); + + /// @brief Deallocates the buffer and resets the class variables. + void deallocate_buffer_(); + + // A possible source or sink for the transfer buffer + std::shared_ptr ring_buffer_; + + uint8_t *buffer_{nullptr}; + uint8_t *data_start_{nullptr}; + + size_t buffer_size_{0}; + size_t buffer_length_{0}; +}; + +class AudioSinkTransferBuffer : public AudioTransferBuffer { + /* + * @brief A class that implements a transfer buffer for audio sinks. + * Supports writing processed data in the transfer buffer to a ring buffer or a speaker component. + */ + public: + /// @brief Creates a new sink transfer buffer. + /// @param buffer_size Size of the transfer buffer in bytes. + /// @return unique_ptr if successfully allocated, nullptr otherwise + static std::unique_ptr create(size_t buffer_size); + + /// @brief Writes any available data in the transfer buffer to the sink. + /// @param ticks_to_wait FreeRTOS ticks to block while waiting for the sink to have enough space + /// @return Number of bytes written + size_t transfer_data_to_sink(TickType_t ticks_to_wait); + + /// @brief Adds a ring buffer as the transfer buffer's sink. + /// @param ring_buffer weak_ptr to the allocated ring buffer + void set_sink(const std::weak_ptr &ring_buffer) { this->ring_buffer_ = ring_buffer.lock(); } + +#ifdef USE_SPEAKER + /// @brief Adds a speaker as the transfer buffer's sink. + /// @param speaker Pointer to the speaker component + void set_sink(speaker::Speaker *speaker) { this->speaker_ = speaker; } +#endif + + void clear_buffered_data() override; + + bool has_buffered_data() const override; + + protected: +#ifdef USE_SPEAKER + speaker::Speaker *speaker_{nullptr}; +#endif +}; + +class AudioSourceTransferBuffer : public AudioTransferBuffer { + /* + * @brief A class that implements a transfer buffer for audio sources. + * Supports reading audio data from a ring buffer into the transfer buffer for processing. + */ + public: + /// @brief Creates a new source transfer buffer. + /// @param buffer_size Size of the transfer buffer in bytes. + /// @return unique_ptr if successfully allocated, nullptr otherwise + static std::unique_ptr create(size_t buffer_size); + + /// @brief Reads any available data from the sink into the transfer buffer. + /// @param ticks_to_wait FreeRTOS ticks to block while waiting for the source to have enough data + /// @return Number of bytes read + size_t transfer_data_from_source(TickType_t ticks_to_wait); + + /// @brief Adds a ring buffer as the transfer buffer's source. + /// @param ring_buffer weak_ptr to the allocated ring buffer + void set_source(const std::weak_ptr &ring_buffer) { this->ring_buffer_ = ring_buffer.lock(); }; +}; + +} // namespace audio +} // namespace esphome + +#endif diff --git a/esphome/components/ch422g/ch422g.h b/esphome/components/ch422g/ch422g.h index 30780e09ad..1193a3db27 100644 --- a/esphome/components/ch422g/ch422g.h +++ b/esphome/components/ch422g/ch422g.h @@ -57,6 +57,8 @@ class CH422GGPIOPin : public GPIOPin { void set_inverted(bool inverted) { inverted_ = inverted; } void set_flags(gpio::Flags flags); + gpio::Flags get_flags() const override { return this->flags_; } + protected: CH422GComponent *parent_{}; uint8_t pin_{}; diff --git a/esphome/components/esp32/gpio.h b/esphome/components/esp32/gpio.h index 23b723e0b4..d69ac1c493 100644 --- a/esphome/components/esp32/gpio.h +++ b/esphome/components/esp32/gpio.h @@ -13,6 +13,7 @@ class ESP32InternalGPIOPin : public InternalGPIOPin { void set_inverted(bool inverted) { inverted_ = inverted; } void set_drive_strength(gpio_drive_cap_t drive_strength) { drive_strength_ = drive_strength; } void set_flags(gpio::Flags flags) { flags_ = flags; } + void setup() override; void pin_mode(gpio::Flags flags) override; bool digital_read() override; @@ -21,6 +22,7 @@ class ESP32InternalGPIOPin : public InternalGPIOPin { void detach_interrupt() const override; ISRInternalGPIOPin to_isr() const override; uint8_t get_pin() const override { return (uint8_t) pin_; } + gpio::Flags get_flags() const override { return flags_; } bool is_inverted() const override { return inverted_; } protected: diff --git a/esphome/components/esp8266/gpio.h b/esphome/components/esp8266/gpio.h index 0474d0baa6..dd6407885e 100644 --- a/esphome/components/esp8266/gpio.h +++ b/esphome/components/esp8266/gpio.h @@ -22,6 +22,7 @@ class ESP8266GPIOPin : public InternalGPIOPin { void detach_interrupt() const override; ISRInternalGPIOPin to_isr() const override; uint8_t get_pin() const override { return pin_; } + gpio::Flags get_flags() const override { return flags_; } bool is_inverted() const override { return inverted_; } protected: diff --git a/esphome/components/host/gpio.h b/esphome/components/host/gpio.h index c0920467d6..a60d535912 100644 --- a/esphome/components/host/gpio.h +++ b/esphome/components/host/gpio.h @@ -21,6 +21,7 @@ class HostGPIOPin : public InternalGPIOPin { void detach_interrupt() const override; ISRInternalGPIOPin to_isr() const override; uint8_t get_pin() const override { return pin_; } + gpio::Flags get_flags() const override { return flags_; } bool is_inverted() const override { return inverted_; } protected: diff --git a/esphome/components/i2c/i2c_bus_esp_idf.cpp b/esphome/components/i2c/i2c_bus_esp_idf.cpp index ac3a754024..c7bba70582 100644 --- a/esphome/components/i2c/i2c_bus_esp_idf.cpp +++ b/esphome/components/i2c/i2c_bus_esp_idf.cpp @@ -39,6 +39,10 @@ void IDFI2CBus::setup() { conf.scl_io_num = scl_pin_; conf.scl_pullup_en = scl_pullup_enabled_; conf.master.clk_speed = frequency_; +#ifdef USE_ESP32_VARIANT_ESP32S2 + // workaround for https://github.com/esphome/issues/issues/6718 + conf.clk_flags = I2C_SCLK_SRC_FLAG_AWARE_DFS; +#endif esp_err_t err = i2c_param_config(port_, &conf); if (err != ESP_OK) { ESP_LOGW(TAG, "i2c_param_config failed: %s", esp_err_to_name(err)); diff --git a/esphome/components/i2s_audio/speaker/__init__.py b/esphome/components/i2s_audio/speaker/__init__.py index 0355c16321..aa3b50d336 100644 --- a/esphome/components/i2s_audio/speaker/__init__.py +++ b/esphome/components/i2s_audio/speaker/__init__.py @@ -1,13 +1,25 @@ from esphome import pins import esphome.codegen as cg -from esphome.components import esp32, speaker +from esphome.components import audio, esp32, speaker import esphome.config_validation as cv -from esphome.const import CONF_CHANNEL, CONF_ID, CONF_MODE, CONF_TIMEOUT +from esphome.const import ( + CONF_BITS_PER_SAMPLE, + CONF_BUFFER_DURATION, + CONF_CHANNEL, + CONF_ID, + CONF_MODE, + CONF_NEVER, + CONF_NUM_CHANNELS, + CONF_SAMPLE_RATE, + CONF_TIMEOUT, +) from .. import ( CONF_I2S_DOUT_PIN, + CONF_I2S_MODE, CONF_LEFT, CONF_MONO, + CONF_PRIMARY, CONF_RIGHT, CONF_STEREO, I2SAudioOut, @@ -24,10 +36,8 @@ I2SAudioSpeaker = i2s_audio_ns.class_( "I2SAudioSpeaker", cg.Component, speaker.Speaker, I2SAudioOut ) -CONF_BUFFER_DURATION = "buffer_duration" CONF_DAC_TYPE = "dac_type" CONF_I2S_COMM_FMT = "i2s_comm_fmt" -CONF_NEVER = "never" i2s_dac_mode_t = cg.global_ns.enum("i2s_dac_mode_t") INTERNAL_DAC_OPTIONS = { @@ -53,7 +63,41 @@ I2C_COMM_FMT_OPTIONS = { NO_INTERNAL_DAC_VARIANTS = [esp32.const.VARIANT_ESP32S2] -def validate_esp32_variant(config): +def _set_num_channels_from_config(config): + if config[CONF_CHANNEL] in (CONF_MONO, CONF_LEFT, CONF_RIGHT): + config[CONF_NUM_CHANNELS] = 1 + else: + config[CONF_NUM_CHANNELS] = 2 + + return config + + +def _set_stream_limits(config): + if config[CONF_I2S_MODE] == CONF_PRIMARY: + # Primary mode has modifiable stream settings + audio.set_stream_limits( + min_bits_per_sample=8, + max_bits_per_sample=32, + min_channels=1, + max_channels=2, + min_sample_rate=16000, + max_sample_rate=48000, + )(config) + else: + # Secondary mode has unmodifiable max bits per sample and min/max sample rates + audio.set_stream_limits( + min_bits_per_sample=8, + max_bits_per_sample=config.get(CONF_BITS_PER_SAMPLE), + min_channels=1, + max_channels=2, + min_sample_rate=config.get(CONF_SAMPLE_RATE), + max_sample_rate=config.get(CONF_SAMPLE_RATE), + ) + + return config + + +def _validate_esp32_variant(config): if config[CONF_DAC_TYPE] != "internal": return config variant = esp32.get_esp32_variant() @@ -85,6 +129,7 @@ BASE_SCHEMA = ( .extend(cv.COMPONENT_SCHEMA) ) + CONFIG_SCHEMA = cv.All( cv.typed_schema( { @@ -106,7 +151,9 @@ CONFIG_SCHEMA = cv.All( }, key=CONF_DAC_TYPE, ), - validate_esp32_variant, + _validate_esp32_variant, + _set_num_channels_from_config, + _set_stream_limits, ) diff --git a/esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp b/esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp index 46f1b00d05..2a3fa9f5f3 100644 --- a/esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +++ b/esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp @@ -148,9 +148,11 @@ void I2SAudioSpeaker::loop() { this->status_set_error("Failed to adjust I2S bus to match the incoming audio"); ESP_LOGE(TAG, "Incompatible audio format: sample rate = %" PRIu32 ", channels = %" PRIu8 ", bits per sample = %" PRIu8, - this->audio_stream_info_.sample_rate, this->audio_stream_info_.channels, - this->audio_stream_info_.bits_per_sample); + this->audio_stream_info_.get_sample_rate(), this->audio_stream_info_.get_channels(), + this->audio_stream_info_.get_bits_per_sample()); } + + xEventGroupClearBits(this->event_group_, ALL_ERR_ESP_BITS); } void I2SAudioSpeaker::set_volume(float volume) { @@ -201,6 +203,12 @@ size_t I2SAudioSpeaker::play(const uint8_t *data, size_t length, TickType_t tick this->start(); } + if ((this->state_ != speaker::STATE_RUNNING) || (this->audio_ring_buffer_.use_count() == 1)) { + // Unable to write data to a running speaker, so delay the max amount of time so it can get ready + vTaskDelay(ticks_to_wait); + ticks_to_wait = 0; + } + size_t bytes_written = 0; if ((this->state_ == speaker::STATE_RUNNING) && (this->audio_ring_buffer_.use_count() == 1)) { // Only one owner of the ring buffer (the speaker task), so the ring buffer is allocated and no other components are @@ -223,6 +231,8 @@ bool I2SAudioSpeaker::has_buffered_data() const { void I2SAudioSpeaker::speaker_task(void *params) { I2SAudioSpeaker *this_speaker = (I2SAudioSpeaker *) params; + this_speaker->task_created_ = true; + uint32_t event_group_bits = xEventGroupWaitBits(this_speaker->event_group_, SpeakerEventGroupBits::COMMAND_START | SpeakerEventGroupBits::COMMAND_STOP | @@ -240,19 +250,20 @@ void I2SAudioSpeaker::speaker_task(void *params) { audio::AudioStreamInfo audio_stream_info = this_speaker->audio_stream_info_; - const uint32_t bytes_per_ms = - audio_stream_info.channels * audio_stream_info.get_bytes_per_sample() * audio_stream_info.sample_rate / 1000; + const uint32_t dma_buffers_duration_ms = DMA_BUFFER_DURATION_MS * DMA_BUFFERS_COUNT; + // Ensure ring buffer duration is at least the duration of all DMA buffers + const uint32_t ring_buffer_duration = std::max(dma_buffers_duration_ms, this_speaker->buffer_duration_ms_); - const size_t dma_buffers_size = DMA_BUFFERS_COUNT * DMA_BUFFER_DURATION_MS * bytes_per_ms; + // The DMA buffers may have more bits per sample, so calculate buffer sizes based in the input audio stream info + const size_t data_buffer_size = audio_stream_info.ms_to_bytes(dma_buffers_duration_ms); + const size_t ring_buffer_size = audio_stream_info.ms_to_bytes(ring_buffer_duration); - // Ensure ring buffer is at least as large as the total size of the DMA buffers - const size_t ring_buffer_size = - std::max((uint32_t) dma_buffers_size, this_speaker->buffer_duration_ms_ * bytes_per_ms); + const size_t single_dma_buffer_input_size = data_buffer_size / DMA_BUFFERS_COUNT; - if (this_speaker->send_esp_err_to_event_group_(this_speaker->allocate_buffers_(dma_buffers_size, ring_buffer_size))) { + if (this_speaker->send_esp_err_to_event_group_(this_speaker->allocate_buffers_(data_buffer_size, ring_buffer_size))) { // Failed to allocate buffers xEventGroupSetBits(this_speaker->event_group_, SpeakerEventGroupBits::ERR_ESP_NO_MEM); - this_speaker->delete_task_(dma_buffers_size); + this_speaker->delete_task_(data_buffer_size); } if (!this_speaker->send_esp_err_to_event_group_(this_speaker->start_i2s_driver_(audio_stream_info))) { @@ -262,20 +273,25 @@ void I2SAudioSpeaker::speaker_task(void *params) { uint32_t last_data_received_time = millis(); bool tx_dma_underflow = false; - while (!this_speaker->timeout_.has_value() || + this_speaker->accumulated_frames_written_ = 0; + + // Keep looping if paused, there is no timeout configured, or data was received more recently than the configured + // timeout + while (this_speaker->pause_state_ || !this_speaker->timeout_.has_value() || (millis() - last_data_received_time) <= this_speaker->timeout_.value()) { event_group_bits = xEventGroupGetBits(this_speaker->event_group_); if (event_group_bits & SpeakerEventGroupBits::COMMAND_STOP) { + xEventGroupClearBits(this_speaker->event_group_, SpeakerEventGroupBits::COMMAND_STOP); break; } if (event_group_bits & SpeakerEventGroupBits::COMMAND_STOP_GRACEFULLY) { + xEventGroupClearBits(this_speaker->event_group_, SpeakerEventGroupBits::COMMAND_STOP_GRACEFULLY); stop_gracefully = true; } if (this_speaker->audio_stream_info_ != audio_stream_info) { - // Audio stream info has changed, stop the speaker task so it will restart with the proper settings. - + // Audio stream info changed, stop the speaker task so it will restart with the proper settings. break; } @@ -286,33 +302,64 @@ void I2SAudioSpeaker::speaker_task(void *params) { } } - size_t bytes_to_read = dma_buffers_size; - size_t bytes_read = this_speaker->audio_ring_buffer_->read((void *) this_speaker->data_buffer_, bytes_to_read, + if (this_speaker->pause_state_) { + // Pause state is accessed atomically, so thread safe + // Delay so the task can yields, then skip transferring audio data + delay(TASK_DELAY_MS); + continue; + } + + size_t bytes_read = this_speaker->audio_ring_buffer_->read((void *) this_speaker->data_buffer_, data_buffer_size, pdMS_TO_TICKS(TASK_DELAY_MS)); if (bytes_read > 0) { - size_t bytes_written = 0; - - if ((audio_stream_info.bits_per_sample == 16) && (this_speaker->q15_volume_factor_ < INT16_MAX)) { + if ((audio_stream_info.get_bits_per_sample() == 16) && (this_speaker->q15_volume_factor_ < INT16_MAX)) { // Scale samples by the volume factor in place q15_multiplication((int16_t *) this_speaker->data_buffer_, (int16_t *) this_speaker->data_buffer_, bytes_read / sizeof(int16_t), this_speaker->q15_volume_factor_); } - if (audio_stream_info.bits_per_sample == (uint8_t) this_speaker->bits_per_sample_) { - i2s_write(this_speaker->parent_->get_port(), this_speaker->data_buffer_, bytes_read, &bytes_written, - portMAX_DELAY); - } else if (audio_stream_info.bits_per_sample < (uint8_t) this_speaker->bits_per_sample_) { - i2s_write_expand(this_speaker->parent_->get_port(), this_speaker->data_buffer_, bytes_read, - audio_stream_info.bits_per_sample, this_speaker->bits_per_sample_, &bytes_written, - portMAX_DELAY); - } + // Write the audio data to a single DMA buffer at a time to reduce latency for the audio duration played + // callback. + const uint32_t batches = (bytes_read + single_dma_buffer_input_size - 1) / single_dma_buffer_input_size; - if (bytes_written != bytes_read) { - xEventGroupSetBits(this_speaker->event_group_, SpeakerEventGroupBits::ERR_ESP_INVALID_SIZE); + for (uint32_t i = 0; i < batches; ++i) { + size_t bytes_written = 0; + size_t bytes_to_write = std::min(single_dma_buffer_input_size, bytes_read); + + if (audio_stream_info.get_bits_per_sample() == (uint8_t) this_speaker->bits_per_sample_) { + i2s_write(this_speaker->parent_->get_port(), this_speaker->data_buffer_ + i * single_dma_buffer_input_size, + bytes_to_write, &bytes_written, pdMS_TO_TICKS(DMA_BUFFER_DURATION_MS * 5)); + } else if (audio_stream_info.get_bits_per_sample() < (uint8_t) this_speaker->bits_per_sample_) { + i2s_write_expand(this_speaker->parent_->get_port(), + this_speaker->data_buffer_ + i * single_dma_buffer_input_size, bytes_to_write, + audio_stream_info.get_bits_per_sample(), this_speaker->bits_per_sample_, &bytes_written, + pdMS_TO_TICKS(DMA_BUFFER_DURATION_MS * 5)); + } + + uint32_t write_timestamp = micros(); + + if (bytes_written != bytes_to_write) { + xEventGroupSetBits(this_speaker->event_group_, SpeakerEventGroupBits::ERR_ESP_INVALID_SIZE); + } + + bytes_read -= bytes_written; + + this_speaker->accumulated_frames_written_ += audio_stream_info.bytes_to_frames(bytes_written); + const uint32_t new_playback_ms = + audio_stream_info.frames_to_milliseconds_with_remainder(&this_speaker->accumulated_frames_written_); + const uint32_t remainder_us = + audio_stream_info.frames_to_microseconds(this_speaker->accumulated_frames_written_); + + uint32_t pending_frames = + audio_stream_info.bytes_to_frames(bytes_read + this_speaker->audio_ring_buffer_->available()); + const uint32_t pending_ms = audio_stream_info.frames_to_milliseconds_with_remainder(&pending_frames); + + this_speaker->audio_output_callback_(new_playback_ms, remainder_us, pending_ms, write_timestamp); + + tx_dma_underflow = false; + last_data_received_time = millis(); } - tx_dma_underflow = false; - last_data_received_time = millis(); } else { // No data received if (stop_gracefully && tx_dma_underflow) { @@ -328,7 +375,7 @@ void I2SAudioSpeaker::speaker_task(void *params) { this_speaker->parent_->unlock(); } - this_speaker->delete_task_(dma_buffers_size); + this_speaker->delete_task_(data_buffer_size); } void I2SAudioSpeaker::start() { @@ -337,16 +384,15 @@ void I2SAudioSpeaker::start() { if ((this->state_ == speaker::STATE_STARTING) || (this->state_ == speaker::STATE_RUNNING)) return; - if (this->speaker_task_handle_ == nullptr) { + if (!this->task_created_ && (this->speaker_task_handle_ == nullptr)) { xTaskCreate(I2SAudioSpeaker::speaker_task, "speaker_task", TASK_STACK_SIZE, (void *) this, TASK_PRIORITY, &this->speaker_task_handle_); - } - if (this->speaker_task_handle_ != nullptr) { - xEventGroupSetBits(this->event_group_, SpeakerEventGroupBits::COMMAND_START); - this->task_created_ = true; - } else { - xEventGroupSetBits(this->event_group_, SpeakerEventGroupBits::ERR_TASK_FAILED_TO_START); + if (this->speaker_task_handle_ != nullptr) { + xEventGroupSetBits(this->event_group_, SpeakerEventGroupBits::COMMAND_START); + } else { + xEventGroupSetBits(this->event_group_, SpeakerEventGroupBits::ERR_TASK_FAILED_TO_START); + } } } @@ -416,12 +462,12 @@ esp_err_t I2SAudioSpeaker::allocate_buffers_(size_t data_buffer_size, size_t rin } esp_err_t I2SAudioSpeaker::start_i2s_driver_(audio::AudioStreamInfo &audio_stream_info) { - if ((this->i2s_mode_ & I2S_MODE_SLAVE) && (this->sample_rate_ != audio_stream_info.sample_rate)) { // NOLINT - // Can't reconfigure I2S bus, so the sample rate must match the configured value + if ((this->i2s_mode_ & I2S_MODE_SLAVE) && (this->sample_rate_ != audio_stream_info.get_sample_rate())) { // NOLINT + // Can't reconfigure I2S bus, so the sample rate must match the configured value return ESP_ERR_NOT_SUPPORTED; } - if ((i2s_bits_per_sample_t) audio_stream_info.bits_per_sample > this->bits_per_sample_) { + if ((i2s_bits_per_sample_t) audio_stream_info.get_bits_per_sample() > this->bits_per_sample_) { // Currently can't handle the case when the incoming audio has more bits per sample than the configured value return ESP_ERR_NOT_SUPPORTED; } @@ -432,21 +478,21 @@ esp_err_t I2SAudioSpeaker::start_i2s_driver_(audio::AudioStreamInfo &audio_strea i2s_channel_fmt_t channel = this->channel_; - if (audio_stream_info.channels == 1) { + if (audio_stream_info.get_channels() == 1) { if (this->channel_ == I2S_CHANNEL_FMT_ONLY_LEFT) { channel = I2S_CHANNEL_FMT_ONLY_LEFT; } else { channel = I2S_CHANNEL_FMT_ONLY_RIGHT; } - } else if (audio_stream_info.channels == 2) { + } else if (audio_stream_info.get_channels() == 2) { channel = I2S_CHANNEL_FMT_RIGHT_LEFT; } - int dma_buffer_length = DMA_BUFFER_DURATION_MS * this->sample_rate_ / 1000; + int dma_buffer_length = audio_stream_info.ms_to_frames(DMA_BUFFER_DURATION_MS); i2s_driver_config_t config = { .mode = (i2s_mode_t) (this->i2s_mode_ | I2S_MODE_TX), - .sample_rate = audio_stream_info.sample_rate, + .sample_rate = audio_stream_info.get_sample_rate(), .bits_per_sample = this->bits_per_sample_, .channel_format = channel, .communication_format = this->i2s_comm_fmt_, @@ -504,7 +550,7 @@ esp_err_t I2SAudioSpeaker::start_i2s_driver_(audio::AudioStreamInfo &audio_strea } void I2SAudioSpeaker::delete_task_(size_t buffer_size) { - this->audio_ring_buffer_.reset(); // Releases onwership of the shared_ptr + this->audio_ring_buffer_.reset(); // Releases ownership of the shared_ptr if (this->data_buffer_ != nullptr) { ExternalRAMAllocator allocator(ExternalRAMAllocator::ALLOW_FAILURE); diff --git a/esphome/components/i2s_audio/speaker/i2s_audio_speaker.h b/esphome/components/i2s_audio/speaker/i2s_audio_speaker.h index d706deb0f4..7b14a57aac 100644 --- a/esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +++ b/esphome/components/i2s_audio/speaker/i2s_audio_speaker.h @@ -40,6 +40,9 @@ class I2SAudioSpeaker : public I2SAudioOut, public speaker::Speaker, public Comp void stop() override; void finish() override; + void set_pause_state(bool pause_state) override { this->pause_state_ = pause_state; } + bool get_pause_state() const override { return this->pause_state_; } + /// @brief Plays the provided audio data. /// Starts the speaker task, if necessary. Writes the audio data to the ring buffer. /// @param data Audio data in the format set by the parent speaker classes ``set_audio_stream_info`` method. @@ -121,13 +124,18 @@ class I2SAudioSpeaker : public I2SAudioOut, public speaker::Speaker, public Comp uint8_t dout_pin_; bool task_created_{false}; + bool pause_state_{false}; int16_t q15_volume_factor_{INT16_MAX}; + size_t bytes_written_{0}; + #if SOC_I2S_SUPPORTS_DAC i2s_dac_mode_t internal_dac_mode_{I2S_DAC_CHANNEL_DISABLE}; #endif i2s_comm_format_t i2s_comm_fmt_; + + uint32_t accumulated_frames_written_{0}; }; } // namespace i2s_audio diff --git a/esphome/components/libretiny/gpio_arduino.h b/esphome/components/libretiny/gpio_arduino.h index a43ed28c5e..9adc425a41 100644 --- a/esphome/components/libretiny/gpio_arduino.h +++ b/esphome/components/libretiny/gpio_arduino.h @@ -20,6 +20,7 @@ class ArduinoInternalGPIOPin : public InternalGPIOPin { void detach_interrupt() const override; ISRInternalGPIOPin to_isr() const override; uint8_t get_pin() const override { return pin_; } + gpio::Flags get_flags() const override { return flags_; } bool is_inverted() const override { return inverted_; } protected: diff --git a/esphome/components/lvgl/__init__.py b/esphome/components/lvgl/__init__.py index c64ffcb5f2..07f5d94543 100644 --- a/esphome/components/lvgl/__init__.py +++ b/esphome/components/lvgl/__init__.py @@ -61,7 +61,14 @@ from .types import ( lv_style_t, lvgl_ns, ) -from .widgets import Widget, add_widgets, get_scr_act, set_obj_properties, styles_used +from .widgets import ( + LvScrActType, + Widget, + add_widgets, + get_scr_act, + set_obj_properties, + styles_used, +) from .widgets.animimg import animimg_spec from .widgets.arc import arc_spec from .widgets.button import button_spec @@ -318,7 +325,7 @@ async def to_code(configs): config[df.CONF_RESUME_ON_INPUT], ) await cg.register_component(lv_component, config) - Widget.create(config[CONF_ID], lv_component, obj_spec, config) + Widget.create(config[CONF_ID], lv_component, LvScrActType(), config) lv_scr_act = get_scr_act(lv_component) async with LvContext(): @@ -391,7 +398,7 @@ FINAL_VALIDATE_SCHEMA = final_validation LVGL_SCHEMA = ( cv.polling_component_schema("1s") - .extend(obj_schema(obj_spec)) + .extend(obj_schema(LvScrActType())) .extend( { cv.GenerateID(CONF_ID): cv.declare_id(LvglComponent), diff --git a/esphome/components/lvgl/defines.py b/esphome/components/lvgl/defines.py index 733a6bc180..119a358e1d 100644 --- a/esphome/components/lvgl/defines.py +++ b/esphome/components/lvgl/defines.py @@ -146,6 +146,8 @@ TYPE_FLEX = "flex" TYPE_GRID = "grid" TYPE_NONE = "none" +DIRECTIONS = LvConstant("LV_DIR_", "LEFT", "RIGHT", "BOTTOM", "TOP") + LV_FONTS = list(f"montserrat_{s}" for s in range(8, 50, 2)) + [ "dejavu_16_persian_hebrew", "simsun_16_cjk", @@ -169,9 +171,13 @@ LV_EVENT_MAP = { "CANCEL": "CANCEL", "ALL_EVENTS": "ALL", "CHANGE": "VALUE_CHANGED", + "GESTURE": "GESTURE", } LV_EVENT_TRIGGERS = tuple(f"on_{x.lower()}" for x in LV_EVENT_MAP) +SWIPE_TRIGGERS = tuple( + f"on_swipe_{x.lower()}" for x in DIRECTIONS.choices + ("up", "down") +) LV_ANIM = LvConstant( @@ -250,7 +256,6 @@ KEYBOARD_MODES = LvConstant( "NUMBER", ) ROLLER_MODES = LvConstant("LV_ROLLER_MODE_", "NORMAL", "INFINITE") -DIRECTIONS = LvConstant("LV_DIR_", "LEFT", "RIGHT", "BOTTOM", "TOP") TILE_DIRECTIONS = DIRECTIONS.extend("HOR", "VER", "ALL") CHILD_ALIGNMENTS = LvConstant( "LV_ALIGN_", diff --git a/esphome/components/lvgl/schemas.py b/esphome/components/lvgl/schemas.py index f0318dd17a..ae50d5b2e1 100644 --- a/esphome/components/lvgl/schemas.py +++ b/esphome/components/lvgl/schemas.py @@ -211,10 +211,9 @@ def part_schema(parts): def automation_schema(typ: LvType): + events = df.LV_EVENT_TRIGGERS + df.SWIPE_TRIGGERS if typ.has_on_value: - events = df.LV_EVENT_TRIGGERS + (CONF_ON_VALUE,) - else: - events = df.LV_EVENT_TRIGGERS + events = events + (CONF_ON_VALUE,) args = typ.get_arg_type() if isinstance(typ, LvType) else [] args.append(lv_event_t_ptr) return { diff --git a/esphome/components/lvgl/trigger.py b/esphome/components/lvgl/trigger.py index fb856df04e..b76f90fecd 100644 --- a/esphome/components/lvgl/trigger.py +++ b/esphome/components/lvgl/trigger.py @@ -7,8 +7,10 @@ from .defines import ( CONF_ALIGN_TO, CONF_X, CONF_Y, + DIRECTIONS, LV_EVENT_MAP, LV_EVENT_TRIGGERS, + SWIPE_TRIGGERS, literal, ) from .lvcode import ( @@ -23,7 +25,7 @@ from .lvcode import ( lvgl_static, ) from .types import LV_EVENT -from .widgets import widget_map +from .widgets import LvScrActType, get_scr_act, widget_map async def generate_triggers(): @@ -33,6 +35,9 @@ async def generate_triggers(): """ for w in widget_map.values(): + if isinstance(w.type, LvScrActType): + w = get_scr_act(w.var) + if w.config: for event, conf in { event: conf @@ -43,6 +48,24 @@ async def generate_triggers(): w.add_flag("LV_OBJ_FLAG_CLICKABLE") event = literal("LV_EVENT_" + LV_EVENT_MAP[event[3:].upper()]) await add_trigger(conf, w, event) + + for event, conf in { + event: conf + for event, conf in w.config.items() + if event in SWIPE_TRIGGERS + }.items(): + conf = conf[0] + dir = event[9:].upper() + dir = {"UP": "TOP", "DOWN": "BOTTOM"}.get(dir, dir) + dir = DIRECTIONS.mapper(dir) + w.clear_flag("LV_OBJ_FLAG_SCROLLABLE") + selected = literal( + f"lv_indev_get_gesture_dir(lv_indev_get_act()) == {dir}" + ) + await add_trigger( + conf, w, literal("LV_EVENT_GESTURE"), is_selected=selected + ) + for conf in w.config.get(CONF_ON_VALUE, ()): await add_trigger( conf, @@ -61,13 +84,14 @@ async def generate_triggers(): lv.obj_align_to(w.obj, target, align, x, y) -async def add_trigger(conf, w, *events): +async def add_trigger(conf, w, *events, is_selected=None): + is_selected = is_selected or w.is_selected() tid = conf[CONF_TRIGGER_ID] trigger = cg.new_Pvariable(tid) args = w.get_args() + [(lv_event_t_ptr, "event")] value = w.get_values() await automation.build_automation(trigger, args, conf) async with LambdaContext(EVENT_ARG, where=tid) as context: - with LvConditional(w.is_selected()): + with LvConditional(is_selected): lv_add(trigger.trigger(*value, literal("event"))) lv_add(lvgl_static.add_event_cb(w.obj, await context.get_lambda(), *events)) diff --git a/esphome/components/max6956/max6956.h b/esphome/components/max6956/max6956.h index 759fa45b07..0a1fd5e4b5 100644 --- a/esphome/components/max6956/max6956.h +++ b/esphome/components/max6956/max6956.h @@ -83,6 +83,8 @@ class MAX6956GPIOPin : public GPIOPin { void set_inverted(bool inverted) { inverted_ = inverted; } void set_flags(gpio::Flags flags) { flags_ = flags; } + gpio::Flags get_flags() const override { return this->flags_; } + protected: MAX6956 *parent_; uint8_t pin_; diff --git a/esphome/components/mcp23016/mcp23016.h b/esphome/components/mcp23016/mcp23016.h index a4890b4120..e4ed47a3b2 100644 --- a/esphome/components/mcp23016/mcp23016.h +++ b/esphome/components/mcp23016/mcp23016.h @@ -61,6 +61,8 @@ class MCP23016GPIOPin : public GPIOPin { void set_inverted(bool inverted) { inverted_ = inverted; } void set_flags(gpio::Flags flags) { flags_ = flags; } + gpio::Flags get_flags() const override { return this->flags_; } + protected: MCP23016 *parent_; uint8_t pin_; diff --git a/esphome/components/mcp23xxx_base/mcp23xxx_base.h b/esphome/components/mcp23xxx_base/mcp23xxx_base.h index a522ea28c5..9686c9fd33 100644 --- a/esphome/components/mcp23xxx_base/mcp23xxx_base.h +++ b/esphome/components/mcp23xxx_base/mcp23xxx_base.h @@ -43,6 +43,8 @@ class MCP23XXXGPIOPin : public GPIOPin { void set_flags(gpio::Flags flags) { flags_ = flags; } void set_interrupt_mode(MCP23XXXInterruptMode interrupt_mode) { interrupt_mode_ = interrupt_mode; } + gpio::Flags get_flags() const override { return this->flags_; } + protected: MCP23XXXBase *parent_; uint8_t pin_; diff --git a/esphome/components/mixer/__init__.py b/esphome/components/mixer/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/esphome/components/mixer/speaker/__init__.py b/esphome/components/mixer/speaker/__init__.py new file mode 100644 index 0000000000..a451f2b7b4 --- /dev/null +++ b/esphome/components/mixer/speaker/__init__.py @@ -0,0 +1,172 @@ +from esphome import automation +import esphome.codegen as cg +from esphome.components import audio, esp32, speaker +import esphome.config_validation as cv +from esphome.const import ( + CONF_BITS_PER_SAMPLE, + CONF_BUFFER_DURATION, + CONF_DURATION, + CONF_ID, + CONF_NEVER, + CONF_NUM_CHANNELS, + CONF_OUTPUT_SPEAKER, + CONF_SAMPLE_RATE, + CONF_TASK_STACK_IN_PSRAM, + CONF_TIMEOUT, + PLATFORM_ESP32, +) +from esphome.core.entity_helpers import inherit_property_from +import esphome.final_validate as fv + +AUTO_LOAD = ["audio"] +CODEOWNERS = ["@kahrendt"] + +mixer_speaker_ns = cg.esphome_ns.namespace("mixer_speaker") +MixerSpeaker = mixer_speaker_ns.class_("MixerSpeaker", cg.Component) +SourceSpeaker = mixer_speaker_ns.class_("SourceSpeaker", cg.Component, speaker.Speaker) + +CONF_DECIBEL_REDUCTION = "decibel_reduction" +CONF_QUEUE_MODE = "queue_mode" +CONF_SOURCE_SPEAKERS = "source_speakers" + +DuckingApplyAction = mixer_speaker_ns.class_( + "DuckingApplyAction", automation.Action, cg.Parented.template(SourceSpeaker) +) + + +SOURCE_SPEAKER_SCHEMA = speaker.SPEAKER_SCHEMA.extend( + { + cv.GenerateID(): cv.declare_id(SourceSpeaker), + cv.Optional( + CONF_BUFFER_DURATION, default="100ms" + ): cv.positive_time_period_milliseconds, + cv.Optional(CONF_TIMEOUT, default="500ms"): cv.Any( + cv.positive_time_period_milliseconds, + cv.one_of(CONF_NEVER, lower=True), + ), + cv.Optional(CONF_BITS_PER_SAMPLE, default=16): cv.int_range(16, 16), + } +) + + +def _set_stream_limits(config): + audio.set_stream_limits( + min_bits_per_sample=16, + max_bits_per_sample=16, + )(config) + + return config + + +def _validate_source_speaker(config): + fconf = fv.full_config.get() + + # Get ID for the output speaker and add it to the source speakrs config to easily inherit properties + path = fconf.get_path_for_id(config[CONF_ID])[:-3] + path.append(CONF_OUTPUT_SPEAKER) + output_speaker_id = fconf.get_config_for_path(path) + config[CONF_OUTPUT_SPEAKER] = output_speaker_id + + inherit_property_from(CONF_NUM_CHANNELS, CONF_OUTPUT_SPEAKER)(config) + inherit_property_from(CONF_SAMPLE_RATE, CONF_OUTPUT_SPEAKER)(config) + + audio.final_validate_audio_schema( + "mixer", + audio_device=CONF_OUTPUT_SPEAKER, + bits_per_sample=config.get(CONF_BITS_PER_SAMPLE), + channels=config.get(CONF_NUM_CHANNELS), + sample_rate=config.get(CONF_SAMPLE_RATE), + )(config) + + return config + + +CONFIG_SCHEMA = cv.All( + cv.Schema( + { + cv.GenerateID(): cv.declare_id(MixerSpeaker), + cv.Required(CONF_OUTPUT_SPEAKER): cv.use_id(speaker.Speaker), + cv.Required(CONF_SOURCE_SPEAKERS): cv.All( + cv.ensure_list(SOURCE_SPEAKER_SCHEMA), + cv.Length(min=2, max=8), + [_set_stream_limits], + ), + cv.Optional(CONF_NUM_CHANNELS): cv.int_range(min=1, max=2), + cv.Optional(CONF_QUEUE_MODE, default=False): cv.boolean, + cv.SplitDefault(CONF_TASK_STACK_IN_PSRAM, esp32_idf=False): cv.All( + cv.boolean, cv.only_with_esp_idf + ), + } + ), + cv.only_on([PLATFORM_ESP32]), +) + +FINAL_VALIDATE_SCHEMA = cv.All( + cv.Schema( + { + cv.Optional(CONF_SOURCE_SPEAKERS): [_validate_source_speaker], + }, + extra=cv.ALLOW_EXTRA, + ), + inherit_property_from(CONF_NUM_CHANNELS, CONF_OUTPUT_SPEAKER), +) + + +async def to_code(config): + var = cg.new_Pvariable(config[CONF_ID]) + await cg.register_component(var, config) + + spkr = await cg.get_variable(config[CONF_OUTPUT_SPEAKER]) + + cg.add(var.set_output_channels(config[CONF_NUM_CHANNELS])) + cg.add(var.set_output_speaker(spkr)) + cg.add(var.set_queue_mode(config[CONF_QUEUE_MODE])) + + if task_stack_in_psram := config.get(CONF_TASK_STACK_IN_PSRAM): + cg.add(var.set_task_stack_in_psram(task_stack_in_psram)) + if task_stack_in_psram: + if config[CONF_TASK_STACK_IN_PSRAM]: + esp32.add_idf_sdkconfig_option( + "CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY", True + ) + + for speaker_config in config[CONF_SOURCE_SPEAKERS]: + source_speaker = cg.new_Pvariable(speaker_config[CONF_ID]) + + cg.add(source_speaker.set_buffer_duration(speaker_config[CONF_BUFFER_DURATION])) + + if speaker_config[CONF_TIMEOUT] != CONF_NEVER: + cg.add(source_speaker.set_timeout(speaker_config[CONF_TIMEOUT])) + + await cg.register_component(source_speaker, speaker_config) + await cg.register_parented(source_speaker, config[CONF_ID]) + await speaker.register_speaker(source_speaker, speaker_config) + + cg.add(var.add_source_speaker(source_speaker)) + + +@automation.register_action( + "mixer_speaker.apply_ducking", + DuckingApplyAction, + cv.Schema( + { + cv.GenerateID(): cv.use_id(SourceSpeaker), + cv.Required(CONF_DECIBEL_REDUCTION): cv.templatable( + cv.int_range(min=0, max=51) + ), + cv.Optional(CONF_DURATION, default="0.0s"): cv.templatable( + cv.positive_time_period_milliseconds + ), + } + ), +) +async def ducking_set_to_code(config, action_id, template_arg, args): + var = cg.new_Pvariable(action_id, template_arg) + await cg.register_parented(var, config[CONF_ID]) + decibel_reduction = await cg.templatable( + config[CONF_DECIBEL_REDUCTION], args, cg.uint8 + ) + cg.add(var.set_decibel_reduction(decibel_reduction)) + duration = await cg.templatable(config[CONF_DURATION], args, cg.uint32) + cg.add(var.set_duration(duration)) + return var diff --git a/esphome/components/mixer/speaker/automation.h b/esphome/components/mixer/speaker/automation.h new file mode 100644 index 0000000000..b688fa2c1e --- /dev/null +++ b/esphome/components/mixer/speaker/automation.h @@ -0,0 +1,19 @@ +#pragma once + +#include "mixer_speaker.h" + +#ifdef USE_ESP32 + +namespace esphome { +namespace mixer_speaker { +template class DuckingApplyAction : public Action, public Parented { + TEMPLATABLE_VALUE(uint8_t, decibel_reduction) + TEMPLATABLE_VALUE(uint32_t, duration) + void play(Ts... x) override { + this->parent_->apply_ducking(this->decibel_reduction_.value(x...), this->duration_.value(x...)); + } +}; +} // namespace mixer_speaker +} // namespace esphome + +#endif diff --git a/esphome/components/mixer/speaker/mixer_speaker.cpp b/esphome/components/mixer/speaker/mixer_speaker.cpp new file mode 100644 index 0000000000..60cff95eb2 --- /dev/null +++ b/esphome/components/mixer/speaker/mixer_speaker.cpp @@ -0,0 +1,624 @@ +#include "mixer_speaker.h" + +#ifdef USE_ESP32 + +#include "esphome/core/hal.h" +#include "esphome/core/helpers.h" +#include "esphome/core/log.h" + +#include +#include + +namespace esphome { +namespace mixer_speaker { + +static const UBaseType_t MIXER_TASK_PRIORITY = 10; + +static const uint32_t TRANSFER_BUFFER_DURATION_MS = 50; +static const uint32_t TASK_DELAY_MS = 25; + +static const size_t TASK_STACK_SIZE = 4096; + +static const int16_t MAX_AUDIO_SAMPLE_VALUE = INT16_MAX; +static const int16_t MIN_AUDIO_SAMPLE_VALUE = INT16_MIN; + +static const char *const TAG = "speaker_mixer"; + +// Gives the Q15 fixed point scaling factor to reduce by 0 dB, 1dB, ..., 50 dB +// dB to PCM scaling factor formula: floating_point_scale_factor = 2^(-db/6.014) +// float to Q15 fixed point formula: q15_scale_factor = floating_point_scale_factor * 2^(15) +static const std::vector DECIBEL_REDUCTION_TABLE = { + 32767, 29201, 26022, 23189, 20665, 18415, 16410, 14624, 13032, 11613, 10349, 9222, 8218, 7324, 6527, 5816, 5183, + 4619, 4116, 3668, 3269, 2913, 2596, 2313, 2061, 1837, 1637, 1459, 1300, 1158, 1032, 920, 820, 731, + 651, 580, 517, 461, 411, 366, 326, 291, 259, 231, 206, 183, 163, 146, 130, 116, 103}; + +enum MixerEventGroupBits : uint32_t { + COMMAND_STOP = (1 << 0), // stops the mixer task + STATE_STARTING = (1 << 10), + STATE_RUNNING = (1 << 11), + STATE_STOPPING = (1 << 12), + STATE_STOPPED = (1 << 13), + ERR_ESP_NO_MEM = (1 << 19), + ALL_BITS = 0x00FFFFFF, // All valid FreeRTOS event group bits +}; + +void SourceSpeaker::dump_config() { + ESP_LOGCONFIG(TAG, "Mixer Source Speaker"); + ESP_LOGCONFIG(TAG, " Buffer Duration: %" PRIu32 " ms", this->buffer_duration_ms_); + if (this->timeout_ms_.has_value()) { + ESP_LOGCONFIG(TAG, " Timeout: %" PRIu32 " ms", this->timeout_ms_.value()); + } else { + ESP_LOGCONFIG(TAG, " Timeout: never"); + } +} + +void SourceSpeaker::setup() { + this->parent_->get_output_speaker()->add_audio_output_callback( + [this](uint32_t new_playback_ms, uint32_t remainder_us, uint32_t pending_ms, uint32_t write_timestamp) { + uint32_t personal_playback_ms = std::min(new_playback_ms, this->pending_playback_ms_); + if (personal_playback_ms > 0) { + this->pending_playback_ms_ -= personal_playback_ms; + this->audio_output_callback_(personal_playback_ms, remainder_us, this->pending_playback_ms_, write_timestamp); + } + }); +} + +void SourceSpeaker::loop() { + switch (this->state_) { + case speaker::STATE_STARTING: { + esp_err_t err = this->start_(); + if (err == ESP_OK) { + this->state_ = speaker::STATE_RUNNING; + this->stop_gracefully_ = false; + this->last_seen_data_ms_ = millis(); + this->status_clear_error(); + } else { + switch (err) { + case ESP_ERR_NO_MEM: + this->status_set_error("Failed to start mixer: not enough memory"); + break; + case ESP_ERR_NOT_SUPPORTED: + this->status_set_error("Failed to start mixer: unsupported bits per sample"); + break; + case ESP_ERR_INVALID_ARG: + this->status_set_error("Failed to start mixer: audio stream isn't compatible with the other audio stream."); + break; + case ESP_ERR_INVALID_STATE: + this->status_set_error("Failed to start mixer: mixer task failed to start"); + break; + default: + this->status_set_error("Failed to start mixer"); + break; + } + + this->state_ = speaker::STATE_STOPPING; + } + break; + } + case speaker::STATE_RUNNING: + if (!this->transfer_buffer_->has_buffered_data()) { + if ((this->timeout_ms_.has_value() && ((millis() - this->last_seen_data_ms_) > this->timeout_ms_.value())) || + this->stop_gracefully_) { + this->state_ = speaker::STATE_STOPPING; + } + } + break; + case speaker::STATE_STOPPING: + this->stop_(); + this->stop_gracefully_ = false; + this->state_ = speaker::STATE_STOPPED; + break; + case speaker::STATE_STOPPED: + break; + } +} + +size_t SourceSpeaker::play(const uint8_t *data, size_t length, TickType_t ticks_to_wait) { + if (this->is_stopped()) { + this->start(); + } + size_t bytes_written = 0; + if (this->ring_buffer_.use_count() == 1) { + std::shared_ptr temp_ring_buffer = this->ring_buffer_.lock(); + bytes_written = temp_ring_buffer->write_without_replacement(data, length, ticks_to_wait); + if (bytes_written > 0) { + this->last_seen_data_ms_ = millis(); + } + } + return bytes_written; +} + +void SourceSpeaker::start() { this->state_ = speaker::STATE_STARTING; } + +esp_err_t SourceSpeaker::start_() { + const size_t ring_buffer_size = this->audio_stream_info_.ms_to_bytes(this->buffer_duration_ms_); + if (this->transfer_buffer_.use_count() == 0) { + this->transfer_buffer_ = + audio::AudioSourceTransferBuffer::create(this->audio_stream_info_.ms_to_bytes(TRANSFER_BUFFER_DURATION_MS)); + + if (this->transfer_buffer_ == nullptr) { + return ESP_ERR_NO_MEM; + } + std::shared_ptr temp_ring_buffer; + + if (!this->ring_buffer_.use_count()) { + temp_ring_buffer = RingBuffer::create(ring_buffer_size); + this->ring_buffer_ = temp_ring_buffer; + } + + if (!this->ring_buffer_.use_count()) { + return ESP_ERR_NO_MEM; + } else { + this->transfer_buffer_->set_source(temp_ring_buffer); + } + } + + return this->parent_->start(this->audio_stream_info_); +} + +void SourceSpeaker::stop() { + if (this->state_ != speaker::STATE_STOPPED) { + this->state_ = speaker::STATE_STOPPING; + } +} + +void SourceSpeaker::stop_() { + this->transfer_buffer_.reset(); // deallocates the transfer buffer +} + +void SourceSpeaker::finish() { this->stop_gracefully_ = true; } + +bool SourceSpeaker::has_buffered_data() const { + return ((this->transfer_buffer_.use_count() > 0) && this->transfer_buffer_->has_buffered_data()); +} + +void SourceSpeaker::set_mute_state(bool mute_state) { + this->mute_state_ = mute_state; + this->parent_->get_output_speaker()->set_mute_state(mute_state); +} + +void SourceSpeaker::set_volume(float volume) { + this->volume_ = volume; + this->parent_->get_output_speaker()->set_volume(volume); +} + +size_t SourceSpeaker::process_data_from_source(TickType_t ticks_to_wait) { + if (!this->transfer_buffer_.use_count()) { + return 0; + } + + // Store current offset, as these samples are already ducked + const size_t current_length = this->transfer_buffer_->available(); + + size_t bytes_read = this->transfer_buffer_->transfer_data_from_source(ticks_to_wait); + + uint32_t samples_to_duck = this->audio_stream_info_.bytes_to_samples(bytes_read); + if (samples_to_duck > 0) { + int16_t *current_buffer = reinterpret_cast(this->transfer_buffer_->get_buffer_start() + current_length); + + duck_samples(current_buffer, samples_to_duck, &this->current_ducking_db_reduction_, + &this->ducking_transition_samples_remaining_, this->samples_per_ducking_step_, + this->db_change_per_ducking_step_); + } + + return bytes_read; +} + +void SourceSpeaker::apply_ducking(uint8_t decibel_reduction, uint32_t duration) { + if (this->target_ducking_db_reduction_ != decibel_reduction) { + this->current_ducking_db_reduction_ = this->target_ducking_db_reduction_; + + this->target_ducking_db_reduction_ = decibel_reduction; + + uint8_t total_ducking_steps = 0; + if (this->target_ducking_db_reduction_ > this->current_ducking_db_reduction_) { + // The dB reduction level is increasing (which results in quieter audio) + total_ducking_steps = this->target_ducking_db_reduction_ - this->current_ducking_db_reduction_ - 1; + this->db_change_per_ducking_step_ = 1; + } else { + // The dB reduction level is decreasing (which results in louder audio) + total_ducking_steps = this->current_ducking_db_reduction_ - this->target_ducking_db_reduction_ - 1; + this->db_change_per_ducking_step_ = -1; + } + if ((duration > 0) && (total_ducking_steps > 0)) { + this->ducking_transition_samples_remaining_ = this->audio_stream_info_.ms_to_samples(duration); + + this->samples_per_ducking_step_ = this->ducking_transition_samples_remaining_ / total_ducking_steps; + this->ducking_transition_samples_remaining_ = + this->samples_per_ducking_step_ * total_ducking_steps; // Adjust for integer division rounding + + this->current_ducking_db_reduction_ += this->db_change_per_ducking_step_; + } else { + this->ducking_transition_samples_remaining_ = 0; + this->current_ducking_db_reduction_ = this->target_ducking_db_reduction_; + } + } +} + +void SourceSpeaker::duck_samples(int16_t *input_buffer, uint32_t input_samples_to_duck, + int8_t *current_ducking_db_reduction, uint32_t *ducking_transition_samples_remaining, + uint32_t samples_per_ducking_step, int8_t db_change_per_ducking_step) { + if (*ducking_transition_samples_remaining > 0) { + // Ducking level is still transitioning + + // Takes the ceiling of input_samples_to_duck/samples_per_ducking_step + uint32_t ducking_steps_in_batch = + input_samples_to_duck / samples_per_ducking_step + (input_samples_to_duck % samples_per_ducking_step != 0); + + for (uint32_t i = 0; i < ducking_steps_in_batch; ++i) { + uint32_t samples_left_in_step = *ducking_transition_samples_remaining % samples_per_ducking_step; + + if (samples_left_in_step == 0) { + samples_left_in_step = samples_per_ducking_step; + } + + uint32_t samples_to_duck = std::min(input_samples_to_duck, samples_left_in_step); + samples_to_duck = std::min(samples_to_duck, *ducking_transition_samples_remaining); + + // Ensure we only point to valid index in the Q15 scaling factor table + uint8_t safe_db_reduction_index = + clamp(*current_ducking_db_reduction, 0, DECIBEL_REDUCTION_TABLE.size() - 1); + int16_t q15_scale_factor = DECIBEL_REDUCTION_TABLE[safe_db_reduction_index]; + + audio::scale_audio_samples(input_buffer, input_buffer, q15_scale_factor, samples_to_duck); + + if (samples_left_in_step - samples_to_duck == 0) { + // After scaling the current samples, we are ready to transition to the next step + *current_ducking_db_reduction += db_change_per_ducking_step; + } + + input_buffer += samples_to_duck; + *ducking_transition_samples_remaining -= samples_to_duck; + input_samples_to_duck -= samples_to_duck; + } + } + + if ((*current_ducking_db_reduction > 0) && (input_samples_to_duck > 0)) { + // Audio is ducked, but its not in the middle of a transition step + + uint8_t safe_db_reduction_index = + clamp(*current_ducking_db_reduction, 0, DECIBEL_REDUCTION_TABLE.size() - 1); + int16_t q15_scale_factor = DECIBEL_REDUCTION_TABLE[safe_db_reduction_index]; + + audio::scale_audio_samples(input_buffer, input_buffer, q15_scale_factor, input_samples_to_duck); + } +} + +void MixerSpeaker::dump_config() { + ESP_LOGCONFIG(TAG, "Speaker Mixer:"); + ESP_LOGCONFIG(TAG, " Number of output channels: %u", this->output_channels_); +} + +void MixerSpeaker::setup() { + this->event_group_ = xEventGroupCreate(); + + if (this->event_group_ == nullptr) { + ESP_LOGE(TAG, "Failed to create event group"); + this->mark_failed(); + return; + } +} + +void MixerSpeaker::loop() { + uint32_t event_group_bits = xEventGroupGetBits(this->event_group_); + + if (event_group_bits & MixerEventGroupBits::STATE_STARTING) { + ESP_LOGD(TAG, "Starting speaker mixer"); + xEventGroupClearBits(this->event_group_, MixerEventGroupBits::STATE_STARTING); + } + if (event_group_bits & MixerEventGroupBits::ERR_ESP_NO_MEM) { + this->status_set_error("Failed to allocate the mixer's internal buffer"); + xEventGroupClearBits(this->event_group_, MixerEventGroupBits::ERR_ESP_NO_MEM); + } + if (event_group_bits & MixerEventGroupBits::STATE_RUNNING) { + ESP_LOGD(TAG, "Started speaker mixer"); + this->status_clear_error(); + xEventGroupClearBits(this->event_group_, MixerEventGroupBits::STATE_RUNNING); + } + if (event_group_bits & MixerEventGroupBits::STATE_STOPPING) { + ESP_LOGD(TAG, "Stopping speaker mixer"); + xEventGroupClearBits(this->event_group_, MixerEventGroupBits::STATE_STOPPING); + } + if (event_group_bits & MixerEventGroupBits::STATE_STOPPED) { + if (this->delete_task_() == ESP_OK) { + xEventGroupClearBits(this->event_group_, MixerEventGroupBits::ALL_BITS); + } + } + + if (this->task_handle_ != nullptr) { + bool all_stopped = true; + + for (auto &speaker : this->source_speakers_) { + all_stopped &= speaker->is_stopped(); + } + + if (all_stopped) { + this->stop(); + } + } +} + +esp_err_t MixerSpeaker::start(audio::AudioStreamInfo &stream_info) { + if (!this->audio_stream_info_.has_value()) { + if (stream_info.get_bits_per_sample() != 16) { + // Audio streams that don't have 16 bits per sample are not supported + return ESP_ERR_NOT_SUPPORTED; + } + + this->audio_stream_info_ = audio::AudioStreamInfo(stream_info.get_bits_per_sample(), this->output_channels_, + stream_info.get_sample_rate()); + this->output_speaker_->set_audio_stream_info(this->audio_stream_info_.value()); + } else { + if (!this->queue_mode_ && (stream_info.get_sample_rate() != this->audio_stream_info_.value().get_sample_rate())) { + // The two audio streams must have the same sample rate to mix properly if not in queue mode + return ESP_ERR_INVALID_ARG; + } + } + + return this->start_task_(); +} + +esp_err_t MixerSpeaker::start_task_() { + if (this->task_stack_buffer_ == nullptr) { + if (this->task_stack_in_psram_) { + RAMAllocator stack_allocator(RAMAllocator::ALLOC_EXTERNAL); + this->task_stack_buffer_ = stack_allocator.allocate(TASK_STACK_SIZE); + } else { + RAMAllocator stack_allocator(RAMAllocator::ALLOC_INTERNAL); + this->task_stack_buffer_ = stack_allocator.allocate(TASK_STACK_SIZE); + } + } + + if (this->task_stack_buffer_ == nullptr) { + return ESP_ERR_NO_MEM; + } + + if (this->task_handle_ == nullptr) { + this->task_handle_ = xTaskCreateStatic(audio_mixer_task, "mixer", TASK_STACK_SIZE, (void *) this, + MIXER_TASK_PRIORITY, this->task_stack_buffer_, &this->task_stack_); + } + + if (this->task_handle_ == nullptr) { + return ESP_ERR_INVALID_STATE; + } + + return ESP_OK; +} + +esp_err_t MixerSpeaker::delete_task_() { + if (!this->task_created_) { + this->task_handle_ = nullptr; + + if (this->task_stack_buffer_ != nullptr) { + if (this->task_stack_in_psram_) { + RAMAllocator stack_allocator(RAMAllocator::ALLOC_EXTERNAL); + stack_allocator.deallocate(this->task_stack_buffer_, TASK_STACK_SIZE); + } else { + RAMAllocator stack_allocator(RAMAllocator::ALLOC_INTERNAL); + stack_allocator.deallocate(this->task_stack_buffer_, TASK_STACK_SIZE); + } + + this->task_stack_buffer_ = nullptr; + } + + return ESP_OK; + } + + return ESP_ERR_INVALID_STATE; +} + +void MixerSpeaker::stop() { xEventGroupSetBits(this->event_group_, MixerEventGroupBits::COMMAND_STOP); } + +void MixerSpeaker::copy_frames(const int16_t *input_buffer, audio::AudioStreamInfo input_stream_info, + int16_t *output_buffer, audio::AudioStreamInfo output_stream_info, + uint32_t frames_to_transfer) { + uint8_t input_channels = input_stream_info.get_channels(); + uint8_t output_channels = output_stream_info.get_channels(); + const uint8_t max_input_channel_index = input_channels - 1; + + if (input_channels == output_channels) { + size_t bytes_to_copy = input_stream_info.frames_to_bytes(frames_to_transfer); + memcpy(output_buffer, input_buffer, bytes_to_copy); + + return; + } + + for (uint32_t frame_index = 0; frame_index < frames_to_transfer; ++frame_index) { + for (uint8_t output_channel_index = 0; output_channel_index < output_channels; ++output_channel_index) { + uint8_t input_channel_index = std::min(output_channel_index, max_input_channel_index); + output_buffer[output_channels * frame_index + output_channel_index] = + input_buffer[input_channels * frame_index + input_channel_index]; + } + } +} + +void MixerSpeaker::mix_audio_samples(const int16_t *primary_buffer, audio::AudioStreamInfo primary_stream_info, + const int16_t *secondary_buffer, audio::AudioStreamInfo secondary_stream_info, + int16_t *output_buffer, audio::AudioStreamInfo output_stream_info, + uint32_t frames_to_mix) { + const uint8_t primary_channels = primary_stream_info.get_channels(); + const uint8_t secondary_channels = secondary_stream_info.get_channels(); + const uint8_t output_channels = output_stream_info.get_channels(); + + const uint8_t max_primary_channel_index = primary_channels - 1; + const uint8_t max_secondary_channel_index = secondary_channels - 1; + + for (uint32_t frames_index = 0; frames_index < frames_to_mix; ++frames_index) { + for (uint8_t output_channel_index = 0; output_channel_index < output_channels; ++output_channel_index) { + const uint32_t secondary_channel_index = std::min(output_channel_index, max_secondary_channel_index); + const int32_t secondary_sample = secondary_buffer[frames_index * secondary_channels + secondary_channel_index]; + + const uint32_t primary_channel_index = std::min(output_channel_index, max_primary_channel_index); + const int32_t primary_sample = + static_cast(primary_buffer[frames_index * primary_channels + primary_channel_index]); + + const int32_t added_sample = secondary_sample + primary_sample; + + output_buffer[frames_index * output_channels + output_channel_index] = + static_cast(clamp(added_sample, MIN_AUDIO_SAMPLE_VALUE, MAX_AUDIO_SAMPLE_VALUE)); + } + } +} + +void MixerSpeaker::audio_mixer_task(void *params) { + MixerSpeaker *this_mixer = (MixerSpeaker *) params; + + xEventGroupSetBits(this_mixer->event_group_, MixerEventGroupBits::STATE_STARTING); + + this_mixer->task_created_ = true; + + std::unique_ptr output_transfer_buffer = audio::AudioSinkTransferBuffer::create( + this_mixer->audio_stream_info_.value().ms_to_bytes(TRANSFER_BUFFER_DURATION_MS)); + + if (output_transfer_buffer == nullptr) { + xEventGroupSetBits(this_mixer->event_group_, + MixerEventGroupBits::STATE_STOPPED | MixerEventGroupBits::ERR_ESP_NO_MEM); + + this_mixer->task_created_ = false; + vTaskDelete(nullptr); + } + + output_transfer_buffer->set_sink(this_mixer->output_speaker_); + + xEventGroupSetBits(this_mixer->event_group_, MixerEventGroupBits::STATE_RUNNING); + + bool sent_finished = false; + + while (true) { + uint32_t event_group_bits = xEventGroupGetBits(this_mixer->event_group_); + if (event_group_bits & MixerEventGroupBits::COMMAND_STOP) { + break; + } + + output_transfer_buffer->transfer_data_to_sink(pdMS_TO_TICKS(TASK_DELAY_MS)); + + const uint32_t output_frames_free = + this_mixer->audio_stream_info_.value().bytes_to_frames(output_transfer_buffer->free()); + + std::vector speakers_with_data; + std::vector> transfer_buffers_with_data; + + for (auto &speaker : this_mixer->source_speakers_) { + if (speaker->get_transfer_buffer().use_count() > 0) { + std::shared_ptr transfer_buffer = speaker->get_transfer_buffer().lock(); + speaker->process_data_from_source(0); // Transfers and ducks audio from source ring buffers + + if ((transfer_buffer->available() > 0) && !speaker->get_pause_state()) { + // Store the locked transfer buffers in their own vector to avoid releasing ownership until after the loop + transfer_buffers_with_data.push_back(transfer_buffer); + speakers_with_data.push_back(speaker); + } + } + } + + if (transfer_buffers_with_data.empty()) { + // No audio available for transferring, block task temporarily + delay(TASK_DELAY_MS); + continue; + } + + uint32_t frames_to_mix = output_frames_free; + + if ((transfer_buffers_with_data.size() == 1) || this_mixer->queue_mode_) { + // Only one speaker has audio data, just copy samples over + + audio::AudioStreamInfo active_stream_info = speakers_with_data[0]->get_audio_stream_info(); + + if (active_stream_info.get_sample_rate() == + this_mixer->output_speaker_->get_audio_stream_info().get_sample_rate()) { + // Speaker's sample rate matches the output speaker's, copy directly + + const uint32_t frames_available_in_buffer = + active_stream_info.bytes_to_frames(transfer_buffers_with_data[0]->available()); + frames_to_mix = std::min(frames_to_mix, frames_available_in_buffer); + copy_frames(reinterpret_cast(transfer_buffers_with_data[0]->get_buffer_start()), active_stream_info, + reinterpret_cast(output_transfer_buffer->get_buffer_end()), + this_mixer->audio_stream_info_.value(), frames_to_mix); + + // Update source speaker buffer length + transfer_buffers_with_data[0]->decrease_buffer_length(active_stream_info.frames_to_bytes(frames_to_mix)); + speakers_with_data[0]->accumulated_frames_read_ += frames_to_mix; + + // Add new audio duration to the source speaker pending playback + speakers_with_data[0]->pending_playback_ms_ += + active_stream_info.frames_to_milliseconds_with_remainder(&speakers_with_data[0]->accumulated_frames_read_); + + // Update output transfer buffer length + output_transfer_buffer->increase_buffer_length( + this_mixer->audio_stream_info_.value().frames_to_bytes(frames_to_mix)); + } else { + // Speaker's stream info doesn't match the output speaker's, so it's a new source speaker + if (!this_mixer->output_speaker_->is_stopped()) { + if (!sent_finished) { + this_mixer->output_speaker_->finish(); + sent_finished = true; // Avoid repeatedly sending the finish command + } + } else { + // Speaker has finished writing the current audio, update the stream information and restart the speaker + this_mixer->audio_stream_info_ = + audio::AudioStreamInfo(active_stream_info.get_bits_per_sample(), this_mixer->output_channels_, + active_stream_info.get_sample_rate()); + this_mixer->output_speaker_->set_audio_stream_info(this_mixer->audio_stream_info_.value()); + this_mixer->output_speaker_->start(); + sent_finished = false; + } + } + } else { + // Determine how many frames to mix + for (int i = 0; i < transfer_buffers_with_data.size(); ++i) { + const uint32_t frames_available_in_buffer = + speakers_with_data[i]->get_audio_stream_info().bytes_to_frames(transfer_buffers_with_data[i]->available()); + frames_to_mix = std::min(frames_to_mix, frames_available_in_buffer); + } + int16_t *primary_buffer = reinterpret_cast(transfer_buffers_with_data[0]->get_buffer_start()); + audio::AudioStreamInfo primary_stream_info = speakers_with_data[0]->get_audio_stream_info(); + + // Mix two streams together + for (int i = 1; i < transfer_buffers_with_data.size(); ++i) { + mix_audio_samples(primary_buffer, primary_stream_info, + reinterpret_cast(transfer_buffers_with_data[i]->get_buffer_start()), + speakers_with_data[i]->get_audio_stream_info(), + reinterpret_cast(output_transfer_buffer->get_buffer_end()), + this_mixer->audio_stream_info_.value(), frames_to_mix); + + speakers_with_data[i]->pending_playback_ms_ += + speakers_with_data[i]->get_audio_stream_info().frames_to_milliseconds_with_remainder( + &speakers_with_data[i]->accumulated_frames_read_); + + if (i != transfer_buffers_with_data.size() - 1) { + // Need to mix more streams together, point primary buffer and stream info to the already mixed output + primary_buffer = reinterpret_cast(output_transfer_buffer->get_buffer_end()); + primary_stream_info = this_mixer->audio_stream_info_.value(); + } + } + + // Update source transfer buffer lengths and add new audio durations to the source speaker pending playbacks + for (int i = 0; i < transfer_buffers_with_data.size(); ++i) { + transfer_buffers_with_data[i]->decrease_buffer_length( + speakers_with_data[i]->get_audio_stream_info().frames_to_bytes(frames_to_mix)); + speakers_with_data[i]->accumulated_frames_read_ += frames_to_mix; + + speakers_with_data[i]->pending_playback_ms_ += + speakers_with_data[i]->get_audio_stream_info().frames_to_milliseconds_with_remainder( + &speakers_with_data[i]->accumulated_frames_read_); + } + + // Update output transfer buffer length + output_transfer_buffer->increase_buffer_length( + this_mixer->audio_stream_info_.value().frames_to_bytes(frames_to_mix)); + } + } + + xEventGroupSetBits(this_mixer->event_group_, MixerEventGroupBits::STATE_STOPPING); + + output_transfer_buffer.reset(); + + xEventGroupSetBits(this_mixer->event_group_, MixerEventGroupBits::STATE_STOPPED); + this_mixer->task_created_ = false; + vTaskDelete(nullptr); +} + +} // namespace mixer_speaker +} // namespace esphome + +#endif diff --git a/esphome/components/mixer/speaker/mixer_speaker.h b/esphome/components/mixer/speaker/mixer_speaker.h new file mode 100644 index 0000000000..b2cb3e1e39 --- /dev/null +++ b/esphome/components/mixer/speaker/mixer_speaker.h @@ -0,0 +1,207 @@ +#pragma once + +#ifdef USE_ESP32 + +#include "esphome/components/audio/audio.h" +#include "esphome/components/audio/audio_transfer_buffer.h" +#include "esphome/components/speaker/speaker.h" + +#include "esphome/core/component.h" + +#include +#include + +namespace esphome { +namespace mixer_speaker { + +/* Classes for mixing several source speaker audio streams and writing it to another speaker component. + * - Volume controls are passed through to the output speaker + * - Directly handles pausing at the SourceSpeaker level; pause state is not passed through to the output speaker. + * - Audio sent to the SourceSpeaker's must have 16 bits per sample. + * - Audio sent to the SourceSpeaker can have any number of channels. They are duplicated or ignored as needed to match + * the number of channels required for the output speaker. + * - In queue mode, the audio sent to the SoureSpeakers can have different sample rates. + * - In non-queue mode, the audio sent to the SourceSpeakers must have the same sample rates. + * - SourceSpeaker has an internal ring buffer. It also allocates a shared_ptr for an AudioTranserBuffer object. + * - Audio Data Flow: + * - Audio data played on a SourceSpeaker first writes to its internal ring buffer. + * - MixerSpeaker task temporarily takes shared ownership of each SourceSpeaker's AudioTransferBuffer. + * - MixerSpeaker calls SourceSpeaker's `process_data_from_source`, which tranfers audio from the SourceSpeaker's + * ring buffer to its AudioTransferBuffer. Audio ducking is applied at this step. + * - In queue mode, MixerSpeaker prioritizes the earliest configured SourceSpeaker with audio data. Audio data is + * sent to the output speaker. + * - In non-queue mode, MixerSpeaker adds all the audio data in each SourceSpeaker into one stream that is written + * to the output speaker. + */ + +class MixerSpeaker; + +class SourceSpeaker : public speaker::Speaker, public Component { + public: + void dump_config() override; + void setup() override; + void loop() override; + + size_t play(const uint8_t *data, size_t length, TickType_t ticks_to_wait) override; + size_t play(const uint8_t *data, size_t length) override { return this->play(data, length, 0); } + + void start() override; + void stop() override; + void finish() override; + + bool has_buffered_data() const override; + + /// @brief Mute state changes are passed to the parent's output speaker + void set_mute_state(bool mute_state) override; + + /// @brief Volume state changes are passed to the parent's output speaker + void set_volume(float volume) override; + + void set_pause_state(bool pause_state) override { this->pause_state_ = pause_state; } + bool get_pause_state() const override { return this->pause_state_; } + + /// @brief Transfers audio from the ring buffer into the transfer buffer. Ducks audio while transferring. + /// @param ticks_to_wait FreeRTOS ticks to wait while waiting to read from the ring buffer. + /// @return Number of bytes transferred from the ring buffer. + size_t process_data_from_source(TickType_t ticks_to_wait); + + /// @brief Sets the ducking level for the source speaker. + /// @param decibel_reduction (uint8_t) The dB reduction level. For example, 0 is no change, 10 is a reduction by 10 dB + /// @param duration (uint32_t) The number of milliseconds to transition from the current level to the new level + void apply_ducking(uint8_t decibel_reduction, uint32_t duration); + + void set_buffer_duration(uint32_t buffer_duration_ms) { this->buffer_duration_ms_ = buffer_duration_ms; } + void set_parent(MixerSpeaker *parent) { this->parent_ = parent; } + void set_timeout(uint32_t ms) { this->timeout_ms_ = ms; } + + std::weak_ptr get_transfer_buffer() { return this->transfer_buffer_; } + + protected: + friend class MixerSpeaker; + esp_err_t start_(); + void stop_(); + + /// @brief Ducks audio samples by a specified amount. When changing the ducking amount, it can transition gradually + /// over a specified amount of samples. + /// @param input_buffer buffer with audio samples to be ducked in place + /// @param input_samples_to_duck number of samples to process in ``input_buffer`` + /// @param current_ducking_db_reduction pointer to the current dB reduction + /// @param ducking_transition_samples_remaining pointer to the total number of samples left before the the + /// transition is finished + /// @param samples_per_ducking_step total number of samples per ducking step for the transition + /// @param db_change_per_ducking_step the change in dB reduction per step + static void duck_samples(int16_t *input_buffer, uint32_t input_samples_to_duck, int8_t *current_ducking_db_reduction, + uint32_t *ducking_transition_samples_remaining, uint32_t samples_per_ducking_step, + int8_t db_change_per_ducking_step); + + MixerSpeaker *parent_; + + std::shared_ptr transfer_buffer_; + std::weak_ptr ring_buffer_; + + uint32_t buffer_duration_ms_; + uint32_t last_seen_data_ms_{0}; + optional timeout_ms_; + bool stop_gracefully_{false}; + + bool pause_state_{false}; + + int8_t target_ducking_db_reduction_{0}; + int8_t current_ducking_db_reduction_{0}; + int8_t db_change_per_ducking_step_{1}; + uint32_t ducking_transition_samples_remaining_{0}; + uint32_t samples_per_ducking_step_{0}; + + uint32_t accumulated_frames_read_{0}; + + uint32_t pending_playback_ms_{0}; +}; + +class MixerSpeaker : public Component { + public: + void dump_config() override; + void setup() override; + void loop() override; + + void add_source_speaker(SourceSpeaker *source_speaker) { this->source_speakers_.push_back(source_speaker); } + + /// @brief Starts the mixer task. Called by a source speaker giving the current audio stream information + /// @param stream_info The calling source speakers audio stream information + /// @return ESP_ERR_NOT_SUPPORTED if the incoming stream is incompatible due to unsupported bits per sample + /// ESP_ERR_INVALID_ARG if the incoming stream is incompatible to be mixed with the other input audio stream + /// ESP_ERR_NO_MEM if there isn't enough memory for the task's stack + /// ESP_ERR_INVALID_STATE if the task fails to start + /// ESP_OK if the incoming stream is compatible and the mixer task starts + esp_err_t start(audio::AudioStreamInfo &stream_info); + + void stop(); + + void set_output_channels(uint8_t output_channels) { this->output_channels_ = output_channels; } + void set_output_speaker(speaker::Speaker *speaker) { this->output_speaker_ = speaker; } + void set_queue_mode(bool queue_mode) { this->queue_mode_ = queue_mode; } + void set_task_stack_in_psram(bool task_stack_in_psram) { this->task_stack_in_psram_ = task_stack_in_psram; } + + speaker::Speaker *get_output_speaker() const { return this->output_speaker_; } + + protected: + /// @brief Copies audio frames from the input buffer to the output buffer taking into account the number of channels + /// in each stream. If the output stream has more channels, the input samples are duplicated. If the output stream has + /// less channels, the extra channel input samples are dropped. + /// @param input_buffer + /// @param input_stream_info + /// @param output_buffer + /// @param output_stream_info + /// @param frames_to_transfer number of frames (consisting of a sample for each channel) to copy from the input buffer + static void copy_frames(const int16_t *input_buffer, audio::AudioStreamInfo input_stream_info, int16_t *output_buffer, + audio::AudioStreamInfo output_stream_info, uint32_t frames_to_transfer); + + /// @brief Mixes the primary and secondary streams taking into account the number of channels in each stream. Primary + /// and secondary samples are duplicated or dropped as necessary to ensure the output stream has the configured number + /// of channels. Output samples are clamped to the corresponding int16 min or max values if the mixed sample + /// overflows. + /// @param primary_buffer (int16_t *) samples buffer for the primary stream + /// @param primary_stream_info stream info for the primary stream + /// @param secondary_buffer (int16_t *) samples buffer for secondary stream + /// @param secondary_stream_info stream info for the secondary stream + /// @param output_buffer (int16_t *) buffer for the mixed samples + /// @param output_stream_info stream info for the output buffer + /// @param frames_to_mix number of frames in the primary and secondary buffers to mix together + static void mix_audio_samples(const int16_t *primary_buffer, audio::AudioStreamInfo primary_stream_info, + const int16_t *secondary_buffer, audio::AudioStreamInfo secondary_stream_info, + int16_t *output_buffer, audio::AudioStreamInfo output_stream_info, + uint32_t frames_to_mix); + + static void audio_mixer_task(void *params); + + /// @brief Starts the mixer task after allocating memory for the task stack. + /// @return ESP_ERR_NO_MEM if there isn't enough memory for the task's stack + /// ESP_ERR_INVALID_STATE if the task didn't start + /// ESP_OK if successful + esp_err_t start_task_(); + + /// @brief If the task is stopped, it sets the task handle to the nullptr and deallocates its stack + /// @return ESP_OK if the task was stopped, ESP_ERR_INVALID_STATE otherwise. + esp_err_t delete_task_(); + + EventGroupHandle_t event_group_{nullptr}; + + std::vector source_speakers_; + speaker::Speaker *output_speaker_{nullptr}; + + uint8_t output_channels_; + bool queue_mode_; + bool task_stack_in_psram_{false}; + + bool task_created_{false}; + + TaskHandle_t task_handle_{nullptr}; + StaticTask_t task_stack_; + StackType_t *task_stack_buffer_{nullptr}; + + optional audio_stream_info_; +}; + +} // namespace mixer_speaker +} // namespace esphome + +#endif diff --git a/esphome/components/mpr121/mpr121.h b/esphome/components/mpr121/mpr121.h index f2dc2fe9c9..eb2e2edc57 100644 --- a/esphome/components/mpr121/mpr121.h +++ b/esphome/components/mpr121/mpr121.h @@ -117,6 +117,8 @@ class MPR121GPIOPin : public GPIOPin { void set_inverted(bool inverted) { this->inverted_ = inverted; } void set_flags(gpio::Flags flags) { this->flags_ = flags; } + gpio::Flags get_flags() const override { return this->flags_; } + protected: MPR121Component *parent_; uint8_t pin_; diff --git a/esphome/components/pca6416a/pca6416a.h b/esphome/components/pca6416a/pca6416a.h index 247f443e87..1e8015c40a 100644 --- a/esphome/components/pca6416a/pca6416a.h +++ b/esphome/components/pca6416a/pca6416a.h @@ -52,6 +52,8 @@ class PCA6416AGPIOPin : public GPIOPin { void set_inverted(bool inverted) { inverted_ = inverted; } void set_flags(gpio::Flags flags) { flags_ = flags; } + gpio::Flags get_flags() const override { return this->flags_; } + protected: PCA6416AComponent *parent_; uint8_t pin_; diff --git a/esphome/components/pca9554/pca9554.h b/esphome/components/pca9554/pca9554.h index c548bec619..efeec4d306 100644 --- a/esphome/components/pca9554/pca9554.h +++ b/esphome/components/pca9554/pca9554.h @@ -65,6 +65,8 @@ class PCA9554GPIOPin : public GPIOPin { void set_inverted(bool inverted) { inverted_ = inverted; } void set_flags(gpio::Flags flags) { flags_ = flags; } + gpio::Flags get_flags() const override { return this->flags_; } + protected: PCA9554Component *parent_; uint8_t pin_; diff --git a/esphome/components/pcf8574/pcf8574.h b/esphome/components/pcf8574/pcf8574.h index c201e0615f..6edc67fc96 100644 --- a/esphome/components/pcf8574/pcf8574.h +++ b/esphome/components/pcf8574/pcf8574.h @@ -54,6 +54,8 @@ class PCF8574GPIOPin : public GPIOPin { void set_inverted(bool inverted) { inverted_ = inverted; } void set_flags(gpio::Flags flags) { flags_ = flags; } + gpio::Flags get_flags() const override { return this->flags_; } + protected: PCF8574Component *parent_; uint8_t pin_; diff --git a/esphome/components/resampler/__init__.py b/esphome/components/resampler/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/esphome/components/resampler/speaker/__init__.py b/esphome/components/resampler/speaker/__init__.py new file mode 100644 index 0000000000..9e9b32476f --- /dev/null +++ b/esphome/components/resampler/speaker/__init__.py @@ -0,0 +1,103 @@ +import esphome.codegen as cg +from esphome.components import audio, esp32, speaker +import esphome.config_validation as cv +from esphome.const import ( + CONF_BITS_PER_SAMPLE, + CONF_BUFFER_DURATION, + CONF_FILTERS, + CONF_ID, + CONF_NUM_CHANNELS, + CONF_OUTPUT_SPEAKER, + CONF_SAMPLE_RATE, + CONF_TASK_STACK_IN_PSRAM, + PLATFORM_ESP32, +) +from esphome.core.entity_helpers import inherit_property_from + +AUTO_LOAD = ["audio"] +CODEOWNERS = ["@kahrendt"] + +resampler_ns = cg.esphome_ns.namespace("resampler") +ResamplerSpeaker = resampler_ns.class_( + "ResamplerSpeaker", cg.Component, speaker.Speaker +) + +CONF_TAPS = "taps" + + +def _set_stream_limits(config): + audio.set_stream_limits( + min_bits_per_sample=16, + max_bits_per_sample=32, + )(config) + + return config + + +def _validate_audio_compatability(config): + inherit_property_from(CONF_BITS_PER_SAMPLE, CONF_OUTPUT_SPEAKER)(config) + inherit_property_from(CONF_NUM_CHANNELS, CONF_OUTPUT_SPEAKER)(config) + inherit_property_from(CONF_SAMPLE_RATE, CONF_OUTPUT_SPEAKER)(config) + + audio.final_validate_audio_schema( + "source_speaker", + audio_device=CONF_OUTPUT_SPEAKER, + bits_per_sample=config.get(CONF_BITS_PER_SAMPLE), + channels=config.get(CONF_NUM_CHANNELS), + sample_rate=config.get(CONF_SAMPLE_RATE), + )(config) + + +def _validate_taps(taps): + value = cv.int_range(min=16, max=128)(taps) + if value % 4 != 0: + raise cv.Invalid("Number of taps must be divisible by 4") + return value + + +CONFIG_SCHEMA = cv.All( + speaker.SPEAKER_SCHEMA.extend( + { + cv.GenerateID(): cv.declare_id(ResamplerSpeaker), + cv.Required(CONF_OUTPUT_SPEAKER): cv.use_id(speaker.Speaker), + cv.Optional( + CONF_BUFFER_DURATION, default="100ms" + ): cv.positive_time_period_milliseconds, + cv.SplitDefault(CONF_TASK_STACK_IN_PSRAM, esp32_idf=False): cv.All( + cv.boolean, cv.only_with_esp_idf + ), + cv.Optional(CONF_FILTERS, default=16): cv.int_range(min=2, max=1024), + cv.Optional(CONF_TAPS, default=16): _validate_taps, + } + ).extend(cv.COMPONENT_SCHEMA), + cv.only_on([PLATFORM_ESP32]), + _set_stream_limits, +) + + +FINAL_VALIDATE_SCHEMA = _validate_audio_compatability + + +async def to_code(config): + var = cg.new_Pvariable(config[CONF_ID]) + await cg.register_component(var, config) + await speaker.register_speaker(var, config) + + output_spkr = await cg.get_variable(config[CONF_OUTPUT_SPEAKER]) + cg.add(var.set_output_speaker(output_spkr)) + + cg.add(var.set_buffer_duration(config[CONF_BUFFER_DURATION])) + + if task_stack_in_psram := config.get(CONF_TASK_STACK_IN_PSRAM): + cg.add(var.set_task_stack_in_psram(task_stack_in_psram)) + if task_stack_in_psram: + if config[CONF_TASK_STACK_IN_PSRAM]: + esp32.add_idf_sdkconfig_option( + "CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY", True + ) + + cg.add(var.set_target_bits_per_sample(config[CONF_BITS_PER_SAMPLE])) + cg.add(var.set_target_sample_rate(config[CONF_SAMPLE_RATE])) + + cg.add(var.set_filters(config[CONF_FILTERS])) + cg.add(var.set_taps(config[CONF_TAPS])) diff --git a/esphome/components/resampler/speaker/resampler_speaker.cpp b/esphome/components/resampler/speaker/resampler_speaker.cpp new file mode 100644 index 0000000000..9bb46ad78c --- /dev/null +++ b/esphome/components/resampler/speaker/resampler_speaker.cpp @@ -0,0 +1,318 @@ +#include "resampler_speaker.h" + +#ifdef USE_ESP32 + +#include "esphome/components/audio/audio_resampler.h" + +#include "esphome/core/helpers.h" +#include "esphome/core/log.h" + +#include +#include + +namespace esphome { +namespace resampler { + +static const UBaseType_t RESAMPLER_TASK_PRIORITY = 1; + +static const uint32_t TRANSFER_BUFFER_DURATION_MS = 50; + +static const uint32_t TASK_DELAY_MS = 20; +static const uint32_t TASK_STACK_SIZE = 3072; + +static const char *const TAG = "resampler_speaker"; + +enum ResamplingEventGroupBits : uint32_t { + COMMAND_STOP = (1 << 0), // stops the resampler task + STATE_STARTING = (1 << 10), + STATE_RUNNING = (1 << 11), + STATE_STOPPING = (1 << 12), + STATE_STOPPED = (1 << 13), + ERR_ESP_NO_MEM = (1 << 19), + ERR_ESP_NOT_SUPPORTED = (1 << 20), + ERR_ESP_FAIL = (1 << 21), + ALL_BITS = 0x00FFFFFF, // All valid FreeRTOS event group bits +}; + +void ResamplerSpeaker::setup() { + this->event_group_ = xEventGroupCreate(); + + if (this->event_group_ == nullptr) { + ESP_LOGE(TAG, "Failed to create event group"); + this->mark_failed(); + return; + } + + this->output_speaker_->add_audio_output_callback( + [this](uint32_t new_playback_ms, uint32_t remainder_us, uint32_t pending_ms, uint32_t write_timestamp) { + int32_t adjustment = this->playback_differential_ms_; + this->playback_differential_ms_ -= adjustment; + int32_t adjusted_playback_ms = static_cast(new_playback_ms) + adjustment; + this->audio_output_callback_(adjusted_playback_ms, remainder_us, pending_ms, write_timestamp); + }); +} + +void ResamplerSpeaker::loop() { + uint32_t event_group_bits = xEventGroupGetBits(this->event_group_); + + if (event_group_bits & ResamplingEventGroupBits::STATE_STARTING) { + ESP_LOGD(TAG, "Starting resampler task"); + xEventGroupClearBits(this->event_group_, ResamplingEventGroupBits::STATE_STARTING); + } + + if (event_group_bits & ResamplingEventGroupBits::ERR_ESP_NO_MEM) { + this->status_set_error("Resampler task failed to allocate the internal buffers"); + xEventGroupClearBits(this->event_group_, ResamplingEventGroupBits::ERR_ESP_NO_MEM); + this->state_ = speaker::STATE_STOPPING; + } + if (event_group_bits & ResamplingEventGroupBits::ERR_ESP_NOT_SUPPORTED) { + this->status_set_error("Cannot resample due to an unsupported audio stream"); + xEventGroupClearBits(this->event_group_, ResamplingEventGroupBits::ERR_ESP_NOT_SUPPORTED); + this->state_ = speaker::STATE_STOPPING; + } + if (event_group_bits & ResamplingEventGroupBits::ERR_ESP_FAIL) { + this->status_set_error("Resampler task failed"); + xEventGroupClearBits(this->event_group_, ResamplingEventGroupBits::ERR_ESP_FAIL); + this->state_ = speaker::STATE_STOPPING; + } + + if (event_group_bits & ResamplingEventGroupBits::STATE_RUNNING) { + ESP_LOGD(TAG, "Started resampler task"); + this->status_clear_error(); + xEventGroupClearBits(this->event_group_, ResamplingEventGroupBits::STATE_RUNNING); + } + if (event_group_bits & ResamplingEventGroupBits::STATE_STOPPING) { + ESP_LOGD(TAG, "Stopping resampler task"); + xEventGroupClearBits(this->event_group_, ResamplingEventGroupBits::STATE_STOPPING); + } + if (event_group_bits & ResamplingEventGroupBits::STATE_STOPPED) { + if (this->delete_task_() == ESP_OK) { + ESP_LOGD(TAG, "Stopped resampler task"); + xEventGroupClearBits(this->event_group_, ResamplingEventGroupBits::ALL_BITS); + } + } + + switch (this->state_) { + case speaker::STATE_STARTING: { + esp_err_t err = this->start_(); + if (err == ESP_OK) { + this->status_clear_error(); + this->state_ = speaker::STATE_RUNNING; + } else { + switch (err) { + case ESP_ERR_INVALID_STATE: + this->status_set_error("Failed to start resampler: resampler task failed to start"); + break; + case ESP_ERR_NO_MEM: + this->status_set_error("Failed to start resampler: not enough memory for task stack"); + default: + this->status_set_error("Failed to start resampler"); + break; + } + + this->state_ = speaker::STATE_STOPPING; + } + break; + } + case speaker::STATE_RUNNING: + if (this->output_speaker_->is_stopped()) { + this->state_ = speaker::STATE_STOPPING; + } + + break; + case speaker::STATE_STOPPING: + this->stop_(); + this->state_ = speaker::STATE_STOPPED; + break; + case speaker::STATE_STOPPED: + break; + } +} + +size_t ResamplerSpeaker::play(const uint8_t *data, size_t length, TickType_t ticks_to_wait) { + if (this->is_stopped()) { + this->start(); + } + + size_t bytes_written = 0; + if ((this->output_speaker_->is_running()) && (!this->requires_resampling_())) { + bytes_written = this->output_speaker_->play(data, length, ticks_to_wait); + } else { + if (this->ring_buffer_.use_count() == 1) { + std::shared_ptr temp_ring_buffer = this->ring_buffer_.lock(); + bytes_written = temp_ring_buffer->write_without_replacement(data, length, ticks_to_wait); + } + } + + return bytes_written; +} + +void ResamplerSpeaker::start() { this->state_ = speaker::STATE_STARTING; } + +esp_err_t ResamplerSpeaker::start_() { + this->target_stream_info_ = audio::AudioStreamInfo( + this->target_bits_per_sample_, this->audio_stream_info_.get_channels(), this->target_sample_rate_); + + this->output_speaker_->set_audio_stream_info(this->target_stream_info_); + this->output_speaker_->start(); + + if (this->requires_resampling_()) { + // Start the resampler task to handle converting sample rates + return this->start_task_(); + } + + return ESP_OK; +} + +esp_err_t ResamplerSpeaker::start_task_() { + if (this->task_stack_buffer_ == nullptr) { + if (this->task_stack_in_psram_) { + RAMAllocator stack_allocator(RAMAllocator::ALLOC_EXTERNAL); + this->task_stack_buffer_ = stack_allocator.allocate(TASK_STACK_SIZE); + } else { + RAMAllocator stack_allocator(RAMAllocator::ALLOC_INTERNAL); + this->task_stack_buffer_ = stack_allocator.allocate(TASK_STACK_SIZE); + } + } + + if (this->task_stack_buffer_ == nullptr) { + return ESP_ERR_NO_MEM; + } + + if (this->task_handle_ == nullptr) { + this->task_handle_ = xTaskCreateStatic(resample_task, "sample", TASK_STACK_SIZE, (void *) this, + RESAMPLER_TASK_PRIORITY, this->task_stack_buffer_, &this->task_stack_); + } + + if (this->task_handle_ == nullptr) { + return ESP_ERR_INVALID_STATE; + } + + return ESP_OK; +} + +void ResamplerSpeaker::stop() { this->state_ = speaker::STATE_STOPPING; } + +void ResamplerSpeaker::stop_() { + if (this->task_handle_ != nullptr) { + xEventGroupSetBits(this->event_group_, ResamplingEventGroupBits::COMMAND_STOP); + } + this->output_speaker_->stop(); +} + +esp_err_t ResamplerSpeaker::delete_task_() { + if (!this->task_created_) { + this->task_handle_ = nullptr; + + if (this->task_stack_buffer_ != nullptr) { + if (this->task_stack_in_psram_) { + RAMAllocator stack_allocator(RAMAllocator::ALLOC_EXTERNAL); + stack_allocator.deallocate(this->task_stack_buffer_, TASK_STACK_SIZE); + } else { + RAMAllocator stack_allocator(RAMAllocator::ALLOC_INTERNAL); + stack_allocator.deallocate(this->task_stack_buffer_, TASK_STACK_SIZE); + } + + this->task_stack_buffer_ = nullptr; + } + + return ESP_OK; + } + + return ESP_ERR_INVALID_STATE; +} + +void ResamplerSpeaker::finish() { this->output_speaker_->finish(); } + +bool ResamplerSpeaker::has_buffered_data() const { + bool has_ring_buffer_data = false; + if (this->requires_resampling_() && (this->ring_buffer_.use_count() > 0)) { + has_ring_buffer_data = (this->ring_buffer_.lock()->available() > 0); + } + return (has_ring_buffer_data || this->output_speaker_->has_buffered_data()); +} + +void ResamplerSpeaker::set_mute_state(bool mute_state) { + this->mute_state_ = mute_state; + this->output_speaker_->set_mute_state(mute_state); +} + +void ResamplerSpeaker::set_volume(float volume) { + this->volume_ = volume; + this->output_speaker_->set_volume(volume); +} + +bool ResamplerSpeaker::requires_resampling_() const { + return (this->audio_stream_info_.get_sample_rate() != this->target_sample_rate_) || + (this->audio_stream_info_.get_bits_per_sample() != this->target_bits_per_sample_); +} + +void ResamplerSpeaker::resample_task(void *params) { + ResamplerSpeaker *this_resampler = (ResamplerSpeaker *) params; + + this_resampler->task_created_ = true; + xEventGroupSetBits(this_resampler->event_group_, ResamplingEventGroupBits::STATE_STARTING); + + std::unique_ptr resampler = + make_unique(this_resampler->audio_stream_info_.ms_to_bytes(TRANSFER_BUFFER_DURATION_MS), + this_resampler->target_stream_info_.ms_to_bytes(TRANSFER_BUFFER_DURATION_MS)); + + esp_err_t err = resampler->start(this_resampler->audio_stream_info_, this_resampler->target_stream_info_, + this_resampler->taps_, this_resampler->filters_); + + if (err == ESP_OK) { + std::shared_ptr temp_ring_buffer = + RingBuffer::create(this_resampler->audio_stream_info_.ms_to_bytes(this_resampler->buffer_duration_ms_)); + + if (temp_ring_buffer.use_count() == 0) { + err = ESP_ERR_NO_MEM; + } else { + this_resampler->ring_buffer_ = temp_ring_buffer; + resampler->add_source(this_resampler->ring_buffer_); + + this_resampler->output_speaker_->set_audio_stream_info(this_resampler->target_stream_info_); + resampler->add_sink(this_resampler->output_speaker_); + } + } + + if (err == ESP_OK) { + xEventGroupSetBits(this_resampler->event_group_, ResamplingEventGroupBits::STATE_RUNNING); + } else if (err == ESP_ERR_NO_MEM) { + xEventGroupSetBits(this_resampler->event_group_, ResamplingEventGroupBits::ERR_ESP_NO_MEM); + } else if (err == ESP_ERR_NOT_SUPPORTED) { + xEventGroupSetBits(this_resampler->event_group_, ResamplingEventGroupBits::ERR_ESP_NOT_SUPPORTED); + } + + this_resampler->playback_differential_ms_ = 0; + while (err == ESP_OK) { + uint32_t event_bits = xEventGroupGetBits(this_resampler->event_group_); + + if (event_bits & ResamplingEventGroupBits::COMMAND_STOP) { + break; + } + + // Stop gracefully if the decoder is done + int32_t ms_differential = 0; + audio::AudioResamplerState resampler_state = resampler->resample(false, &ms_differential); + + this_resampler->playback_differential_ms_ += ms_differential; + + if (resampler_state == audio::AudioResamplerState::FINISHED) { + break; + } else if (resampler_state == audio::AudioResamplerState::FAILED) { + xEventGroupSetBits(this_resampler->event_group_, ResamplingEventGroupBits::ERR_ESP_FAIL); + break; + } + } + + xEventGroupSetBits(this_resampler->event_group_, ResamplingEventGroupBits::STATE_STOPPING); + resampler.reset(); + xEventGroupSetBits(this_resampler->event_group_, ResamplingEventGroupBits::STATE_STOPPED); + this_resampler->task_created_ = false; + vTaskDelete(nullptr); +} + +} // namespace resampler +} // namespace esphome + +#endif diff --git a/esphome/components/resampler/speaker/resampler_speaker.h b/esphome/components/resampler/speaker/resampler_speaker.h new file mode 100644 index 0000000000..c44f740fa2 --- /dev/null +++ b/esphome/components/resampler/speaker/resampler_speaker.h @@ -0,0 +1,107 @@ +#pragma once + +#ifdef USE_ESP32 + +#include "esphome/components/audio/audio.h" +#include "esphome/components/audio/audio_transfer_buffer.h" +#include "esphome/components/speaker/speaker.h" + +#include "esphome/core/component.h" + +#include +#include + +namespace esphome { +namespace resampler { + +class ResamplerSpeaker : public Component, public speaker::Speaker { + public: + float get_setup_priority() const override { return esphome::setup_priority::DATA; } + void setup() override; + void loop() override; + + size_t play(const uint8_t *data, size_t length, TickType_t ticks_to_wait) override; + size_t play(const uint8_t *data, size_t length) override { return this->play(data, length, 0); } + + void start() override; + void stop() override; + void finish() override; + + void set_pause_state(bool pause_state) override { this->output_speaker_->set_pause_state(pause_state); } + bool get_pause_state() const override { return this->output_speaker_->get_pause_state(); } + + bool has_buffered_data() const override; + + /// @brief Mute state changes are passed to the parent's output speaker + void set_mute_state(bool mute_state) override; + + /// @brief Volume state changes are passed to the parent's output speaker + void set_volume(float volume) override; + + void set_output_speaker(speaker::Speaker *speaker) { this->output_speaker_ = speaker; } + void set_task_stack_in_psram(bool task_stack_in_psram) { this->task_stack_in_psram_ = task_stack_in_psram; } + + void set_target_bits_per_sample(uint8_t target_bits_per_sample) { + this->target_bits_per_sample_ = target_bits_per_sample; + } + void set_target_sample_rate(uint32_t target_sample_rate) { this->target_sample_rate_ = target_sample_rate; } + + void set_filters(uint16_t filters) { this->filters_ = filters; } + void set_taps(uint16_t taps) { this->taps_ = taps; } + + void set_buffer_duration(uint32_t buffer_duration_ms) { this->buffer_duration_ms_ = buffer_duration_ms; } + + protected: + /// @brief Starts the output speaker after setting the resampled stream info. If resampling is required, it starts the + /// task. + /// @return ESP_OK if resampling is required + /// return value of start_task_() if resampling is required + esp_err_t start_(); + + /// @brief Starts the resampler task after allocating the task stack + /// @return ESP_OK if successful, + /// ESP_ERR_NO_MEM if the task stack couldn't be allocated + /// ESP_ERR_INVALID_STATE if the task wasn't created + esp_err_t start_task_(); + + /// @brief Stops the output speaker. If the resampling task is running, it sends the stop command. + void stop_(); + + /// @brief Deallocates the task stack and resets the pointers. + /// @return ESP_OK if successful + /// ESP_ERR_INVALID_STATE if the task hasn't stopped itself + esp_err_t delete_task_(); + + inline bool requires_resampling_() const; + static void resample_task(void *params); + + EventGroupHandle_t event_group_{nullptr}; + + std::weak_ptr ring_buffer_; + + speaker::Speaker *output_speaker_{nullptr}; + + bool task_stack_in_psram_{false}; + bool task_created_{false}; + + TaskHandle_t task_handle_{nullptr}; + StaticTask_t task_stack_; + StackType_t *task_stack_buffer_{nullptr}; + + audio::AudioStreamInfo target_stream_info_; + + uint16_t taps_; + uint16_t filters_; + + uint8_t target_bits_per_sample_; + uint32_t target_sample_rate_; + + uint32_t buffer_duration_ms_; + + int32_t playback_differential_ms_{0}; +}; + +} // namespace resampler +} // namespace esphome + +#endif diff --git a/esphome/components/rp2040/gpio.h b/esphome/components/rp2040/gpio.h index ef9500d5dd..9bc66d9e4b 100644 --- a/esphome/components/rp2040/gpio.h +++ b/esphome/components/rp2040/gpio.h @@ -22,6 +22,7 @@ class RP2040GPIOPin : public InternalGPIOPin { void detach_interrupt() const override; ISRInternalGPIOPin to_isr() const override; uint8_t get_pin() const override { return pin_; } + gpio::Flags get_flags() const override { return flags_; } bool is_inverted() const override { return inverted_; } protected: diff --git a/esphome/components/sn74hc165/sn74hc165.h b/esphome/components/sn74hc165/sn74hc165.h index c349d079ae..4684844687 100644 --- a/esphome/components/sn74hc165/sn74hc165.h +++ b/esphome/components/sn74hc165/sn74hc165.h @@ -52,6 +52,9 @@ class SN74HC165GPIOPin : public GPIOPin, public Parented { void set_pin(uint16_t pin) { pin_ = pin; } void set_inverted(bool inverted) { inverted_ = inverted; } + /// Always returns `gpio::Flags::FLAG_INPUT`. + gpio::Flags get_flags() const override { return gpio::Flags::FLAG_INPUT; } + protected: uint16_t pin_; bool inverted_; diff --git a/esphome/components/sn74hc595/sn74hc595.h b/esphome/components/sn74hc595/sn74hc595.h index cb9d7bf140..181015b1e6 100644 --- a/esphome/components/sn74hc595/sn74hc595.h +++ b/esphome/components/sn74hc595/sn74hc595.h @@ -59,6 +59,9 @@ class SN74HC595GPIOPin : public GPIOPin, public Parented { void set_pin(uint16_t pin) { pin_ = pin; } void set_inverted(bool inverted) { inverted_ = inverted; } + /// Always returns `gpio::Flags::FLAG_OUTPUT`. + gpio::Flags get_flags() const override { return gpio::Flags::FLAG_OUTPUT; } + protected: uint16_t pin_; bool inverted_; diff --git a/esphome/components/speaker/__init__.py b/esphome/components/speaker/__init__.py index 948fe4b534..2ac1ca0cb9 100644 --- a/esphome/components/speaker/__init__.py +++ b/esphome/components/speaker/__init__.py @@ -1,7 +1,6 @@ from esphome import automation -from esphome.automation import maybe_simple_id import esphome.codegen as cg -from esphome.components import audio_dac +from esphome.components import audio, audio_dac import esphome.config_validation as cv from esphome.const import CONF_DATA, CONF_ID, CONF_VOLUME from esphome.core import CORE @@ -54,13 +53,15 @@ async def register_speaker(var, config): await setup_speaker_core_(var, config) -SPEAKER_SCHEMA = cv.Schema( +SPEAKER_SCHEMA = cv.Schema.extend(audio.AUDIO_COMPONENT_SCHEMA).extend( { cv.Optional(CONF_AUDIO_DAC): cv.use_id(audio_dac.AudioDac), } ) -SPEAKER_AUTOMATION_SCHEMA = maybe_simple_id({cv.GenerateID(): cv.use_id(Speaker)}) +SPEAKER_AUTOMATION_SCHEMA = automation.maybe_simple_id( + {cv.GenerateID(): cv.use_id(Speaker)} +) async def speaker_action(config, action_id, template_arg, args): diff --git a/esphome/components/speaker/speaker.h b/esphome/components/speaker/speaker.h index 96843e2d5a..74c4822eca 100644 --- a/esphome/components/speaker/speaker.h +++ b/esphome/components/speaker/speaker.h @@ -9,6 +9,7 @@ #endif #include "esphome/core/defines.h" +#include "esphome/core/helpers.h" #include "esphome/components/audio/audio.h" #ifdef USE_AUDIO_DAC @@ -56,6 +57,10 @@ class Speaker { // When finish() is not implemented on the platform component it should just do a normal stop. virtual void finish() { this->stop(); } + // Pauses processing incoming audio. Needs to be implemented specifically per speaker component + virtual void set_pause_state(bool pause_state) {} + virtual bool get_pause_state() const { return false; } + virtual bool has_buffered_data() const = 0; bool is_running() const { return this->state_ == STATE_RUNNING; } @@ -95,6 +100,19 @@ class Speaker { this->audio_stream_info_ = audio_stream_info; } + audio::AudioStreamInfo &get_audio_stream_info() { return this->audio_stream_info_; } + + /// Callback function for sending the duration of the audio written to the speaker since the last callback. + /// Parameters: + /// - Duration in milliseconds. Never rounded and should always be less than or equal to the actual duration. + /// - Remainder duration in microseconds. Rounded duration after subtracting the previous parameter from the actual + /// duration. + /// - Duration of remaining, unwritten audio buffered in the speaker in milliseconds. + /// - System time in microseconds when the last write was completed. + void add_audio_output_callback(std::function &&callback) { + this->audio_output_callback_.add(std::move(callback)); + } + protected: State state_{STATE_STOPPED}; audio::AudioStreamInfo audio_stream_info_; @@ -104,6 +122,8 @@ class Speaker { #ifdef USE_AUDIO_DAC audio_dac::AudioDac *audio_dac_{nullptr}; #endif + + CallbackManager audio_output_callback_{}; }; } // namespace speaker diff --git a/esphome/components/spi/spi.h b/esphome/components/spi/spi.h index f581dc3f56..64463747a2 100644 --- a/esphome/components/spi/spi.h +++ b/esphome/components/spi/spi.h @@ -114,6 +114,8 @@ class NullPin : public GPIOPin { void pin_mode(gpio::Flags flags) override {} + gpio::Flags get_flags() const override { return gpio::Flags::FLAG_NONE; } + bool digital_read() override { return false; } void digital_write(bool value) override {} diff --git a/esphome/components/sx1509/sx1509_gpio_pin.h b/esphome/components/sx1509/sx1509_gpio_pin.h index 1cfa341ee7..eb9207e882 100644 --- a/esphome/components/sx1509/sx1509_gpio_pin.h +++ b/esphome/components/sx1509/sx1509_gpio_pin.h @@ -20,6 +20,8 @@ class SX1509GPIOPin : public GPIOPin { void set_inverted(bool inverted) { this->inverted_ = inverted; } void set_flags(gpio::Flags flags) { this->flags_ = flags; } + gpio::Flags get_flags() const override { return this->flags_; } + protected: SX1509Component *parent_; uint8_t pin_; diff --git a/esphome/components/tca9555/tca9555.h b/esphome/components/tca9555/tca9555.h index ea464db043..0c236ae4e3 100644 --- a/esphome/components/tca9555/tca9555.h +++ b/esphome/components/tca9555/tca9555.h @@ -54,6 +54,8 @@ class TCA9555GPIOPin : public GPIOPin, public Parented { void set_inverted(bool inverted) { this->inverted_ = inverted; } void set_flags(gpio::Flags flags) { this->flags_ = flags; } + gpio::Flags get_flags() const override { return this->flags_; } + protected: uint8_t pin_; bool inverted_; diff --git a/esphome/components/udp/__init__.py b/esphome/components/udp/__init__.py index 5485663f1c..140d1e4236 100644 --- a/esphome/components/udp/__init__.py +++ b/esphome/components/udp/__init__.py @@ -18,7 +18,7 @@ from esphome.cpp_generator import MockObjClass CODEOWNERS = ["@clydebarrow"] DEPENDENCIES = ["network"] -AUTO_LOAD = ["socket"] +AUTO_LOAD = ["socket", "xxtea"] MULTI_CONF = True udp_ns = cg.esphome_ns.namespace("udp") diff --git a/esphome/components/udp/udp_component.cpp b/esphome/components/udp/udp_component.cpp index 30f7356879..59cba8c7fe 100644 --- a/esphome/components/udp/udp_component.cpp +++ b/esphome/components/udp/udp_component.cpp @@ -3,6 +3,8 @@ #include "esphome/components/network/util.h" #include "udp_component.h" +#include "esphome/components/xxtea/xxtea.h" + namespace esphome { namespace udp { @@ -47,54 +49,7 @@ namespace udp { */ static const char *const TAG = "udp"; -/** - * XXTEA implementation, using 256 bit key. - */ - -static const uint32_t DELTA = 0x9e3779b9; -#define MX ((((z >> 5) ^ (y << 2)) + ((y >> 3) ^ (z << 4))) ^ ((sum ^ y) + (k[(p ^ e) & 7] ^ z))) - -/** - * Encrypt a block of data in-place - */ - -static void xxtea_encrypt(uint32_t *v, size_t n, const uint32_t *k) { - uint32_t z, y, sum, e; - size_t p; - size_t q = 6 + 52 / n; - sum = 0; - z = v[n - 1]; - while (q-- != 0) { - sum += DELTA; - e = (sum >> 2); - for (p = 0; p != n - 1; p++) { - y = v[p + 1]; - z = v[p] += MX; - } - y = v[0]; - z = v[n - 1] += MX; - } -} - -static void xxtea_decrypt(uint32_t *v, size_t n, const uint32_t *k) { - uint32_t z, y, sum, e; - size_t p; - size_t q = 6 + 52 / n; - sum = q * DELTA; - y = v[0]; - while (q-- != 0) { - e = (sum >> 2); - for (p = n - 1; p != 0; p--) { - z = v[p - 1]; - y = v[p] -= MX; - } - z = v[n - 1]; - y = v[0] -= MX; - sum -= DELTA; - } -} - -inline static size_t round4(size_t value) { return (value + 3) & ~3; } +static size_t round4(size_t value) { return (value + 3) & ~3; } union FuData { uint32_t u32; @@ -312,7 +267,7 @@ void UDPComponent::flush_() { memcpy(buffer, this->header_.data(), this->header_.size()); memcpy(buffer + header_len, this->data_.data(), this->data_.size()); if (this->is_encrypted_()) { - xxtea_encrypt(buffer + header_len, len, (uint32_t *) this->encryption_key_.data()); + xxtea::encrypt(buffer + header_len, len, (uint32_t *) this->encryption_key_.data()); } auto total_len = (header_len + len) * 4; this->send_packet_(buffer, total_len); @@ -503,7 +458,7 @@ void UDPComponent::process_(uint8_t *buf, const size_t len) { #endif if (!provider.encryption_key.empty()) { - xxtea_decrypt((uint32_t *) buf, (end - buf) / 4, (uint32_t *) provider.encryption_key.data()); + xxtea::decrypt((uint32_t *) buf, (end - buf) / 4, (uint32_t *) provider.encryption_key.data()); } byte = *buf++; if (byte == ROLLING_CODE_KEY) { diff --git a/esphome/components/weikai/weikai.h b/esphome/components/weikai/weikai.h index 175a067b27..987278213a 100644 --- a/esphome/components/weikai/weikai.h +++ b/esphome/components/weikai/weikai.h @@ -275,6 +275,8 @@ class WeikaiGPIOPin : public GPIOPin { void set_inverted(bool inverted) { this->inverted_ = inverted; } void set_flags(gpio::Flags flags) { this->flags_ = flags; } + gpio::Flags get_flags() const override { return this->flags_; } + void setup() override; std::string dump_summary() const override; void pin_mode(gpio::Flags flags) override { this->parent_->set_pin_direction_(this->pin_, flags); } diff --git a/esphome/components/xl9535/xl9535.h b/esphome/components/xl9535/xl9535.h index dd67990fa8..3b511fd9b3 100644 --- a/esphome/components/xl9535/xl9535.h +++ b/esphome/components/xl9535/xl9535.h @@ -36,6 +36,8 @@ class XL9535GPIOPin : public GPIOPin { void set_inverted(bool inverted) { this->inverted_ = inverted; } void set_flags(gpio::Flags flags) { this->flags_ = flags; } + gpio::Flags get_flags() const override { return this->flags_; } + void setup() override; std::string dump_summary() const override; void pin_mode(gpio::Flags flags) override; diff --git a/esphome/components/xxtea/__init__.py b/esphome/components/xxtea/__init__.py new file mode 100644 index 0000000000..7a7bce1781 --- /dev/null +++ b/esphome/components/xxtea/__init__.py @@ -0,0 +1,3 @@ +"""ESPHome XXTEA encryption component.""" + +CODEOWNERS = ["@clydebarrow"] diff --git a/esphome/components/xxtea/xxtea.cpp b/esphome/components/xxtea/xxtea.cpp new file mode 100644 index 0000000000..aae663ee01 --- /dev/null +++ b/esphome/components/xxtea/xxtea.cpp @@ -0,0 +1,46 @@ +#include "xxtea.h" + +namespace esphome { +namespace xxtea { + +static const uint32_t DELTA = 0x9e3779b9; +#define MX ((((z >> 5) ^ (y << 2)) + ((y >> 3) ^ (z << 4))) ^ ((sum ^ y) + (k[(p ^ e) & 7] ^ z))) + +void encrypt(uint32_t *v, size_t n, const uint32_t *k) { + uint32_t z, y, sum, e; + size_t p; + size_t q = 6 + 52 / n; + sum = 0; + z = v[n - 1]; + while (q-- != 0) { + sum += DELTA; + e = (sum >> 2); + for (p = 0; p != n - 1; p++) { + y = v[p + 1]; + z = v[p] += MX; + } + y = v[0]; + z = v[n - 1] += MX; + } +} + +void decrypt(uint32_t *v, size_t n, const uint32_t *k) { + uint32_t z, y, sum, e; + size_t p; + size_t q = 6 + 52 / n; + sum = q * DELTA; + y = v[0]; + while (q-- != 0) { + e = (sum >> 2); + for (p = n - 1; p != 0; p--) { + z = v[p - 1]; + y = v[p] -= MX; + } + z = v[n - 1]; + y = v[0] -= MX; + sum -= DELTA; + } +} + +} // namespace xxtea +} // namespace esphome diff --git a/esphome/components/xxtea/xxtea.h b/esphome/components/xxtea/xxtea.h new file mode 100644 index 0000000000..86afbd1d46 --- /dev/null +++ b/esphome/components/xxtea/xxtea.h @@ -0,0 +1,26 @@ +#pragma once + +#include +#include + +namespace esphome { +namespace xxtea { + +/** + * Encrypt a block of data in-place using XXTEA algorithm with 256-bit key + * @param v Data to encrypt (as array of 32-bit words) + * @param n Number of 32-bit words in data + * @param k Key (array of 8 32-bit words) + */ +void encrypt(uint32_t *v, size_t n, const uint32_t *k); + +/** + * Decrypt a block of data in-place using XXTEA algorithm with 256-bit key + * @param v Data to decrypt (as array of 32-bit words) + * @param n Number of 32-bit words in data + * @param k Key (array of 8 32-bit words) + */ +void decrypt(uint32_t *v, size_t n, const uint32_t *k); + +} // namespace xxtea +} // namespace esphome diff --git a/esphome/const.py b/esphome/const.py index ab41d8cbc2..16bfda9478 100644 --- a/esphome/const.py +++ b/esphome/const.py @@ -94,6 +94,7 @@ CONF_BRIGHTNESS = "brightness" CONF_BRIGHTNESS_LIMITS = "brightness_limits" CONF_BROKER = "broker" CONF_BSSID = "bssid" +CONF_BUFFER_DURATION = "buffer_duration" CONF_BUFFER_SIZE = "buffer_size" CONF_BUILD_PATH = "build_path" CONF_BUS_VOLTAGE = "bus_voltage" @@ -527,6 +528,7 @@ CONF_NAME_FONT = "name_font" CONF_NBITS = "nbits" CONF_NEC = "nec" CONF_NETWORKS = "networks" +CONF_NEVER = "never" CONF_NEW_PASSWORD = "new_password" CONF_NITROGEN_DIOXIDE = "nitrogen_dioxide" CONF_NOISE_LEVEL = "noise_level" @@ -615,6 +617,7 @@ CONF_OTA = "ota" CONF_OUTDOOR_TEMPERATURE = "outdoor_temperature" CONF_OUTPUT = "output" CONF_OUTPUT_ID = "output_id" +CONF_OUTPUT_SPEAKER = "output_speaker" CONF_OUTPUTS = "outputs" CONF_OVERSAMPLING = "oversampling" CONF_PACKAGES = "packages" @@ -859,6 +862,7 @@ CONF_TARGET_TEMPERATURE_LOW = "target_temperature_low" CONF_TARGET_TEMPERATURE_LOW_COMMAND_TOPIC = "target_temperature_low_command_topic" CONF_TARGET_TEMPERATURE_LOW_STATE_TOPIC = "target_temperature_low_state_topic" CONF_TARGET_TEMPERATURE_STATE_TOPIC = "target_temperature_state_topic" +CONF_TASK_STACK_IN_PSRAM = "task_stack_in_psram" CONF_TEMPERATURE = "temperature" CONF_TEMPERATURE_COMPENSATION = "temperature_compensation" CONF_TEMPERATURE_OFFSET = "temperature_offset" diff --git a/esphome/core/__init__.py b/esphome/core/__init__.py index 59cea6f09b..2d856d99c5 100644 --- a/esphome/core/__init__.py +++ b/esphome/core/__init__.py @@ -689,7 +689,7 @@ class EsphomeCore: _LOGGER.debug("Adding: %s", expression) return expression - def add_global(self, expression): + def add_global(self, expression, prepend=False): from esphome.cpp_generator import Expression, Statement, statement if isinstance(expression, Expression): @@ -698,7 +698,10 @@ class EsphomeCore: raise ValueError( f"Add '{expression}' must be expression or statement, not {type(expression)}" ) - self.global_statements.append(expression) + if prepend: + self.global_statements.insert(0, expression) + else: + self.global_statements.append(expression) _LOGGER.debug("Adding global: %s", expression) return expression diff --git a/esphome/core/config.py b/esphome/core/config.py index 06ae1d7747..7152414463 100644 --- a/esphome/core/config.py +++ b/esphome/core/config.py @@ -72,6 +72,9 @@ def validate_hostname(config): def valid_include(value): + # Look for "<...>" includes + if value.startswith("<") and value.endswith(">"): + return value try: return cv.directory(value) except cv.Invalid: @@ -360,7 +363,19 @@ async def to_code(config): CORE.add_job(add_arduino_global_workaround) if config[CONF_INCLUDES]: - CORE.add_job(add_includes, config[CONF_INCLUDES]) + # Get the <...> includes + system_includes = [] + other_includes = [] + for include in config[CONF_INCLUDES]: + if include.startswith("<") and include.endswith(">"): + system_includes.append(include) + else: + other_includes.append(include) + # <...> includes should be at the start + for include in system_includes: + cg.add_global(cg.RawStatement(f"#include {include}"), prepend=True) + # Other includes should be at the end + CORE.add_job(add_includes, other_includes) if project_conf := config.get(CONF_PROJECT): cg.add_define("ESPHOME_PROJECT_NAME", project_conf[CONF_NAME]) diff --git a/esphome/core/defines.h b/esphome/core/defines.h index 211f3b8319..8407391bce 100644 --- a/esphome/core/defines.h +++ b/esphome/core/defines.h @@ -16,6 +16,8 @@ // Feature flags #define USE_ALARM_CONTROL_PANEL +#define USE_AUDIO_FLAC_SUPPORT +#define USE_AUDIO_MP3_SUPPORT #define USE_API #define USE_API_NOISE #define USE_API_PLAINTEXT diff --git a/esphome/core/gpio.h b/esphome/core/gpio.h index 1b6f2ba1e6..dd6f14fef9 100644 --- a/esphome/core/gpio.h +++ b/esphome/core/gpio.h @@ -53,6 +53,13 @@ class GPIOPin { virtual void pin_mode(gpio::Flags flags) = 0; + /** + * @brief Retrieve GPIO pin flags. + * + * @return The GPIO flags describing the pin mode and properties. + */ + virtual gpio::Flags get_flags() const = 0; + virtual bool digital_read() = 0; virtual void digital_write(bool value) = 0; diff --git a/esphome/cpp_generator.py b/esphome/cpp_generator.py index 7a82d5cba1..4e283868e1 100644 --- a/esphome/cpp_generator.py +++ b/esphome/cpp_generator.py @@ -588,9 +588,9 @@ def add(expression: Union[Expression, Statement]): CORE.add(expression) -def add_global(expression: Union[SafeExpType, Statement]): +def add_global(expression: Union[SafeExpType, Statement], prepend: bool = False): """Add an expression to the codegen global storage (above setup()).""" - CORE.add_global(expression) + CORE.add_global(expression, prepend) def add_library(name: str, version: Optional[str], repository: Optional[str] = None): diff --git a/platformio.ini b/platformio.ini index e91c06d86e..cf11139b73 100644 --- a/platformio.ini +++ b/platformio.ini @@ -127,7 +127,8 @@ lib_deps = ESPmDNS ; mdns (Arduino built-in) DNSServer ; captive_portal (Arduino built-in) esphome/ESP32-audioI2S@2.0.7 ; i2s_audio - droscy/esp_wireguard@0.4.2 ; wireguard + droscy/esp_wireguard@0.4.2 ; wireguard + esphome/esp-audio-libs@1.1.1 ; audio build_flags = ${common:arduino.build_flags} @@ -148,6 +149,7 @@ lib_deps = ${common:idf.lib_deps} droscy/esp_wireguard@0.4.2 ; wireguard kahrendt/ESPMicroSpeechFeatures@1.1.0 ; micro_wake_word + esphome/esp-audio-libs@1.1.1 ; audio build_flags = ${common:idf.build_flags} -Wno-nonnull-compare diff --git a/requirements.txt b/requirements.txt index d96004c8ef..0d93c3cc2d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,7 +14,7 @@ esptool==4.7.0 click==8.1.7 esphome-dashboard==20241217.1 aioesphomeapi==24.6.2 -zeroconf==0.132.2 +zeroconf==0.143.0 puremagic==1.27 ruamel.yaml==0.18.6 # dashboard_import glyphsets==1.0.0 diff --git a/tests/components/a02yyuw/common.yaml b/tests/components/a02yyuw/common.yaml new file mode 100644 index 0000000000..b2e5927ff4 --- /dev/null +++ b/tests/components/a02yyuw/common.yaml @@ -0,0 +1,11 @@ +uart: + - id: uart_a02yyuw + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} + baud_rate: 9600 + +sensor: + - platform: a02yyuw + id: a02yyuw_sensor + name: a02yyuw Distance + uart_id: uart_a02yyuw diff --git a/tests/components/a02yyuw/test.esp32-ard.yaml b/tests/components/a02yyuw/test.esp32-ard.yaml index 98d6a266b3..f486544afa 100644 --- a/tests/components/a02yyuw/test.esp32-ard.yaml +++ b/tests/components/a02yyuw/test.esp32-ard.yaml @@ -1,13 +1,5 @@ -uart: - - id: uart_a02yyuw - tx_pin: - number: 17 - rx_pin: - number: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO17 + rx_pin: GPIO16 -sensor: - - platform: a02yyuw - id: a02yyuw_sensor - name: a02yyuw Distance - uart_id: uart_a02yyuw +<<: !include common.yaml diff --git a/tests/components/a02yyuw/test.esp32-c3-ard.yaml b/tests/components/a02yyuw/test.esp32-c3-ard.yaml index 76e1ad8ee1..b516342f3b 100644 --- a/tests/components/a02yyuw/test.esp32-c3-ard.yaml +++ b/tests/components/a02yyuw/test.esp32-c3-ard.yaml @@ -1,13 +1,5 @@ -uart: - - id: uart_a02yyuw - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -sensor: - - platform: a02yyuw - id: a02yyuw_sensor - name: a02yyuw Distance - uart_id: uart_a02yyuw +<<: !include common.yaml diff --git a/tests/components/a02yyuw/test.esp32-c3-idf.yaml b/tests/components/a02yyuw/test.esp32-c3-idf.yaml index 76e1ad8ee1..b516342f3b 100644 --- a/tests/components/a02yyuw/test.esp32-c3-idf.yaml +++ b/tests/components/a02yyuw/test.esp32-c3-idf.yaml @@ -1,13 +1,5 @@ -uart: - - id: uart_a02yyuw - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -sensor: - - platform: a02yyuw - id: a02yyuw_sensor - name: a02yyuw Distance - uart_id: uart_a02yyuw +<<: !include common.yaml diff --git a/tests/components/a02yyuw/test.esp32-idf.yaml b/tests/components/a02yyuw/test.esp32-idf.yaml index 98d6a266b3..f486544afa 100644 --- a/tests/components/a02yyuw/test.esp32-idf.yaml +++ b/tests/components/a02yyuw/test.esp32-idf.yaml @@ -1,13 +1,5 @@ -uart: - - id: uart_a02yyuw - tx_pin: - number: 17 - rx_pin: - number: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO17 + rx_pin: GPIO16 -sensor: - - platform: a02yyuw - id: a02yyuw_sensor - name: a02yyuw Distance - uart_id: uart_a02yyuw +<<: !include common.yaml diff --git a/tests/components/a02yyuw/test.esp8266-ard.yaml b/tests/components/a02yyuw/test.esp8266-ard.yaml index 76e1ad8ee1..b516342f3b 100644 --- a/tests/components/a02yyuw/test.esp8266-ard.yaml +++ b/tests/components/a02yyuw/test.esp8266-ard.yaml @@ -1,13 +1,5 @@ -uart: - - id: uart_a02yyuw - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -sensor: - - platform: a02yyuw - id: a02yyuw_sensor - name: a02yyuw Distance - uart_id: uart_a02yyuw +<<: !include common.yaml diff --git a/tests/components/a02yyuw/test.rp2040-ard.yaml b/tests/components/a02yyuw/test.rp2040-ard.yaml index 76e1ad8ee1..b516342f3b 100644 --- a/tests/components/a02yyuw/test.rp2040-ard.yaml +++ b/tests/components/a02yyuw/test.rp2040-ard.yaml @@ -1,13 +1,5 @@ -uart: - - id: uart_a02yyuw - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -sensor: - - platform: a02yyuw - id: a02yyuw_sensor - name: a02yyuw Distance - uart_id: uart_a02yyuw +<<: !include common.yaml diff --git a/tests/components/a4988/common.yaml b/tests/components/a4988/common.yaml new file mode 100644 index 0000000000..b85f2f41c6 --- /dev/null +++ b/tests/components/a4988/common.yaml @@ -0,0 +1,9 @@ +stepper: + - platform: a4988 + id: a4988_stepper + step_pin: ${step_pin} + dir_pin: ${dir_pin} + sleep_pin: ${sleep_pin} + max_speed: 250 steps/s + acceleration: 100 steps/s^2 + deceleration: 200 steps/s^2 diff --git a/tests/components/a4988/test.esp32-ard.yaml b/tests/components/a4988/test.esp32-ard.yaml index 0ca5e3f504..1ca8c0c084 100644 --- a/tests/components/a4988/test.esp32-ard.yaml +++ b/tests/components/a4988/test.esp32-ard.yaml @@ -1,12 +1,6 @@ -stepper: - - platform: a4988 - id: a4988_stepper - step_pin: - number: 22 - dir_pin: - number: 23 - sleep_pin: - number: 25 - max_speed: 250 steps/s - acceleration: 100 steps/s^2 - deceleration: 200 steps/s^2 +substitutions: + step_pin: GPIO22 + dir_pin: GPIO23 + sleep_pin: GPIO25 + +<<: !include common.yaml diff --git a/tests/components/a4988/test.esp32-c3-ard.yaml b/tests/components/a4988/test.esp32-c3-ard.yaml index af4e4fa32b..25caba75b5 100644 --- a/tests/components/a4988/test.esp32-c3-ard.yaml +++ b/tests/components/a4988/test.esp32-c3-ard.yaml @@ -1,12 +1,6 @@ -stepper: - - platform: a4988 - id: a4988_stepper - step_pin: - number: 2 - dir_pin: - number: 3 - sleep_pin: - number: 5 - max_speed: 250 steps/s - acceleration: 100 steps/s^2 - deceleration: 200 steps/s^2 +substitutions: + step_pin: GPIO2 + dir_pin: GPIO3 + sleep_pin: GPIO5 + +<<: !include common.yaml diff --git a/tests/components/a4988/test.esp32-c3-idf.yaml b/tests/components/a4988/test.esp32-c3-idf.yaml index af4e4fa32b..25caba75b5 100644 --- a/tests/components/a4988/test.esp32-c3-idf.yaml +++ b/tests/components/a4988/test.esp32-c3-idf.yaml @@ -1,12 +1,6 @@ -stepper: - - platform: a4988 - id: a4988_stepper - step_pin: - number: 2 - dir_pin: - number: 3 - sleep_pin: - number: 5 - max_speed: 250 steps/s - acceleration: 100 steps/s^2 - deceleration: 200 steps/s^2 +substitutions: + step_pin: GPIO2 + dir_pin: GPIO3 + sleep_pin: GPIO5 + +<<: !include common.yaml diff --git a/tests/components/a4988/test.esp32-idf.yaml b/tests/components/a4988/test.esp32-idf.yaml index 0ca5e3f504..1ca8c0c084 100644 --- a/tests/components/a4988/test.esp32-idf.yaml +++ b/tests/components/a4988/test.esp32-idf.yaml @@ -1,12 +1,6 @@ -stepper: - - platform: a4988 - id: a4988_stepper - step_pin: - number: 22 - dir_pin: - number: 23 - sleep_pin: - number: 25 - max_speed: 250 steps/s - acceleration: 100 steps/s^2 - deceleration: 200 steps/s^2 +substitutions: + step_pin: GPIO22 + dir_pin: GPIO23 + sleep_pin: GPIO25 + +<<: !include common.yaml diff --git a/tests/components/a4988/test.esp8266-ard.yaml b/tests/components/a4988/test.esp8266-ard.yaml index f4c1886fc5..22b5677d27 100644 --- a/tests/components/a4988/test.esp8266-ard.yaml +++ b/tests/components/a4988/test.esp8266-ard.yaml @@ -1,12 +1,6 @@ -stepper: - - platform: a4988 - id: a4988_stepper - step_pin: - number: 1 - dir_pin: - number: 2 - sleep_pin: - number: 5 - max_speed: 250 steps/s - acceleration: 100 steps/s^2 - deceleration: 200 steps/s^2 +substitutions: + step_pin: GPIO1 + dir_pin: GPIO2 + sleep_pin: GPIO5 + +<<: !include common.yaml diff --git a/tests/components/a4988/test.rp2040-ard.yaml b/tests/components/a4988/test.rp2040-ard.yaml index af4e4fa32b..25caba75b5 100644 --- a/tests/components/a4988/test.rp2040-ard.yaml +++ b/tests/components/a4988/test.rp2040-ard.yaml @@ -1,12 +1,6 @@ -stepper: - - platform: a4988 - id: a4988_stepper - step_pin: - number: 2 - dir_pin: - number: 3 - sleep_pin: - number: 5 - max_speed: 250 steps/s - acceleration: 100 steps/s^2 - deceleration: 200 steps/s^2 +substitutions: + step_pin: GPIO2 + dir_pin: GPIO3 + sleep_pin: GPIO5 + +<<: !include common.yaml diff --git a/tests/components/ac_dimmer/common.yaml b/tests/components/ac_dimmer/common.yaml new file mode 100644 index 0000000000..8f93066838 --- /dev/null +++ b/tests/components/ac_dimmer/common.yaml @@ -0,0 +1,5 @@ +output: + - platform: ac_dimmer + id: ac_dimmer_1 + gate_pin: ${gate_pin} + zero_cross_pin: ${zero_cross_pin} diff --git a/tests/components/ac_dimmer/test.esp32-ard.yaml b/tests/components/ac_dimmer/test.esp32-ard.yaml index cc17201666..3ec069f430 100644 --- a/tests/components/ac_dimmer/test.esp32-ard.yaml +++ b/tests/components/ac_dimmer/test.esp32-ard.yaml @@ -1,7 +1,5 @@ -output: - - platform: ac_dimmer - id: ac_dimmer_1 - gate_pin: - number: 12 - zero_cross_pin: - number: 13 +substitutions: + gate_pin: GPIO18 + zero_cross_pin: GPIO19 + +<<: !include common.yaml diff --git a/tests/components/ac_dimmer/test.esp32-c3-ard.yaml b/tests/components/ac_dimmer/test.esp32-c3-ard.yaml index f411d376be..5d2d42b713 100644 --- a/tests/components/ac_dimmer/test.esp32-c3-ard.yaml +++ b/tests/components/ac_dimmer/test.esp32-c3-ard.yaml @@ -1,7 +1,5 @@ -output: - - platform: ac_dimmer - id: ac_dimmer_1 - gate_pin: - number: 5 - zero_cross_pin: - number: 6 +substitutions: + gate_pin: GPIO5 + zero_cross_pin: GPIO4 + +<<: !include common.yaml diff --git a/tests/components/ac_dimmer/test.esp8266-ard.yaml b/tests/components/ac_dimmer/test.esp8266-ard.yaml index af18d11c5f..5d2d42b713 100644 --- a/tests/components/ac_dimmer/test.esp8266-ard.yaml +++ b/tests/components/ac_dimmer/test.esp8266-ard.yaml @@ -1,7 +1,5 @@ -output: - - platform: ac_dimmer - id: ac_dimmer_1 - gate_pin: - number: 5 - zero_cross_pin: - number: 4 +substitutions: + gate_pin: GPIO5 + zero_cross_pin: GPIO4 + +<<: !include common.yaml diff --git a/tests/components/ac_dimmer/test.rp2040-ard.yaml b/tests/components/ac_dimmer/test.rp2040-ard.yaml index f411d376be..5d2d42b713 100644 --- a/tests/components/ac_dimmer/test.rp2040-ard.yaml +++ b/tests/components/ac_dimmer/test.rp2040-ard.yaml @@ -1,7 +1,5 @@ -output: - - platform: ac_dimmer - id: ac_dimmer_1 - gate_pin: - number: 5 - zero_cross_pin: - number: 6 +substitutions: + gate_pin: GPIO5 + zero_cross_pin: GPIO4 + +<<: !include common.yaml diff --git a/tests/components/adc/test.esp32-c3-ard.yaml b/tests/components/adc/test.esp32-c3-ard.yaml index 18e5ab3561..e74477c582 100644 --- a/tests/components/adc/test.esp32-c3-ard.yaml +++ b/tests/components/adc/test.esp32-c3-ard.yaml @@ -2,4 +2,4 @@ sensor: - platform: adc id: my_sensor pin: 4 - attenuation: 11db + attenuation: 12db diff --git a/tests/components/adc/test.esp32-s2-ard.yaml b/tests/components/adc/test.esp32-s2-ard.yaml index 0119ad5e4d..e1a6bc22e5 100644 --- a/tests/components/adc/test.esp32-s2-ard.yaml +++ b/tests/components/adc/test.esp32-s2-ard.yaml @@ -2,4 +2,4 @@ sensor: - platform: adc id: my_sensor pin: 1 - attenuation: 11db + attenuation: 12db diff --git a/tests/components/adc/test.esp32-s3-ard.yaml b/tests/components/adc/test.esp32-s3-ard.yaml index 0119ad5e4d..e1a6bc22e5 100644 --- a/tests/components/adc/test.esp32-s3-ard.yaml +++ b/tests/components/adc/test.esp32-s3-ard.yaml @@ -2,4 +2,4 @@ sensor: - platform: adc id: my_sensor pin: 1 - attenuation: 11db + attenuation: 12db diff --git a/tests/components/adc128s102/common.yaml b/tests/components/adc128s102/common.yaml new file mode 100644 index 0000000000..5f1638a7e2 --- /dev/null +++ b/tests/components/adc128s102/common.yaml @@ -0,0 +1,14 @@ +spi: + - id: spi_adc128s102 + clk_pin: ${clk_pin} + mosi_pin: ${mosi_pin} + miso_pin: ${miso_pin} + +adc128s102: + cs_pin: ${cs_pin} + id: adc128s102_adc + +sensor: + - platform: adc128s102 + id: adc128s102_channel_0 + channel: 0 diff --git a/tests/components/adc128s102/test.esp32-ard.yaml b/tests/components/adc128s102/test.esp32-ard.yaml index 005fbccc34..aba72f0614 100644 --- a/tests/components/adc128s102/test.esp32-ard.yaml +++ b/tests/components/adc128s102/test.esp32-ard.yaml @@ -1,14 +1,7 @@ -spi: - - id: spi_adc128s102 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO12 -adc128s102: - cs_pin: 12 - id: adc128s102_adc - -sensor: - - platform: adc128s102 - id: adc128s102_channel_0 - channel: 0 +<<: !include common.yaml diff --git a/tests/components/adc128s102/test.esp32-c3-ard.yaml b/tests/components/adc128s102/test.esp32-c3-ard.yaml index 8edf745e58..24da4b5452 100644 --- a/tests/components/adc128s102/test.esp32-c3-ard.yaml +++ b/tests/components/adc128s102/test.esp32-c3-ard.yaml @@ -1,14 +1,7 @@ -spi: - - id: spi_adc128s102 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO2 -adc128s102: - cs_pin: 8 - id: adc128s102_adc - -sensor: - - platform: adc128s102 - id: adc128s102_channel_0 - channel: 0 +<<: !include common.yaml diff --git a/tests/components/adc128s102/test.esp32-c3-idf.yaml b/tests/components/adc128s102/test.esp32-c3-idf.yaml index 8edf745e58..24da4b5452 100644 --- a/tests/components/adc128s102/test.esp32-c3-idf.yaml +++ b/tests/components/adc128s102/test.esp32-c3-idf.yaml @@ -1,14 +1,7 @@ -spi: - - id: spi_adc128s102 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO2 -adc128s102: - cs_pin: 8 - id: adc128s102_adc - -sensor: - - platform: adc128s102 - id: adc128s102_channel_0 - channel: 0 +<<: !include common.yaml diff --git a/tests/components/adc128s102/test.esp32-idf.yaml b/tests/components/adc128s102/test.esp32-idf.yaml index 005fbccc34..aba72f0614 100644 --- a/tests/components/adc128s102/test.esp32-idf.yaml +++ b/tests/components/adc128s102/test.esp32-idf.yaml @@ -1,14 +1,7 @@ -spi: - - id: spi_adc128s102 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO12 -adc128s102: - cs_pin: 12 - id: adc128s102_adc - -sensor: - - platform: adc128s102 - id: adc128s102_channel_0 - channel: 0 +<<: !include common.yaml diff --git a/tests/components/adc128s102/test.esp8266-ard.yaml b/tests/components/adc128s102/test.esp8266-ard.yaml index 09a51caec1..dbd158d030 100644 --- a/tests/components/adc128s102/test.esp8266-ard.yaml +++ b/tests/components/adc128s102/test.esp8266-ard.yaml @@ -1,14 +1,7 @@ -spi: - - id: spi_adc128s102 - clk_pin: 14 - mosi_pin: 13 - miso_pin: 12 +substitutions: + clk_pin: GPIO14 + mosi_pin: GPIO13 + miso_pin: GPIO12 + cs_pin: GPIO15 -adc128s102: - cs_pin: 15 - id: adc128s102_adc - -sensor: - - platform: adc128s102 - id: adc128s102_channel_0 - channel: 0 +<<: !include common.yaml diff --git a/tests/components/adc128s102/test.rp2040-ard.yaml b/tests/components/adc128s102/test.rp2040-ard.yaml index a7d54cbfe6..f6c3f1eeca 100644 --- a/tests/components/adc128s102/test.rp2040-ard.yaml +++ b/tests/components/adc128s102/test.rp2040-ard.yaml @@ -1,14 +1,7 @@ -spi: - - id: spi_adc128s102 - clk_pin: 2 - mosi_pin: 3 - miso_pin: 4 +substitutions: + clk_pin: GPIO2 + mosi_pin: GPIO3 + miso_pin: GPIO4 + cs_pin: GPIO5 -adc128s102: - cs_pin: 5 - id: adc128s102_adc - -sensor: - - platform: adc128s102 - id: adc128s102_channel_0 - channel: 0 +<<: !include common.yaml diff --git a/tests/components/addressable_light/test.esp32-c3-ard.yaml b/tests/components/addressable_light/common-ard-esp32_rmt_led_strip.yaml similarity index 98% rename from tests/components/addressable_light/test.esp32-c3-ard.yaml rename to tests/components/addressable_light/common-ard-esp32_rmt_led_strip.yaml index f587113fac..9c5e63cdc6 100644 --- a/tests/components/addressable_light/test.esp32-c3-ard.yaml +++ b/tests/components/addressable_light/common-ard-esp32_rmt_led_strip.yaml @@ -5,7 +5,7 @@ light: chipset: ws2812 rgb_order: GRB num_leds: 256 - pin: 2 + pin: ${pin} rmt_channel: 0 display: diff --git a/tests/components/addressable_light/test.esp32-ard.yaml b/tests/components/addressable_light/common-ard-fastled.yaml similarity index 98% rename from tests/components/addressable_light/test.esp32-ard.yaml rename to tests/components/addressable_light/common-ard-fastled.yaml index f7717be610..77a5c5fe12 100644 --- a/tests/components/addressable_light/test.esp32-ard.yaml +++ b/tests/components/addressable_light/common-ard-fastled.yaml @@ -3,7 +3,7 @@ light: id: led_matrix_32x8 name: led_matrix_32x8 chipset: WS2812B - pin: 2 + pin: ${pin} num_leds: 256 rgb_order: GRB default_transition_length: 0s diff --git a/tests/components/addressable_light/test.esp32-c3-idf.yaml b/tests/components/addressable_light/common-idf-esp32_rmt_led_strip.yaml similarity index 98% rename from tests/components/addressable_light/test.esp32-c3-idf.yaml rename to tests/components/addressable_light/common-idf-esp32_rmt_led_strip.yaml index 7b3516345d..a071f9df91 100644 --- a/tests/components/addressable_light/test.esp32-c3-idf.yaml +++ b/tests/components/addressable_light/common-idf-esp32_rmt_led_strip.yaml @@ -5,7 +5,7 @@ light: chipset: ws2812 rgb_order: GRB num_leds: 256 - pin: 2 + pin: ${pin} display: - platform: addressable_light diff --git a/tests/components/addressable_light/esp32_rmt_led_strip.esp32-ard.yaml b/tests/components/addressable_light/esp32_rmt_led_strip.esp32-ard.yaml new file mode 100644 index 0000000000..d93c554dae --- /dev/null +++ b/tests/components/addressable_light/esp32_rmt_led_strip.esp32-ard.yaml @@ -0,0 +1,4 @@ +substitutions: + pin: GPIO2 + +<<: !include common-ard-esp32_rmt_led_strip.yaml diff --git a/tests/components/addressable_light/esp32_rmt_led_strip.esp32-c3-ard.yaml b/tests/components/addressable_light/esp32_rmt_led_strip.esp32-c3-ard.yaml new file mode 100644 index 0000000000..d93c554dae --- /dev/null +++ b/tests/components/addressable_light/esp32_rmt_led_strip.esp32-c3-ard.yaml @@ -0,0 +1,4 @@ +substitutions: + pin: GPIO2 + +<<: !include common-ard-esp32_rmt_led_strip.yaml diff --git a/tests/components/addressable_light/esp32_rmt_led_strip.esp32-c3-idf.yaml b/tests/components/addressable_light/esp32_rmt_led_strip.esp32-c3-idf.yaml new file mode 100644 index 0000000000..ca2c244d80 --- /dev/null +++ b/tests/components/addressable_light/esp32_rmt_led_strip.esp32-c3-idf.yaml @@ -0,0 +1,4 @@ +substitutions: + pin: GPIO2 + +<<: !include common-idf-esp32_rmt_led_strip.yaml diff --git a/tests/components/addressable_light/esp32_rmt_led_strip.esp32-idf.yaml b/tests/components/addressable_light/esp32_rmt_led_strip.esp32-idf.yaml new file mode 100644 index 0000000000..ca2c244d80 --- /dev/null +++ b/tests/components/addressable_light/esp32_rmt_led_strip.esp32-idf.yaml @@ -0,0 +1,4 @@ +substitutions: + pin: GPIO2 + +<<: !include common-idf-esp32_rmt_led_strip.yaml diff --git a/tests/components/addressable_light/fastled_clockless.esp32-ard.yaml b/tests/components/addressable_light/fastled_clockless.esp32-ard.yaml new file mode 100644 index 0000000000..78eb5d7fdb --- /dev/null +++ b/tests/components/addressable_light/fastled_clockless.esp32-ard.yaml @@ -0,0 +1,4 @@ +substitutions: + pin: GPIO2 + +<<: !include common-ard-fastled.yaml diff --git a/tests/components/addressable_light/test.esp32-idf.yaml b/tests/components/addressable_light/test.esp32-idf.yaml deleted file mode 100644 index 7b3516345d..0000000000 --- a/tests/components/addressable_light/test.esp32-idf.yaml +++ /dev/null @@ -1,30 +0,0 @@ -light: - - platform: esp32_rmt_led_strip - id: led_matrix_32x8 - default_transition_length: 500ms - chipset: ws2812 - rgb_order: GRB - num_leds: 256 - pin: 2 - -display: - - platform: addressable_light - id: led_matrix_32x8_display - addressable_light_id: led_matrix_32x8 - width: 32 - height: 8 - pixel_mapper: |- - if (x % 2 == 0) { - return (x * 8) + y; - } - return (x * 8) + (7 - y); - lambda: |- - Color red = Color(0xFF0000); - Color green = Color(0x00FF00); - Color blue = Color(0x0000FF); - it.rectangle(0, 0, it.get_width(), it.get_height(), red); - it.rectangle(1, 1, it.get_width()-2, it.get_height()-2, green); - it.rectangle(2, 2, it.get_width()-4, it.get_height()-4, blue); - it.rectangle(3, 3, it.get_width()-6, it.get_height()-6, red); - rotation: 0° - update_interval: 16ms diff --git a/tests/components/ade7953_i2c/common.yaml b/tests/components/ade7953_i2c/common.yaml new file mode 100644 index 0000000000..a2d163567d --- /dev/null +++ b/tests/components/ade7953_i2c/common.yaml @@ -0,0 +1,34 @@ +i2c: + - id: i2c_ade7953 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: ade7953_i2c + irq_pin: ${irq_pin} + voltage: + name: ADE7953 Voltage + id: ade7953_voltage + current_a: + name: ADE7953 Current A + id: ade7953_current_a + current_b: + name: ADE7953 Current B + id: ade7953_current_b + power_factor_a: + name: ADE7953 Power Factor A + power_factor_b: + name: ADE7953 Power Factor B + apparent_power_a: + name: ADE7953 Apparent Power A + apparent_power_b: + name: ADE7953 Apparent Power B + active_power_a: + name: ADE7953 Active Power A + active_power_b: + name: ADE7953 Active Power B + reactive_power_a: + name: ADE7953 Reactive Power A + reactive_power_b: + name: ADE7953 Reactive Power B + update_interval: 1s diff --git a/tests/components/ade7953_i2c/test.esp32-ard.yaml b/tests/components/ade7953_i2c/test.esp32-ard.yaml index 71602f20a3..2c57d412f6 100644 --- a/tests/components/ade7953_i2c/test.esp32-ard.yaml +++ b/tests/components/ade7953_i2c/test.esp32-ard.yaml @@ -1,34 +1,6 @@ -i2c: - - id: i2c_ade7953 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 + irq_pin: GPIO15 -sensor: - - platform: ade7953_i2c - irq_pin: 15 - voltage: - name: ADE7953 Voltage - id: ade7953_voltage - current_a: - name: ADE7953 Current A - id: ade7953_current_a - current_b: - name: ADE7953 Current B - id: ade7953_current_b - power_factor_a: - name: ADE7953 Power Factor A - power_factor_b: - name: ADE7953 Power Factor B - apparent_power_a: - name: ADE7953 Apparent Power A - apparent_power_b: - name: ADE7953 Apparent Power B - active_power_a: - name: ADE7953 Active Power A - active_power_b: - name: ADE7953 Active Power B - reactive_power_a: - name: ADE7953 Reactive Power A - reactive_power_b: - name: ADE7953 Reactive Power B - update_interval: 1s +<<: !include common.yaml diff --git a/tests/components/ade7953_i2c/test.esp32-c3-ard.yaml b/tests/components/ade7953_i2c/test.esp32-c3-ard.yaml index d7b365a7e1..799acabd5a 100644 --- a/tests/components/ade7953_i2c/test.esp32-c3-ard.yaml +++ b/tests/components/ade7953_i2c/test.esp32-c3-ard.yaml @@ -1,34 +1,6 @@ -i2c: - - id: i2c_ade7953 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + irq_pin: GPIO6 -sensor: - - platform: ade7953_i2c - irq_pin: 6 - voltage: - name: ADE7953 Voltage - id: ade7953_voltage - current_a: - name: ADE7953 Current A - id: ade7953_current_a - current_b: - name: ADE7953 Current B - id: ade7953_current_b - power_factor_a: - name: ADE7953 Power Factor A - power_factor_b: - name: ADE7953 Power Factor B - apparent_power_a: - name: ADE7953 Apparent Power A - apparent_power_b: - name: ADE7953 Apparent Power B - active_power_a: - name: ADE7953 Active Power A - active_power_b: - name: ADE7953 Active Power B - reactive_power_a: - name: ADE7953 Reactive Power A - reactive_power_b: - name: ADE7953 Reactive Power B - update_interval: 1s +<<: !include common.yaml diff --git a/tests/components/ade7953_i2c/test.esp32-c3-idf.yaml b/tests/components/ade7953_i2c/test.esp32-c3-idf.yaml index d7b365a7e1..799acabd5a 100644 --- a/tests/components/ade7953_i2c/test.esp32-c3-idf.yaml +++ b/tests/components/ade7953_i2c/test.esp32-c3-idf.yaml @@ -1,34 +1,6 @@ -i2c: - - id: i2c_ade7953 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + irq_pin: GPIO6 -sensor: - - platform: ade7953_i2c - irq_pin: 6 - voltage: - name: ADE7953 Voltage - id: ade7953_voltage - current_a: - name: ADE7953 Current A - id: ade7953_current_a - current_b: - name: ADE7953 Current B - id: ade7953_current_b - power_factor_a: - name: ADE7953 Power Factor A - power_factor_b: - name: ADE7953 Power Factor B - apparent_power_a: - name: ADE7953 Apparent Power A - apparent_power_b: - name: ADE7953 Apparent Power B - active_power_a: - name: ADE7953 Active Power A - active_power_b: - name: ADE7953 Active Power B - reactive_power_a: - name: ADE7953 Reactive Power A - reactive_power_b: - name: ADE7953 Reactive Power B - update_interval: 1s +<<: !include common.yaml diff --git a/tests/components/ade7953_i2c/test.esp32-idf.yaml b/tests/components/ade7953_i2c/test.esp32-idf.yaml index 71602f20a3..2c57d412f6 100644 --- a/tests/components/ade7953_i2c/test.esp32-idf.yaml +++ b/tests/components/ade7953_i2c/test.esp32-idf.yaml @@ -1,34 +1,6 @@ -i2c: - - id: i2c_ade7953 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 + irq_pin: GPIO15 -sensor: - - platform: ade7953_i2c - irq_pin: 15 - voltage: - name: ADE7953 Voltage - id: ade7953_voltage - current_a: - name: ADE7953 Current A - id: ade7953_current_a - current_b: - name: ADE7953 Current B - id: ade7953_current_b - power_factor_a: - name: ADE7953 Power Factor A - power_factor_b: - name: ADE7953 Power Factor B - apparent_power_a: - name: ADE7953 Apparent Power A - apparent_power_b: - name: ADE7953 Apparent Power B - active_power_a: - name: ADE7953 Active Power A - active_power_b: - name: ADE7953 Active Power B - reactive_power_a: - name: ADE7953 Reactive Power A - reactive_power_b: - name: ADE7953 Reactive Power B - update_interval: 1s +<<: !include common.yaml diff --git a/tests/components/ade7953_i2c/test.esp8266-ard.yaml b/tests/components/ade7953_i2c/test.esp8266-ard.yaml index 6903cd1953..c8e6a43f44 100644 --- a/tests/components/ade7953_i2c/test.esp8266-ard.yaml +++ b/tests/components/ade7953_i2c/test.esp8266-ard.yaml @@ -1,34 +1,6 @@ -i2c: - - id: i2c_ade7953 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + irq_pin: GPIO15 -sensor: - - platform: ade7953_i2c - irq_pin: 15 - voltage: - name: ADE7953 Voltage - id: ade7953_voltage - current_a: - name: ADE7953 Current A - id: ade7953_current_a - current_b: - name: ADE7953 Current B - id: ade7953_current_b - power_factor_a: - name: ADE7953 Power Factor A - power_factor_b: - name: ADE7953 Power Factor B - apparent_power_a: - name: ADE7953 Apparent Power A - apparent_power_b: - name: ADE7953 Apparent Power B - active_power_a: - name: ADE7953 Active Power A - active_power_b: - name: ADE7953 Active Power B - reactive_power_a: - name: ADE7953 Reactive Power A - reactive_power_b: - name: ADE7953 Reactive Power B - update_interval: 1s +<<: !include common.yaml diff --git a/tests/components/ade7953_i2c/test.rp2040-ard.yaml b/tests/components/ade7953_i2c/test.rp2040-ard.yaml index d7b365a7e1..799acabd5a 100644 --- a/tests/components/ade7953_i2c/test.rp2040-ard.yaml +++ b/tests/components/ade7953_i2c/test.rp2040-ard.yaml @@ -1,34 +1,6 @@ -i2c: - - id: i2c_ade7953 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + irq_pin: GPIO6 -sensor: - - platform: ade7953_i2c - irq_pin: 6 - voltage: - name: ADE7953 Voltage - id: ade7953_voltage - current_a: - name: ADE7953 Current A - id: ade7953_current_a - current_b: - name: ADE7953 Current B - id: ade7953_current_b - power_factor_a: - name: ADE7953 Power Factor A - power_factor_b: - name: ADE7953 Power Factor B - apparent_power_a: - name: ADE7953 Apparent Power A - apparent_power_b: - name: ADE7953 Apparent Power B - active_power_a: - name: ADE7953 Active Power A - active_power_b: - name: ADE7953 Active Power B - reactive_power_a: - name: ADE7953 Reactive Power A - reactive_power_b: - name: ADE7953 Reactive Power B - update_interval: 1s +<<: !include common.yaml diff --git a/tests/components/ade7953_spi/common.yaml b/tests/components/ade7953_spi/common.yaml new file mode 100644 index 0000000000..706f31f22c --- /dev/null +++ b/tests/components/ade7953_spi/common.yaml @@ -0,0 +1,36 @@ +spi: + - id: spi_ade7953 + clk_pin: ${clk_pin} + mosi_pin: ${mosi_pin} + miso_pin: ${miso_pin} + +sensor: + - platform: ade7953_spi + cs_pin: ${cs_pin} + irq_pin: ${irq_pin} + voltage: + name: ADE7953 Voltage + id: ade7953_voltage + current_a: + name: ADE7953 Current A + id: ade7953_current_a + current_b: + name: ADE7953 Current B + id: ade7953_current_b + power_factor_a: + name: ADE7953 Power Factor A + power_factor_b: + name: ADE7953 Power Factor B + apparent_power_a: + name: ADE7953 Apparent Power A + apparent_power_b: + name: ADE7953 Apparent Power B + active_power_a: + name: ADE7953 Active Power A + active_power_b: + name: ADE7953 Active Power B + reactive_power_a: + name: ADE7953 Reactive Power A + reactive_power_b: + name: ADE7953 Reactive Power B + update_interval: 1s diff --git a/tests/components/ade7953_spi/test.esp32-ard.yaml b/tests/components/ade7953_spi/test.esp32-ard.yaml index e9ef7e4116..e00f522dd4 100644 --- a/tests/components/ade7953_spi/test.esp32-ard.yaml +++ b/tests/components/ade7953_spi/test.esp32-ard.yaml @@ -1,36 +1,8 @@ -spi: - - id: spi_ade7953 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + irq_pin: GPIO13 + cs_pin: GPIO5 -sensor: - - platform: ade7953_spi - cs_pin: 5 - irq_pin: 13 - voltage: - name: ADE7953 Voltage - id: ade7953_voltage - current_a: - name: ADE7953 Current A - id: ade7953_current_a - current_b: - name: ADE7953 Current B - id: ade7953_current_b - power_factor_a: - name: ADE7953 Power Factor A - power_factor_b: - name: ADE7953 Power Factor B - apparent_power_a: - name: ADE7953 Apparent Power A - apparent_power_b: - name: ADE7953 Apparent Power B - active_power_a: - name: ADE7953 Active Power A - active_power_b: - name: ADE7953 Active Power B - reactive_power_a: - name: ADE7953 Reactive Power A - reactive_power_b: - name: ADE7953 Reactive Power B - update_interval: 1s +<<: !include common.yaml diff --git a/tests/components/ade7953_spi/test.esp32-c3-ard.yaml b/tests/components/ade7953_spi/test.esp32-c3-ard.yaml index a967f28d9c..fcf35f528e 100644 --- a/tests/components/ade7953_spi/test.esp32-c3-ard.yaml +++ b/tests/components/ade7953_spi/test.esp32-c3-ard.yaml @@ -1,36 +1,8 @@ -spi: - - id: spi_ade7953 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + irq_pin: GPIO9 + cs_pin: GPIO8 -sensor: - - platform: ade7953_spi - cs_pin: 8 - irq_pin: 9 - voltage: - name: ADE7953 Voltage - id: ade7953_voltage - current_a: - name: ADE7953 Current A - id: ade7953_current_a - current_b: - name: ADE7953 Current B - id: ade7953_current_b - power_factor_a: - name: ADE7953 Power Factor A - power_factor_b: - name: ADE7953 Power Factor B - apparent_power_a: - name: ADE7953 Apparent Power A - apparent_power_b: - name: ADE7953 Apparent Power B - active_power_a: - name: ADE7953 Active Power A - active_power_b: - name: ADE7953 Active Power B - reactive_power_a: - name: ADE7953 Reactive Power A - reactive_power_b: - name: ADE7953 Reactive Power B - update_interval: 1s +<<: !include common.yaml diff --git a/tests/components/ade7953_spi/test.esp32-c3-idf.yaml b/tests/components/ade7953_spi/test.esp32-c3-idf.yaml index a967f28d9c..fcf35f528e 100644 --- a/tests/components/ade7953_spi/test.esp32-c3-idf.yaml +++ b/tests/components/ade7953_spi/test.esp32-c3-idf.yaml @@ -1,36 +1,8 @@ -spi: - - id: spi_ade7953 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + irq_pin: GPIO9 + cs_pin: GPIO8 -sensor: - - platform: ade7953_spi - cs_pin: 8 - irq_pin: 9 - voltage: - name: ADE7953 Voltage - id: ade7953_voltage - current_a: - name: ADE7953 Current A - id: ade7953_current_a - current_b: - name: ADE7953 Current B - id: ade7953_current_b - power_factor_a: - name: ADE7953 Power Factor A - power_factor_b: - name: ADE7953 Power Factor B - apparent_power_a: - name: ADE7953 Apparent Power A - apparent_power_b: - name: ADE7953 Apparent Power B - active_power_a: - name: ADE7953 Active Power A - active_power_b: - name: ADE7953 Active Power B - reactive_power_a: - name: ADE7953 Reactive Power A - reactive_power_b: - name: ADE7953 Reactive Power B - update_interval: 1s +<<: !include common.yaml diff --git a/tests/components/ade7953_spi/test.esp32-idf.yaml b/tests/components/ade7953_spi/test.esp32-idf.yaml index e9ef7e4116..e00f522dd4 100644 --- a/tests/components/ade7953_spi/test.esp32-idf.yaml +++ b/tests/components/ade7953_spi/test.esp32-idf.yaml @@ -1,36 +1,8 @@ -spi: - - id: spi_ade7953 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + irq_pin: GPIO13 + cs_pin: GPIO5 -sensor: - - platform: ade7953_spi - cs_pin: 5 - irq_pin: 13 - voltage: - name: ADE7953 Voltage - id: ade7953_voltage - current_a: - name: ADE7953 Current A - id: ade7953_current_a - current_b: - name: ADE7953 Current B - id: ade7953_current_b - power_factor_a: - name: ADE7953 Power Factor A - power_factor_b: - name: ADE7953 Power Factor B - apparent_power_a: - name: ADE7953 Apparent Power A - apparent_power_b: - name: ADE7953 Apparent Power B - active_power_a: - name: ADE7953 Active Power A - active_power_b: - name: ADE7953 Active Power B - reactive_power_a: - name: ADE7953 Reactive Power A - reactive_power_b: - name: ADE7953 Reactive Power B - update_interval: 1s +<<: !include common.yaml diff --git a/tests/components/ade7953_spi/test.esp8266-ard.yaml b/tests/components/ade7953_spi/test.esp8266-ard.yaml index b36b4445ab..b90e661ec0 100644 --- a/tests/components/ade7953_spi/test.esp8266-ard.yaml +++ b/tests/components/ade7953_spi/test.esp8266-ard.yaml @@ -1,36 +1,8 @@ -spi: - - id: spi_ade7953 - clk_pin: 14 - mosi_pin: 13 - miso_pin: 12 +substitutions: + clk_pin: GPIO14 + mosi_pin: GPIO13 + miso_pin: GPIO12 + irq_pin: GPIO5 + cs_pin: GPIO15 -sensor: - - platform: ade7953_spi - cs_pin: 15 - irq_pin: 5 - voltage: - name: ADE7953 Voltage - id: ade7953_voltage - current_a: - name: ADE7953 Current A - id: ade7953_current_a - current_b: - name: ADE7953 Current B - id: ade7953_current_b - power_factor_a: - name: ADE7953 Power Factor A - power_factor_b: - name: ADE7953 Power Factor B - apparent_power_a: - name: ADE7953 Apparent Power A - apparent_power_b: - name: ADE7953 Apparent Power B - active_power_a: - name: ADE7953 Active Power A - active_power_b: - name: ADE7953 Active Power B - reactive_power_a: - name: ADE7953 Reactive Power A - reactive_power_b: - name: ADE7953 Reactive Power B - update_interval: 1s +<<: !include common.yaml diff --git a/tests/components/ade7953_spi/test.rp2040-ard.yaml b/tests/components/ade7953_spi/test.rp2040-ard.yaml index 319abd4613..8f5941e1b2 100644 --- a/tests/components/ade7953_spi/test.rp2040-ard.yaml +++ b/tests/components/ade7953_spi/test.rp2040-ard.yaml @@ -1,36 +1,8 @@ -spi: - - id: spi_ade7953 - clk_pin: 2 - mosi_pin: 3 - miso_pin: 4 +substitutions: + clk_pin: GPIO2 + mosi_pin: GPIO3 + miso_pin: GPIO4 + irq_pin: GPIO5 + cs_pin: GPIO6 -sensor: - - platform: ade7953_spi - cs_pin: 5 - irq_pin: 6 - voltage: - name: ADE7953 Voltage - id: ade7953_voltage - current_a: - name: ADE7953 Current A - id: ade7953_current_a - current_b: - name: ADE7953 Current B - id: ade7953_current_b - power_factor_a: - name: ADE7953 Power Factor A - power_factor_b: - name: ADE7953 Power Factor B - apparent_power_a: - name: ADE7953 Apparent Power A - apparent_power_b: - name: ADE7953 Apparent Power B - active_power_a: - name: ADE7953 Active Power A - active_power_b: - name: ADE7953 Active Power B - reactive_power_a: - name: ADE7953 Reactive Power A - reactive_power_b: - name: ADE7953 Reactive Power B - update_interval: 1s +<<: !include common.yaml diff --git a/tests/components/ads1115/common.yaml b/tests/components/ads1115/common.yaml new file mode 100644 index 0000000000..297877d2d8 --- /dev/null +++ b/tests/components/ads1115/common.yaml @@ -0,0 +1,14 @@ +i2c: + - id: i2c_ads1115 + scl: ${scl_pin} + sda: ${sda_pin} + +ads1115: + address: 0x48 + +sensor: + - platform: ads1115 + multiplexer: A0_A1 + gain: 1.024 + sample_rate: 128 + id: ads1115_sensor diff --git a/tests/components/ads1115/test.esp32-ard.yaml b/tests/components/ads1115/test.esp32-ard.yaml index 0fdaeff275..63c3bd6afd 100644 --- a/tests/components/ads1115/test.esp32-ard.yaml +++ b/tests/components/ads1115/test.esp32-ard.yaml @@ -1,14 +1,5 @@ -i2c: - - id: i2c_ads1115 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -ads1115: - address: 0x48 - -sensor: - - platform: ads1115 - multiplexer: A0_A1 - gain: 1.024 - sample_rate: 128 - id: ads1115_sensor +<<: !include common.yaml diff --git a/tests/components/ads1115/test.esp32-c3-ard.yaml b/tests/components/ads1115/test.esp32-c3-ard.yaml index 265d2cad2c..ee2c29ca4e 100644 --- a/tests/components/ads1115/test.esp32-c3-ard.yaml +++ b/tests/components/ads1115/test.esp32-c3-ard.yaml @@ -1,14 +1,5 @@ -i2c: - - id: i2c_ads1115 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -ads1115: - address: 0x48 - -sensor: - - platform: ads1115 - multiplexer: A0_A1 - gain: 1.024 - sample_rate: 128 - id: ads1115_sensor +<<: !include common.yaml diff --git a/tests/components/ads1115/test.esp32-c3-idf.yaml b/tests/components/ads1115/test.esp32-c3-idf.yaml index 265d2cad2c..ee2c29ca4e 100644 --- a/tests/components/ads1115/test.esp32-c3-idf.yaml +++ b/tests/components/ads1115/test.esp32-c3-idf.yaml @@ -1,14 +1,5 @@ -i2c: - - id: i2c_ads1115 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -ads1115: - address: 0x48 - -sensor: - - platform: ads1115 - multiplexer: A0_A1 - gain: 1.024 - sample_rate: 128 - id: ads1115_sensor +<<: !include common.yaml diff --git a/tests/components/ads1115/test.esp32-idf.yaml b/tests/components/ads1115/test.esp32-idf.yaml index 0fdaeff275..63c3bd6afd 100644 --- a/tests/components/ads1115/test.esp32-idf.yaml +++ b/tests/components/ads1115/test.esp32-idf.yaml @@ -1,14 +1,5 @@ -i2c: - - id: i2c_ads1115 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -ads1115: - address: 0x48 - -sensor: - - platform: ads1115 - multiplexer: A0_A1 - gain: 1.024 - sample_rate: 128 - id: ads1115_sensor +<<: !include common.yaml diff --git a/tests/components/ads1115/test.esp8266-ard.yaml b/tests/components/ads1115/test.esp8266-ard.yaml index 265d2cad2c..ee2c29ca4e 100644 --- a/tests/components/ads1115/test.esp8266-ard.yaml +++ b/tests/components/ads1115/test.esp8266-ard.yaml @@ -1,14 +1,5 @@ -i2c: - - id: i2c_ads1115 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -ads1115: - address: 0x48 - -sensor: - - platform: ads1115 - multiplexer: A0_A1 - gain: 1.024 - sample_rate: 128 - id: ads1115_sensor +<<: !include common.yaml diff --git a/tests/components/ads1115/test.rp2040-ard.yaml b/tests/components/ads1115/test.rp2040-ard.yaml index 265d2cad2c..ee2c29ca4e 100644 --- a/tests/components/ads1115/test.rp2040-ard.yaml +++ b/tests/components/ads1115/test.rp2040-ard.yaml @@ -1,14 +1,5 @@ -i2c: - - id: i2c_ads1115 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -ads1115: - address: 0x48 - -sensor: - - platform: ads1115 - multiplexer: A0_A1 - gain: 1.024 - sample_rate: 128 - id: ads1115_sensor +<<: !include common.yaml diff --git a/tests/components/ags10/common.yaml b/tests/components/ags10/common.yaml new file mode 100644 index 0000000000..0c4c3513cf --- /dev/null +++ b/tests/components/ags10/common.yaml @@ -0,0 +1,12 @@ +i2c: + - id: i2c_ags10 + scl: ${scl_pin} + sda: ${sda_pin} + frequency: 10kHz + +sensor: + - platform: ags10 + id: ags10_1 + tvoc: + name: AGS10 TVOC + update_interval: 60s diff --git a/tests/components/ags10/test.esp32-ard.yaml b/tests/components/ags10/test.esp32-ard.yaml index b3b53c0d31..63c3bd6afd 100644 --- a/tests/components/ags10/test.esp32-ard.yaml +++ b/tests/components/ags10/test.esp32-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_ags10 - scl: 16 - sda: 17 - frequency: 10kHz +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: ags10 - id: ags10_1 - tvoc: - name: AGS10 TVOC - update_interval: 60s +<<: !include common.yaml diff --git a/tests/components/ags10/test.esp32-c3-ard.yaml b/tests/components/ags10/test.esp32-c3-ard.yaml index e338fc78e0..ee2c29ca4e 100644 --- a/tests/components/ags10/test.esp32-c3-ard.yaml +++ b/tests/components/ags10/test.esp32-c3-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_ags10 - scl: 5 - sda: 4 - frequency: 10kHz +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ags10 - id: ags10_1 - tvoc: - name: AGS10 TVOC - update_interval: 60s +<<: !include common.yaml diff --git a/tests/components/ags10/test.esp32-c3-idf.yaml b/tests/components/ags10/test.esp32-c3-idf.yaml index e338fc78e0..ee2c29ca4e 100644 --- a/tests/components/ags10/test.esp32-c3-idf.yaml +++ b/tests/components/ags10/test.esp32-c3-idf.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_ags10 - scl: 5 - sda: 4 - frequency: 10kHz +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ags10 - id: ags10_1 - tvoc: - name: AGS10 TVOC - update_interval: 60s +<<: !include common.yaml diff --git a/tests/components/ags10/test.esp32-idf.yaml b/tests/components/ags10/test.esp32-idf.yaml index b3b53c0d31..63c3bd6afd 100644 --- a/tests/components/ags10/test.esp32-idf.yaml +++ b/tests/components/ags10/test.esp32-idf.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_ags10 - scl: 16 - sda: 17 - frequency: 10kHz +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: ags10 - id: ags10_1 - tvoc: - name: AGS10 TVOC - update_interval: 60s +<<: !include common.yaml diff --git a/tests/components/ags10/test.esp8266-ard.yaml b/tests/components/ags10/test.esp8266-ard.yaml index e338fc78e0..ee2c29ca4e 100644 --- a/tests/components/ags10/test.esp8266-ard.yaml +++ b/tests/components/ags10/test.esp8266-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_ags10 - scl: 5 - sda: 4 - frequency: 10kHz +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ags10 - id: ags10_1 - tvoc: - name: AGS10 TVOC - update_interval: 60s +<<: !include common.yaml diff --git a/tests/components/aht10/common.yaml b/tests/components/aht10/common.yaml new file mode 100644 index 0000000000..721af09bb4 --- /dev/null +++ b/tests/components/aht10/common.yaml @@ -0,0 +1,11 @@ +i2c: + - id: i2c_aht10 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: aht10 + temperature: + name: Temperature + humidity: + name: Humidity diff --git a/tests/components/aht10/test.esp32-ard.yaml b/tests/components/aht10/test.esp32-ard.yaml index 499e69e5d3..63c3bd6afd 100644 --- a/tests/components/aht10/test.esp32-ard.yaml +++ b/tests/components/aht10/test.esp32-ard.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_aht10 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: aht10 - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/aht10/test.esp32-c3-ard.yaml b/tests/components/aht10/test.esp32-c3-ard.yaml index 2e5f505476..ee2c29ca4e 100644 --- a/tests/components/aht10/test.esp32-c3-ard.yaml +++ b/tests/components/aht10/test.esp32-c3-ard.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_aht10 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: aht10 - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/aht10/test.esp32-c3-idf.yaml b/tests/components/aht10/test.esp32-c3-idf.yaml index 2e5f505476..ee2c29ca4e 100644 --- a/tests/components/aht10/test.esp32-c3-idf.yaml +++ b/tests/components/aht10/test.esp32-c3-idf.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_aht10 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: aht10 - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/aht10/test.esp32-idf.yaml b/tests/components/aht10/test.esp32-idf.yaml index 499e69e5d3..63c3bd6afd 100644 --- a/tests/components/aht10/test.esp32-idf.yaml +++ b/tests/components/aht10/test.esp32-idf.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_aht10 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: aht10 - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/aht10/test.esp8266-ard.yaml b/tests/components/aht10/test.esp8266-ard.yaml index 2e5f505476..ee2c29ca4e 100644 --- a/tests/components/aht10/test.esp8266-ard.yaml +++ b/tests/components/aht10/test.esp8266-ard.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_aht10 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: aht10 - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/aht10/test.rp2040-ard.yaml b/tests/components/aht10/test.rp2040-ard.yaml index 2e5f505476..ee2c29ca4e 100644 --- a/tests/components/aht10/test.rp2040-ard.yaml +++ b/tests/components/aht10/test.rp2040-ard.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_aht10 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: aht10 - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/am2315c/common.yaml b/tests/components/am2315c/common.yaml new file mode 100644 index 0000000000..ab4656c17d --- /dev/null +++ b/tests/components/am2315c/common.yaml @@ -0,0 +1,11 @@ +i2c: + - id: i2c_am2315c + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: am2315c + temperature: + name: Temperature + humidity: + name: Humidity diff --git a/tests/components/am2315c/test.esp32-ard.yaml b/tests/components/am2315c/test.esp32-ard.yaml index ed6b65f787..63c3bd6afd 100644 --- a/tests/components/am2315c/test.esp32-ard.yaml +++ b/tests/components/am2315c/test.esp32-ard.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_am2315c - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: am2315c - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/am2315c/test.esp32-c3-ard.yaml b/tests/components/am2315c/test.esp32-c3-ard.yaml index d09bffb7a4..ee2c29ca4e 100644 --- a/tests/components/am2315c/test.esp32-c3-ard.yaml +++ b/tests/components/am2315c/test.esp32-c3-ard.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_am2315c - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: am2315c - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/am2315c/test.esp32-c3-idf.yaml b/tests/components/am2315c/test.esp32-c3-idf.yaml index d09bffb7a4..ee2c29ca4e 100644 --- a/tests/components/am2315c/test.esp32-c3-idf.yaml +++ b/tests/components/am2315c/test.esp32-c3-idf.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_am2315c - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: am2315c - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/am2315c/test.esp32-idf.yaml b/tests/components/am2315c/test.esp32-idf.yaml index ed6b65f787..63c3bd6afd 100644 --- a/tests/components/am2315c/test.esp32-idf.yaml +++ b/tests/components/am2315c/test.esp32-idf.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_am2315c - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: am2315c - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/am2315c/test.esp8266-ard.yaml b/tests/components/am2315c/test.esp8266-ard.yaml index d09bffb7a4..ee2c29ca4e 100644 --- a/tests/components/am2315c/test.esp8266-ard.yaml +++ b/tests/components/am2315c/test.esp8266-ard.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_am2315c - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: am2315c - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/am2315c/test.rp2040-ard.yaml b/tests/components/am2315c/test.rp2040-ard.yaml index d09bffb7a4..ee2c29ca4e 100644 --- a/tests/components/am2315c/test.rp2040-ard.yaml +++ b/tests/components/am2315c/test.rp2040-ard.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_am2315c - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: am2315c - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/am2320/common.yaml b/tests/components/am2320/common.yaml new file mode 100644 index 0000000000..c0982b8818 --- /dev/null +++ b/tests/components/am2320/common.yaml @@ -0,0 +1,11 @@ +i2c: + - id: i2c_am2320 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: am2320 + temperature: + name: Temperature + humidity: + name: Humidity diff --git a/tests/components/am2320/test.esp32-ard.yaml b/tests/components/am2320/test.esp32-ard.yaml index 99f4173b85..63c3bd6afd 100644 --- a/tests/components/am2320/test.esp32-ard.yaml +++ b/tests/components/am2320/test.esp32-ard.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_bme280 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: am2320 - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/am2320/test.esp32-c3-ard.yaml b/tests/components/am2320/test.esp32-c3-ard.yaml index 6acfe8d4fd..ee2c29ca4e 100644 --- a/tests/components/am2320/test.esp32-c3-ard.yaml +++ b/tests/components/am2320/test.esp32-c3-ard.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_bme280 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: am2320 - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/am2320/test.esp32-c3-idf.yaml b/tests/components/am2320/test.esp32-c3-idf.yaml index 6acfe8d4fd..ee2c29ca4e 100644 --- a/tests/components/am2320/test.esp32-c3-idf.yaml +++ b/tests/components/am2320/test.esp32-c3-idf.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_bme280 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: am2320 - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/am2320/test.esp32-idf.yaml b/tests/components/am2320/test.esp32-idf.yaml index 99f4173b85..63c3bd6afd 100644 --- a/tests/components/am2320/test.esp32-idf.yaml +++ b/tests/components/am2320/test.esp32-idf.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_bme280 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: am2320 - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/am2320/test.esp8266-ard.yaml b/tests/components/am2320/test.esp8266-ard.yaml index 6acfe8d4fd..ee2c29ca4e 100644 --- a/tests/components/am2320/test.esp8266-ard.yaml +++ b/tests/components/am2320/test.esp8266-ard.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_bme280 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: am2320 - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/am2320/test.rp2040-ard.yaml b/tests/components/am2320/test.rp2040-ard.yaml index 6acfe8d4fd..ee2c29ca4e 100644 --- a/tests/components/am2320/test.rp2040-ard.yaml +++ b/tests/components/am2320/test.rp2040-ard.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_bme280 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: am2320 - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/apds9960/common.yaml b/tests/components/apds9960/common.yaml new file mode 100644 index 0000000000..de7706648a --- /dev/null +++ b/tests/components/apds9960/common.yaml @@ -0,0 +1,48 @@ +i2c: + - id: i2c_apds9960 + scl: ${scl_pin} + sda: ${sda_pin} + +apds9960: + address: 0x20 + update_interval: 60s + +binary_sensor: + - platform: apds9960 + id: apds9960_binary_sensor + direction: up + name: APDS9960 Up + device_class: motion + filters: + - invert + - delayed_on: 20ms + - delayed_off: 20ms + - lambda: "return false;" + on_state: + - logger.log: New state + - platform: apds9960 + direction: down + name: APDS9960 Down + - platform: apds9960 + direction: left + name: APDS9960 Left + - platform: apds9960 + direction: right + name: APDS9960 Right + +sensor: + - platform: apds9960 + type: proximity + name: APDS9960 Proximity + - platform: apds9960 + type: clear + name: APDS9960 Clear + - platform: apds9960 + type: red + name: APDS9960 Red + - platform: apds9960 + type: green + name: APDS9960 Green + - platform: apds9960 + type: blue + name: APDS9960 Blue diff --git a/tests/components/apds9960/test.esp32-ard.yaml b/tests/components/apds9960/test.esp32-ard.yaml index 7ff70a4d47..63c3bd6afd 100644 --- a/tests/components/apds9960/test.esp32-ard.yaml +++ b/tests/components/apds9960/test.esp32-ard.yaml @@ -1,48 +1,5 @@ -i2c: - - id: i2c_bme280 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -apds9960: - address: 0x20 - update_interval: 60s - -binary_sensor: - - platform: apds9960 - id: apds9960_binary_sensor - direction: up - name: APDS9960 Up - device_class: motion - filters: - - invert - - delayed_on: 20ms - - delayed_off: 20ms - - lambda: "return false;" - on_state: - - logger.log: New state - - platform: apds9960 - direction: down - name: APDS9960 Down - - platform: apds9960 - direction: left - name: APDS9960 Left - - platform: apds9960 - direction: right - name: APDS9960 Right - -sensor: - - platform: apds9960 - type: proximity - name: APDS9960 Proximity - - platform: apds9960 - type: clear - name: APDS9960 Clear - - platform: apds9960 - type: red - name: APDS9960 Red - - platform: apds9960 - type: green - name: APDS9960 Green - - platform: apds9960 - type: blue - name: APDS9960 Blue +<<: !include common.yaml diff --git a/tests/components/apds9960/test.esp32-c3-ard.yaml b/tests/components/apds9960/test.esp32-c3-ard.yaml index f6b6f7bac0..ee2c29ca4e 100644 --- a/tests/components/apds9960/test.esp32-c3-ard.yaml +++ b/tests/components/apds9960/test.esp32-c3-ard.yaml @@ -1,48 +1,5 @@ -i2c: - - id: i2c_bme280 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -apds9960: - address: 0x20 - update_interval: 60s - -binary_sensor: - - platform: apds9960 - id: apds9960_binary_sensor - direction: up - name: APDS9960 Up - device_class: motion - filters: - - invert - - delayed_on: 20ms - - delayed_off: 20ms - - lambda: "return false;" - on_state: - - logger.log: New state - - platform: apds9960 - direction: down - name: APDS9960 Down - - platform: apds9960 - direction: left - name: APDS9960 Left - - platform: apds9960 - direction: right - name: APDS9960 Right - -sensor: - - platform: apds9960 - type: proximity - name: APDS9960 Proximity - - platform: apds9960 - type: clear - name: APDS9960 Clear - - platform: apds9960 - type: red - name: APDS9960 Red - - platform: apds9960 - type: green - name: APDS9960 Green - - platform: apds9960 - type: blue - name: APDS9960 Blue +<<: !include common.yaml diff --git a/tests/components/apds9960/test.esp32-c3-idf.yaml b/tests/components/apds9960/test.esp32-c3-idf.yaml index f6b6f7bac0..ee2c29ca4e 100644 --- a/tests/components/apds9960/test.esp32-c3-idf.yaml +++ b/tests/components/apds9960/test.esp32-c3-idf.yaml @@ -1,48 +1,5 @@ -i2c: - - id: i2c_bme280 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -apds9960: - address: 0x20 - update_interval: 60s - -binary_sensor: - - platform: apds9960 - id: apds9960_binary_sensor - direction: up - name: APDS9960 Up - device_class: motion - filters: - - invert - - delayed_on: 20ms - - delayed_off: 20ms - - lambda: "return false;" - on_state: - - logger.log: New state - - platform: apds9960 - direction: down - name: APDS9960 Down - - platform: apds9960 - direction: left - name: APDS9960 Left - - platform: apds9960 - direction: right - name: APDS9960 Right - -sensor: - - platform: apds9960 - type: proximity - name: APDS9960 Proximity - - platform: apds9960 - type: clear - name: APDS9960 Clear - - platform: apds9960 - type: red - name: APDS9960 Red - - platform: apds9960 - type: green - name: APDS9960 Green - - platform: apds9960 - type: blue - name: APDS9960 Blue +<<: !include common.yaml diff --git a/tests/components/apds9960/test.esp32-idf.yaml b/tests/components/apds9960/test.esp32-idf.yaml index 7ff70a4d47..63c3bd6afd 100644 --- a/tests/components/apds9960/test.esp32-idf.yaml +++ b/tests/components/apds9960/test.esp32-idf.yaml @@ -1,48 +1,5 @@ -i2c: - - id: i2c_bme280 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -apds9960: - address: 0x20 - update_interval: 60s - -binary_sensor: - - platform: apds9960 - id: apds9960_binary_sensor - direction: up - name: APDS9960 Up - device_class: motion - filters: - - invert - - delayed_on: 20ms - - delayed_off: 20ms - - lambda: "return false;" - on_state: - - logger.log: New state - - platform: apds9960 - direction: down - name: APDS9960 Down - - platform: apds9960 - direction: left - name: APDS9960 Left - - platform: apds9960 - direction: right - name: APDS9960 Right - -sensor: - - platform: apds9960 - type: proximity - name: APDS9960 Proximity - - platform: apds9960 - type: clear - name: APDS9960 Clear - - platform: apds9960 - type: red - name: APDS9960 Red - - platform: apds9960 - type: green - name: APDS9960 Green - - platform: apds9960 - type: blue - name: APDS9960 Blue +<<: !include common.yaml diff --git a/tests/components/apds9960/test.esp8266-ard.yaml b/tests/components/apds9960/test.esp8266-ard.yaml index f6b6f7bac0..ee2c29ca4e 100644 --- a/tests/components/apds9960/test.esp8266-ard.yaml +++ b/tests/components/apds9960/test.esp8266-ard.yaml @@ -1,48 +1,5 @@ -i2c: - - id: i2c_bme280 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -apds9960: - address: 0x20 - update_interval: 60s - -binary_sensor: - - platform: apds9960 - id: apds9960_binary_sensor - direction: up - name: APDS9960 Up - device_class: motion - filters: - - invert - - delayed_on: 20ms - - delayed_off: 20ms - - lambda: "return false;" - on_state: - - logger.log: New state - - platform: apds9960 - direction: down - name: APDS9960 Down - - platform: apds9960 - direction: left - name: APDS9960 Left - - platform: apds9960 - direction: right - name: APDS9960 Right - -sensor: - - platform: apds9960 - type: proximity - name: APDS9960 Proximity - - platform: apds9960 - type: clear - name: APDS9960 Clear - - platform: apds9960 - type: red - name: APDS9960 Red - - platform: apds9960 - type: green - name: APDS9960 Green - - platform: apds9960 - type: blue - name: APDS9960 Blue +<<: !include common.yaml diff --git a/tests/components/apds9960/test.rp2040-ard.yaml b/tests/components/apds9960/test.rp2040-ard.yaml index f6b6f7bac0..ee2c29ca4e 100644 --- a/tests/components/apds9960/test.rp2040-ard.yaml +++ b/tests/components/apds9960/test.rp2040-ard.yaml @@ -1,48 +1,5 @@ -i2c: - - id: i2c_bme280 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -apds9960: - address: 0x20 - update_interval: 60s - -binary_sensor: - - platform: apds9960 - id: apds9960_binary_sensor - direction: up - name: APDS9960 Up - device_class: motion - filters: - - invert - - delayed_on: 20ms - - delayed_off: 20ms - - lambda: "return false;" - on_state: - - logger.log: New state - - platform: apds9960 - direction: down - name: APDS9960 Down - - platform: apds9960 - direction: left - name: APDS9960 Left - - platform: apds9960 - direction: right - name: APDS9960 Right - -sensor: - - platform: apds9960 - type: proximity - name: APDS9960 Proximity - - platform: apds9960 - type: clear - name: APDS9960 Clear - - platform: apds9960 - type: red - name: APDS9960 Red - - platform: apds9960 - type: green - name: APDS9960 Green - - platform: apds9960 - type: blue - name: APDS9960 Blue +<<: !include common.yaml diff --git a/tests/components/as3935_i2c/common.yaml b/tests/components/as3935_i2c/common.yaml new file mode 100644 index 0000000000..d76cc37fc1 --- /dev/null +++ b/tests/components/as3935_i2c/common.yaml @@ -0,0 +1,18 @@ +i2c: + - id: i2c_as3935 + scl: ${scl_pin} + sda: ${sda_pin} + +as3935_i2c: + irq_pin: ${irq_pin} + +binary_sensor: + - platform: as3935 + name: Storm Alert + +sensor: + - platform: as3935 + lightning_energy: + name: Lightning Energy + distance: + name: Distance Storm diff --git a/tests/components/as3935_i2c/test.esp32-ard.yaml b/tests/components/as3935_i2c/test.esp32-ard.yaml index fad703bee5..2c57d412f6 100644 --- a/tests/components/as3935_i2c/test.esp32-ard.yaml +++ b/tests/components/as3935_i2c/test.esp32-ard.yaml @@ -1,18 +1,6 @@ -i2c: - - id: i2c_as3935 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 + irq_pin: GPIO15 -as3935_i2c: - irq_pin: 12 - -binary_sensor: - - platform: as3935 - name: Storm Alert - -sensor: - - platform: as3935 - lightning_energy: - name: Lightning Energy - distance: - name: Distance Storm +<<: !include common.yaml diff --git a/tests/components/as3935_i2c/test.esp32-c3-ard.yaml b/tests/components/as3935_i2c/test.esp32-c3-ard.yaml index c72556dbac..799acabd5a 100644 --- a/tests/components/as3935_i2c/test.esp32-c3-ard.yaml +++ b/tests/components/as3935_i2c/test.esp32-c3-ard.yaml @@ -1,18 +1,6 @@ -i2c: - - id: i2c_as3935 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + irq_pin: GPIO6 -as3935_i2c: - irq_pin: 6 - -binary_sensor: - - platform: as3935 - name: Storm Alert - -sensor: - - platform: as3935 - lightning_energy: - name: Lightning Energy - distance: - name: Distance Storm +<<: !include common.yaml diff --git a/tests/components/as3935_i2c/test.esp32-c3-idf.yaml b/tests/components/as3935_i2c/test.esp32-c3-idf.yaml index c72556dbac..799acabd5a 100644 --- a/tests/components/as3935_i2c/test.esp32-c3-idf.yaml +++ b/tests/components/as3935_i2c/test.esp32-c3-idf.yaml @@ -1,18 +1,6 @@ -i2c: - - id: i2c_as3935 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + irq_pin: GPIO6 -as3935_i2c: - irq_pin: 6 - -binary_sensor: - - platform: as3935 - name: Storm Alert - -sensor: - - platform: as3935 - lightning_energy: - name: Lightning Energy - distance: - name: Distance Storm +<<: !include common.yaml diff --git a/tests/components/as3935_i2c/test.esp32-idf.yaml b/tests/components/as3935_i2c/test.esp32-idf.yaml index fad703bee5..2c57d412f6 100644 --- a/tests/components/as3935_i2c/test.esp32-idf.yaml +++ b/tests/components/as3935_i2c/test.esp32-idf.yaml @@ -1,18 +1,6 @@ -i2c: - - id: i2c_as3935 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 + irq_pin: GPIO15 -as3935_i2c: - irq_pin: 12 - -binary_sensor: - - platform: as3935 - name: Storm Alert - -sensor: - - platform: as3935 - lightning_energy: - name: Lightning Energy - distance: - name: Distance Storm +<<: !include common.yaml diff --git a/tests/components/as3935_i2c/test.esp8266-ard.yaml b/tests/components/as3935_i2c/test.esp8266-ard.yaml index adba9e440f..c8e6a43f44 100644 --- a/tests/components/as3935_i2c/test.esp8266-ard.yaml +++ b/tests/components/as3935_i2c/test.esp8266-ard.yaml @@ -1,18 +1,6 @@ -i2c: - - id: i2c_as3935 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + irq_pin: GPIO15 -as3935_i2c: - irq_pin: 15 - -binary_sensor: - - platform: as3935 - name: Storm Alert - -sensor: - - platform: as3935 - lightning_energy: - name: Lightning Energy - distance: - name: Distance Storm +<<: !include common.yaml diff --git a/tests/components/as3935_i2c/test.rp2040-ard.yaml b/tests/components/as3935_i2c/test.rp2040-ard.yaml index c72556dbac..799acabd5a 100644 --- a/tests/components/as3935_i2c/test.rp2040-ard.yaml +++ b/tests/components/as3935_i2c/test.rp2040-ard.yaml @@ -1,18 +1,6 @@ -i2c: - - id: i2c_as3935 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + irq_pin: GPIO6 -as3935_i2c: - irq_pin: 6 - -binary_sensor: - - platform: as3935 - name: Storm Alert - -sensor: - - platform: as3935 - lightning_energy: - name: Lightning Energy - distance: - name: Distance Storm +<<: !include common.yaml diff --git a/tests/components/as3935_spi/common.yaml b/tests/components/as3935_spi/common.yaml new file mode 100644 index 0000000000..c3fb93dff1 --- /dev/null +++ b/tests/components/as3935_spi/common.yaml @@ -0,0 +1,20 @@ +spi: + - id: spi_as3935 + clk_pin: ${clk_pin} + mosi_pin: ${mosi_pin} + miso_pin: ${miso_pin} + +as3935_spi: + cs_pin: ${cs_pin} + irq_pin: ${irq_pin} + +binary_sensor: + - platform: as3935 + name: Storm Alert + +sensor: + - platform: as3935 + lightning_energy: + name: Lightning Energy + distance: + name: Distance Storm diff --git a/tests/components/as3935_spi/test.esp32-ard.yaml b/tests/components/as3935_spi/test.esp32-ard.yaml index 813a39cb23..e00f522dd4 100644 --- a/tests/components/as3935_spi/test.esp32-ard.yaml +++ b/tests/components/as3935_spi/test.esp32-ard.yaml @@ -1,20 +1,8 @@ -spi: - - id: spi_as3935 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + irq_pin: GPIO13 + cs_pin: GPIO5 -as3935_spi: - cs_pin: 12 - irq_pin: 13 - -binary_sensor: - - platform: as3935 - name: Storm Alert - -sensor: - - platform: as3935 - lightning_energy: - name: Lightning Energy - distance: - name: Distance Storm +<<: !include common.yaml diff --git a/tests/components/as3935_spi/test.esp32-c3-ard.yaml b/tests/components/as3935_spi/test.esp32-c3-ard.yaml index 7a4a01aeea..fcf35f528e 100644 --- a/tests/components/as3935_spi/test.esp32-c3-ard.yaml +++ b/tests/components/as3935_spi/test.esp32-c3-ard.yaml @@ -1,20 +1,8 @@ -spi: - - id: spi_as3935 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + irq_pin: GPIO9 + cs_pin: GPIO8 -as3935_spi: - cs_pin: 2 - irq_pin: 3 - -binary_sensor: - - platform: as3935 - name: Storm Alert - -sensor: - - platform: as3935 - lightning_energy: - name: Lightning Energy - distance: - name: Distance Storm +<<: !include common.yaml diff --git a/tests/components/as3935_spi/test.esp32-c3-idf.yaml b/tests/components/as3935_spi/test.esp32-c3-idf.yaml index 7a4a01aeea..fcf35f528e 100644 --- a/tests/components/as3935_spi/test.esp32-c3-idf.yaml +++ b/tests/components/as3935_spi/test.esp32-c3-idf.yaml @@ -1,20 +1,8 @@ -spi: - - id: spi_as3935 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + irq_pin: GPIO9 + cs_pin: GPIO8 -as3935_spi: - cs_pin: 2 - irq_pin: 3 - -binary_sensor: - - platform: as3935 - name: Storm Alert - -sensor: - - platform: as3935 - lightning_energy: - name: Lightning Energy - distance: - name: Distance Storm +<<: !include common.yaml diff --git a/tests/components/as3935_spi/test.esp32-idf.yaml b/tests/components/as3935_spi/test.esp32-idf.yaml index 813a39cb23..e00f522dd4 100644 --- a/tests/components/as3935_spi/test.esp32-idf.yaml +++ b/tests/components/as3935_spi/test.esp32-idf.yaml @@ -1,20 +1,8 @@ -spi: - - id: spi_as3935 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + irq_pin: GPIO13 + cs_pin: GPIO5 -as3935_spi: - cs_pin: 12 - irq_pin: 13 - -binary_sensor: - - platform: as3935 - name: Storm Alert - -sensor: - - platform: as3935 - lightning_energy: - name: Lightning Energy - distance: - name: Distance Storm +<<: !include common.yaml diff --git a/tests/components/as3935_spi/test.esp8266-ard.yaml b/tests/components/as3935_spi/test.esp8266-ard.yaml index 38a40b0833..b90e661ec0 100644 --- a/tests/components/as3935_spi/test.esp8266-ard.yaml +++ b/tests/components/as3935_spi/test.esp8266-ard.yaml @@ -1,20 +1,8 @@ -spi: - - id: spi_as3935 - clk_pin: 14 - mosi_pin: 13 - miso_pin: 12 +substitutions: + clk_pin: GPIO14 + mosi_pin: GPIO13 + miso_pin: GPIO12 + irq_pin: GPIO5 + cs_pin: GPIO15 -as3935_spi: - cs_pin: 15 - irq_pin: 16 - -binary_sensor: - - platform: as3935 - name: Storm Alert - -sensor: - - platform: as3935 - lightning_energy: - name: Lightning Energy - distance: - name: Distance Storm +<<: !include common.yaml diff --git a/tests/components/as3935_spi/test.rp2040-ard.yaml b/tests/components/as3935_spi/test.rp2040-ard.yaml index 528759d97d..8f5941e1b2 100644 --- a/tests/components/as3935_spi/test.rp2040-ard.yaml +++ b/tests/components/as3935_spi/test.rp2040-ard.yaml @@ -1,20 +1,8 @@ -spi: - - id: spi_as3935 - clk_pin: 2 - mosi_pin: 3 - miso_pin: 4 +substitutions: + clk_pin: GPIO2 + mosi_pin: GPIO3 + miso_pin: GPIO4 + irq_pin: GPIO5 + cs_pin: GPIO6 -as3935_spi: - cs_pin: 6 - irq_pin: 7 - -binary_sensor: - - platform: as3935 - name: Storm Alert - -sensor: - - platform: as3935 - lightning_energy: - name: Lightning Energy - distance: - name: Distance Storm +<<: !include common.yaml diff --git a/tests/components/as5600/common.yaml b/tests/components/as5600/common.yaml new file mode 100644 index 0000000000..860f5bf803 --- /dev/null +++ b/tests/components/as5600/common.yaml @@ -0,0 +1,27 @@ +i2c: + - id: i2c_as5600 + scl: ${scl_pin} + sda: ${sda_pin} + +as5600: + dir_pin: ${dir_pin} + direction: clockwise + start_position: 90deg + range: 180deg + watchdog: true + power_mode: low1 + hysteresis: lsb1 + slow_filter: 8x + fast_filter: lsb6 + +sensor: + - platform: as5600 + name: AS5600 Position + raw_position: + name: AS5600 Raw Position + gain: + name: AS5600 Gain + magnitude: + name: AS5600 Magnitude + status: + name: AS5600 Status diff --git a/tests/components/as5600/test.esp32-ard.yaml b/tests/components/as5600/test.esp32-ard.yaml index 312ee9ad04..fa08763501 100644 --- a/tests/components/as5600/test.esp32-ard.yaml +++ b/tests/components/as5600/test.esp32-ard.yaml @@ -1,27 +1,6 @@ -i2c: - - id: i2c_as5600 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 + dir_pin: GPIO15 -as5600: - dir_pin: 12 - direction: clockwise - start_position: 90deg - range: 180deg - watchdog: true - power_mode: low1 - hysteresis: lsb1 - slow_filter: 8x - fast_filter: lsb6 - -sensor: - - platform: as5600 - name: AS5600 Position - raw_position: - name: AS5600 Raw Position - gain: - name: AS5600 Gain - magnitude: - name: AS5600 Magnitude - status: - name: AS5600 Status +<<: !include common.yaml diff --git a/tests/components/as5600/test.esp32-c3-ard.yaml b/tests/components/as5600/test.esp32-c3-ard.yaml index e074fa5e0c..a0623c91e5 100644 --- a/tests/components/as5600/test.esp32-c3-ard.yaml +++ b/tests/components/as5600/test.esp32-c3-ard.yaml @@ -1,27 +1,6 @@ -i2c: - - id: i2c_as5600 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + dir_pin: GPIO6 -as5600: - dir_pin: 6 - direction: clockwise - start_position: 90deg - range: 180deg - watchdog: true - power_mode: low1 - hysteresis: lsb1 - slow_filter: 8x - fast_filter: lsb6 - -sensor: - - platform: as5600 - name: AS5600 Position - raw_position: - name: AS5600 Raw Position - gain: - name: AS5600 Gain - magnitude: - name: AS5600 Magnitude - status: - name: AS5600 Status +<<: !include common.yaml diff --git a/tests/components/as5600/test.esp32-c3-idf.yaml b/tests/components/as5600/test.esp32-c3-idf.yaml index e074fa5e0c..a0623c91e5 100644 --- a/tests/components/as5600/test.esp32-c3-idf.yaml +++ b/tests/components/as5600/test.esp32-c3-idf.yaml @@ -1,27 +1,6 @@ -i2c: - - id: i2c_as5600 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + dir_pin: GPIO6 -as5600: - dir_pin: 6 - direction: clockwise - start_position: 90deg - range: 180deg - watchdog: true - power_mode: low1 - hysteresis: lsb1 - slow_filter: 8x - fast_filter: lsb6 - -sensor: - - platform: as5600 - name: AS5600 Position - raw_position: - name: AS5600 Raw Position - gain: - name: AS5600 Gain - magnitude: - name: AS5600 Magnitude - status: - name: AS5600 Status +<<: !include common.yaml diff --git a/tests/components/as5600/test.esp32-idf.yaml b/tests/components/as5600/test.esp32-idf.yaml index 312ee9ad04..fa08763501 100644 --- a/tests/components/as5600/test.esp32-idf.yaml +++ b/tests/components/as5600/test.esp32-idf.yaml @@ -1,27 +1,6 @@ -i2c: - - id: i2c_as5600 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 + dir_pin: GPIO15 -as5600: - dir_pin: 12 - direction: clockwise - start_position: 90deg - range: 180deg - watchdog: true - power_mode: low1 - hysteresis: lsb1 - slow_filter: 8x - fast_filter: lsb6 - -sensor: - - platform: as5600 - name: AS5600 Position - raw_position: - name: AS5600 Raw Position - gain: - name: AS5600 Gain - magnitude: - name: AS5600 Magnitude - status: - name: AS5600 Status +<<: !include common.yaml diff --git a/tests/components/as5600/test.esp8266-ard.yaml b/tests/components/as5600/test.esp8266-ard.yaml index a232d27305..5e27f8c134 100644 --- a/tests/components/as5600/test.esp8266-ard.yaml +++ b/tests/components/as5600/test.esp8266-ard.yaml @@ -1,27 +1,6 @@ -i2c: - - id: i2c_as5600 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + dir_pin: GPIO15 -as5600: - dir_pin: 15 - direction: clockwise - start_position: 90deg - range: 180deg - watchdog: true - power_mode: low1 - hysteresis: lsb1 - slow_filter: 8x - fast_filter: lsb6 - -sensor: - - platform: as5600 - name: AS5600 Position - raw_position: - name: AS5600 Raw Position - gain: - name: AS5600 Gain - magnitude: - name: AS5600 Magnitude - status: - name: AS5600 Status +<<: !include common.yaml diff --git a/tests/components/as5600/test.rp2040-ard.yaml b/tests/components/as5600/test.rp2040-ard.yaml index e074fa5e0c..a0623c91e5 100644 --- a/tests/components/as5600/test.rp2040-ard.yaml +++ b/tests/components/as5600/test.rp2040-ard.yaml @@ -1,27 +1,6 @@ -i2c: - - id: i2c_as5600 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + dir_pin: GPIO6 -as5600: - dir_pin: 6 - direction: clockwise - start_position: 90deg - range: 180deg - watchdog: true - power_mode: low1 - hysteresis: lsb1 - slow_filter: 8x - fast_filter: lsb6 - -sensor: - - platform: as5600 - name: AS5600 Position - raw_position: - name: AS5600 Raw Position - gain: - name: AS5600 Gain - magnitude: - name: AS5600 Magnitude - status: - name: AS5600 Status +<<: !include common.yaml diff --git a/tests/components/as7341/common.yaml b/tests/components/as7341/common.yaml new file mode 100644 index 0000000000..0351b344c6 --- /dev/null +++ b/tests/components/as7341/common.yaml @@ -0,0 +1,31 @@ +i2c: + - id: i2c_as7341 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: as7341 + update_interval: 15s + gain: X8 + atime: 120 + astep: 99 + f1: + name: F1 + f2: + name: F2 + f3: + name: F3 + f4: + name: F4 + f5: + name: F5 + f6: + name: F6 + f7: + name: F7 + f8: + name: F8 + clear: + name: Clear + nir: + name: NIR diff --git a/tests/components/as7341/test.esp32-ard.yaml b/tests/components/as7341/test.esp32-ard.yaml index d582a367ac..63c3bd6afd 100644 --- a/tests/components/as7341/test.esp32-ard.yaml +++ b/tests/components/as7341/test.esp32-ard.yaml @@ -1,31 +1,5 @@ -i2c: - - id: i2c_as5600 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: as7341 - update_interval: 15s - gain: X8 - atime: 120 - astep: 99 - f1: - name: F1 - f2: - name: F2 - f3: - name: F3 - f4: - name: F4 - f5: - name: F5 - f6: - name: F6 - f7: - name: F7 - f8: - name: F8 - clear: - name: Clear - nir: - name: NIR +<<: !include common.yaml diff --git a/tests/components/as7341/test.esp32-c3-ard.yaml b/tests/components/as7341/test.esp32-c3-ard.yaml index 19965d1715..ee2c29ca4e 100644 --- a/tests/components/as7341/test.esp32-c3-ard.yaml +++ b/tests/components/as7341/test.esp32-c3-ard.yaml @@ -1,31 +1,5 @@ -i2c: - - id: i2c_as5600 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: as7341 - update_interval: 15s - gain: X8 - atime: 120 - astep: 99 - f1: - name: F1 - f2: - name: F2 - f3: - name: F3 - f4: - name: F4 - f5: - name: F5 - f6: - name: F6 - f7: - name: F7 - f8: - name: F8 - clear: - name: Clear - nir: - name: NIR +<<: !include common.yaml diff --git a/tests/components/as7341/test.esp32-c3-idf.yaml b/tests/components/as7341/test.esp32-c3-idf.yaml index 19965d1715..ee2c29ca4e 100644 --- a/tests/components/as7341/test.esp32-c3-idf.yaml +++ b/tests/components/as7341/test.esp32-c3-idf.yaml @@ -1,31 +1,5 @@ -i2c: - - id: i2c_as5600 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: as7341 - update_interval: 15s - gain: X8 - atime: 120 - astep: 99 - f1: - name: F1 - f2: - name: F2 - f3: - name: F3 - f4: - name: F4 - f5: - name: F5 - f6: - name: F6 - f7: - name: F7 - f8: - name: F8 - clear: - name: Clear - nir: - name: NIR +<<: !include common.yaml diff --git a/tests/components/as7341/test.esp32-idf.yaml b/tests/components/as7341/test.esp32-idf.yaml index d582a367ac..63c3bd6afd 100644 --- a/tests/components/as7341/test.esp32-idf.yaml +++ b/tests/components/as7341/test.esp32-idf.yaml @@ -1,31 +1,5 @@ -i2c: - - id: i2c_as5600 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: as7341 - update_interval: 15s - gain: X8 - atime: 120 - astep: 99 - f1: - name: F1 - f2: - name: F2 - f3: - name: F3 - f4: - name: F4 - f5: - name: F5 - f6: - name: F6 - f7: - name: F7 - f8: - name: F8 - clear: - name: Clear - nir: - name: NIR +<<: !include common.yaml diff --git a/tests/components/as7341/test.esp8266-ard.yaml b/tests/components/as7341/test.esp8266-ard.yaml index 19965d1715..ee2c29ca4e 100644 --- a/tests/components/as7341/test.esp8266-ard.yaml +++ b/tests/components/as7341/test.esp8266-ard.yaml @@ -1,31 +1,5 @@ -i2c: - - id: i2c_as5600 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: as7341 - update_interval: 15s - gain: X8 - atime: 120 - astep: 99 - f1: - name: F1 - f2: - name: F2 - f3: - name: F3 - f4: - name: F4 - f5: - name: F5 - f6: - name: F6 - f7: - name: F7 - f8: - name: F8 - clear: - name: Clear - nir: - name: NIR +<<: !include common.yaml diff --git a/tests/components/as7341/test.rp2040-ard.yaml b/tests/components/as7341/test.rp2040-ard.yaml index 19965d1715..ee2c29ca4e 100644 --- a/tests/components/as7341/test.rp2040-ard.yaml +++ b/tests/components/as7341/test.rp2040-ard.yaml @@ -1,31 +1,5 @@ -i2c: - - id: i2c_as5600 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: as7341 - update_interval: 15s - gain: X8 - atime: 120 - astep: 99 - f1: - name: F1 - f2: - name: F2 - f3: - name: F3 - f4: - name: F4 - f5: - name: F5 - f6: - name: F6 - f7: - name: F7 - f8: - name: F8 - clear: - name: Clear - nir: - name: NIR +<<: !include common.yaml diff --git a/tests/components/at581x/common.yaml b/tests/components/at581x/common.yaml new file mode 100644 index 0000000000..018a0fded1 --- /dev/null +++ b/tests/components/at581x/common.yaml @@ -0,0 +1,28 @@ +esphome: + on_boot: + then: + - at581x.settings: + id: waveradar + hw_frontend_reset: false + frequency: 5800MHz + sensing_distance: 200 + poweron_selfcheck_time: 2s + protect_time: 1s + trigger_base: 500ms + trigger_keep: 10s + stage_gain: 3 + power_consumption: 70uA + - at581x.reset: + id: waveradar + +at581x: + id: waveradar + +i2c: + - id: i2c_at581x + scl: ${scl_pin} + sda: ${sda_pin} + +switch: + - platform: at581x + name: Enable Radar diff --git a/tests/components/at581x/test.esp32-ard.yaml b/tests/components/at581x/test.esp32-ard.yaml index ff84e61e1e..63c3bd6afd 100644 --- a/tests/components/at581x/test.esp32-ard.yaml +++ b/tests/components/at581x/test.esp32-ard.yaml @@ -1,38 +1,5 @@ -esphome: - on_boot: - then: - - at581x.settings: - id: "Waveradar" - hw_frontend_reset: false - frequency: 5800MHz - sensing_distance: 200 - poweron_selfcheck_time: 2s - protect_time: 1s - trigger_base: 500ms - trigger_keep: 10s - stage_gain: 3 - power_consumption: 70uA - - at581x.reset: - id: "Waveradar" +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -at581x: - id: "Waveradar" - i2c_id: i2c_bus - -i2c: - sda: 14 - scl: 15 - scan: true - frequency: 100kHz - setup_priority: -100 - id: i2c_bus - -binary_sensor: - - platform: gpio - pin: GPIO21 - name: "Radar motion" - -switch: - - platform: at581x - at581x_id: "Waveradar" - name: "Enable Radar" +<<: !include common.yaml diff --git a/tests/components/at581x/test.esp32-c3-ard.yaml b/tests/components/at581x/test.esp32-c3-ard.yaml index b49a283eca..ee2c29ca4e 100644 --- a/tests/components/at581x/test.esp32-c3-ard.yaml +++ b/tests/components/at581x/test.esp32-c3-ard.yaml @@ -1,38 +1,5 @@ -esphome: - on_boot: - then: - - at581x.settings: - id: "Waveradar" - hw_frontend_reset: false - frequency: 5800MHz - sensing_distance: 200 - poweron_selfcheck_time: 2s - protect_time: 1s - trigger_base: 500ms - trigger_keep: 10s - stage_gain: 3 - power_consumption: 70uA - - at581x.reset: - id: "Waveradar" +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -at581x: - id: "Waveradar" - i2c_id: i2c_bus - -i2c: - sda: 8 - scl: 9 - scan: true - frequency: 100kHz - setup_priority: -100 - id: i2c_bus - -binary_sensor: - - platform: gpio - pin: GPIO21 - name: "Radar motion" - -switch: - - platform: at581x - at581x_id: "Waveradar" - name: "Enable Radar" +<<: !include common.yaml diff --git a/tests/components/at581x/test.esp32-c3-idf.yaml b/tests/components/at581x/test.esp32-c3-idf.yaml index b49a283eca..ee2c29ca4e 100644 --- a/tests/components/at581x/test.esp32-c3-idf.yaml +++ b/tests/components/at581x/test.esp32-c3-idf.yaml @@ -1,38 +1,5 @@ -esphome: - on_boot: - then: - - at581x.settings: - id: "Waveradar" - hw_frontend_reset: false - frequency: 5800MHz - sensing_distance: 200 - poweron_selfcheck_time: 2s - protect_time: 1s - trigger_base: 500ms - trigger_keep: 10s - stage_gain: 3 - power_consumption: 70uA - - at581x.reset: - id: "Waveradar" +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -at581x: - id: "Waveradar" - i2c_id: i2c_bus - -i2c: - sda: 8 - scl: 9 - scan: true - frequency: 100kHz - setup_priority: -100 - id: i2c_bus - -binary_sensor: - - platform: gpio - pin: GPIO21 - name: "Radar motion" - -switch: - - platform: at581x - at581x_id: "Waveradar" - name: "Enable Radar" +<<: !include common.yaml diff --git a/tests/components/at581x/test.esp32-idf.yaml b/tests/components/at581x/test.esp32-idf.yaml index ff84e61e1e..63c3bd6afd 100644 --- a/tests/components/at581x/test.esp32-idf.yaml +++ b/tests/components/at581x/test.esp32-idf.yaml @@ -1,38 +1,5 @@ -esphome: - on_boot: - then: - - at581x.settings: - id: "Waveradar" - hw_frontend_reset: false - frequency: 5800MHz - sensing_distance: 200 - poweron_selfcheck_time: 2s - protect_time: 1s - trigger_base: 500ms - trigger_keep: 10s - stage_gain: 3 - power_consumption: 70uA - - at581x.reset: - id: "Waveradar" +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -at581x: - id: "Waveradar" - i2c_id: i2c_bus - -i2c: - sda: 14 - scl: 15 - scan: true - frequency: 100kHz - setup_priority: -100 - id: i2c_bus - -binary_sensor: - - platform: gpio - pin: GPIO21 - name: "Radar motion" - -switch: - - platform: at581x - at581x_id: "Waveradar" - name: "Enable Radar" +<<: !include common.yaml diff --git a/tests/components/at581x/test.esp8266-ard.yaml b/tests/components/at581x/test.esp8266-ard.yaml index a7b0069045..ee2c29ca4e 100644 --- a/tests/components/at581x/test.esp8266-ard.yaml +++ b/tests/components/at581x/test.esp8266-ard.yaml @@ -1,38 +1,5 @@ -esphome: - on_boot: - then: - - at581x.settings: - id: "Waveradar" - hw_frontend_reset: false - frequency: 5800MHz - sensing_distance: 200 - poweron_selfcheck_time: 2s - protect_time: 1s - trigger_base: 500ms - trigger_keep: 10s - stage_gain: 3 - power_consumption: 70uA - - at581x.reset: - id: "Waveradar" +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -at581x: - id: "Waveradar" - i2c_id: i2c_bus - -i2c: - sda: 14 - scl: 15 - scan: true - frequency: 100kHz - setup_priority: -100 - id: i2c_bus - -binary_sensor: - - platform: gpio - pin: GPIO4 - name: "Radar motion" - -switch: - - platform: at581x - at581x_id: "Waveradar" - name: "Enable Radar" +<<: !include common.yaml diff --git a/tests/components/at581x/test.rp2040-ard.yaml b/tests/components/at581x/test.rp2040-ard.yaml index b49a283eca..ee2c29ca4e 100644 --- a/tests/components/at581x/test.rp2040-ard.yaml +++ b/tests/components/at581x/test.rp2040-ard.yaml @@ -1,38 +1,5 @@ -esphome: - on_boot: - then: - - at581x.settings: - id: "Waveradar" - hw_frontend_reset: false - frequency: 5800MHz - sensing_distance: 200 - poweron_selfcheck_time: 2s - protect_time: 1s - trigger_base: 500ms - trigger_keep: 10s - stage_gain: 3 - power_consumption: 70uA - - at581x.reset: - id: "Waveradar" +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -at581x: - id: "Waveradar" - i2c_id: i2c_bus - -i2c: - sda: 8 - scl: 9 - scan: true - frequency: 100kHz - setup_priority: -100 - id: i2c_bus - -binary_sensor: - - platform: gpio - pin: GPIO21 - name: "Radar motion" - -switch: - - platform: at581x - at581x_id: "Waveradar" - name: "Enable Radar" +<<: !include common.yaml diff --git a/tests/components/atm90e26/common.yaml b/tests/components/atm90e26/common.yaml new file mode 100644 index 0000000000..49c3a73ec8 --- /dev/null +++ b/tests/components/atm90e26/common.yaml @@ -0,0 +1,26 @@ +spi: + - id: spi_atm90e26 + clk_pin: ${clk_pin} + mosi_pin: ${mosi_pin} + miso_pin: ${miso_pin} + +sensor: + - platform: atm90e26 + cs_pin: ${cs_pin} + voltage: + name: Line Voltage + current: + name: CT Amps + power: + name: Active Watts + power_factor: + name: Power Factor + frequency: + name: Line Frequency + line_frequency: 50Hz + meter_constant: 1000 + pl_const: 1429876 + gain_pga: 1X + gain_metering: 7481 + gain_voltage: 26400 + gain_ct: 31251 diff --git a/tests/components/atm90e26/test.esp32-ard.yaml b/tests/components/atm90e26/test.esp32-ard.yaml index 72fb3e5b24..54e027a614 100644 --- a/tests/components/atm90e26/test.esp32-ard.yaml +++ b/tests/components/atm90e26/test.esp32-ard.yaml @@ -1,26 +1,7 @@ -spi: - - id: spi_atm90e26 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -sensor: - - platform: atm90e26 - cs_pin: 13 - voltage: - name: Line Voltage - current: - name: CT Amps - power: - name: Active Watts - power_factor: - name: Power Factor - frequency: - name: Line Frequency - line_frequency: 50Hz - meter_constant: 1000 - pl_const: 1429876 - gain_pga: 1X - gain_metering: 7481 - gain_voltage: 26400 - gain_ct: 31251 +<<: !include common.yaml diff --git a/tests/components/atm90e26/test.esp32-c3-ard.yaml b/tests/components/atm90e26/test.esp32-c3-ard.yaml index ce123bcf72..2415ba5dc6 100644 --- a/tests/components/atm90e26/test.esp32-c3-ard.yaml +++ b/tests/components/atm90e26/test.esp32-c3-ard.yaml @@ -1,26 +1,7 @@ -spi: - - id: spi_atm90e26 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -sensor: - - platform: atm90e26 - cs_pin: 8 - voltage: - name: Line Voltage - current: - name: CT Amps - power: - name: Active Watts - power_factor: - name: Power Factor - frequency: - name: Line Frequency - line_frequency: 50Hz - meter_constant: 1000 - pl_const: 1429876 - gain_pga: 1X - gain_metering: 7481 - gain_voltage: 26400 - gain_ct: 31251 +<<: !include common.yaml diff --git a/tests/components/atm90e26/test.esp32-c3-idf.yaml b/tests/components/atm90e26/test.esp32-c3-idf.yaml index ce123bcf72..2415ba5dc6 100644 --- a/tests/components/atm90e26/test.esp32-c3-idf.yaml +++ b/tests/components/atm90e26/test.esp32-c3-idf.yaml @@ -1,26 +1,7 @@ -spi: - - id: spi_atm90e26 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -sensor: - - platform: atm90e26 - cs_pin: 8 - voltage: - name: Line Voltage - current: - name: CT Amps - power: - name: Active Watts - power_factor: - name: Power Factor - frequency: - name: Line Frequency - line_frequency: 50Hz - meter_constant: 1000 - pl_const: 1429876 - gain_pga: 1X - gain_metering: 7481 - gain_voltage: 26400 - gain_ct: 31251 +<<: !include common.yaml diff --git a/tests/components/atm90e26/test.esp32-idf.yaml b/tests/components/atm90e26/test.esp32-idf.yaml index 72fb3e5b24..54e027a614 100644 --- a/tests/components/atm90e26/test.esp32-idf.yaml +++ b/tests/components/atm90e26/test.esp32-idf.yaml @@ -1,26 +1,7 @@ -spi: - - id: spi_atm90e26 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -sensor: - - platform: atm90e26 - cs_pin: 13 - voltage: - name: Line Voltage - current: - name: CT Amps - power: - name: Active Watts - power_factor: - name: Power Factor - frequency: - name: Line Frequency - line_frequency: 50Hz - meter_constant: 1000 - pl_const: 1429876 - gain_pga: 1X - gain_metering: 7481 - gain_voltage: 26400 - gain_ct: 31251 +<<: !include common.yaml diff --git a/tests/components/atm90e26/test.esp8266-ard.yaml b/tests/components/atm90e26/test.esp8266-ard.yaml index 68d63cc278..dbd158d030 100644 --- a/tests/components/atm90e26/test.esp8266-ard.yaml +++ b/tests/components/atm90e26/test.esp8266-ard.yaml @@ -1,26 +1,7 @@ -spi: - - id: spi_atm90e26 - clk_pin: 14 - mosi_pin: 13 - miso_pin: 12 +substitutions: + clk_pin: GPIO14 + mosi_pin: GPIO13 + miso_pin: GPIO12 + cs_pin: GPIO15 -sensor: - - platform: atm90e26 - cs_pin: 5 - voltage: - name: Line Voltage - current: - name: CT Amps - power: - name: Active Watts - power_factor: - name: Power Factor - frequency: - name: Line Frequency - line_frequency: 50Hz - meter_constant: 1000 - pl_const: 1429876 - gain_pga: 1X - gain_metering: 7481 - gain_voltage: 26400 - gain_ct: 31251 +<<: !include common.yaml diff --git a/tests/components/atm90e26/test.rp2040-ard.yaml b/tests/components/atm90e26/test.rp2040-ard.yaml index f43277dbb1..c8bfab0023 100644 --- a/tests/components/atm90e26/test.rp2040-ard.yaml +++ b/tests/components/atm90e26/test.rp2040-ard.yaml @@ -1,26 +1,7 @@ -spi: - - id: spi_atm90e26 - clk_pin: 2 - mosi_pin: 3 - miso_pin: 4 +substitutions: + clk_pin: GPIO2 + mosi_pin: GPIO3 + miso_pin: GPIO4 + cs_pin: GPIO6 -sensor: - - platform: atm90e26 - cs_pin: 5 - voltage: - name: Line Voltage - current: - name: CT Amps - power: - name: Active Watts - power_factor: - name: Power Factor - frequency: - name: Line Frequency - line_frequency: 50Hz - meter_constant: 1000 - pl_const: 1429876 - gain_pga: 1X - gain_metering: 7481 - gain_voltage: 26400 - gain_ct: 31251 +<<: !include common.yaml diff --git a/tests/components/atm90e32/common.yaml b/tests/components/atm90e32/common.yaml new file mode 100644 index 0000000000..156d00b4e0 --- /dev/null +++ b/tests/components/atm90e32/common.yaml @@ -0,0 +1,61 @@ +spi: + - id: spi_atm90e32 + clk_pin: ${clk_pin} + mosi_pin: ${mosi_pin} + miso_pin: ${miso_pin} + +sensor: + - platform: atm90e32 + cs_pin: ${cs_pin} + id: atm90e32_chip1 + phase_a: + voltage: + name: EMON Line Voltage A + current: + name: EMON CT1 Current + power: + name: EMON Active Power CT1 + reactive_power: + name: EMON Reactive Power CT1 + power_factor: + name: EMON Power Factor CT1 + gain_voltage: 7305 + gain_ct: 27961 + phase_b: + current: + name: EMON CT2 Current + power: + name: EMON Active Power CT2 + reactive_power: + name: EMON Reactive Power CT2 + power_factor: + name: EMON Power Factor CT2 + gain_voltage: 7305 + gain_ct: 27961 + phase_c: + current: + name: EMON CT3 Current + power: + name: EMON Active Power CT3 + reactive_power: + name: EMON Reactive Power CT3 + power_factor: + name: EMON Power Factor CT3 + gain_voltage: 7305 + gain_ct: 27961 + frequency: + name: EMON Line Frequency + chip_temperature: + name: EMON Chip Temp A + line_frequency: 60Hz + current_phases: 3 + gain_pga: 2X + enable_offset_calibration: True + +button: + - platform: atm90e32 + id: atm90e32_chip1 + run_offset_calibration: + name: Chip1 - Run Offset Calibration + clear_offset_calibration: + name: Chip1 - Clear Offset Calibration diff --git a/tests/components/atm90e32/test.esp32-ard.yaml b/tests/components/atm90e32/test.esp32-ard.yaml index 3bdc2bcec6..54e027a614 100644 --- a/tests/components/atm90e32/test.esp32-ard.yaml +++ b/tests/components/atm90e32/test.esp32-ard.yaml @@ -1,60 +1,7 @@ -spi: - - id: spi_atm90e32 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -sensor: - - platform: atm90e32 - cs_pin: 13 - id: chip1 - phase_a: - voltage: - name: EMON Line Voltage A - current: - name: EMON CT1 Current - power: - name: EMON Active Power CT1 - reactive_power: - name: EMON Reactive Power CT1 - power_factor: - name: EMON Power Factor CT1 - gain_voltage: 7305 - gain_ct: 27961 - phase_b: - current: - name: EMON CT2 Current - power: - name: EMON Active Power CT2 - reactive_power: - name: EMON Reactive Power CT2 - power_factor: - name: EMON Power Factor CT2 - gain_voltage: 7305 - gain_ct: 27961 - phase_c: - current: - name: EMON CT3 Current - power: - name: EMON Active Power CT3 - reactive_power: - name: EMON Reactive Power CT3 - power_factor: - name: EMON Power Factor CT3 - gain_voltage: 7305 - gain_ct: 27961 - frequency: - name: EMON Line Frequency - chip_temperature: - name: EMON Chip Temp A - line_frequency: 60Hz - current_phases: 3 - gain_pga: 2X - enable_offset_calibration: True -button: - - platform: atm90e32 - id: chip1 - run_offset_calibration: - name: "Chip1 - Run Offset Calibration" - clear_offset_calibration: - name: "Chip1 - Clear Offset Calibration" +<<: !include common.yaml diff --git a/tests/components/atm90e32/test.esp32-c3-ard.yaml b/tests/components/atm90e32/test.esp32-c3-ard.yaml index 9ec0037a61..2415ba5dc6 100644 --- a/tests/components/atm90e32/test.esp32-c3-ard.yaml +++ b/tests/components/atm90e32/test.esp32-c3-ard.yaml @@ -1,60 +1,7 @@ -spi: - - id: spi_atm90e32 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -sensor: - - platform: atm90e32 - cs_pin: 8 - id: chip1 - phase_a: - voltage: - name: EMON Line Voltage A - current: - name: EMON CT1 Current - power: - name: EMON Active Power CT1 - reactive_power: - name: EMON Reactive Power CT1 - power_factor: - name: EMON Power Factor CT1 - gain_voltage: 7305 - gain_ct: 27961 - phase_b: - current: - name: EMON CT2 Current - power: - name: EMON Active Power CT2 - reactive_power: - name: EMON Reactive Power CT2 - power_factor: - name: EMON Power Factor CT2 - gain_voltage: 7305 - gain_ct: 27961 - phase_c: - current: - name: EMON CT3 Current - power: - name: EMON Active Power CT3 - reactive_power: - name: EMON Reactive Power CT3 - power_factor: - name: EMON Power Factor CT3 - gain_voltage: 7305 - gain_ct: 27961 - frequency: - name: EMON Line Frequency - chip_temperature: - name: EMON Chip Temp A - line_frequency: 60Hz - current_phases: 3 - gain_pga: 2X - enable_offset_calibration: True -button: - - platform: atm90e32 - id: chip1 - run_offset_calibration: - name: "Chip1 - Run Offset Calibration" - clear_offset_calibration: - name: "Chip1 - Clear Offset Calibration" +<<: !include common.yaml diff --git a/tests/components/atm90e32/test.esp32-c3-idf.yaml b/tests/components/atm90e32/test.esp32-c3-idf.yaml index 9ec0037a61..2415ba5dc6 100644 --- a/tests/components/atm90e32/test.esp32-c3-idf.yaml +++ b/tests/components/atm90e32/test.esp32-c3-idf.yaml @@ -1,60 +1,7 @@ -spi: - - id: spi_atm90e32 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -sensor: - - platform: atm90e32 - cs_pin: 8 - id: chip1 - phase_a: - voltage: - name: EMON Line Voltage A - current: - name: EMON CT1 Current - power: - name: EMON Active Power CT1 - reactive_power: - name: EMON Reactive Power CT1 - power_factor: - name: EMON Power Factor CT1 - gain_voltage: 7305 - gain_ct: 27961 - phase_b: - current: - name: EMON CT2 Current - power: - name: EMON Active Power CT2 - reactive_power: - name: EMON Reactive Power CT2 - power_factor: - name: EMON Power Factor CT2 - gain_voltage: 7305 - gain_ct: 27961 - phase_c: - current: - name: EMON CT3 Current - power: - name: EMON Active Power CT3 - reactive_power: - name: EMON Reactive Power CT3 - power_factor: - name: EMON Power Factor CT3 - gain_voltage: 7305 - gain_ct: 27961 - frequency: - name: EMON Line Frequency - chip_temperature: - name: EMON Chip Temp A - line_frequency: 60Hz - current_phases: 3 - gain_pga: 2X - enable_offset_calibration: True -button: - - platform: atm90e32 - id: chip1 - run_offset_calibration: - name: "Chip1 - Run Offset Calibration" - clear_offset_calibration: - name: "Chip1 - Clear Offset Calibration" +<<: !include common.yaml diff --git a/tests/components/atm90e32/test.esp32-idf.yaml b/tests/components/atm90e32/test.esp32-idf.yaml index 3bdc2bcec6..54e027a614 100644 --- a/tests/components/atm90e32/test.esp32-idf.yaml +++ b/tests/components/atm90e32/test.esp32-idf.yaml @@ -1,60 +1,7 @@ -spi: - - id: spi_atm90e32 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -sensor: - - platform: atm90e32 - cs_pin: 13 - id: chip1 - phase_a: - voltage: - name: EMON Line Voltage A - current: - name: EMON CT1 Current - power: - name: EMON Active Power CT1 - reactive_power: - name: EMON Reactive Power CT1 - power_factor: - name: EMON Power Factor CT1 - gain_voltage: 7305 - gain_ct: 27961 - phase_b: - current: - name: EMON CT2 Current - power: - name: EMON Active Power CT2 - reactive_power: - name: EMON Reactive Power CT2 - power_factor: - name: EMON Power Factor CT2 - gain_voltage: 7305 - gain_ct: 27961 - phase_c: - current: - name: EMON CT3 Current - power: - name: EMON Active Power CT3 - reactive_power: - name: EMON Reactive Power CT3 - power_factor: - name: EMON Power Factor CT3 - gain_voltage: 7305 - gain_ct: 27961 - frequency: - name: EMON Line Frequency - chip_temperature: - name: EMON Chip Temp A - line_frequency: 60Hz - current_phases: 3 - gain_pga: 2X - enable_offset_calibration: True -button: - - platform: atm90e32 - id: chip1 - run_offset_calibration: - name: "Chip1 - Run Offset Calibration" - clear_offset_calibration: - name: "Chip1 - Clear Offset Calibration" +<<: !include common.yaml diff --git a/tests/components/atm90e32/test.esp8266-ard.yaml b/tests/components/atm90e32/test.esp8266-ard.yaml index fbb3368efa..dbd158d030 100644 --- a/tests/components/atm90e32/test.esp8266-ard.yaml +++ b/tests/components/atm90e32/test.esp8266-ard.yaml @@ -1,91 +1,7 @@ -spi: - - id: spi_atm90e32 - clk_pin: 14 - mosi_pin: 13 - miso_pin: 12 +substitutions: + clk_pin: GPIO14 + mosi_pin: GPIO13 + miso_pin: GPIO12 + cs_pin: GPIO15 -sensor: - - platform: atm90e32 - cs_pin: 5 - id: chip1 - phase_a: - voltage: - name: EMON Line Voltage A - current: - name: EMON CT1 Current - power: - name: EMON Active Power CT1 - reactive_power: - name: EMON Reactive Power CT1 - power_factor: - name: EMON Power Factor CT1 - gain_voltage: 7305 - gain_ct: 27961 - phase_b: - current: - name: EMON CT2 Current - power: - name: EMON Active Power CT2 - reactive_power: - name: EMON Reactive Power CT2 - power_factor: - name: EMON Power Factor CT2 - gain_voltage: 7305 - gain_ct: 27961 - phase_c: - current: - name: EMON CT3 Current - power: - name: EMON Active Power CT3 - reactive_power: - name: EMON Reactive Power CT3 - power_factor: - name: EMON Power Factor CT3 - gain_voltage: 7305 - gain_ct: 27961 - frequency: - name: EMON Line Frequency - chip_temperature: - name: EMON Chip Temp A - line_frequency: 60Hz - current_phases: 3 - gain_pga: 2X - enable_offset_calibration: True - - platform: atm90e32 - cs_pin: 4 - id: chip2 - phase_a: - voltage: - name: EMON Line Voltage A - current: - name: EMON CT1 Current - power: - name: EMON Active Power CT1 - reactive_power: - name: EMON Reactive Power CT1 - power_factor: - name: EMON Power Factor CT1 - gain_voltage: 7305 - gain_ct: 27961 - phase_c: - voltage: - name: EMON Line Voltage C - current: - name: EMON CT2 Current - power: - name: EMON Active Power CT2 - reactive_power: - name: EMON Reactive Power CT2 - power_factor: - name: EMON Power Factor CT2 - gain_voltage: 7305 - gain_ct: 27961 - line_frequency: 60Hz - current_phases: 2 -button: - - platform: atm90e32 - id: chip1 - run_offset_calibration: - name: "Chip1 - Run Offset Calibration" - clear_offset_calibration: - name: "Chip1 - Clear Offset Calibration" +<<: !include common.yaml diff --git a/tests/components/atm90e32/test.rp2040-ard.yaml b/tests/components/atm90e32/test.rp2040-ard.yaml index a6b7956da7..c8bfab0023 100644 --- a/tests/components/atm90e32/test.rp2040-ard.yaml +++ b/tests/components/atm90e32/test.rp2040-ard.yaml @@ -1,60 +1,7 @@ -spi: - - id: spi_atm90e32 - clk_pin: 2 - mosi_pin: 3 - miso_pin: 4 +substitutions: + clk_pin: GPIO2 + mosi_pin: GPIO3 + miso_pin: GPIO4 + cs_pin: GPIO6 -sensor: - - platform: atm90e32 - cs_pin: 5 - id: chip1 - phase_a: - voltage: - name: EMON Line Voltage A - current: - name: EMON CT1 Current - power: - name: EMON Active Power CT1 - reactive_power: - name: EMON Reactive Power CT1 - power_factor: - name: EMON Power Factor CT1 - gain_voltage: 7305 - gain_ct: 27961 - phase_b: - current: - name: EMON CT2 Current - power: - name: EMON Active Power CT2 - reactive_power: - name: EMON Reactive Power CT2 - power_factor: - name: EMON Power Factor CT2 - gain_voltage: 7305 - gain_ct: 27961 - phase_c: - current: - name: EMON CT3 Current - power: - name: EMON Active Power CT3 - reactive_power: - name: EMON Reactive Power CT3 - power_factor: - name: EMON Power Factor CT3 - gain_voltage: 7305 - gain_ct: 27961 - frequency: - name: EMON Line Frequency - chip_temperature: - name: EMON Chip Temp A - line_frequency: 60Hz - current_phases: 3 - gain_pga: 2X - enable_offset_calibration: True -button: - - platform: atm90e32 - id: chip1 - run_offset_calibration: - name: "Chip1 - Run Offset Calibration" - clear_offset_calibration: - name: "Chip1 - Clear Offset Calibration" +<<: !include common.yaml diff --git a/tests/components/ballu/common.yaml b/tests/components/ballu/common.yaml new file mode 100644 index 0000000000..52f86aa26a --- /dev/null +++ b/tests/components/ballu/common.yaml @@ -0,0 +1,12 @@ +remote_transmitter: + pin: ${pin} + carrier_duty_percent: 50% + +climate: + - platform: heatpumpir + protocol: ballu + horizontal_default: middle + vertical_default: middle + name: HeatpumpIR Climate + min_temperature: 18 + max_temperature: 30 diff --git a/tests/components/ballu/test.esp32-ard.yaml b/tests/components/ballu/test.esp32-ard.yaml index bb7b9b0435..7b012aa64c 100644 --- a/tests/components/ballu/test.esp32-ard.yaml +++ b/tests/components/ballu/test.esp32-ard.yaml @@ -1,12 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: heatpumpir - protocol: ballu - horizontal_default: middle - vertical_default: middle - name: HeatpumpIR Climate - min_temperature: 18 - max_temperature: 30 +<<: !include common.yaml diff --git a/tests/components/ballu/test.esp8266-ard.yaml b/tests/components/ballu/test.esp8266-ard.yaml index 05aa446739..f5097fcf5f 100644 --- a/tests/components/ballu/test.esp8266-ard.yaml +++ b/tests/components/ballu/test.esp8266-ard.yaml @@ -1,12 +1,4 @@ -remote_transmitter: - pin: 5 - carrier_duty_percent: 50% +substitutions: + pin: GPIO5 -climate: - - platform: heatpumpir - protocol: ballu - horizontal_default: middle - vertical_default: middle - name: HeatpumpIR Climate - min_temperature: 18 - max_temperature: 30 +<<: !include common.yaml diff --git a/tests/components/bh1750/common.yaml b/tests/components/bh1750/common.yaml new file mode 100644 index 0000000000..c0e0bc1c59 --- /dev/null +++ b/tests/components/bh1750/common.yaml @@ -0,0 +1,10 @@ +i2c: + - id: i2c_bh1750 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: bh1750 + name: Living Room Brightness + address: 0x23 + update_interval: 30s diff --git a/tests/components/bh1750/test.esp32-ard.yaml b/tests/components/bh1750/test.esp32-ard.yaml index b10ec231ae..3b761d3fc1 100644 --- a/tests/components/bh1750/test.esp32-ard.yaml +++ b/tests/components/bh1750/test.esp32-ard.yaml @@ -1,10 +1,5 @@ -i2c: - - id: i2c_bh1750 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO22 + sda_pin: GPIO21 -sensor: - - platform: bh1750 - name: Living Room Brightness - address: 0x23 - update_interval: 30s +<<: !include common.yaml diff --git a/tests/components/bh1750/test.esp32-c3-ard.yaml b/tests/components/bh1750/test.esp32-c3-ard.yaml index e367de3845..ee2c29ca4e 100644 --- a/tests/components/bh1750/test.esp32-c3-ard.yaml +++ b/tests/components/bh1750/test.esp32-c3-ard.yaml @@ -1,10 +1,5 @@ -i2c: - - id: i2c_bh1750 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: bh1750 - name: Living Room Brightness - address: 0x23 - update_interval: 30s +<<: !include common.yaml diff --git a/tests/components/bh1750/test.esp32-c3-idf.yaml b/tests/components/bh1750/test.esp32-c3-idf.yaml index e367de3845..ee2c29ca4e 100644 --- a/tests/components/bh1750/test.esp32-c3-idf.yaml +++ b/tests/components/bh1750/test.esp32-c3-idf.yaml @@ -1,10 +1,5 @@ -i2c: - - id: i2c_bh1750 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: bh1750 - name: Living Room Brightness - address: 0x23 - update_interval: 30s +<<: !include common.yaml diff --git a/tests/components/bh1750/test.esp32-idf.yaml b/tests/components/bh1750/test.esp32-idf.yaml index b10ec231ae..3b761d3fc1 100644 --- a/tests/components/bh1750/test.esp32-idf.yaml +++ b/tests/components/bh1750/test.esp32-idf.yaml @@ -1,10 +1,5 @@ -i2c: - - id: i2c_bh1750 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO22 + sda_pin: GPIO21 -sensor: - - platform: bh1750 - name: Living Room Brightness - address: 0x23 - update_interval: 30s +<<: !include common.yaml diff --git a/tests/components/bh1750/test.esp8266-ard.yaml b/tests/components/bh1750/test.esp8266-ard.yaml index e367de3845..ee2c29ca4e 100644 --- a/tests/components/bh1750/test.esp8266-ard.yaml +++ b/tests/components/bh1750/test.esp8266-ard.yaml @@ -1,10 +1,5 @@ -i2c: - - id: i2c_bh1750 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: bh1750 - name: Living Room Brightness - address: 0x23 - update_interval: 30s +<<: !include common.yaml diff --git a/tests/components/bh1750/test.rp2040-ard.yaml b/tests/components/bh1750/test.rp2040-ard.yaml index e367de3845..ee2c29ca4e 100644 --- a/tests/components/bh1750/test.rp2040-ard.yaml +++ b/tests/components/bh1750/test.rp2040-ard.yaml @@ -1,10 +1,5 @@ -i2c: - - id: i2c_bh1750 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: bh1750 - name: Living Room Brightness - address: 0x23 - update_interval: 30s +<<: !include common.yaml diff --git a/tests/components/bl0906/common.yaml b/tests/components/bl0906/common.yaml index 29321a9471..29b82a5958 100644 --- a/tests/components/bl0906/common.yaml +++ b/tests/components/bl0906/common.yaml @@ -1,9 +1,7 @@ uart: - id: uart_bl0906 - tx_pin: - number: ${tx_pin} - rx_pin: - number: ${rx_pin} + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} baud_rate: 19200 sensor: diff --git a/tests/components/bl0939/common.yaml b/tests/components/bl0939/common.yaml new file mode 100644 index 0000000000..7a6b635b70 --- /dev/null +++ b/tests/components/bl0939/common.yaml @@ -0,0 +1,24 @@ +uart: + - id: uart_bl0939 + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} + baud_rate: 9600 + +sensor: + - platform: bl0939 + voltage: + name: BL0939 Voltage + current_1: + name: BL0939 Current 1 + current_2: + name: BL0939 Current 2 + active_power_1: + name: BL0939 Active Power 1 + active_power_2: + name: BL0939 Active Power 2 + energy_1: + name: BL0939 Energy 1 + energy_2: + name: BL0939 Energy 2 + energy_total: + name: BL0939 Total energy diff --git a/tests/components/bl0939/test.esp32-ard.yaml b/tests/components/bl0939/test.esp32-ard.yaml index df0e683b2f..811f6b72a6 100644 --- a/tests/components/bl0939/test.esp32-ard.yaml +++ b/tests/components/bl0939/test.esp32-ard.yaml @@ -1,26 +1,5 @@ -uart: - - id: uart_bl0939 - tx_pin: - number: 17 - rx_pin: - number: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 -sensor: - - platform: bl0939 - voltage: - name: BL0939 Voltage - current_1: - name: BL0939 Current 1 - current_2: - name: BL0939 Current 2 - active_power_1: - name: BL0939 Active Power 1 - active_power_2: - name: BL0939 Active Power 2 - energy_1: - name: BL0939 Energy 1 - energy_2: - name: BL0939 Energy 2 - energy_total: - name: BL0939 Total energy +<<: !include common.yaml diff --git a/tests/components/bl0939/test.esp32-c3-ard.yaml b/tests/components/bl0939/test.esp32-c3-ard.yaml index 4c92ccb7dd..c79d14c740 100644 --- a/tests/components/bl0939/test.esp32-c3-ard.yaml +++ b/tests/components/bl0939/test.esp32-c3-ard.yaml @@ -1,26 +1,5 @@ -uart: - - id: uart_bl0939 - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO7 + rx_pin: GPIO8 -sensor: - - platform: bl0939 - voltage: - name: BL0939 Voltage - current_1: - name: BL0939 Current 1 - current_2: - name: BL0939 Current 2 - active_power_1: - name: BL0939 Active Power 1 - active_power_2: - name: BL0939 Active Power 2 - energy_1: - name: BL0939 Energy 1 - energy_2: - name: BL0939 Energy 2 - energy_total: - name: BL0939 Total energy +<<: !include common.yaml diff --git a/tests/components/bl0939/test.esp32-c3-idf.yaml b/tests/components/bl0939/test.esp32-c3-idf.yaml index 4c92ccb7dd..c79d14c740 100644 --- a/tests/components/bl0939/test.esp32-c3-idf.yaml +++ b/tests/components/bl0939/test.esp32-c3-idf.yaml @@ -1,26 +1,5 @@ -uart: - - id: uart_bl0939 - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO7 + rx_pin: GPIO8 -sensor: - - platform: bl0939 - voltage: - name: BL0939 Voltage - current_1: - name: BL0939 Current 1 - current_2: - name: BL0939 Current 2 - active_power_1: - name: BL0939 Active Power 1 - active_power_2: - name: BL0939 Active Power 2 - energy_1: - name: BL0939 Energy 1 - energy_2: - name: BL0939 Energy 2 - energy_total: - name: BL0939 Total energy +<<: !include common.yaml diff --git a/tests/components/bl0939/test.esp32-idf.yaml b/tests/components/bl0939/test.esp32-idf.yaml index df0e683b2f..811f6b72a6 100644 --- a/tests/components/bl0939/test.esp32-idf.yaml +++ b/tests/components/bl0939/test.esp32-idf.yaml @@ -1,26 +1,5 @@ -uart: - - id: uart_bl0939 - tx_pin: - number: 17 - rx_pin: - number: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 -sensor: - - platform: bl0939 - voltage: - name: BL0939 Voltage - current_1: - name: BL0939 Current 1 - current_2: - name: BL0939 Current 2 - active_power_1: - name: BL0939 Active Power 1 - active_power_2: - name: BL0939 Active Power 2 - energy_1: - name: BL0939 Energy 1 - energy_2: - name: BL0939 Energy 2 - energy_total: - name: BL0939 Total energy +<<: !include common.yaml diff --git a/tests/components/bl0939/test.esp8266-ard.yaml b/tests/components/bl0939/test.esp8266-ard.yaml index 4c92ccb7dd..3b44f9c9c3 100644 --- a/tests/components/bl0939/test.esp8266-ard.yaml +++ b/tests/components/bl0939/test.esp8266-ard.yaml @@ -1,26 +1,5 @@ -uart: - - id: uart_bl0939 - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO1 + rx_pin: GPIO3 -sensor: - - platform: bl0939 - voltage: - name: BL0939 Voltage - current_1: - name: BL0939 Current 1 - current_2: - name: BL0939 Current 2 - active_power_1: - name: BL0939 Active Power 1 - active_power_2: - name: BL0939 Active Power 2 - energy_1: - name: BL0939 Energy 1 - energy_2: - name: BL0939 Energy 2 - energy_total: - name: BL0939 Total energy +<<: !include common.yaml diff --git a/tests/components/bl0939/test.rp2040-ard.yaml b/tests/components/bl0939/test.rp2040-ard.yaml index 4c92ccb7dd..b516342f3b 100644 --- a/tests/components/bl0939/test.rp2040-ard.yaml +++ b/tests/components/bl0939/test.rp2040-ard.yaml @@ -1,26 +1,5 @@ -uart: - - id: uart_bl0939 - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -sensor: - - platform: bl0939 - voltage: - name: BL0939 Voltage - current_1: - name: BL0939 Current 1 - current_2: - name: BL0939 Current 2 - active_power_1: - name: BL0939 Active Power 1 - active_power_2: - name: BL0939 Active Power 2 - energy_1: - name: BL0939 Energy 1 - energy_2: - name: BL0939 Energy 2 - energy_total: - name: BL0939 Total energy +<<: !include common.yaml diff --git a/tests/components/bl0940/common.yaml b/tests/components/bl0940/common.yaml new file mode 100644 index 0000000000..97a997d2b4 --- /dev/null +++ b/tests/components/bl0940/common.yaml @@ -0,0 +1,20 @@ +uart: + - id: uart_bl0939 + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} + baud_rate: 9600 + +sensor: + - platform: bl0940 + voltage: + name: BL0940 Voltage + current: + name: BL0940 Current + power: + name: BL0940 Power + energy: + name: BL0940 Energy + internal_temperature: + name: BL0940 Internal temperature + external_temperature: + name: BL0940 External temperature diff --git a/tests/components/bl0940/test.esp32-ard.yaml b/tests/components/bl0940/test.esp32-ard.yaml index c7d97ca3b9..811f6b72a6 100644 --- a/tests/components/bl0940/test.esp32-ard.yaml +++ b/tests/components/bl0940/test.esp32-ard.yaml @@ -1,22 +1,5 @@ -uart: - - id: uart_bl0939 - tx_pin: - number: 17 - rx_pin: - number: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 -sensor: - - platform: bl0940 - voltage: - name: BL0940 Voltage - current: - name: BL0940 Current - power: - name: BL0940 Power - energy: - name: BL0940 Energy - internal_temperature: - name: BL0940 Internal temperature - external_temperature: - name: BL0940 External temperature +<<: !include common.yaml diff --git a/tests/components/bl0940/test.esp32-c3-ard.yaml b/tests/components/bl0940/test.esp32-c3-ard.yaml index a20f785b02..c79d14c740 100644 --- a/tests/components/bl0940/test.esp32-c3-ard.yaml +++ b/tests/components/bl0940/test.esp32-c3-ard.yaml @@ -1,22 +1,5 @@ -uart: - - id: uart_bl0939 - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO7 + rx_pin: GPIO8 -sensor: - - platform: bl0940 - voltage: - name: BL0940 Voltage - current: - name: BL0940 Current - power: - name: BL0940 Power - energy: - name: BL0940 Energy - internal_temperature: - name: BL0940 Internal temperature - external_temperature: - name: BL0940 External temperature +<<: !include common.yaml diff --git a/tests/components/bl0940/test.esp32-c3-idf.yaml b/tests/components/bl0940/test.esp32-c3-idf.yaml index a20f785b02..c79d14c740 100644 --- a/tests/components/bl0940/test.esp32-c3-idf.yaml +++ b/tests/components/bl0940/test.esp32-c3-idf.yaml @@ -1,22 +1,5 @@ -uart: - - id: uart_bl0939 - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO7 + rx_pin: GPIO8 -sensor: - - platform: bl0940 - voltage: - name: BL0940 Voltage - current: - name: BL0940 Current - power: - name: BL0940 Power - energy: - name: BL0940 Energy - internal_temperature: - name: BL0940 Internal temperature - external_temperature: - name: BL0940 External temperature +<<: !include common.yaml diff --git a/tests/components/bl0940/test.esp32-idf.yaml b/tests/components/bl0940/test.esp32-idf.yaml index c7d97ca3b9..811f6b72a6 100644 --- a/tests/components/bl0940/test.esp32-idf.yaml +++ b/tests/components/bl0940/test.esp32-idf.yaml @@ -1,22 +1,5 @@ -uart: - - id: uart_bl0939 - tx_pin: - number: 17 - rx_pin: - number: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 -sensor: - - platform: bl0940 - voltage: - name: BL0940 Voltage - current: - name: BL0940 Current - power: - name: BL0940 Power - energy: - name: BL0940 Energy - internal_temperature: - name: BL0940 Internal temperature - external_temperature: - name: BL0940 External temperature +<<: !include common.yaml diff --git a/tests/components/bl0940/test.esp8266-ard.yaml b/tests/components/bl0940/test.esp8266-ard.yaml index a20f785b02..3b44f9c9c3 100644 --- a/tests/components/bl0940/test.esp8266-ard.yaml +++ b/tests/components/bl0940/test.esp8266-ard.yaml @@ -1,22 +1,5 @@ -uart: - - id: uart_bl0939 - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO1 + rx_pin: GPIO3 -sensor: - - platform: bl0940 - voltage: - name: BL0940 Voltage - current: - name: BL0940 Current - power: - name: BL0940 Power - energy: - name: BL0940 Energy - internal_temperature: - name: BL0940 Internal temperature - external_temperature: - name: BL0940 External temperature +<<: !include common.yaml diff --git a/tests/components/bl0940/test.rp2040-ard.yaml b/tests/components/bl0940/test.rp2040-ard.yaml index a20f785b02..b516342f3b 100644 --- a/tests/components/bl0940/test.rp2040-ard.yaml +++ b/tests/components/bl0940/test.rp2040-ard.yaml @@ -1,22 +1,5 @@ -uart: - - id: uart_bl0939 - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -sensor: - - platform: bl0940 - voltage: - name: BL0940 Voltage - current: - name: BL0940 Current - power: - name: BL0940 Power - energy: - name: BL0940 Energy - internal_temperature: - name: BL0940 Internal temperature - external_temperature: - name: BL0940 External temperature +<<: !include common.yaml diff --git a/tests/components/bl0942/common.yaml b/tests/components/bl0942/common.yaml new file mode 100644 index 0000000000..32da24885f --- /dev/null +++ b/tests/components/bl0942/common.yaml @@ -0,0 +1,19 @@ +uart: + - id: uart_bl0939 + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} + baud_rate: 9600 + +sensor: + - platform: bl0942 + reset: true + voltage: + name: BL0942 Voltage + current: + name: BL0942 Current + power: + name: BL0942 Power + energy: + name: BL0942 Energy + frequency: + name: BL0942 Frequency diff --git a/tests/components/bl0942/test.bk72xx-ard.yaml b/tests/components/bl0942/test.bk72xx-ard.yaml index ea61734441..96e13c83a9 100644 --- a/tests/components/bl0942/test.bk72xx-ard.yaml +++ b/tests/components/bl0942/test.bk72xx-ard.yaml @@ -1,27 +1,5 @@ -uart: - - id: uart_bl0942 - tx_pin: - number: TX1 - rx_pin: - number: RX1 - baud_rate: 2400 +substitutions: + tx_pin: TX1 + rx_pin: RX1 -sensor: - - platform: bl0942 - address: 0 - line_frequency: 50Hz - reset: false - voltage: - name: BL0942 Voltage - current: - name: BL0942 Current - power: - name: BL0942 Power - energy: - name: BL0942 Energy - frequency: - name: BL0942 Frequency - voltage_reference: 15968 - current_reference: 124180 - power_reference: 309.1 - energy_reference: 2653 +<<: !include common.yaml diff --git a/tests/components/bl0942/test.esp32-ard.yaml b/tests/components/bl0942/test.esp32-ard.yaml index 4138543967..811f6b72a6 100644 --- a/tests/components/bl0942/test.esp32-ard.yaml +++ b/tests/components/bl0942/test.esp32-ard.yaml @@ -1,21 +1,5 @@ -uart: - - id: uart_bl0939 - tx_pin: - number: 17 - rx_pin: - number: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 -sensor: - - platform: bl0942 - reset: true - voltage: - name: BL0942 Voltage - current: - name: BL0942 Current - power: - name: BL0942 Power - energy: - name: BL0942 Energy - frequency: - name: BL0942 Frequency +<<: !include common.yaml diff --git a/tests/components/bl0942/test.esp32-c3-ard.yaml b/tests/components/bl0942/test.esp32-c3-ard.yaml index 8d16efed4f..c79d14c740 100644 --- a/tests/components/bl0942/test.esp32-c3-ard.yaml +++ b/tests/components/bl0942/test.esp32-c3-ard.yaml @@ -1,20 +1,5 @@ -uart: - - id: uart_bl0939 - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO7 + rx_pin: GPIO8 -sensor: - - platform: bl0942 - voltage: - name: BL0942 Voltage - current: - name: BL0942 Current - power: - name: BL0942 Power - energy: - name: BL0942 Energy - frequency: - name: BL0942 Frequency +<<: !include common.yaml diff --git a/tests/components/bl0942/test.esp32-c3-idf.yaml b/tests/components/bl0942/test.esp32-c3-idf.yaml index 8d16efed4f..c79d14c740 100644 --- a/tests/components/bl0942/test.esp32-c3-idf.yaml +++ b/tests/components/bl0942/test.esp32-c3-idf.yaml @@ -1,20 +1,5 @@ -uart: - - id: uart_bl0939 - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO7 + rx_pin: GPIO8 -sensor: - - platform: bl0942 - voltage: - name: BL0942 Voltage - current: - name: BL0942 Current - power: - name: BL0942 Power - energy: - name: BL0942 Energy - frequency: - name: BL0942 Frequency +<<: !include common.yaml diff --git a/tests/components/bl0942/test.esp32-idf.yaml b/tests/components/bl0942/test.esp32-idf.yaml index 45ac85aa2a..811f6b72a6 100644 --- a/tests/components/bl0942/test.esp32-idf.yaml +++ b/tests/components/bl0942/test.esp32-idf.yaml @@ -1,20 +1,5 @@ -uart: - - id: uart_bl0939 - tx_pin: - number: 17 - rx_pin: - number: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 -sensor: - - platform: bl0942 - voltage: - name: BL0942 Voltage - current: - name: BL0942 Current - power: - name: BL0942 Power - energy: - name: BL0942 Energy - frequency: - name: BL0942 Frequency +<<: !include common.yaml diff --git a/tests/components/bl0942/test.esp8266-ard.yaml b/tests/components/bl0942/test.esp8266-ard.yaml index 8d16efed4f..3b44f9c9c3 100644 --- a/tests/components/bl0942/test.esp8266-ard.yaml +++ b/tests/components/bl0942/test.esp8266-ard.yaml @@ -1,20 +1,5 @@ -uart: - - id: uart_bl0939 - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO1 + rx_pin: GPIO3 -sensor: - - platform: bl0942 - voltage: - name: BL0942 Voltage - current: - name: BL0942 Current - power: - name: BL0942 Power - energy: - name: BL0942 Energy - frequency: - name: BL0942 Frequency +<<: !include common.yaml diff --git a/tests/components/bl0942/test.rp2040-ard.yaml b/tests/components/bl0942/test.rp2040-ard.yaml index d07e0c4402..b516342f3b 100644 --- a/tests/components/bl0942/test.rp2040-ard.yaml +++ b/tests/components/bl0942/test.rp2040-ard.yaml @@ -1,22 +1,5 @@ -uart: - - id: uart_bl0939 - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -sensor: - - platform: bl0942 - voltage: - name: BL0942 Voltage - current: - name: BL0942 Current - power: - name: BL0942 Power - energy: - name: BL0942 Energy - frequency: - name: BL0942 Frequency - voltage_reference: 15968 - current_reference: 124180 +<<: !include common.yaml diff --git a/tests/components/bme680/common.yaml b/tests/components/bme680/common.yaml new file mode 100644 index 0000000000..13a42488f2 --- /dev/null +++ b/tests/components/bme680/common.yaml @@ -0,0 +1,21 @@ +i2c: + - id: i2c_bme680 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: bme680 + temperature: + name: BME680 Temperature + oversampling: 16x + pressure: + name: BME680 Pressure + humidity: + name: BME680 Humidity + gas_resistance: + name: BME680 Gas Sensor + address: 0x77 + heater: + temperature: 320 + duration: 150ms + update_interval: 15s diff --git a/tests/components/bme680/test.esp32-ard.yaml b/tests/components/bme680/test.esp32-ard.yaml index 04d0ed8fe4..3b761d3fc1 100644 --- a/tests/components/bme680/test.esp32-ard.yaml +++ b/tests/components/bme680/test.esp32-ard.yaml @@ -1,21 +1,5 @@ -i2c: - - id: i2c_bme680 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO22 + sda_pin: GPIO21 -sensor: - - platform: bme680 - temperature: - name: BME680 Temperature - oversampling: 16x - pressure: - name: BME680 Pressure - humidity: - name: BME680 Humidity - gas_resistance: - name: BME680 Gas Sensor - address: 0x77 - heater: - temperature: 320 - duration: 150ms - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/bme680/test.esp32-c3-ard.yaml b/tests/components/bme680/test.esp32-c3-ard.yaml index f12be09d20..ee2c29ca4e 100644 --- a/tests/components/bme680/test.esp32-c3-ard.yaml +++ b/tests/components/bme680/test.esp32-c3-ard.yaml @@ -1,21 +1,5 @@ -i2c: - - id: i2c_bme680 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: bme680 - temperature: - name: BME680 Temperature - oversampling: 16x - pressure: - name: BME680 Pressure - humidity: - name: BME680 Humidity - gas_resistance: - name: BME680 Gas Sensor - address: 0x77 - heater: - temperature: 320 - duration: 150ms - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/bme680/test.esp32-c3-idf.yaml b/tests/components/bme680/test.esp32-c3-idf.yaml index f12be09d20..ee2c29ca4e 100644 --- a/tests/components/bme680/test.esp32-c3-idf.yaml +++ b/tests/components/bme680/test.esp32-c3-idf.yaml @@ -1,21 +1,5 @@ -i2c: - - id: i2c_bme680 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: bme680 - temperature: - name: BME680 Temperature - oversampling: 16x - pressure: - name: BME680 Pressure - humidity: - name: BME680 Humidity - gas_resistance: - name: BME680 Gas Sensor - address: 0x77 - heater: - temperature: 320 - duration: 150ms - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/bme680/test.esp32-idf.yaml b/tests/components/bme680/test.esp32-idf.yaml index 04d0ed8fe4..3b761d3fc1 100644 --- a/tests/components/bme680/test.esp32-idf.yaml +++ b/tests/components/bme680/test.esp32-idf.yaml @@ -1,21 +1,5 @@ -i2c: - - id: i2c_bme680 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO22 + sda_pin: GPIO21 -sensor: - - platform: bme680 - temperature: - name: BME680 Temperature - oversampling: 16x - pressure: - name: BME680 Pressure - humidity: - name: BME680 Humidity - gas_resistance: - name: BME680 Gas Sensor - address: 0x77 - heater: - temperature: 320 - duration: 150ms - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/bme680/test.esp8266-ard.yaml b/tests/components/bme680/test.esp8266-ard.yaml index f12be09d20..ee2c29ca4e 100644 --- a/tests/components/bme680/test.esp8266-ard.yaml +++ b/tests/components/bme680/test.esp8266-ard.yaml @@ -1,21 +1,5 @@ -i2c: - - id: i2c_bme680 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: bme680 - temperature: - name: BME680 Temperature - oversampling: 16x - pressure: - name: BME680 Pressure - humidity: - name: BME680 Humidity - gas_resistance: - name: BME680 Gas Sensor - address: 0x77 - heater: - temperature: 320 - duration: 150ms - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/bme680/test.rp2040-ard.yaml b/tests/components/bme680/test.rp2040-ard.yaml index f12be09d20..ee2c29ca4e 100644 --- a/tests/components/bme680/test.rp2040-ard.yaml +++ b/tests/components/bme680/test.rp2040-ard.yaml @@ -1,21 +1,5 @@ -i2c: - - id: i2c_bme680 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: bme680 - temperature: - name: BME680 Temperature - oversampling: 16x - pressure: - name: BME680 Pressure - humidity: - name: BME680 Humidity - gas_resistance: - name: BME680 Gas Sensor - address: 0x77 - heater: - temperature: 320 - duration: 150ms - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/bme680_bsec/common.yaml b/tests/components/bme680_bsec/common.yaml new file mode 100644 index 0000000000..7d2e9e210b --- /dev/null +++ b/tests/components/bme680_bsec/common.yaml @@ -0,0 +1,29 @@ +i2c: + - id: i2c_bme680 + scl: ${scl_pin} + sda: ${sda_pin} + +bme680_bsec: + address: 0x77 + +sensor: + - platform: bme680_bsec + temperature: + name: BME680 Temperature + pressure: + name: BME680 Pressure + humidity: + name: BME680 Humidity + gas_resistance: + name: BME680 Gas Sensor + iaq: + name: BME680 IAQ + co2_equivalent: + name: BME680 eCO2 + breath_voc_equivalent: + name: BME680 Breath eVOC + +text_sensor: + - platform: bme680_bsec + iaq_accuracy: + name: BME680 Accuracy diff --git a/tests/components/bme680_bsec/test.esp32-ard.yaml b/tests/components/bme680_bsec/test.esp32-ard.yaml index 4f62f13abb..3b761d3fc1 100644 --- a/tests/components/bme680_bsec/test.esp32-ard.yaml +++ b/tests/components/bme680_bsec/test.esp32-ard.yaml @@ -1,29 +1,5 @@ -i2c: - - id: i2c_bme680 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO22 + sda_pin: GPIO21 -bme680_bsec: - address: 0x77 - -sensor: - - platform: bme680_bsec - temperature: - name: BME680 Temperature - pressure: - name: BME680 Pressure - humidity: - name: BME680 Humidity - gas_resistance: - name: BME680 Gas Sensor - iaq: - name: BME680 IAQ - co2_equivalent: - name: BME680 eCO2 - breath_voc_equivalent: - name: BME680 Breath eVOC - -text_sensor: - - platform: bme680_bsec - iaq_accuracy: - name: BME680 Accuracy +<<: !include common.yaml diff --git a/tests/components/bme680_bsec/test.esp8266-ard.yaml b/tests/components/bme680_bsec/test.esp8266-ard.yaml index 84b32d3635..ee2c29ca4e 100644 --- a/tests/components/bme680_bsec/test.esp8266-ard.yaml +++ b/tests/components/bme680_bsec/test.esp8266-ard.yaml @@ -1,29 +1,5 @@ -i2c: - - id: i2c_bme680 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -bme680_bsec: - address: 0x77 - -sensor: - - platform: bme680_bsec - temperature: - name: BME680 Temperature - pressure: - name: BME680 Pressure - humidity: - name: BME680 Humidity - gas_resistance: - name: BME680 Gas Sensor - iaq: - name: BME680 IAQ - co2_equivalent: - name: BME680 eCO2 - breath_voc_equivalent: - name: BME680 Breath eVOC - -text_sensor: - - platform: bme680_bsec - iaq_accuracy: - name: BME680 Accuracy +<<: !include common.yaml diff --git a/tests/components/bmi160/common.yaml b/tests/components/bmi160/common.yaml new file mode 100644 index 0000000000..6aa9aa6ed0 --- /dev/null +++ b/tests/components/bmi160/common.yaml @@ -0,0 +1,22 @@ +i2c: + - id: i2c_bmi160 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: bmi160 + address: 0x68 + acceleration_x: + name: BMI160 Accel X + acceleration_y: + name: BMI160 Accel Y + acceleration_z: + name: BMI160 Accel z + gyroscope_x: + name: BMI160 Gyro X + gyroscope_y: + name: BMI160 Gyro Y + gyroscope_z: + name: BMI160 Gyro z + temperature: + name: BMI160 Temperature diff --git a/tests/components/bmi160/test.esp32-ard.yaml b/tests/components/bmi160/test.esp32-ard.yaml index a8a90c8c87..3b761d3fc1 100644 --- a/tests/components/bmi160/test.esp32-ard.yaml +++ b/tests/components/bmi160/test.esp32-ard.yaml @@ -1,22 +1,5 @@ -i2c: - - id: i2c_bmi160 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO22 + sda_pin: GPIO21 -sensor: - - platform: bmi160 - address: 0x68 - acceleration_x: - name: BMI160 Accel X - acceleration_y: - name: BMI160 Accel Y - acceleration_z: - name: BMI160 Accel z - gyroscope_x: - name: BMI160 Gyro X - gyroscope_y: - name: BMI160 Gyro Y - gyroscope_z: - name: BMI160 Gyro z - temperature: - name: BMI160 Temperature +<<: !include common.yaml diff --git a/tests/components/bmi160/test.esp32-c3-ard.yaml b/tests/components/bmi160/test.esp32-c3-ard.yaml index 3fd6441980..ee2c29ca4e 100644 --- a/tests/components/bmi160/test.esp32-c3-ard.yaml +++ b/tests/components/bmi160/test.esp32-c3-ard.yaml @@ -1,22 +1,5 @@ -i2c: - - id: i2c_bmi160 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: bmi160 - address: 0x68 - acceleration_x: - name: BMI160 Accel X - acceleration_y: - name: BMI160 Accel Y - acceleration_z: - name: BMI160 Accel z - gyroscope_x: - name: BMI160 Gyro X - gyroscope_y: - name: BMI160 Gyro Y - gyroscope_z: - name: BMI160 Gyro z - temperature: - name: BMI160 Temperature +<<: !include common.yaml diff --git a/tests/components/bmi160/test.esp32-c3-idf.yaml b/tests/components/bmi160/test.esp32-c3-idf.yaml index 3fd6441980..ee2c29ca4e 100644 --- a/tests/components/bmi160/test.esp32-c3-idf.yaml +++ b/tests/components/bmi160/test.esp32-c3-idf.yaml @@ -1,22 +1,5 @@ -i2c: - - id: i2c_bmi160 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: bmi160 - address: 0x68 - acceleration_x: - name: BMI160 Accel X - acceleration_y: - name: BMI160 Accel Y - acceleration_z: - name: BMI160 Accel z - gyroscope_x: - name: BMI160 Gyro X - gyroscope_y: - name: BMI160 Gyro Y - gyroscope_z: - name: BMI160 Gyro z - temperature: - name: BMI160 Temperature +<<: !include common.yaml diff --git a/tests/components/bmi160/test.esp32-idf.yaml b/tests/components/bmi160/test.esp32-idf.yaml index a8a90c8c87..3b761d3fc1 100644 --- a/tests/components/bmi160/test.esp32-idf.yaml +++ b/tests/components/bmi160/test.esp32-idf.yaml @@ -1,22 +1,5 @@ -i2c: - - id: i2c_bmi160 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO22 + sda_pin: GPIO21 -sensor: - - platform: bmi160 - address: 0x68 - acceleration_x: - name: BMI160 Accel X - acceleration_y: - name: BMI160 Accel Y - acceleration_z: - name: BMI160 Accel z - gyroscope_x: - name: BMI160 Gyro X - gyroscope_y: - name: BMI160 Gyro Y - gyroscope_z: - name: BMI160 Gyro z - temperature: - name: BMI160 Temperature +<<: !include common.yaml diff --git a/tests/components/bmi160/test.esp8266-ard.yaml b/tests/components/bmi160/test.esp8266-ard.yaml index 3fd6441980..ee2c29ca4e 100644 --- a/tests/components/bmi160/test.esp8266-ard.yaml +++ b/tests/components/bmi160/test.esp8266-ard.yaml @@ -1,22 +1,5 @@ -i2c: - - id: i2c_bmi160 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: bmi160 - address: 0x68 - acceleration_x: - name: BMI160 Accel X - acceleration_y: - name: BMI160 Accel Y - acceleration_z: - name: BMI160 Accel z - gyroscope_x: - name: BMI160 Gyro X - gyroscope_y: - name: BMI160 Gyro Y - gyroscope_z: - name: BMI160 Gyro z - temperature: - name: BMI160 Temperature +<<: !include common.yaml diff --git a/tests/components/bmi160/test.rp2040-ard.yaml b/tests/components/bmi160/test.rp2040-ard.yaml index 3fd6441980..ee2c29ca4e 100644 --- a/tests/components/bmi160/test.rp2040-ard.yaml +++ b/tests/components/bmi160/test.rp2040-ard.yaml @@ -1,22 +1,5 @@ -i2c: - - id: i2c_bmi160 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: bmi160 - address: 0x68 - acceleration_x: - name: BMI160 Accel X - acceleration_y: - name: BMI160 Accel Y - acceleration_z: - name: BMI160 Accel z - gyroscope_x: - name: BMI160 Gyro X - gyroscope_y: - name: BMI160 Gyro Y - gyroscope_z: - name: BMI160 Gyro z - temperature: - name: BMI160 Temperature +<<: !include common.yaml diff --git a/tests/components/bmp085/common.yaml b/tests/components/bmp085/common.yaml new file mode 100644 index 0000000000..219bc51fbb --- /dev/null +++ b/tests/components/bmp085/common.yaml @@ -0,0 +1,15 @@ +i2c: + - id: i2c_bmp085 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: bmp085 + temperature: + name: Outside Temperature + pressure: + name: Outside Pressure + filters: + - lambda: >- + return x / powf(1.0 - (x / 44330.0), 5.255); + update_interval: 15s diff --git a/tests/components/bmp085/test.esp32-ard.yaml b/tests/components/bmp085/test.esp32-ard.yaml index 8a4f714ddd..3b761d3fc1 100644 --- a/tests/components/bmp085/test.esp32-ard.yaml +++ b/tests/components/bmp085/test.esp32-ard.yaml @@ -1,15 +1,5 @@ -i2c: - - id: i2c_bmp085 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO22 + sda_pin: GPIO21 -sensor: - - platform: bmp085 - temperature: - name: Outside Temperature - pressure: - name: Outside Pressure - filters: - - lambda: >- - return x / powf(1.0 - (x / 44330.0), 5.255); - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/bmp085/test.esp32-c3-ard.yaml b/tests/components/bmp085/test.esp32-c3-ard.yaml index 76a9fd07ba..ee2c29ca4e 100644 --- a/tests/components/bmp085/test.esp32-c3-ard.yaml +++ b/tests/components/bmp085/test.esp32-c3-ard.yaml @@ -1,15 +1,5 @@ -i2c: - - id: i2c_bmp085 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: bmp085 - temperature: - name: Outside Temperature - pressure: - name: Outside Pressure - filters: - - lambda: >- - return x / powf(1.0 - (x / 44330.0), 5.255); - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/bmp085/test.esp32-c3-idf.yaml b/tests/components/bmp085/test.esp32-c3-idf.yaml index 76a9fd07ba..ee2c29ca4e 100644 --- a/tests/components/bmp085/test.esp32-c3-idf.yaml +++ b/tests/components/bmp085/test.esp32-c3-idf.yaml @@ -1,15 +1,5 @@ -i2c: - - id: i2c_bmp085 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: bmp085 - temperature: - name: Outside Temperature - pressure: - name: Outside Pressure - filters: - - lambda: >- - return x / powf(1.0 - (x / 44330.0), 5.255); - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/bmp085/test.esp32-idf.yaml b/tests/components/bmp085/test.esp32-idf.yaml index 8a4f714ddd..3b761d3fc1 100644 --- a/tests/components/bmp085/test.esp32-idf.yaml +++ b/tests/components/bmp085/test.esp32-idf.yaml @@ -1,15 +1,5 @@ -i2c: - - id: i2c_bmp085 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO22 + sda_pin: GPIO21 -sensor: - - platform: bmp085 - temperature: - name: Outside Temperature - pressure: - name: Outside Pressure - filters: - - lambda: >- - return x / powf(1.0 - (x / 44330.0), 5.255); - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/bmp085/test.esp8266-ard.yaml b/tests/components/bmp085/test.esp8266-ard.yaml index 76a9fd07ba..ee2c29ca4e 100644 --- a/tests/components/bmp085/test.esp8266-ard.yaml +++ b/tests/components/bmp085/test.esp8266-ard.yaml @@ -1,15 +1,5 @@ -i2c: - - id: i2c_bmp085 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: bmp085 - temperature: - name: Outside Temperature - pressure: - name: Outside Pressure - filters: - - lambda: >- - return x / powf(1.0 - (x / 44330.0), 5.255); - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/bmp085/test.rp2040-ard.yaml b/tests/components/bmp085/test.rp2040-ard.yaml index 76a9fd07ba..ee2c29ca4e 100644 --- a/tests/components/bmp085/test.rp2040-ard.yaml +++ b/tests/components/bmp085/test.rp2040-ard.yaml @@ -1,15 +1,5 @@ -i2c: - - id: i2c_bmp085 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: bmp085 - temperature: - name: Outside Temperature - pressure: - name: Outside Pressure - filters: - - lambda: >- - return x / powf(1.0 - (x / 44330.0), 5.255); - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/bmp581/common.yaml b/tests/components/bmp581/common.yaml new file mode 100644 index 0000000000..71ad4bfb1a --- /dev/null +++ b/tests/components/bmp581/common.yaml @@ -0,0 +1,13 @@ +i2c: + - id: i2c_bmp581 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: bmp581 + temperature: + name: BMP581 Temperature + iir_filter: 2x + pressure: + name: BMP581 Pressure + oversampling: 128x diff --git a/tests/components/bmp581/test.esp32-ard.yaml b/tests/components/bmp581/test.esp32-ard.yaml index a464b8ce6a..3b761d3fc1 100644 --- a/tests/components/bmp581/test.esp32-ard.yaml +++ b/tests/components/bmp581/test.esp32-ard.yaml @@ -1,13 +1,5 @@ -i2c: - - id: i2c_bmp581 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO22 + sda_pin: GPIO21 -sensor: - - platform: bmp581 - temperature: - name: "BMP581 Temperature" - iir_filter: 2x - pressure: - name: "BMP581 Pressure" - oversampling: 128x +<<: !include common.yaml diff --git a/tests/components/bmp581/test.esp32-c3-ard.yaml b/tests/components/bmp581/test.esp32-c3-ard.yaml index 29d27afb90..ee2c29ca4e 100644 --- a/tests/components/bmp581/test.esp32-c3-ard.yaml +++ b/tests/components/bmp581/test.esp32-c3-ard.yaml @@ -1,13 +1,5 @@ -i2c: - - id: i2c_bmp581 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: bmp581 - temperature: - name: "BMP581 Temperature" - iir_filter: 2x - pressure: - name: "BMP581 Pressure" - oversampling: 128x +<<: !include common.yaml diff --git a/tests/components/bmp581/test.esp32-c3-idf.yaml b/tests/components/bmp581/test.esp32-c3-idf.yaml index 29d27afb90..ee2c29ca4e 100644 --- a/tests/components/bmp581/test.esp32-c3-idf.yaml +++ b/tests/components/bmp581/test.esp32-c3-idf.yaml @@ -1,13 +1,5 @@ -i2c: - - id: i2c_bmp581 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: bmp581 - temperature: - name: "BMP581 Temperature" - iir_filter: 2x - pressure: - name: "BMP581 Pressure" - oversampling: 128x +<<: !include common.yaml diff --git a/tests/components/bmp581/test.esp32-idf.yaml b/tests/components/bmp581/test.esp32-idf.yaml index a464b8ce6a..3b761d3fc1 100644 --- a/tests/components/bmp581/test.esp32-idf.yaml +++ b/tests/components/bmp581/test.esp32-idf.yaml @@ -1,13 +1,5 @@ -i2c: - - id: i2c_bmp581 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO22 + sda_pin: GPIO21 -sensor: - - platform: bmp581 - temperature: - name: "BMP581 Temperature" - iir_filter: 2x - pressure: - name: "BMP581 Pressure" - oversampling: 128x +<<: !include common.yaml diff --git a/tests/components/bmp581/test.esp8266-ard.yaml b/tests/components/bmp581/test.esp8266-ard.yaml index 29d27afb90..ee2c29ca4e 100644 --- a/tests/components/bmp581/test.esp8266-ard.yaml +++ b/tests/components/bmp581/test.esp8266-ard.yaml @@ -1,13 +1,5 @@ -i2c: - - id: i2c_bmp581 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: bmp581 - temperature: - name: "BMP581 Temperature" - iir_filter: 2x - pressure: - name: "BMP581 Pressure" - oversampling: 128x +<<: !include common.yaml diff --git a/tests/components/bmp581/test.rp2040-ard.yaml b/tests/components/bmp581/test.rp2040-ard.yaml index 29d27afb90..ee2c29ca4e 100644 --- a/tests/components/bmp581/test.rp2040-ard.yaml +++ b/tests/components/bmp581/test.rp2040-ard.yaml @@ -1,13 +1,5 @@ -i2c: - - id: i2c_bmp581 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: bmp581 - temperature: - name: "BMP581 Temperature" - iir_filter: 2x - pressure: - name: "BMP581 Pressure" - oversampling: 128x +<<: !include common.yaml diff --git a/tests/components/bp1658cj/common.yaml b/tests/components/bp1658cj/common.yaml new file mode 100644 index 0000000000..e1d71bd4f3 --- /dev/null +++ b/tests/components/bp1658cj/common.yaml @@ -0,0 +1,22 @@ +bp1658cj: + clock_pin: ${clock_pin} + data_pin: ${data_pin} + max_power_color_channels: 4 + max_power_white_channels: 6 + +output: + - platform: bp1658cj + id: bp1658cj_red + channel: 1 + - platform: bp1658cj + id: bp1658cj_green + channel: 2 + - platform: bp1658cj + id: bp1658cj_blue + channel: 0 + - platform: bp1658cj + id: bp1658cj_coldwhite + channel: 3 + - platform: bp1658cj + id: bp1658cj_warmwhite + channel: 4 diff --git a/tests/components/bp1658cj/test.esp32-ard.yaml b/tests/components/bp1658cj/test.esp32-ard.yaml index 5f9e25d3bd..d295973e3f 100644 --- a/tests/components/bp1658cj/test.esp32-ard.yaml +++ b/tests/components/bp1658cj/test.esp32-ard.yaml @@ -1,22 +1,5 @@ -bp1658cj: - clock_pin: 16 - data_pin: 17 - max_power_color_channels: 4 - max_power_white_channels: 6 +substitutions: + clock_pin: GPIO16 + data_pin: GPIO17 -output: - - platform: bp1658cj - id: bp1658cj_red - channel: 1 - - platform: bp1658cj - id: bp1658cj_green - channel: 2 - - platform: bp1658cj - id: bp1658cj_blue - channel: 0 - - platform: bp1658cj - id: bp1658cj_coldwhite - channel: 3 - - platform: bp1658cj - id: bp1658cj_warmwhite - channel: 4 +<<: !include common.yaml diff --git a/tests/components/bp1658cj/test.esp32-c3-ard.yaml b/tests/components/bp1658cj/test.esp32-c3-ard.yaml index 74d3155371..7808481215 100644 --- a/tests/components/bp1658cj/test.esp32-c3-ard.yaml +++ b/tests/components/bp1658cj/test.esp32-c3-ard.yaml @@ -1,22 +1,5 @@ -bp1658cj: - clock_pin: 5 - data_pin: 4 - max_power_color_channels: 4 - max_power_white_channels: 6 +substitutions: + clock_pin: GPIO5 + data_pin: GPIO4 -output: - - platform: bp1658cj - id: bp1658cj_red - channel: 1 - - platform: bp1658cj - id: bp1658cj_green - channel: 2 - - platform: bp1658cj - id: bp1658cj_blue - channel: 0 - - platform: bp1658cj - id: bp1658cj_coldwhite - channel: 3 - - platform: bp1658cj - id: bp1658cj_warmwhite - channel: 4 +<<: !include common.yaml diff --git a/tests/components/bp1658cj/test.esp32-c3-idf.yaml b/tests/components/bp1658cj/test.esp32-c3-idf.yaml index 74d3155371..7808481215 100644 --- a/tests/components/bp1658cj/test.esp32-c3-idf.yaml +++ b/tests/components/bp1658cj/test.esp32-c3-idf.yaml @@ -1,22 +1,5 @@ -bp1658cj: - clock_pin: 5 - data_pin: 4 - max_power_color_channels: 4 - max_power_white_channels: 6 +substitutions: + clock_pin: GPIO5 + data_pin: GPIO4 -output: - - platform: bp1658cj - id: bp1658cj_red - channel: 1 - - platform: bp1658cj - id: bp1658cj_green - channel: 2 - - platform: bp1658cj - id: bp1658cj_blue - channel: 0 - - platform: bp1658cj - id: bp1658cj_coldwhite - channel: 3 - - platform: bp1658cj - id: bp1658cj_warmwhite - channel: 4 +<<: !include common.yaml diff --git a/tests/components/bp1658cj/test.esp32-idf.yaml b/tests/components/bp1658cj/test.esp32-idf.yaml index 5f9e25d3bd..d295973e3f 100644 --- a/tests/components/bp1658cj/test.esp32-idf.yaml +++ b/tests/components/bp1658cj/test.esp32-idf.yaml @@ -1,22 +1,5 @@ -bp1658cj: - clock_pin: 16 - data_pin: 17 - max_power_color_channels: 4 - max_power_white_channels: 6 +substitutions: + clock_pin: GPIO16 + data_pin: GPIO17 -output: - - platform: bp1658cj - id: bp1658cj_red - channel: 1 - - platform: bp1658cj - id: bp1658cj_green - channel: 2 - - platform: bp1658cj - id: bp1658cj_blue - channel: 0 - - platform: bp1658cj - id: bp1658cj_coldwhite - channel: 3 - - platform: bp1658cj - id: bp1658cj_warmwhite - channel: 4 +<<: !include common.yaml diff --git a/tests/components/bp1658cj/test.esp8266-ard.yaml b/tests/components/bp1658cj/test.esp8266-ard.yaml index 74d3155371..7808481215 100644 --- a/tests/components/bp1658cj/test.esp8266-ard.yaml +++ b/tests/components/bp1658cj/test.esp8266-ard.yaml @@ -1,22 +1,5 @@ -bp1658cj: - clock_pin: 5 - data_pin: 4 - max_power_color_channels: 4 - max_power_white_channels: 6 +substitutions: + clock_pin: GPIO5 + data_pin: GPIO4 -output: - - platform: bp1658cj - id: bp1658cj_red - channel: 1 - - platform: bp1658cj - id: bp1658cj_green - channel: 2 - - platform: bp1658cj - id: bp1658cj_blue - channel: 0 - - platform: bp1658cj - id: bp1658cj_coldwhite - channel: 3 - - platform: bp1658cj - id: bp1658cj_warmwhite - channel: 4 +<<: !include common.yaml diff --git a/tests/components/bp1658cj/test.rp2040-ard.yaml b/tests/components/bp1658cj/test.rp2040-ard.yaml index 74d3155371..7808481215 100644 --- a/tests/components/bp1658cj/test.rp2040-ard.yaml +++ b/tests/components/bp1658cj/test.rp2040-ard.yaml @@ -1,22 +1,5 @@ -bp1658cj: - clock_pin: 5 - data_pin: 4 - max_power_color_channels: 4 - max_power_white_channels: 6 +substitutions: + clock_pin: GPIO5 + data_pin: GPIO4 -output: - - platform: bp1658cj - id: bp1658cj_red - channel: 1 - - platform: bp1658cj - id: bp1658cj_green - channel: 2 - - platform: bp1658cj - id: bp1658cj_blue - channel: 0 - - platform: bp1658cj - id: bp1658cj_coldwhite - channel: 3 - - platform: bp1658cj - id: bp1658cj_warmwhite - channel: 4 +<<: !include common.yaml diff --git a/tests/components/bp5758d/common.yaml b/tests/components/bp5758d/common.yaml new file mode 100644 index 0000000000..4a39a6f69f --- /dev/null +++ b/tests/components/bp5758d/common.yaml @@ -0,0 +1,25 @@ +bp5758d: + clock_pin: ${clock_pin} + data_pin: ${data_pin} + +output: + - platform: bp5758d + id: bp5758d_red + channel: 2 + current: 10 + - platform: bp5758d + id: bp5758d_green + channel: 3 + current: 10 + - platform: bp5758d + id: bp5758d_blue + channel: 1 + current: 10 + - platform: bp5758d + id: bp5758d_coldwhite + channel: 5 + current: 10 + - platform: bp5758d + id: bp5758d_warmwhite + channel: 4 + current: 10 diff --git a/tests/components/bp5758d/test.esp32-ard.yaml b/tests/components/bp5758d/test.esp32-ard.yaml index b7929a0518..d295973e3f 100644 --- a/tests/components/bp5758d/test.esp32-ard.yaml +++ b/tests/components/bp5758d/test.esp32-ard.yaml @@ -1,25 +1,5 @@ -bp5758d: - clock_pin: 16 - data_pin: 17 +substitutions: + clock_pin: GPIO16 + data_pin: GPIO17 -output: - - platform: bp5758d - id: bp5758d_red - channel: 2 - current: 10 - - platform: bp5758d - id: bp5758d_green - channel: 3 - current: 10 - - platform: bp5758d - id: bp5758d_blue - channel: 1 - current: 10 - - platform: bp5758d - id: bp5758d_coldwhite - channel: 5 - current: 10 - - platform: bp5758d - id: bp5758d_warmwhite - channel: 4 - current: 10 +<<: !include common.yaml diff --git a/tests/components/bp5758d/test.esp32-c3-ard.yaml b/tests/components/bp5758d/test.esp32-c3-ard.yaml index ec74e935cd..7808481215 100644 --- a/tests/components/bp5758d/test.esp32-c3-ard.yaml +++ b/tests/components/bp5758d/test.esp32-c3-ard.yaml @@ -1,25 +1,5 @@ -bp5758d: - clock_pin: 5 - data_pin: 4 +substitutions: + clock_pin: GPIO5 + data_pin: GPIO4 -output: - - platform: bp5758d - id: bp5758d_red - channel: 2 - current: 10 - - platform: bp5758d - id: bp5758d_green - channel: 3 - current: 10 - - platform: bp5758d - id: bp5758d_blue - channel: 1 - current: 10 - - platform: bp5758d - id: bp5758d_coldwhite - channel: 5 - current: 10 - - platform: bp5758d - id: bp5758d_warmwhite - channel: 4 - current: 10 +<<: !include common.yaml diff --git a/tests/components/bp5758d/test.esp32-c3-idf.yaml b/tests/components/bp5758d/test.esp32-c3-idf.yaml index ec74e935cd..7808481215 100644 --- a/tests/components/bp5758d/test.esp32-c3-idf.yaml +++ b/tests/components/bp5758d/test.esp32-c3-idf.yaml @@ -1,25 +1,5 @@ -bp5758d: - clock_pin: 5 - data_pin: 4 +substitutions: + clock_pin: GPIO5 + data_pin: GPIO4 -output: - - platform: bp5758d - id: bp5758d_red - channel: 2 - current: 10 - - platform: bp5758d - id: bp5758d_green - channel: 3 - current: 10 - - platform: bp5758d - id: bp5758d_blue - channel: 1 - current: 10 - - platform: bp5758d - id: bp5758d_coldwhite - channel: 5 - current: 10 - - platform: bp5758d - id: bp5758d_warmwhite - channel: 4 - current: 10 +<<: !include common.yaml diff --git a/tests/components/bp5758d/test.esp32-idf.yaml b/tests/components/bp5758d/test.esp32-idf.yaml index b7929a0518..d295973e3f 100644 --- a/tests/components/bp5758d/test.esp32-idf.yaml +++ b/tests/components/bp5758d/test.esp32-idf.yaml @@ -1,25 +1,5 @@ -bp5758d: - clock_pin: 16 - data_pin: 17 +substitutions: + clock_pin: GPIO16 + data_pin: GPIO17 -output: - - platform: bp5758d - id: bp5758d_red - channel: 2 - current: 10 - - platform: bp5758d - id: bp5758d_green - channel: 3 - current: 10 - - platform: bp5758d - id: bp5758d_blue - channel: 1 - current: 10 - - platform: bp5758d - id: bp5758d_coldwhite - channel: 5 - current: 10 - - platform: bp5758d - id: bp5758d_warmwhite - channel: 4 - current: 10 +<<: !include common.yaml diff --git a/tests/components/bp5758d/test.esp8266-ard.yaml b/tests/components/bp5758d/test.esp8266-ard.yaml index ec74e935cd..7808481215 100644 --- a/tests/components/bp5758d/test.esp8266-ard.yaml +++ b/tests/components/bp5758d/test.esp8266-ard.yaml @@ -1,25 +1,5 @@ -bp5758d: - clock_pin: 5 - data_pin: 4 +substitutions: + clock_pin: GPIO5 + data_pin: GPIO4 -output: - - platform: bp5758d - id: bp5758d_red - channel: 2 - current: 10 - - platform: bp5758d - id: bp5758d_green - channel: 3 - current: 10 - - platform: bp5758d - id: bp5758d_blue - channel: 1 - current: 10 - - platform: bp5758d - id: bp5758d_coldwhite - channel: 5 - current: 10 - - platform: bp5758d - id: bp5758d_warmwhite - channel: 4 - current: 10 +<<: !include common.yaml diff --git a/tests/components/bp5758d/test.rp2040-ard.yaml b/tests/components/bp5758d/test.rp2040-ard.yaml index ec74e935cd..7808481215 100644 --- a/tests/components/bp5758d/test.rp2040-ard.yaml +++ b/tests/components/bp5758d/test.rp2040-ard.yaml @@ -1,25 +1,5 @@ -bp5758d: - clock_pin: 5 - data_pin: 4 +substitutions: + clock_pin: GPIO5 + data_pin: GPIO4 -output: - - platform: bp5758d - id: bp5758d_red - channel: 2 - current: 10 - - platform: bp5758d - id: bp5758d_green - channel: 3 - current: 10 - - platform: bp5758d - id: bp5758d_blue - channel: 1 - current: 10 - - platform: bp5758d - id: bp5758d_coldwhite - channel: 5 - current: 10 - - platform: bp5758d - id: bp5758d_warmwhite - channel: 4 - current: 10 +<<: !include common.yaml diff --git a/tests/components/cap1188/common.yaml b/tests/components/cap1188/common.yaml new file mode 100644 index 0000000000..e83bf5d5d2 --- /dev/null +++ b/tests/components/cap1188/common.yaml @@ -0,0 +1,11 @@ +i2c: + - id: i2c_cap1188 + scl: ${scl_pin} + sda: ${sda_pin} + +cap1188: + id: cap1188_component + address: 0x29 + reset_pin: ${reset_pin} + touch_threshold: 0x20 + allow_multiple_touches: true diff --git a/tests/components/cap1188/test.esp32-ard.yaml b/tests/components/cap1188/test.esp32-ard.yaml index efd1d60217..1ca773e06c 100644 --- a/tests/components/cap1188/test.esp32-ard.yaml +++ b/tests/components/cap1188/test.esp32-ard.yaml @@ -1,11 +1,6 @@ -i2c: - - id: i2c_cap1188 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 + reset_pin: GPIO15 -cap1188: - id: cap1188_component - address: 0x29 - reset_pin: 15 - touch_threshold: 0x20 - allow_multiple_touches: true +<<: !include common.yaml diff --git a/tests/components/cap1188/test.esp32-c3-ard.yaml b/tests/components/cap1188/test.esp32-c3-ard.yaml index c6d3c95942..1e6670c196 100644 --- a/tests/components/cap1188/test.esp32-c3-ard.yaml +++ b/tests/components/cap1188/test.esp32-c3-ard.yaml @@ -1,11 +1,6 @@ -i2c: - - id: i2c_cap1188 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + reset_pin: GPIO6 -cap1188: - id: cap1188_component - address: 0x29 - reset_pin: 6 - touch_threshold: 0x20 - allow_multiple_touches: true +<<: !include common.yaml diff --git a/tests/components/cap1188/test.esp32-c3-idf.yaml b/tests/components/cap1188/test.esp32-c3-idf.yaml index c6d3c95942..1e6670c196 100644 --- a/tests/components/cap1188/test.esp32-c3-idf.yaml +++ b/tests/components/cap1188/test.esp32-c3-idf.yaml @@ -1,11 +1,6 @@ -i2c: - - id: i2c_cap1188 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + reset_pin: GPIO6 -cap1188: - id: cap1188_component - address: 0x29 - reset_pin: 6 - touch_threshold: 0x20 - allow_multiple_touches: true +<<: !include common.yaml diff --git a/tests/components/cap1188/test.esp32-idf.yaml b/tests/components/cap1188/test.esp32-idf.yaml index efd1d60217..1ca773e06c 100644 --- a/tests/components/cap1188/test.esp32-idf.yaml +++ b/tests/components/cap1188/test.esp32-idf.yaml @@ -1,11 +1,6 @@ -i2c: - - id: i2c_cap1188 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 + reset_pin: GPIO15 -cap1188: - id: cap1188_component - address: 0x29 - reset_pin: 15 - touch_threshold: 0x20 - allow_multiple_touches: true +<<: !include common.yaml diff --git a/tests/components/cap1188/test.esp8266-ard.yaml b/tests/components/cap1188/test.esp8266-ard.yaml index 7573d45140..dfdc12a3d1 100644 --- a/tests/components/cap1188/test.esp8266-ard.yaml +++ b/tests/components/cap1188/test.esp8266-ard.yaml @@ -1,11 +1,6 @@ -i2c: - - id: i2c_cap1188 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + reset_pin: GPIO15 -cap1188: - id: cap1188_component - address: 0x29 - reset_pin: 15 - touch_threshold: 0x20 - allow_multiple_touches: true +<<: !include common.yaml diff --git a/tests/components/cap1188/test.rp2040-ard.yaml b/tests/components/cap1188/test.rp2040-ard.yaml index c6d3c95942..1e6670c196 100644 --- a/tests/components/cap1188/test.rp2040-ard.yaml +++ b/tests/components/cap1188/test.rp2040-ard.yaml @@ -1,11 +1,6 @@ -i2c: - - id: i2c_cap1188 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + reset_pin: GPIO6 -cap1188: - id: cap1188_component - address: 0x29 - reset_pin: 6 - touch_threshold: 0x20 - allow_multiple_touches: true +<<: !include common.yaml diff --git a/tests/components/ccs811/common.yaml b/tests/components/ccs811/common.yaml new file mode 100644 index 0000000000..a781996c66 --- /dev/null +++ b/tests/components/ccs811/common.yaml @@ -0,0 +1,13 @@ +i2c: + - id: i2c_ccs811 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: ccs811 + eco2: + name: CCS811 eCO2 + tvoc: + name: CCS811 TVOC + baseline: 0x4242 + update_interval: 30s diff --git a/tests/components/ccs811/test.esp32-ard.yaml b/tests/components/ccs811/test.esp32-ard.yaml index 08b3a48cc7..63c3bd6afd 100644 --- a/tests/components/ccs811/test.esp32-ard.yaml +++ b/tests/components/ccs811/test.esp32-ard.yaml @@ -1,13 +1,5 @@ -i2c: - - id: i2c_ccs811 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: ccs811 - eco2: - name: CCS811 eCO2 - tvoc: - name: CCS811 TVOC - baseline: 0x4242 - update_interval: 30s +<<: !include common.yaml diff --git a/tests/components/ccs811/test.esp32-c3-ard.yaml b/tests/components/ccs811/test.esp32-c3-ard.yaml index 26ec7807e4..ee2c29ca4e 100644 --- a/tests/components/ccs811/test.esp32-c3-ard.yaml +++ b/tests/components/ccs811/test.esp32-c3-ard.yaml @@ -1,13 +1,5 @@ -i2c: - - id: i2c_ccs811 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ccs811 - eco2: - name: CCS811 eCO2 - tvoc: - name: CCS811 TVOC - baseline: 0x4242 - update_interval: 30s +<<: !include common.yaml diff --git a/tests/components/ccs811/test.esp32-c3-idf.yaml b/tests/components/ccs811/test.esp32-c3-idf.yaml index 26ec7807e4..ee2c29ca4e 100644 --- a/tests/components/ccs811/test.esp32-c3-idf.yaml +++ b/tests/components/ccs811/test.esp32-c3-idf.yaml @@ -1,13 +1,5 @@ -i2c: - - id: i2c_ccs811 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ccs811 - eco2: - name: CCS811 eCO2 - tvoc: - name: CCS811 TVOC - baseline: 0x4242 - update_interval: 30s +<<: !include common.yaml diff --git a/tests/components/ccs811/test.esp32-idf.yaml b/tests/components/ccs811/test.esp32-idf.yaml index 08b3a48cc7..63c3bd6afd 100644 --- a/tests/components/ccs811/test.esp32-idf.yaml +++ b/tests/components/ccs811/test.esp32-idf.yaml @@ -1,13 +1,5 @@ -i2c: - - id: i2c_ccs811 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: ccs811 - eco2: - name: CCS811 eCO2 - tvoc: - name: CCS811 TVOC - baseline: 0x4242 - update_interval: 30s +<<: !include common.yaml diff --git a/tests/components/ccs811/test.esp8266-ard.yaml b/tests/components/ccs811/test.esp8266-ard.yaml index 26ec7807e4..ee2c29ca4e 100644 --- a/tests/components/ccs811/test.esp8266-ard.yaml +++ b/tests/components/ccs811/test.esp8266-ard.yaml @@ -1,13 +1,5 @@ -i2c: - - id: i2c_ccs811 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ccs811 - eco2: - name: CCS811 eCO2 - tvoc: - name: CCS811 TVOC - baseline: 0x4242 - update_interval: 30s +<<: !include common.yaml diff --git a/tests/components/ccs811/test.rp2040-ard.yaml b/tests/components/ccs811/test.rp2040-ard.yaml index 26ec7807e4..ee2c29ca4e 100644 --- a/tests/components/ccs811/test.rp2040-ard.yaml +++ b/tests/components/ccs811/test.rp2040-ard.yaml @@ -1,13 +1,5 @@ -i2c: - - id: i2c_ccs811 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ccs811 - eco2: - name: CCS811 eCO2 - tvoc: - name: CCS811 TVOC - baseline: 0x4242 - update_interval: 30s +<<: !include common.yaml diff --git a/tests/components/cd74hc4067/common.yaml b/tests/components/cd74hc4067/common.yaml new file mode 100644 index 0000000000..9afb39cd31 --- /dev/null +++ b/tests/components/cd74hc4067/common.yaml @@ -0,0 +1,18 @@ +cd74hc4067: + pin_s0: ${pin_s0} + pin_s1: ${pin_s1} + pin_s2: ${pin_s2} + pin_s3: ${pin_s3} + +sensor: + - platform: adc + id: esp_adc_sensor + pin: ${pin} + - platform: cd74hc4067 + id: cd74hc4067_adc_0 + number: 0 + sensor: esp_adc_sensor + - platform: cd74hc4067 + id: cd74hc4067_adc_1 + number: 1 + sensor: esp_adc_sensor diff --git a/tests/components/cd74hc4067/test.esp32-ard.yaml b/tests/components/cd74hc4067/test.esp32-ard.yaml index 71a1238ccc..c4dd280943 100644 --- a/tests/components/cd74hc4067/test.esp32-ard.yaml +++ b/tests/components/cd74hc4067/test.esp32-ard.yaml @@ -1,18 +1,8 @@ -cd74hc4067: - pin_s0: 12 - pin_s1: 13 - pin_s2: 14 - pin_s3: 15 +substitutions: + pin_s0: GPIO12 + pin_s1: GPIO13 + pin_s2: GPIO14 + pin_s3: GPIO15 + pin: GPIO39 -sensor: - - platform: adc - id: esp_adc_sensor - pin: 39 - - platform: cd74hc4067 - id: cd74hc4067_adc_0 - number: 0 - sensor: esp_adc_sensor - - platform: cd74hc4067 - id: cd74hc4067_adc_1 - number: 1 - sensor: esp_adc_sensor +<<: !include common.yaml diff --git a/tests/components/cd74hc4067/test.esp32-c3-ard.yaml b/tests/components/cd74hc4067/test.esp32-c3-ard.yaml index 5aa653d26c..5e8784c1fc 100644 --- a/tests/components/cd74hc4067/test.esp32-c3-ard.yaml +++ b/tests/components/cd74hc4067/test.esp32-c3-ard.yaml @@ -1,18 +1,8 @@ -cd74hc4067: - pin_s0: 2 - pin_s1: 3 - pin_s2: 4 - pin_s3: 5 +substitutions: + pin_s0: GPIO2 + pin_s1: GPIO3 + pin_s2: GPIO4 + pin_s3: GPIO5 + pin: GPIO0 -sensor: - - platform: adc - id: esp_adc_sensor - pin: 0 - - platform: cd74hc4067 - id: cd74hc4067_adc_0 - number: 0 - sensor: esp_adc_sensor - - platform: cd74hc4067 - id: cd74hc4067_adc_1 - number: 1 - sensor: esp_adc_sensor +<<: !include common.yaml diff --git a/tests/components/cd74hc4067/test.esp32-c3-idf.yaml b/tests/components/cd74hc4067/test.esp32-c3-idf.yaml index 5aa653d26c..5e8784c1fc 100644 --- a/tests/components/cd74hc4067/test.esp32-c3-idf.yaml +++ b/tests/components/cd74hc4067/test.esp32-c3-idf.yaml @@ -1,18 +1,8 @@ -cd74hc4067: - pin_s0: 2 - pin_s1: 3 - pin_s2: 4 - pin_s3: 5 +substitutions: + pin_s0: GPIO2 + pin_s1: GPIO3 + pin_s2: GPIO4 + pin_s3: GPIO5 + pin: GPIO0 -sensor: - - platform: adc - id: esp_adc_sensor - pin: 0 - - platform: cd74hc4067 - id: cd74hc4067_adc_0 - number: 0 - sensor: esp_adc_sensor - - platform: cd74hc4067 - id: cd74hc4067_adc_1 - number: 1 - sensor: esp_adc_sensor +<<: !include common.yaml diff --git a/tests/components/cd74hc4067/test.esp32-idf.yaml b/tests/components/cd74hc4067/test.esp32-idf.yaml index 71a1238ccc..c4dd280943 100644 --- a/tests/components/cd74hc4067/test.esp32-idf.yaml +++ b/tests/components/cd74hc4067/test.esp32-idf.yaml @@ -1,18 +1,8 @@ -cd74hc4067: - pin_s0: 12 - pin_s1: 13 - pin_s2: 14 - pin_s3: 15 +substitutions: + pin_s0: GPIO12 + pin_s1: GPIO13 + pin_s2: GPIO14 + pin_s3: GPIO15 + pin: GPIO39 -sensor: - - platform: adc - id: esp_adc_sensor - pin: 39 - - platform: cd74hc4067 - id: cd74hc4067_adc_0 - number: 0 - sensor: esp_adc_sensor - - platform: cd74hc4067 - id: cd74hc4067_adc_1 - number: 1 - sensor: esp_adc_sensor +<<: !include common.yaml diff --git a/tests/components/cd74hc4067/test.esp8266-ard.yaml b/tests/components/cd74hc4067/test.esp8266-ard.yaml index 8bcce5bc17..1162cec1f8 100644 --- a/tests/components/cd74hc4067/test.esp8266-ard.yaml +++ b/tests/components/cd74hc4067/test.esp8266-ard.yaml @@ -1,18 +1,8 @@ -cd74hc4067: - pin_s0: 12 - pin_s1: 13 - pin_s2: 14 - pin_s3: 15 +substitutions: + pin_s0: GPIO12 + pin_s1: GPIO13 + pin_s2: GPIO14 + pin_s3: GPIO15 + pin: A0 -sensor: - - platform: adc - id: esp_adc_sensor - pin: A0 - - platform: cd74hc4067 - id: cd74hc4067_adc_0 - number: 0 - sensor: esp_adc_sensor - - platform: cd74hc4067 - id: cd74hc4067_adc_1 - number: 1 - sensor: esp_adc_sensor +<<: !include common.yaml diff --git a/tests/components/cd74hc4067/test.rp2040-ard.yaml b/tests/components/cd74hc4067/test.rp2040-ard.yaml index 75adcce796..88c3273a44 100644 --- a/tests/components/cd74hc4067/test.rp2040-ard.yaml +++ b/tests/components/cd74hc4067/test.rp2040-ard.yaml @@ -1,18 +1,8 @@ -cd74hc4067: - pin_s0: 2 - pin_s1: 3 - pin_s2: 4 - pin_s3: 5 +substitutions: + pin_s0: GPIO2 + pin_s1: GPIO3 + pin_s2: GPIO4 + pin_s3: GPIO5 + pin: GPIO26 -sensor: - - platform: adc - id: esp_adc_sensor - pin: 26 - - platform: cd74hc4067 - id: cd74hc4067_adc_0 - number: 0 - sensor: esp_adc_sensor - - platform: cd74hc4067 - id: cd74hc4067_adc_1 - number: 1 - sensor: esp_adc_sensor +<<: !include common.yaml diff --git a/tests/components/climate_ir_lg/common.yaml b/tests/components/climate_ir_lg/common.yaml new file mode 100644 index 0000000000..c8f84411c0 --- /dev/null +++ b/tests/components/climate_ir_lg/common.yaml @@ -0,0 +1,7 @@ +remote_transmitter: + pin: ${pin} + carrier_duty_percent: 50% + +climate: + - platform: climate_ir_lg + name: LG Climate diff --git a/tests/components/climate_ir_lg/test.esp32-ard.yaml b/tests/components/climate_ir_lg/test.esp32-ard.yaml index e714bf0686..7b012aa64c 100644 --- a/tests/components/climate_ir_lg/test.esp32-ard.yaml +++ b/tests/components/climate_ir_lg/test.esp32-ard.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: climate_ir_lg - name: LG Climate +<<: !include common.yaml diff --git a/tests/components/climate_ir_lg/test.esp32-c3-ard.yaml b/tests/components/climate_ir_lg/test.esp32-c3-ard.yaml index e714bf0686..7b012aa64c 100644 --- a/tests/components/climate_ir_lg/test.esp32-c3-ard.yaml +++ b/tests/components/climate_ir_lg/test.esp32-c3-ard.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: climate_ir_lg - name: LG Climate +<<: !include common.yaml diff --git a/tests/components/climate_ir_lg/test.esp32-c3-idf.yaml b/tests/components/climate_ir_lg/test.esp32-c3-idf.yaml index e714bf0686..7b012aa64c 100644 --- a/tests/components/climate_ir_lg/test.esp32-c3-idf.yaml +++ b/tests/components/climate_ir_lg/test.esp32-c3-idf.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: climate_ir_lg - name: LG Climate +<<: !include common.yaml diff --git a/tests/components/climate_ir_lg/test.esp32-idf.yaml b/tests/components/climate_ir_lg/test.esp32-idf.yaml index e714bf0686..7b012aa64c 100644 --- a/tests/components/climate_ir_lg/test.esp32-idf.yaml +++ b/tests/components/climate_ir_lg/test.esp32-idf.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: climate_ir_lg - name: LG Climate +<<: !include common.yaml diff --git a/tests/components/climate_ir_lg/test.esp8266-ard.yaml b/tests/components/climate_ir_lg/test.esp8266-ard.yaml index 7482bf0580..f5097fcf5f 100644 --- a/tests/components/climate_ir_lg/test.esp8266-ard.yaml +++ b/tests/components/climate_ir_lg/test.esp8266-ard.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 5 - carrier_duty_percent: 50% +substitutions: + pin: GPIO5 -climate: - - platform: climate_ir_lg - name: LG Climate +<<: !include common.yaml diff --git a/tests/components/color_temperature/common.yaml b/tests/components/color_temperature/common.yaml new file mode 100644 index 0000000000..fe0c5bf917 --- /dev/null +++ b/tests/components/color_temperature/common.yaml @@ -0,0 +1,15 @@ +output: + - platform: ${light_platform} + id: light_output_1 + pin: ${pin_o1} + - platform: ${light_platform} + id: light_output_2 + pin: ${pin_o2} + +light: + - platform: color_temperature + name: Lights + color_temperature: light_output_1 + brightness: light_output_2 + cold_white_color_temperature: 153 mireds + warm_white_color_temperature: 500 mireds diff --git a/tests/components/color_temperature/test.esp32-ard.yaml b/tests/components/color_temperature/test.esp32-ard.yaml index 608907d2fc..1831adda6e 100644 --- a/tests/components/color_temperature/test.esp32-ard.yaml +++ b/tests/components/color_temperature/test.esp32-ard.yaml @@ -1,15 +1,6 @@ -output: - - platform: ledc - id: light_output_1 - pin: 12 - - platform: ledc - id: light_output_2 - pin: 13 +substitutions: + light_platform: ledc + pin_o1: GPIO16 + pin_o2: GPIO17 -light: - - platform: color_temperature - name: Lights - color_temperature: light_output_1 - brightness: light_output_2 - cold_white_color_temperature: 153 mireds - warm_white_color_temperature: 500 mireds +<<: !include common.yaml diff --git a/tests/components/color_temperature/test.esp32-c3-ard.yaml b/tests/components/color_temperature/test.esp32-c3-ard.yaml index 8d3faa54ee..016f315d9f 100644 --- a/tests/components/color_temperature/test.esp32-c3-ard.yaml +++ b/tests/components/color_temperature/test.esp32-c3-ard.yaml @@ -1,15 +1,6 @@ -output: - - platform: ledc - id: light_output_1 - pin: 1 - - platform: ledc - id: light_output_2 - pin: 2 +substitutions: + light_platform: ledc + pin_o1: GPIO6 + pin_o2: GPIO7 -light: - - platform: color_temperature - name: Lights - color_temperature: light_output_1 - brightness: light_output_2 - cold_white_color_temperature: 153 mireds - warm_white_color_temperature: 500 mireds +<<: !include common.yaml diff --git a/tests/components/color_temperature/test.esp32-c3-idf.yaml b/tests/components/color_temperature/test.esp32-c3-idf.yaml index 8d3faa54ee..016f315d9f 100644 --- a/tests/components/color_temperature/test.esp32-c3-idf.yaml +++ b/tests/components/color_temperature/test.esp32-c3-idf.yaml @@ -1,15 +1,6 @@ -output: - - platform: ledc - id: light_output_1 - pin: 1 - - platform: ledc - id: light_output_2 - pin: 2 +substitutions: + light_platform: ledc + pin_o1: GPIO6 + pin_o2: GPIO7 -light: - - platform: color_temperature - name: Lights - color_temperature: light_output_1 - brightness: light_output_2 - cold_white_color_temperature: 153 mireds - warm_white_color_temperature: 500 mireds +<<: !include common.yaml diff --git a/tests/components/color_temperature/test.esp32-idf.yaml b/tests/components/color_temperature/test.esp32-idf.yaml index 608907d2fc..1831adda6e 100644 --- a/tests/components/color_temperature/test.esp32-idf.yaml +++ b/tests/components/color_temperature/test.esp32-idf.yaml @@ -1,15 +1,6 @@ -output: - - platform: ledc - id: light_output_1 - pin: 12 - - platform: ledc - id: light_output_2 - pin: 13 +substitutions: + light_platform: ledc + pin_o1: GPIO16 + pin_o2: GPIO17 -light: - - platform: color_temperature - name: Lights - color_temperature: light_output_1 - brightness: light_output_2 - cold_white_color_temperature: 153 mireds - warm_white_color_temperature: 500 mireds +<<: !include common.yaml diff --git a/tests/components/color_temperature/test.esp8266-ard.yaml b/tests/components/color_temperature/test.esp8266-ard.yaml index ed0bfb6aa4..75a5b9d64d 100644 --- a/tests/components/color_temperature/test.esp8266-ard.yaml +++ b/tests/components/color_temperature/test.esp8266-ard.yaml @@ -1,15 +1,6 @@ -output: - - platform: esp8266_pwm - id: light_output_1 - pin: 12 - - platform: esp8266_pwm - id: light_output_2 - pin: 13 +substitutions: + light_platform: esp8266_pwm + pin_o1: GPIO12 + pin_o2: GPIO13 -light: - - platform: color_temperature - name: Lights - color_temperature: light_output_1 - brightness: light_output_2 - cold_white_color_temperature: 153 mireds - warm_white_color_temperature: 500 mireds +<<: !include common.yaml diff --git a/tests/components/color_temperature/test.rp2040-ard.yaml b/tests/components/color_temperature/test.rp2040-ard.yaml index 887ad1c857..537177aca1 100644 --- a/tests/components/color_temperature/test.rp2040-ard.yaml +++ b/tests/components/color_temperature/test.rp2040-ard.yaml @@ -1,15 +1,6 @@ -output: - - platform: rp2040_pwm - id: light_output_1 - pin: 12 - - platform: rp2040_pwm - id: light_output_2 - pin: 13 +substitutions: + light_platform: rp2040_pwm + pin_o1: GPIO12 + pin_o2: GPIO13 -light: - - platform: color_temperature - name: Lights - color_temperature: light_output_1 - brightness: light_output_2 - cold_white_color_temperature: 153 mireds - warm_white_color_temperature: 500 mireds +<<: !include common.yaml diff --git a/tests/components/coolix/common.yaml b/tests/components/coolix/common.yaml new file mode 100644 index 0000000000..abe609c3ea --- /dev/null +++ b/tests/components/coolix/common.yaml @@ -0,0 +1,7 @@ +remote_transmitter: + pin: ${pin} + carrier_duty_percent: 50% + +climate: + - platform: coolix + name: Coolix Climate diff --git a/tests/components/coolix/test.esp32-ard.yaml b/tests/components/coolix/test.esp32-ard.yaml index 0f9518d2cf..7b012aa64c 100644 --- a/tests/components/coolix/test.esp32-ard.yaml +++ b/tests/components/coolix/test.esp32-ard.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: coolix - name: Coolix Climate +<<: !include common.yaml diff --git a/tests/components/coolix/test.esp32-c3-ard.yaml b/tests/components/coolix/test.esp32-c3-ard.yaml index 0f9518d2cf..7b012aa64c 100644 --- a/tests/components/coolix/test.esp32-c3-ard.yaml +++ b/tests/components/coolix/test.esp32-c3-ard.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: coolix - name: Coolix Climate +<<: !include common.yaml diff --git a/tests/components/coolix/test.esp32-c3-idf.yaml b/tests/components/coolix/test.esp32-c3-idf.yaml index 0f9518d2cf..7b012aa64c 100644 --- a/tests/components/coolix/test.esp32-c3-idf.yaml +++ b/tests/components/coolix/test.esp32-c3-idf.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: coolix - name: Coolix Climate +<<: !include common.yaml diff --git a/tests/components/coolix/test.esp32-idf.yaml b/tests/components/coolix/test.esp32-idf.yaml index 0f9518d2cf..7b012aa64c 100644 --- a/tests/components/coolix/test.esp32-idf.yaml +++ b/tests/components/coolix/test.esp32-idf.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: coolix - name: Coolix Climate +<<: !include common.yaml diff --git a/tests/components/coolix/test.esp8266-ard.yaml b/tests/components/coolix/test.esp8266-ard.yaml index 61de8c7558..f5097fcf5f 100644 --- a/tests/components/coolix/test.esp8266-ard.yaml +++ b/tests/components/coolix/test.esp8266-ard.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 5 - carrier_duty_percent: 50% +substitutions: + pin: GPIO5 -climate: - - platform: coolix - name: Coolix Climate +<<: !include common.yaml diff --git a/tests/components/copy/common.yaml b/tests/components/copy/common.yaml new file mode 100644 index 0000000000..a73b3467e6 --- /dev/null +++ b/tests/components/copy/common.yaml @@ -0,0 +1,23 @@ +output: + - platform: ${pwm_platform} + id: fan_output_1 + pin: ${pin} + +fan: + - platform: speed + id: fan_speed + output: fan_output_1 + - platform: copy + source_id: fan_speed + name: Fan Speed Copy + +select: + - platform: template + id: test_select + options: + - one + - two + optimistic: true + - platform: copy + source_id: test_select + name: Test Select Copy diff --git a/tests/components/copy/test.esp32-ard.yaml b/tests/components/copy/test.esp32-ard.yaml index 806dbfe9f3..e5337726dc 100644 --- a/tests/components/copy/test.esp32-ard.yaml +++ b/tests/components/copy/test.esp32-ard.yaml @@ -1,23 +1,5 @@ -output: - - platform: ledc - id: fan_output_1 - pin: 12 +substitutions: + pwm_platform: ledc + pin: GPIO12 -fan: - - platform: speed - id: fan_speed - output: fan_output_1 - - platform: copy - source_id: fan_speed - name: Fan Speed Copy - -select: - - platform: template - id: test_select - options: - - one - - two - optimistic: true - - platform: copy - source_id: test_select - name: Test Select Copy +<<: !include common.yaml diff --git a/tests/components/copy/test.esp32-c3-ard.yaml b/tests/components/copy/test.esp32-c3-ard.yaml index 554638f462..76272beb77 100644 --- a/tests/components/copy/test.esp32-c3-ard.yaml +++ b/tests/components/copy/test.esp32-c3-ard.yaml @@ -1,23 +1,5 @@ -output: - - platform: ledc - id: fan_output_1 - pin: 2 +substitutions: + pwm_platform: ledc + pin: GPIO2 -fan: - - platform: speed - id: fan_speed - output: fan_output_1 - - platform: copy - source_id: fan_speed - name: Fan Speed Copy - -select: - - platform: template - id: test_select - options: - - one - - two - optimistic: true - - platform: copy - source_id: test_select - name: Test Select Copy +<<: !include common.yaml diff --git a/tests/components/copy/test.esp32-c3-idf.yaml b/tests/components/copy/test.esp32-c3-idf.yaml index 554638f462..76272beb77 100644 --- a/tests/components/copy/test.esp32-c3-idf.yaml +++ b/tests/components/copy/test.esp32-c3-idf.yaml @@ -1,23 +1,5 @@ -output: - - platform: ledc - id: fan_output_1 - pin: 2 +substitutions: + pwm_platform: ledc + pin: GPIO2 -fan: - - platform: speed - id: fan_speed - output: fan_output_1 - - platform: copy - source_id: fan_speed - name: Fan Speed Copy - -select: - - platform: template - id: test_select - options: - - one - - two - optimistic: true - - platform: copy - source_id: test_select - name: Test Select Copy +<<: !include common.yaml diff --git a/tests/components/copy/test.esp32-idf.yaml b/tests/components/copy/test.esp32-idf.yaml index 806dbfe9f3..e5337726dc 100644 --- a/tests/components/copy/test.esp32-idf.yaml +++ b/tests/components/copy/test.esp32-idf.yaml @@ -1,23 +1,5 @@ -output: - - platform: ledc - id: fan_output_1 - pin: 12 +substitutions: + pwm_platform: ledc + pin: GPIO12 -fan: - - platform: speed - id: fan_speed - output: fan_output_1 - - platform: copy - source_id: fan_speed - name: Fan Speed Copy - -select: - - platform: template - id: test_select - options: - - one - - two - optimistic: true - - platform: copy - source_id: test_select - name: Test Select Copy +<<: !include common.yaml diff --git a/tests/components/copy/test.esp8266-ard.yaml b/tests/components/copy/test.esp8266-ard.yaml index 1521e5f279..497fac5161 100644 --- a/tests/components/copy/test.esp8266-ard.yaml +++ b/tests/components/copy/test.esp8266-ard.yaml @@ -1,23 +1,5 @@ -output: - - platform: esp8266_pwm - id: fan_output_1 - pin: 12 +substitutions: + pwm_platform: esp8266_pwm + pin: GPIO12 -fan: - - platform: speed - id: fan_speed - output: fan_output_1 - - platform: copy - source_id: fan_speed - name: Fan Speed Copy - -select: - - platform: template - id: test_select - options: - - one - - two - optimistic: true - - platform: copy - source_id: test_select - name: Test Select Copy +<<: !include common.yaml diff --git a/tests/components/copy/test.rp2040-ard.yaml b/tests/components/copy/test.rp2040-ard.yaml index 42e5eb8000..61e461d247 100644 --- a/tests/components/copy/test.rp2040-ard.yaml +++ b/tests/components/copy/test.rp2040-ard.yaml @@ -1,23 +1,5 @@ -output: - - platform: rp2040_pwm - id: fan_output_1 - pin: 12 +substitutions: + pwm_platform: rp2040_pwm + pin: GPIO12 -fan: - - platform: speed - id: fan_speed - output: fan_output_1 - - platform: copy - source_id: fan_speed - name: Fan Speed Copy - -select: - - platform: template - id: test_select - options: - - one - - two - optimistic: true - - platform: copy - source_id: test_select - name: Test Select Copy +<<: !include common.yaml diff --git a/tests/components/cs5460a/common.yaml b/tests/components/cs5460a/common.yaml new file mode 100644 index 0000000000..d97b01716b --- /dev/null +++ b/tests/components/cs5460a/common.yaml @@ -0,0 +1,27 @@ +spi: + - id: spi_cs5460a + clk_pin: ${clk_pin} + mosi_pin: ${mosi_pin} + miso_pin: ${miso_pin} + +sensor: + - platform: cs5460a + id: cs5460a1 + cs_pin: ${cs_pin} + current: + name: Socket current + voltage: + name: Mains voltage + power: + name: Socket power + on_value: + then: + cs5460a.restart: cs5460a1 + samples: 1600 + pga_gain: 10X + current_gain: 0.01 + voltage_gain: 0.000573 + current_hpf: true + voltage_hpf: true + phase_offset: 20 + pulse_energy: 0.01 kWh diff --git a/tests/components/cs5460a/test.esp32-ard.yaml b/tests/components/cs5460a/test.esp32-ard.yaml index e7eb1cbd73..54e027a614 100644 --- a/tests/components/cs5460a/test.esp32-ard.yaml +++ b/tests/components/cs5460a/test.esp32-ard.yaml @@ -1,27 +1,7 @@ -spi: - - id: spi_cs5460a - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -sensor: - - platform: cs5460a - id: cs5460a1 - cs_pin: 12 - current: - name: Socket current - voltage: - name: Mains voltage - power: - name: Socket power - on_value: - then: - cs5460a.restart: cs5460a1 - samples: 1600 - pga_gain: 10X - current_gain: 0.01 - voltage_gain: 0.000573 - current_hpf: true - voltage_hpf: true - phase_offset: 20 - pulse_energy: 0.01 kWh +<<: !include common.yaml diff --git a/tests/components/cs5460a/test.esp32-c3-ard.yaml b/tests/components/cs5460a/test.esp32-c3-ard.yaml index 4ce21783a3..2415ba5dc6 100644 --- a/tests/components/cs5460a/test.esp32-c3-ard.yaml +++ b/tests/components/cs5460a/test.esp32-c3-ard.yaml @@ -1,27 +1,7 @@ -spi: - - id: spi_cs5460a - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -sensor: - - platform: cs5460a - id: cs5460a1 - cs_pin: 8 - current: - name: Socket current - voltage: - name: Mains voltage - power: - name: Socket power - on_value: - then: - cs5460a.restart: cs5460a1 - samples: 1600 - pga_gain: 10X - current_gain: 0.01 - voltage_gain: 0.000573 - current_hpf: true - voltage_hpf: true - phase_offset: 20 - pulse_energy: 0.01 kWh +<<: !include common.yaml diff --git a/tests/components/cs5460a/test.esp32-c3-idf.yaml b/tests/components/cs5460a/test.esp32-c3-idf.yaml index 4ce21783a3..2415ba5dc6 100644 --- a/tests/components/cs5460a/test.esp32-c3-idf.yaml +++ b/tests/components/cs5460a/test.esp32-c3-idf.yaml @@ -1,27 +1,7 @@ -spi: - - id: spi_cs5460a - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -sensor: - - platform: cs5460a - id: cs5460a1 - cs_pin: 8 - current: - name: Socket current - voltage: - name: Mains voltage - power: - name: Socket power - on_value: - then: - cs5460a.restart: cs5460a1 - samples: 1600 - pga_gain: 10X - current_gain: 0.01 - voltage_gain: 0.000573 - current_hpf: true - voltage_hpf: true - phase_offset: 20 - pulse_energy: 0.01 kWh +<<: !include common.yaml diff --git a/tests/components/cs5460a/test.esp32-idf.yaml b/tests/components/cs5460a/test.esp32-idf.yaml index e7eb1cbd73..54e027a614 100644 --- a/tests/components/cs5460a/test.esp32-idf.yaml +++ b/tests/components/cs5460a/test.esp32-idf.yaml @@ -1,27 +1,7 @@ -spi: - - id: spi_cs5460a - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -sensor: - - platform: cs5460a - id: cs5460a1 - cs_pin: 12 - current: - name: Socket current - voltage: - name: Mains voltage - power: - name: Socket power - on_value: - then: - cs5460a.restart: cs5460a1 - samples: 1600 - pga_gain: 10X - current_gain: 0.01 - voltage_gain: 0.000573 - current_hpf: true - voltage_hpf: true - phase_offset: 20 - pulse_energy: 0.01 kWh +<<: !include common.yaml diff --git a/tests/components/cs5460a/test.esp8266-ard.yaml b/tests/components/cs5460a/test.esp8266-ard.yaml index c5a458d0ec..dbd158d030 100644 --- a/tests/components/cs5460a/test.esp8266-ard.yaml +++ b/tests/components/cs5460a/test.esp8266-ard.yaml @@ -1,27 +1,7 @@ -spi: - - id: spi_cs5460a - clk_pin: 14 - mosi_pin: 13 - miso_pin: 12 +substitutions: + clk_pin: GPIO14 + mosi_pin: GPIO13 + miso_pin: GPIO12 + cs_pin: GPIO15 -sensor: - - platform: cs5460a - id: cs5460a1 - cs_pin: 15 - current: - name: Socket current - voltage: - name: Mains voltage - power: - name: Socket power - on_value: - then: - cs5460a.restart: cs5460a1 - samples: 1600 - pga_gain: 10X - current_gain: 0.01 - voltage_gain: 0.000573 - current_hpf: true - voltage_hpf: true - phase_offset: 20 - pulse_energy: 0.01 kWh +<<: !include common.yaml diff --git a/tests/components/cs5460a/test.rp2040-ard.yaml b/tests/components/cs5460a/test.rp2040-ard.yaml index f3daf7d72d..f6c3f1eeca 100644 --- a/tests/components/cs5460a/test.rp2040-ard.yaml +++ b/tests/components/cs5460a/test.rp2040-ard.yaml @@ -1,27 +1,7 @@ -spi: - - id: spi_cs5460a - clk_pin: 2 - mosi_pin: 3 - miso_pin: 4 +substitutions: + clk_pin: GPIO2 + mosi_pin: GPIO3 + miso_pin: GPIO4 + cs_pin: GPIO5 -sensor: - - platform: cs5460a - id: cs5460a1 - cs_pin: 6 - current: - name: Socket current - voltage: - name: Mains voltage - power: - name: Socket power - on_value: - then: - cs5460a.restart: cs5460a1 - samples: 1600 - pga_gain: 10X - current_gain: 0.01 - voltage_gain: 0.000573 - current_hpf: true - voltage_hpf: true - phase_offset: 20 - pulse_energy: 0.01 kWh +<<: !include common.yaml diff --git a/tests/components/cse7761/common.yaml b/tests/components/cse7761/common.yaml new file mode 100644 index 0000000000..60cce3864a --- /dev/null +++ b/tests/components/cse7761/common.yaml @@ -0,0 +1,18 @@ +uart: + - id: uart_cse7761 + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} + baud_rate: 38400 + +sensor: + - platform: cse7761 + voltage: + name: CSE7761 Voltage + current_1: + name: CSE7761 Current 1 + current_2: + name: CSE7761 Current 2 + active_power_1: + name: CSE7761 Active Power 1 + active_power_2: + name: CSE7761 Active Power 2 diff --git a/tests/components/cse7761/test.esp32-ard.yaml b/tests/components/cse7761/test.esp32-ard.yaml index 4174e9a92e..811f6b72a6 100644 --- a/tests/components/cse7761/test.esp32-ard.yaml +++ b/tests/components/cse7761/test.esp32-ard.yaml @@ -1,20 +1,5 @@ -uart: - - id: uart_cse7761 - tx_pin: - number: 17 - rx_pin: - number: 16 - baud_rate: 38400 +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 -sensor: - - platform: cse7761 - voltage: - name: CSE7761 Voltage - current_1: - name: CSE7761 Current 1 - current_2: - name: CSE7761 Current 2 - active_power_1: - name: CSE7761 Active Power 1 - active_power_2: - name: CSE7761 Active Power 2 +<<: !include common.yaml diff --git a/tests/components/cse7761/test.esp32-c3-ard.yaml b/tests/components/cse7761/test.esp32-c3-ard.yaml index 581db24fd5..c79d14c740 100644 --- a/tests/components/cse7761/test.esp32-c3-ard.yaml +++ b/tests/components/cse7761/test.esp32-c3-ard.yaml @@ -1,20 +1,5 @@ -uart: - - id: uart_cse7761 - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 38400 +substitutions: + tx_pin: GPIO7 + rx_pin: GPIO8 -sensor: - - platform: cse7761 - voltage: - name: CSE7761 Voltage - current_1: - name: CSE7761 Current 1 - current_2: - name: CSE7761 Current 2 - active_power_1: - name: CSE7761 Active Power 1 - active_power_2: - name: CSE7761 Active Power 2 +<<: !include common.yaml diff --git a/tests/components/cse7761/test.esp32-c3-idf.yaml b/tests/components/cse7761/test.esp32-c3-idf.yaml index 581db24fd5..c79d14c740 100644 --- a/tests/components/cse7761/test.esp32-c3-idf.yaml +++ b/tests/components/cse7761/test.esp32-c3-idf.yaml @@ -1,20 +1,5 @@ -uart: - - id: uart_cse7761 - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 38400 +substitutions: + tx_pin: GPIO7 + rx_pin: GPIO8 -sensor: - - platform: cse7761 - voltage: - name: CSE7761 Voltage - current_1: - name: CSE7761 Current 1 - current_2: - name: CSE7761 Current 2 - active_power_1: - name: CSE7761 Active Power 1 - active_power_2: - name: CSE7761 Active Power 2 +<<: !include common.yaml diff --git a/tests/components/cse7761/test.esp32-idf.yaml b/tests/components/cse7761/test.esp32-idf.yaml index 4174e9a92e..811f6b72a6 100644 --- a/tests/components/cse7761/test.esp32-idf.yaml +++ b/tests/components/cse7761/test.esp32-idf.yaml @@ -1,20 +1,5 @@ -uart: - - id: uart_cse7761 - tx_pin: - number: 17 - rx_pin: - number: 16 - baud_rate: 38400 +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 -sensor: - - platform: cse7761 - voltage: - name: CSE7761 Voltage - current_1: - name: CSE7761 Current 1 - current_2: - name: CSE7761 Current 2 - active_power_1: - name: CSE7761 Active Power 1 - active_power_2: - name: CSE7761 Active Power 2 +<<: !include common.yaml diff --git a/tests/components/cse7761/test.esp8266-ard.yaml b/tests/components/cse7761/test.esp8266-ard.yaml index 581db24fd5..3b44f9c9c3 100644 --- a/tests/components/cse7761/test.esp8266-ard.yaml +++ b/tests/components/cse7761/test.esp8266-ard.yaml @@ -1,20 +1,5 @@ -uart: - - id: uart_cse7761 - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 38400 +substitutions: + tx_pin: GPIO1 + rx_pin: GPIO3 -sensor: - - platform: cse7761 - voltage: - name: CSE7761 Voltage - current_1: - name: CSE7761 Current 1 - current_2: - name: CSE7761 Current 2 - active_power_1: - name: CSE7761 Active Power 1 - active_power_2: - name: CSE7761 Active Power 2 +<<: !include common.yaml diff --git a/tests/components/cse7761/test.rp2040-ard.yaml b/tests/components/cse7761/test.rp2040-ard.yaml index 581db24fd5..b516342f3b 100644 --- a/tests/components/cse7761/test.rp2040-ard.yaml +++ b/tests/components/cse7761/test.rp2040-ard.yaml @@ -1,20 +1,5 @@ -uart: - - id: uart_cse7761 - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 38400 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -sensor: - - platform: cse7761 - voltage: - name: CSE7761 Voltage - current_1: - name: CSE7761 Current 1 - current_2: - name: CSE7761 Current 2 - active_power_1: - name: CSE7761 Active Power 1 - active_power_2: - name: CSE7761 Active Power 2 +<<: !include common.yaml diff --git a/tests/components/cse7766/common.yaml b/tests/components/cse7766/common.yaml new file mode 100644 index 0000000000..f12b135a77 --- /dev/null +++ b/tests/components/cse7766/common.yaml @@ -0,0 +1,15 @@ +uart: + - id: uart_cse7766 + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} + baud_rate: 4800 + parity: EVEN + +sensor: + - platform: cse7766 + voltage: + name: CSE7766 Voltage + current: + name: CSE7766 Current + power: + name: CSE776 Power diff --git a/tests/components/cse7766/test.esp32-ard.yaml b/tests/components/cse7766/test.esp32-ard.yaml index 5542b52824..811f6b72a6 100644 --- a/tests/components/cse7766/test.esp32-ard.yaml +++ b/tests/components/cse7766/test.esp32-ard.yaml @@ -1,17 +1,5 @@ -uart: - - id: uart_cse7766 - tx_pin: - number: 17 - rx_pin: - number: 16 - baud_rate: 4800 - parity: EVEN +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 -sensor: - - platform: cse7766 - voltage: - name: CSE7766 Voltage - current: - name: CSE7766 Current - power: - name: CSE776 Power +<<: !include common.yaml diff --git a/tests/components/cse7766/test.esp32-c3-ard.yaml b/tests/components/cse7766/test.esp32-c3-ard.yaml index d27c9d4463..c79d14c740 100644 --- a/tests/components/cse7766/test.esp32-c3-ard.yaml +++ b/tests/components/cse7766/test.esp32-c3-ard.yaml @@ -1,17 +1,5 @@ -uart: - - id: uart_cse7766 - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 4800 - parity: EVEN +substitutions: + tx_pin: GPIO7 + rx_pin: GPIO8 -sensor: - - platform: cse7766 - voltage: - name: CSE7766 Voltage - current: - name: CSE7766 Current - power: - name: CSE776 Power +<<: !include common.yaml diff --git a/tests/components/cse7766/test.esp32-c3-idf.yaml b/tests/components/cse7766/test.esp32-c3-idf.yaml index d27c9d4463..c79d14c740 100644 --- a/tests/components/cse7766/test.esp32-c3-idf.yaml +++ b/tests/components/cse7766/test.esp32-c3-idf.yaml @@ -1,17 +1,5 @@ -uart: - - id: uart_cse7766 - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 4800 - parity: EVEN +substitutions: + tx_pin: GPIO7 + rx_pin: GPIO8 -sensor: - - platform: cse7766 - voltage: - name: CSE7766 Voltage - current: - name: CSE7766 Current - power: - name: CSE776 Power +<<: !include common.yaml diff --git a/tests/components/cse7766/test.esp32-idf.yaml b/tests/components/cse7766/test.esp32-idf.yaml index 5542b52824..811f6b72a6 100644 --- a/tests/components/cse7766/test.esp32-idf.yaml +++ b/tests/components/cse7766/test.esp32-idf.yaml @@ -1,17 +1,5 @@ -uart: - - id: uart_cse7766 - tx_pin: - number: 17 - rx_pin: - number: 16 - baud_rate: 4800 - parity: EVEN +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 -sensor: - - platform: cse7766 - voltage: - name: CSE7766 Voltage - current: - name: CSE7766 Current - power: - name: CSE776 Power +<<: !include common.yaml diff --git a/tests/components/cse7766/test.esp8266-ard.yaml b/tests/components/cse7766/test.esp8266-ard.yaml index d27c9d4463..3b44f9c9c3 100644 --- a/tests/components/cse7766/test.esp8266-ard.yaml +++ b/tests/components/cse7766/test.esp8266-ard.yaml @@ -1,17 +1,5 @@ -uart: - - id: uart_cse7766 - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 4800 - parity: EVEN +substitutions: + tx_pin: GPIO1 + rx_pin: GPIO3 -sensor: - - platform: cse7766 - voltage: - name: CSE7766 Voltage - current: - name: CSE7766 Current - power: - name: CSE776 Power +<<: !include common.yaml diff --git a/tests/components/cse7766/test.rp2040-ard.yaml b/tests/components/cse7766/test.rp2040-ard.yaml index d27c9d4463..b516342f3b 100644 --- a/tests/components/cse7766/test.rp2040-ard.yaml +++ b/tests/components/cse7766/test.rp2040-ard.yaml @@ -1,17 +1,5 @@ -uart: - - id: uart_cse7766 - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 4800 - parity: EVEN +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -sensor: - - platform: cse7766 - voltage: - name: CSE7766 Voltage - current: - name: CSE7766 Current - power: - name: CSE776 Power +<<: !include common.yaml diff --git a/tests/components/cst226/common.yaml b/tests/components/cst226/common.yaml index 7e1c5dde36..c12d8d872c 100644 --- a/tests/components/cst226/common.yaml +++ b/tests/components/cst226/common.yaml @@ -1,25 +1,25 @@ +i2c: + - id: i2c_cst226 + scl: ${scl_pin} + sda: ${sda_pin} + spi: - - id: spi_id_1 - clk_pin: GPIO7 - mosi_pin: GPIO6 - interface: any + - id: spi_ili9xxx + clk_pin: ${clk_pin} + mosi_pin: ${mosi_pin} display: - - platform: ili9xxx - id: displ8 + - id: my_display + platform: ili9xxx model: ili9342 - cs_pin: GPIO5 - dc_pin: GPIO4 - reset_pin: - number: GPIO21 + cs_pin: ${cs_pin} + dc_pin: ${dc_pin} + reset_pin: ${disp_reset_pin} invert_colors: false -i2c: - scl: GPIO18 - sda: GPIO8 - touchscreen: - - platform: cst226 - interrupt_pin: GPIO3 - reset_pin: GPIO20 + - id: ts_cst226 + platform: cst226 + interrupt_pin: ${interrupt_pin} + reset_pin: ${reset_pin} diff --git a/tests/components/cst226/test.esp32-ard.yaml b/tests/components/cst226/test.esp32-ard.yaml new file mode 100644 index 0000000000..11e2c4fd43 --- /dev/null +++ b/tests/components/cst226/test.esp32-ard.yaml @@ -0,0 +1,12 @@ +substitutions: + clk_pin: GPIO0 + mosi_pin: GPIO2 + cs_pin: GPIO4 + dc_pin: GPIO5 + disp_reset_pin: GPIO12 + scl_pin: GPIO13 + sda_pin: GPIO14 + interrupt_pin: GPIO15 + reset_pin: GPIO16 + +<<: !include common.yaml diff --git a/tests/components/cst226/test.esp32-c3-ard.yaml b/tests/components/cst226/test.esp32-c3-ard.yaml index dade44d145..2f9bd72882 100644 --- a/tests/components/cst226/test.esp32-c3-ard.yaml +++ b/tests/components/cst226/test.esp32-c3-ard.yaml @@ -1 +1,12 @@ +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + cs_pin: GPIO8 + dc_pin: GPIO9 + disp_reset_pin: GPIO10 + scl_pin: GPIO0 + sda_pin: GPIO1 + interrupt_pin: GPIO2 + reset_pin: GPIO3 + <<: !include common.yaml diff --git a/tests/components/cst226/test.esp32-c3-idf.yaml b/tests/components/cst226/test.esp32-c3-idf.yaml new file mode 100644 index 0000000000..2f9bd72882 --- /dev/null +++ b/tests/components/cst226/test.esp32-c3-idf.yaml @@ -0,0 +1,12 @@ +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + cs_pin: GPIO8 + dc_pin: GPIO9 + disp_reset_pin: GPIO10 + scl_pin: GPIO0 + sda_pin: GPIO1 + interrupt_pin: GPIO2 + reset_pin: GPIO3 + +<<: !include common.yaml diff --git a/tests/components/cst226/test.esp32-idf.yaml b/tests/components/cst226/test.esp32-idf.yaml new file mode 100644 index 0000000000..11e2c4fd43 --- /dev/null +++ b/tests/components/cst226/test.esp32-idf.yaml @@ -0,0 +1,12 @@ +substitutions: + clk_pin: GPIO0 + mosi_pin: GPIO2 + cs_pin: GPIO4 + dc_pin: GPIO5 + disp_reset_pin: GPIO12 + scl_pin: GPIO13 + sda_pin: GPIO14 + interrupt_pin: GPIO15 + reset_pin: GPIO16 + +<<: !include common.yaml diff --git a/tests/components/cst816/common.yaml b/tests/components/cst816/common.yaml index 765a353d1d..a4ac4aafec 100644 --- a/tests/components/cst816/common.yaml +++ b/tests/components/cst816/common.yaml @@ -1,27 +1,21 @@ -touchscreen: - - platform: cst816 - id: my_touchscreen - interrupt_pin: - number: 21 - reset_pin: GPIO16 - skip_probe: false - transform: - mirror_x: false - mirror_y: false - swap_xy: false - i2c: - sda: 3 - scl: 4 + - id: i2c_cst816 + scl: ${scl_pin} + sda: ${sda_pin} + +spi: + - id: spi_ili9xxx + clk_pin: ${clk_pin} + mosi_pin: ${mosi_pin} display: - id: my_display platform: ili9xxx dimensions: 480x320 model: ST7796 - cs_pin: 18 - dc_pin: 20 - reset_pin: 22 + cs_pin: ${cs_pin} + dc_pin: ${dc_pin} + reset_pin: ${disp_reset_pin} transform: swap_xy: true mirror_x: true @@ -29,9 +23,16 @@ display: auto_clear_enabled: false invert_colors: false -spi: - clk_pin: 14 - mosi_pin: 13 +touchscreen: + - id: ts_cst816 + platform: cst816 + interrupt_pin: ${interrupt_pin} + reset_pin: ${reset_pin} + skip_probe: false + transform: + mirror_x: false + mirror_y: false + swap_xy: false binary_sensor: - platform: cst816 diff --git a/tests/components/cst816/test.esp32-ard.yaml b/tests/components/cst816/test.esp32-ard.yaml index dade44d145..11e2c4fd43 100644 --- a/tests/components/cst816/test.esp32-ard.yaml +++ b/tests/components/cst816/test.esp32-ard.yaml @@ -1 +1,12 @@ +substitutions: + clk_pin: GPIO0 + mosi_pin: GPIO2 + cs_pin: GPIO4 + dc_pin: GPIO5 + disp_reset_pin: GPIO12 + scl_pin: GPIO13 + sda_pin: GPIO14 + interrupt_pin: GPIO15 + reset_pin: GPIO16 + <<: !include common.yaml diff --git a/tests/components/cst816/test.esp32-c3-ard.yaml b/tests/components/cst816/test.esp32-c3-ard.yaml new file mode 100644 index 0000000000..2f9bd72882 --- /dev/null +++ b/tests/components/cst816/test.esp32-c3-ard.yaml @@ -0,0 +1,12 @@ +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + cs_pin: GPIO8 + dc_pin: GPIO9 + disp_reset_pin: GPIO10 + scl_pin: GPIO0 + sda_pin: GPIO1 + interrupt_pin: GPIO2 + reset_pin: GPIO3 + +<<: !include common.yaml diff --git a/tests/components/cst816/test.esp32-c3-idf.yaml b/tests/components/cst816/test.esp32-c3-idf.yaml new file mode 100644 index 0000000000..2f9bd72882 --- /dev/null +++ b/tests/components/cst816/test.esp32-c3-idf.yaml @@ -0,0 +1,12 @@ +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + cs_pin: GPIO8 + dc_pin: GPIO9 + disp_reset_pin: GPIO10 + scl_pin: GPIO0 + sda_pin: GPIO1 + interrupt_pin: GPIO2 + reset_pin: GPIO3 + +<<: !include common.yaml diff --git a/tests/components/cst816/test.esp32-idf.yaml b/tests/components/cst816/test.esp32-idf.yaml new file mode 100644 index 0000000000..11e2c4fd43 --- /dev/null +++ b/tests/components/cst816/test.esp32-idf.yaml @@ -0,0 +1,12 @@ +substitutions: + clk_pin: GPIO0 + mosi_pin: GPIO2 + cs_pin: GPIO4 + dc_pin: GPIO5 + disp_reset_pin: GPIO12 + scl_pin: GPIO13 + sda_pin: GPIO14 + interrupt_pin: GPIO15 + reset_pin: GPIO16 + +<<: !include common.yaml diff --git a/tests/components/ct_clamp/common.yaml b/tests/components/ct_clamp/common.yaml new file mode 100644 index 0000000000..3ed9678447 --- /dev/null +++ b/tests/components/ct_clamp/common.yaml @@ -0,0 +1,9 @@ +sensor: + - platform: adc + id: esp_adc_sensor + pin: ${pin} + - platform: ct_clamp + sensor: esp_adc_sensor + name: CT Clamp + sample_duration: 500ms + update_interval: 5s diff --git a/tests/components/ct_clamp/test.esp32-ard.yaml b/tests/components/ct_clamp/test.esp32-ard.yaml index 1ea964fa96..0a70e3f733 100644 --- a/tests/components/ct_clamp/test.esp32-ard.yaml +++ b/tests/components/ct_clamp/test.esp32-ard.yaml @@ -1,9 +1,4 @@ -sensor: - - platform: adc - id: esp_adc_sensor - pin: 39 - - platform: ct_clamp - sensor: esp_adc_sensor - name: CT Clamp - sample_duration: 500ms - update_interval: 5s +substitutions: + pin: GPIO39 + +<<: !include common.yaml diff --git a/tests/components/ct_clamp/test.esp32-c3-ard.yaml b/tests/components/ct_clamp/test.esp32-c3-ard.yaml index e25acc95e1..a8f29c98ae 100644 --- a/tests/components/ct_clamp/test.esp32-c3-ard.yaml +++ b/tests/components/ct_clamp/test.esp32-c3-ard.yaml @@ -1,9 +1,4 @@ -sensor: - - platform: adc - id: esp_adc_sensor - pin: 0 - - platform: ct_clamp - sensor: esp_adc_sensor - name: CT Clamp - sample_duration: 500ms - update_interval: 5s +substitutions: + pin: GPIO0 + +<<: !include common.yaml diff --git a/tests/components/ct_clamp/test.esp32-c3-idf.yaml b/tests/components/ct_clamp/test.esp32-c3-idf.yaml index e25acc95e1..a8f29c98ae 100644 --- a/tests/components/ct_clamp/test.esp32-c3-idf.yaml +++ b/tests/components/ct_clamp/test.esp32-c3-idf.yaml @@ -1,9 +1,4 @@ -sensor: - - platform: adc - id: esp_adc_sensor - pin: 0 - - platform: ct_clamp - sensor: esp_adc_sensor - name: CT Clamp - sample_duration: 500ms - update_interval: 5s +substitutions: + pin: GPIO0 + +<<: !include common.yaml diff --git a/tests/components/ct_clamp/test.esp32-idf.yaml b/tests/components/ct_clamp/test.esp32-idf.yaml index 1ea964fa96..0a70e3f733 100644 --- a/tests/components/ct_clamp/test.esp32-idf.yaml +++ b/tests/components/ct_clamp/test.esp32-idf.yaml @@ -1,9 +1,4 @@ -sensor: - - platform: adc - id: esp_adc_sensor - pin: 39 - - platform: ct_clamp - sensor: esp_adc_sensor - name: CT Clamp - sample_duration: 500ms - update_interval: 5s +substitutions: + pin: GPIO39 + +<<: !include common.yaml diff --git a/tests/components/ct_clamp/test.esp8266-ard.yaml b/tests/components/ct_clamp/test.esp8266-ard.yaml index 9c7126480d..4a6d36cbb4 100644 --- a/tests/components/ct_clamp/test.esp8266-ard.yaml +++ b/tests/components/ct_clamp/test.esp8266-ard.yaml @@ -1,9 +1,4 @@ -sensor: - - platform: adc - id: esp_adc_sensor - pin: A0 - - platform: ct_clamp - sensor: esp_adc_sensor - name: CT Clamp - sample_duration: 500ms - update_interval: 5s +substitutions: + pin: A0 + +<<: !include common.yaml diff --git a/tests/components/ct_clamp/test.rp2040-ard.yaml b/tests/components/ct_clamp/test.rp2040-ard.yaml index 47077308aa..9479437434 100644 --- a/tests/components/ct_clamp/test.rp2040-ard.yaml +++ b/tests/components/ct_clamp/test.rp2040-ard.yaml @@ -1,9 +1,4 @@ -sensor: - - platform: adc - id: esp_adc_sensor - pin: 26 - - platform: ct_clamp - sensor: esp_adc_sensor - name: CT Clamp - sample_duration: 500ms - update_interval: 5s +substitutions: + pin: GPIO26 + +<<: !include common.yaml diff --git a/tests/components/current_based/common.yaml b/tests/components/current_based/common.yaml new file mode 100644 index 0000000000..25dc9671b7 --- /dev/null +++ b/tests/components/current_based/common.yaml @@ -0,0 +1,68 @@ +i2c: + - id: i2c_ade7953 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: ade7953_i2c + irq_pin: ${irq_pin} + voltage: + name: ADE7953 Voltage + id: ade7953_voltage + current_a: + name: ADE7953 Current A + id: ade7953_current_a + current_b: + name: ADE7953 Current B + id: ade7953_current_b + power_factor_a: + name: ADE7953 Power Factor A + power_factor_b: + name: ADE7953 Power Factor B + apparent_power_a: + name: ADE7953 Apparent Power A + apparent_power_b: + name: ADE7953 Apparent Power B + active_power_a: + name: ADE7953 Active Power A + active_power_b: + name: ADE7953 Active Power B + reactive_power_a: + name: ADE7953 Reactive Power A + reactive_power_b: + name: ADE7953 Reactive Power B + update_interval: 1s + +switch: + - platform: template + id: template_switch1 + optimistic: true + - platform: template + id: template_switch2 + optimistic: true + +cover: + - platform: current_based + name: Current Based Cover + id: current_based_cover + open_sensor: ade7953_current_a + open_moving_current_threshold: 0.5 + open_obstacle_current_threshold: 0.8 + open_duration: 12s + open_action: + - switch.turn_on: template_switch1 + close_sensor: ade7953_current_b + close_moving_current_threshold: 0.5 + close_obstacle_current_threshold: 0.8 + close_duration: 10s + close_action: + - switch.turn_on: template_switch2 + stop_action: + - switch.turn_off: template_switch1 + - switch.turn_off: template_switch2 + obstacle_rollback: 30% + start_sensing_delay: 0.8s + malfunction_detection: true + malfunction_action: + then: + - logger.log: Malfunction Detected diff --git a/tests/components/current_based/test.esp32-ard.yaml b/tests/components/current_based/test.esp32-ard.yaml index 90781120bc..2c57d412f6 100644 --- a/tests/components/current_based/test.esp32-ard.yaml +++ b/tests/components/current_based/test.esp32-ard.yaml @@ -1,68 +1,6 @@ -i2c: - - id: i2c_ade7953 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 + irq_pin: GPIO15 -sensor: - - platform: ade7953_i2c - irq_pin: 15 - voltage: - name: ADE7953 Voltage - id: ade7953_voltage - current_a: - name: ADE7953 Current A - id: ade7953_current_a - current_b: - name: ADE7953 Current B - id: ade7953_current_b - power_factor_a: - name: ADE7953 Power Factor A - power_factor_b: - name: ADE7953 Power Factor B - apparent_power_a: - name: ADE7953 Apparent Power A - apparent_power_b: - name: ADE7953 Apparent Power B - active_power_a: - name: ADE7953 Active Power A - active_power_b: - name: ADE7953 Active Power B - reactive_power_a: - name: ADE7953 Reactive Power A - reactive_power_b: - name: ADE7953 Reactive Power B - update_interval: 1s - -switch: - - platform: template - id: template_switch1 - optimistic: true - - platform: template - id: template_switch2 - optimistic: true - -cover: - - platform: current_based - name: Current Based Cover - id: current_based_cover - open_sensor: ade7953_current_a - open_moving_current_threshold: 0.5 - open_obstacle_current_threshold: 0.8 - open_duration: 12s - open_action: - - switch.turn_on: template_switch1 - close_sensor: ade7953_current_b - close_moving_current_threshold: 0.5 - close_obstacle_current_threshold: 0.8 - close_duration: 10s - close_action: - - switch.turn_on: template_switch2 - stop_action: - - switch.turn_off: template_switch1 - - switch.turn_off: template_switch2 - obstacle_rollback: 30% - start_sensing_delay: 0.8s - malfunction_detection: true - malfunction_action: - then: - - logger.log: Malfunction Detected +<<: !include common.yaml diff --git a/tests/components/current_based/test.esp32-c3-ard.yaml b/tests/components/current_based/test.esp32-c3-ard.yaml index 69ab8830c3..799acabd5a 100644 --- a/tests/components/current_based/test.esp32-c3-ard.yaml +++ b/tests/components/current_based/test.esp32-c3-ard.yaml @@ -1,68 +1,6 @@ -i2c: - - id: i2c_ade7953 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + irq_pin: GPIO6 -sensor: - - platform: ade7953_i2c - irq_pin: 6 - voltage: - name: ADE7953 Voltage - id: ade7953_voltage - current_a: - name: ADE7953 Current A - id: ade7953_current_a - current_b: - name: ADE7953 Current B - id: ade7953_current_b - power_factor_a: - name: ADE7953 Power Factor A - power_factor_b: - name: ADE7953 Power Factor B - apparent_power_a: - name: ADE7953 Apparent Power A - apparent_power_b: - name: ADE7953 Apparent Power B - active_power_a: - name: ADE7953 Active Power A - active_power_b: - name: ADE7953 Active Power B - reactive_power_a: - name: ADE7953 Reactive Power A - reactive_power_b: - name: ADE7953 Reactive Power B - update_interval: 1s - -switch: - - platform: template - id: template_switch1 - optimistic: true - - platform: template - id: template_switch2 - optimistic: true - -cover: - - platform: current_based - name: Current Based Cover - id: current_based_cover - open_sensor: ade7953_current_a - open_moving_current_threshold: 0.5 - open_obstacle_current_threshold: 0.8 - open_duration: 12s - open_action: - - switch.turn_on: template_switch1 - close_sensor: ade7953_current_b - close_moving_current_threshold: 0.5 - close_obstacle_current_threshold: 0.8 - close_duration: 10s - close_action: - - switch.turn_on: template_switch2 - stop_action: - - switch.turn_off: template_switch1 - - switch.turn_off: template_switch2 - obstacle_rollback: 30% - start_sensing_delay: 0.8s - malfunction_detection: true - malfunction_action: - then: - - logger.log: Malfunction Detected +<<: !include common.yaml diff --git a/tests/components/current_based/test.esp32-c3-idf.yaml b/tests/components/current_based/test.esp32-c3-idf.yaml index 69ab8830c3..799acabd5a 100644 --- a/tests/components/current_based/test.esp32-c3-idf.yaml +++ b/tests/components/current_based/test.esp32-c3-idf.yaml @@ -1,68 +1,6 @@ -i2c: - - id: i2c_ade7953 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + irq_pin: GPIO6 -sensor: - - platform: ade7953_i2c - irq_pin: 6 - voltage: - name: ADE7953 Voltage - id: ade7953_voltage - current_a: - name: ADE7953 Current A - id: ade7953_current_a - current_b: - name: ADE7953 Current B - id: ade7953_current_b - power_factor_a: - name: ADE7953 Power Factor A - power_factor_b: - name: ADE7953 Power Factor B - apparent_power_a: - name: ADE7953 Apparent Power A - apparent_power_b: - name: ADE7953 Apparent Power B - active_power_a: - name: ADE7953 Active Power A - active_power_b: - name: ADE7953 Active Power B - reactive_power_a: - name: ADE7953 Reactive Power A - reactive_power_b: - name: ADE7953 Reactive Power B - update_interval: 1s - -switch: - - platform: template - id: template_switch1 - optimistic: true - - platform: template - id: template_switch2 - optimistic: true - -cover: - - platform: current_based - name: Current Based Cover - id: current_based_cover - open_sensor: ade7953_current_a - open_moving_current_threshold: 0.5 - open_obstacle_current_threshold: 0.8 - open_duration: 12s - open_action: - - switch.turn_on: template_switch1 - close_sensor: ade7953_current_b - close_moving_current_threshold: 0.5 - close_obstacle_current_threshold: 0.8 - close_duration: 10s - close_action: - - switch.turn_on: template_switch2 - stop_action: - - switch.turn_off: template_switch1 - - switch.turn_off: template_switch2 - obstacle_rollback: 30% - start_sensing_delay: 0.8s - malfunction_detection: true - malfunction_action: - then: - - logger.log: Malfunction Detected +<<: !include common.yaml diff --git a/tests/components/current_based/test.esp32-idf.yaml b/tests/components/current_based/test.esp32-idf.yaml index 90781120bc..2c57d412f6 100644 --- a/tests/components/current_based/test.esp32-idf.yaml +++ b/tests/components/current_based/test.esp32-idf.yaml @@ -1,68 +1,6 @@ -i2c: - - id: i2c_ade7953 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 + irq_pin: GPIO15 -sensor: - - platform: ade7953_i2c - irq_pin: 15 - voltage: - name: ADE7953 Voltage - id: ade7953_voltage - current_a: - name: ADE7953 Current A - id: ade7953_current_a - current_b: - name: ADE7953 Current B - id: ade7953_current_b - power_factor_a: - name: ADE7953 Power Factor A - power_factor_b: - name: ADE7953 Power Factor B - apparent_power_a: - name: ADE7953 Apparent Power A - apparent_power_b: - name: ADE7953 Apparent Power B - active_power_a: - name: ADE7953 Active Power A - active_power_b: - name: ADE7953 Active Power B - reactive_power_a: - name: ADE7953 Reactive Power A - reactive_power_b: - name: ADE7953 Reactive Power B - update_interval: 1s - -switch: - - platform: template - id: template_switch1 - optimistic: true - - platform: template - id: template_switch2 - optimistic: true - -cover: - - platform: current_based - name: Current Based Cover - id: current_based_cover - open_sensor: ade7953_current_a - open_moving_current_threshold: 0.5 - open_obstacle_current_threshold: 0.8 - open_duration: 12s - open_action: - - switch.turn_on: template_switch1 - close_sensor: ade7953_current_b - close_moving_current_threshold: 0.5 - close_obstacle_current_threshold: 0.8 - close_duration: 10s - close_action: - - switch.turn_on: template_switch2 - stop_action: - - switch.turn_off: template_switch1 - - switch.turn_off: template_switch2 - obstacle_rollback: 30% - start_sensing_delay: 0.8s - malfunction_detection: true - malfunction_action: - then: - - logger.log: Malfunction Detected +<<: !include common.yaml diff --git a/tests/components/current_based/test.esp8266-ard.yaml b/tests/components/current_based/test.esp8266-ard.yaml index 42d6d4676b..c8e6a43f44 100644 --- a/tests/components/current_based/test.esp8266-ard.yaml +++ b/tests/components/current_based/test.esp8266-ard.yaml @@ -1,68 +1,6 @@ -i2c: - - id: i2c_ade7953 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + irq_pin: GPIO15 -sensor: - - platform: ade7953_i2c - irq_pin: 15 - voltage: - name: ADE7953 Voltage - id: ade7953_voltage - current_a: - name: ADE7953 Current A - id: ade7953_current_a - current_b: - name: ADE7953 Current B - id: ade7953_current_b - power_factor_a: - name: ADE7953 Power Factor A - power_factor_b: - name: ADE7953 Power Factor B - apparent_power_a: - name: ADE7953 Apparent Power A - apparent_power_b: - name: ADE7953 Apparent Power B - active_power_a: - name: ADE7953 Active Power A - active_power_b: - name: ADE7953 Active Power B - reactive_power_a: - name: ADE7953 Reactive Power A - reactive_power_b: - name: ADE7953 Reactive Power B - update_interval: 1s - -switch: - - platform: template - id: template_switch1 - optimistic: true - - platform: template - id: template_switch2 - optimistic: true - -cover: - - platform: current_based - name: Current Based Cover - id: current_based_cover - open_sensor: ade7953_current_a - open_moving_current_threshold: 0.5 - open_obstacle_current_threshold: 0.8 - open_duration: 12s - open_action: - - switch.turn_on: template_switch1 - close_sensor: ade7953_current_b - close_moving_current_threshold: 0.5 - close_obstacle_current_threshold: 0.8 - close_duration: 10s - close_action: - - switch.turn_on: template_switch2 - stop_action: - - switch.turn_off: template_switch1 - - switch.turn_off: template_switch2 - obstacle_rollback: 30% - start_sensing_delay: 0.8s - malfunction_detection: true - malfunction_action: - then: - - logger.log: Malfunction Detected +<<: !include common.yaml diff --git a/tests/components/current_based/test.rp2040-ard.yaml b/tests/components/current_based/test.rp2040-ard.yaml index 69ab8830c3..799acabd5a 100644 --- a/tests/components/current_based/test.rp2040-ard.yaml +++ b/tests/components/current_based/test.rp2040-ard.yaml @@ -1,68 +1,6 @@ -i2c: - - id: i2c_ade7953 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + irq_pin: GPIO6 -sensor: - - platform: ade7953_i2c - irq_pin: 6 - voltage: - name: ADE7953 Voltage - id: ade7953_voltage - current_a: - name: ADE7953 Current A - id: ade7953_current_a - current_b: - name: ADE7953 Current B - id: ade7953_current_b - power_factor_a: - name: ADE7953 Power Factor A - power_factor_b: - name: ADE7953 Power Factor B - apparent_power_a: - name: ADE7953 Apparent Power A - apparent_power_b: - name: ADE7953 Apparent Power B - active_power_a: - name: ADE7953 Active Power A - active_power_b: - name: ADE7953 Active Power B - reactive_power_a: - name: ADE7953 Reactive Power A - reactive_power_b: - name: ADE7953 Reactive Power B - update_interval: 1s - -switch: - - platform: template - id: template_switch1 - optimistic: true - - platform: template - id: template_switch2 - optimistic: true - -cover: - - platform: current_based - name: Current Based Cover - id: current_based_cover - open_sensor: ade7953_current_a - open_moving_current_threshold: 0.5 - open_obstacle_current_threshold: 0.8 - open_duration: 12s - open_action: - - switch.turn_on: template_switch1 - close_sensor: ade7953_current_b - close_moving_current_threshold: 0.5 - close_obstacle_current_threshold: 0.8 - close_duration: 10s - close_action: - - switch.turn_on: template_switch2 - stop_action: - - switch.turn_off: template_switch1 - - switch.turn_off: template_switch2 - obstacle_rollback: 30% - start_sensing_delay: 0.8s - malfunction_detection: true - malfunction_action: - then: - - logger.log: Malfunction Detected +<<: !include common.yaml diff --git a/tests/components/cwww/common.yaml b/tests/components/cwww/common.yaml new file mode 100644 index 0000000000..0ad5beeaae --- /dev/null +++ b/tests/components/cwww/common.yaml @@ -0,0 +1,16 @@ +output: + - platform: ${light_platform} + id: light_output_1 + pin: ${pin_o1} + - platform: ${light_platform} + id: light_output_2 + pin: ${pin_o2} + +light: + - platform: cwww + name: CWWW Light + cold_white: light_output_1 + warm_white: light_output_2 + cold_white_color_temperature: 153 mireds + warm_white_color_temperature: 500 mireds + constant_brightness: true diff --git a/tests/components/cwww/test.esp32-ard.yaml b/tests/components/cwww/test.esp32-ard.yaml index f108d96ad3..1831adda6e 100644 --- a/tests/components/cwww/test.esp32-ard.yaml +++ b/tests/components/cwww/test.esp32-ard.yaml @@ -1,16 +1,6 @@ -output: - - platform: ledc - id: light_output_1 - pin: 12 - - platform: ledc - id: light_output_2 - pin: 13 +substitutions: + light_platform: ledc + pin_o1: GPIO16 + pin_o2: GPIO17 -light: - - platform: cwww - name: CWWW Light - cold_white: light_output_1 - warm_white: light_output_2 - cold_white_color_temperature: 153 mireds - warm_white_color_temperature: 500 mireds - constant_brightness: true +<<: !include common.yaml diff --git a/tests/components/cwww/test.esp32-c3-ard.yaml b/tests/components/cwww/test.esp32-c3-ard.yaml index c829ca2a2b..016f315d9f 100644 --- a/tests/components/cwww/test.esp32-c3-ard.yaml +++ b/tests/components/cwww/test.esp32-c3-ard.yaml @@ -1,16 +1,6 @@ -output: - - platform: ledc - id: light_output_1 - pin: 1 - - platform: ledc - id: light_output_2 - pin: 2 +substitutions: + light_platform: ledc + pin_o1: GPIO6 + pin_o2: GPIO7 -light: - - platform: cwww - name: CWWW Light - cold_white: light_output_1 - warm_white: light_output_2 - cold_white_color_temperature: 153 mireds - warm_white_color_temperature: 500 mireds - constant_brightness: true +<<: !include common.yaml diff --git a/tests/components/cwww/test.esp32-c3-idf.yaml b/tests/components/cwww/test.esp32-c3-idf.yaml index 2760a167ee..982394ded6 100644 --- a/tests/components/cwww/test.esp32-c3-idf.yaml +++ b/tests/components/cwww/test.esp32-c3-idf.yaml @@ -1,19 +1,14 @@ +substitutions: + light_platform: ledc + pin_o1: GPIO6 + pin_o2: GPIO7 + +packages: + device_base: !include common.yaml + output: - - platform: ledc - id: light_output_1 - pin: 1 + - id: !extend light_output_1 channel: 0 - - platform: ledc - id: light_output_2 - pin: 2 + - id: !extend light_output_2 channel: 1 phase_angle: 180° - -light: - - platform: cwww - name: CWWW Light - cold_white: light_output_1 - warm_white: light_output_2 - cold_white_color_temperature: 153 mireds - warm_white_color_temperature: 500 mireds - constant_brightness: true diff --git a/tests/components/cwww/test.esp32-idf.yaml b/tests/components/cwww/test.esp32-idf.yaml index 27fa160e56..d2a998e6b3 100644 --- a/tests/components/cwww/test.esp32-idf.yaml +++ b/tests/components/cwww/test.esp32-idf.yaml @@ -1,19 +1,14 @@ +substitutions: + light_platform: ledc + pin_o1: GPIO16 + pin_o2: GPIO17 + +packages: + device_base: !include common.yaml + output: - - platform: ledc - id: light_output_1 - pin: 12 + - id: !extend light_output_1 channel: 0 - - platform: ledc - id: light_output_2 - pin: 13 + - id: !extend light_output_2 channel: 1 phase_angle: 180° - -light: - - platform: cwww - name: CWWW Light - cold_white: light_output_1 - warm_white: light_output_2 - cold_white_color_temperature: 153 mireds - warm_white_color_temperature: 500 mireds - constant_brightness: true diff --git a/tests/components/cwww/test.esp8266-ard.yaml b/tests/components/cwww/test.esp8266-ard.yaml index 50c311f616..75a5b9d64d 100644 --- a/tests/components/cwww/test.esp8266-ard.yaml +++ b/tests/components/cwww/test.esp8266-ard.yaml @@ -1,16 +1,6 @@ -output: - - platform: esp8266_pwm - id: light_output_1 - pin: 12 - - platform: esp8266_pwm - id: light_output_2 - pin: 13 +substitutions: + light_platform: esp8266_pwm + pin_o1: GPIO12 + pin_o2: GPIO13 -light: - - platform: cwww - name: CWWW Light - cold_white: light_output_1 - warm_white: light_output_2 - cold_white_color_temperature: 153 mireds - warm_white_color_temperature: 500 mireds - constant_brightness: true +<<: !include common.yaml diff --git a/tests/components/cwww/test.rp2040-ard.yaml b/tests/components/cwww/test.rp2040-ard.yaml index 505d67f862..537177aca1 100644 --- a/tests/components/cwww/test.rp2040-ard.yaml +++ b/tests/components/cwww/test.rp2040-ard.yaml @@ -1,16 +1,6 @@ -output: - - platform: rp2040_pwm - id: light_output_1 - pin: 12 - - platform: rp2040_pwm - id: light_output_2 - pin: 13 +substitutions: + light_platform: rp2040_pwm + pin_o1: GPIO12 + pin_o2: GPIO13 -light: - - platform: cwww - name: CWWW Light - cold_white: light_output_1 - warm_white: light_output_2 - cold_white_color_temperature: 153 mireds - warm_white_color_temperature: 500 mireds - constant_brightness: true +<<: !include common.yaml diff --git a/tests/components/dac7678/common.yaml b/tests/components/dac7678/common.yaml new file mode 100644 index 0000000000..efad81a5ff --- /dev/null +++ b/tests/components/dac7678/common.yaml @@ -0,0 +1,43 @@ +i2c: + - id: i2c_dac7678 + scl: ${scl_pin} + sda: ${sda_pin} + +dac7678: + address: 0x4A + id: dac7678_hub + internal_reference: true + +output: + - platform: dac7678 + dac7678_id: dac7678_hub + channel: 0 + id: dac7678_1_ch0 + - platform: dac7678 + dac7678_id: dac7678_hub + channel: 1 + id: dac7678_1_ch1 + - platform: dac7678 + dac7678_id: dac7678_hub + channel: 2 + id: dac7678_1_ch2 + - platform: dac7678 + dac7678_id: dac7678_hub + channel: 3 + id: dac7678_1_ch3 + - platform: dac7678 + dac7678_id: dac7678_hub + channel: 4 + id: dac7678_1_ch4 + - platform: dac7678 + dac7678_id: dac7678_hub + channel: 5 + id: dac7678_1_ch5 + - platform: dac7678 + dac7678_id: dac7678_hub + channel: 6 + id: dac7678_1_ch6 + - platform: dac7678 + dac7678_id: dac7678_hub + channel: 7 + id: dac7678_1_ch7 diff --git a/tests/components/dac7678/test.esp32-ard.yaml b/tests/components/dac7678/test.esp32-ard.yaml index 946a7ca58d..63c3bd6afd 100644 --- a/tests/components/dac7678/test.esp32-ard.yaml +++ b/tests/components/dac7678/test.esp32-ard.yaml @@ -1,43 +1,5 @@ -i2c: - - id: i2c_dac7678 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -dac7678: - address: 0x4A - id: dac7678_hub - internal_reference: true - -output: - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 0 - id: dac7678_1_ch0 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 1 - id: dac7678_1_ch1 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 2 - id: dac7678_1_ch2 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 3 - id: dac7678_1_ch3 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 4 - id: dac7678_1_ch4 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 5 - id: dac7678_1_ch5 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 6 - id: dac7678_1_ch6 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 7 - id: dac7678_1_ch7 +<<: !include common.yaml diff --git a/tests/components/dac7678/test.esp32-c3-ard.yaml b/tests/components/dac7678/test.esp32-c3-ard.yaml index 7e3455bb68..ee2c29ca4e 100644 --- a/tests/components/dac7678/test.esp32-c3-ard.yaml +++ b/tests/components/dac7678/test.esp32-c3-ard.yaml @@ -1,43 +1,5 @@ -i2c: - - id: i2c_dac7678 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -dac7678: - address: 0x4A - id: dac7678_hub - internal_reference: true - -output: - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 0 - id: dac7678_1_ch0 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 1 - id: dac7678_1_ch1 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 2 - id: dac7678_1_ch2 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 3 - id: dac7678_1_ch3 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 4 - id: dac7678_1_ch4 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 5 - id: dac7678_1_ch5 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 6 - id: dac7678_1_ch6 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 7 - id: dac7678_1_ch7 +<<: !include common.yaml diff --git a/tests/components/dac7678/test.esp32-c3-idf.yaml b/tests/components/dac7678/test.esp32-c3-idf.yaml index 7e3455bb68..ee2c29ca4e 100644 --- a/tests/components/dac7678/test.esp32-c3-idf.yaml +++ b/tests/components/dac7678/test.esp32-c3-idf.yaml @@ -1,43 +1,5 @@ -i2c: - - id: i2c_dac7678 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -dac7678: - address: 0x4A - id: dac7678_hub - internal_reference: true - -output: - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 0 - id: dac7678_1_ch0 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 1 - id: dac7678_1_ch1 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 2 - id: dac7678_1_ch2 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 3 - id: dac7678_1_ch3 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 4 - id: dac7678_1_ch4 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 5 - id: dac7678_1_ch5 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 6 - id: dac7678_1_ch6 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 7 - id: dac7678_1_ch7 +<<: !include common.yaml diff --git a/tests/components/dac7678/test.esp32-idf.yaml b/tests/components/dac7678/test.esp32-idf.yaml index 946a7ca58d..63c3bd6afd 100644 --- a/tests/components/dac7678/test.esp32-idf.yaml +++ b/tests/components/dac7678/test.esp32-idf.yaml @@ -1,43 +1,5 @@ -i2c: - - id: i2c_dac7678 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -dac7678: - address: 0x4A - id: dac7678_hub - internal_reference: true - -output: - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 0 - id: dac7678_1_ch0 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 1 - id: dac7678_1_ch1 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 2 - id: dac7678_1_ch2 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 3 - id: dac7678_1_ch3 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 4 - id: dac7678_1_ch4 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 5 - id: dac7678_1_ch5 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 6 - id: dac7678_1_ch6 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 7 - id: dac7678_1_ch7 +<<: !include common.yaml diff --git a/tests/components/dac7678/test.esp8266-ard.yaml b/tests/components/dac7678/test.esp8266-ard.yaml index 7e3455bb68..ee2c29ca4e 100644 --- a/tests/components/dac7678/test.esp8266-ard.yaml +++ b/tests/components/dac7678/test.esp8266-ard.yaml @@ -1,43 +1,5 @@ -i2c: - - id: i2c_dac7678 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -dac7678: - address: 0x4A - id: dac7678_hub - internal_reference: true - -output: - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 0 - id: dac7678_1_ch0 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 1 - id: dac7678_1_ch1 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 2 - id: dac7678_1_ch2 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 3 - id: dac7678_1_ch3 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 4 - id: dac7678_1_ch4 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 5 - id: dac7678_1_ch5 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 6 - id: dac7678_1_ch6 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 7 - id: dac7678_1_ch7 +<<: !include common.yaml diff --git a/tests/components/dac7678/test.rp2040-ard.yaml b/tests/components/dac7678/test.rp2040-ard.yaml index 7e3455bb68..ee2c29ca4e 100644 --- a/tests/components/dac7678/test.rp2040-ard.yaml +++ b/tests/components/dac7678/test.rp2040-ard.yaml @@ -1,43 +1,5 @@ -i2c: - - id: i2c_dac7678 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -dac7678: - address: 0x4A - id: dac7678_hub - internal_reference: true - -output: - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 0 - id: dac7678_1_ch0 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 1 - id: dac7678_1_ch1 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 2 - id: dac7678_1_ch2 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 3 - id: dac7678_1_ch3 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 4 - id: dac7678_1_ch4 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 5 - id: dac7678_1_ch5 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 6 - id: dac7678_1_ch6 - - platform: dac7678 - dac7678_id: dac7678_hub - channel: 7 - id: dac7678_1_ch7 +<<: !include common.yaml diff --git a/tests/components/daikin/common.yaml b/tests/components/daikin/common.yaml new file mode 100644 index 0000000000..27f381b422 --- /dev/null +++ b/tests/components/daikin/common.yaml @@ -0,0 +1,12 @@ +remote_transmitter: + pin: ${pin} + carrier_duty_percent: 50% + +climate: + - platform: heatpumpir + protocol: daikin + horizontal_default: middle + vertical_default: middle + name: HeatpumpIR Climate + min_temperature: 18 + max_temperature: 30 diff --git a/tests/components/daikin/test.esp32-ard.yaml b/tests/components/daikin/test.esp32-ard.yaml index 6672fe3e45..7b012aa64c 100644 --- a/tests/components/daikin/test.esp32-ard.yaml +++ b/tests/components/daikin/test.esp32-ard.yaml @@ -1,12 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: heatpumpir - protocol: daikin - horizontal_default: middle - vertical_default: middle - name: HeatpumpIR Climate - min_temperature: 18 - max_temperature: 30 +<<: !include common.yaml diff --git a/tests/components/daikin/test.esp8266-ard.yaml b/tests/components/daikin/test.esp8266-ard.yaml index 47f02bbad9..f5097fcf5f 100644 --- a/tests/components/daikin/test.esp8266-ard.yaml +++ b/tests/components/daikin/test.esp8266-ard.yaml @@ -1,12 +1,4 @@ -remote_transmitter: - pin: 5 - carrier_duty_percent: 50% +substitutions: + pin: GPIO5 -climate: - - platform: heatpumpir - protocol: daikin - horizontal_default: middle - vertical_default: middle - name: HeatpumpIR Climate - min_temperature: 18 - max_temperature: 30 +<<: !include common.yaml diff --git a/tests/components/daikin_arc/common.yaml b/tests/components/daikin_arc/common.yaml new file mode 100644 index 0000000000..5c0510f6df --- /dev/null +++ b/tests/components/daikin_arc/common.yaml @@ -0,0 +1,19 @@ +remote_transmitter: + pin: ${tx_pin} + carrier_duty_percent: 50% + id: tsvr + +remote_receiver: + id: rcvr + pin: + number: ${rx_pin} + inverted: true + mode: + input: true + pullup: true + tolerance: 40% + +climate: + - platform: daikin_arc + name: Daikin AC + receiver_id: rcvr diff --git a/tests/components/daikin_arc/test.esp32-ard.yaml b/tests/components/daikin_arc/test.esp32-ard.yaml index a8556e8576..cd59eb0832 100644 --- a/tests/components/daikin_arc/test.esp32-ard.yaml +++ b/tests/components/daikin_arc/test.esp32-ard.yaml @@ -1,19 +1,5 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% - id: tsvr +substitutions: + tx_pin: GPIO2 + rx_pin: GPIO4 -remote_receiver: - id: rcvr - pin: - number: 27 - inverted: true - mode: - input: true - pullup: true - tolerance: 40% - -climate: - - platform: daikin_arc - name: "AC" - receiver_id: rcvr +<<: !include common.yaml diff --git a/tests/components/daikin_arc/test.esp8266-ard.yaml b/tests/components/daikin_arc/test.esp8266-ard.yaml index abf1b34a6e..8e08490d0c 100644 --- a/tests/components/daikin_arc/test.esp8266-ard.yaml +++ b/tests/components/daikin_arc/test.esp8266-ard.yaml @@ -1,19 +1,5 @@ -remote_transmitter: - pin: 5 - carrier_duty_percent: 50% - id: tsvr +substitutions: + tx_pin: GPIO5 + rx_pin: GPIO4 -remote_receiver: - id: rcvr - pin: - number: 2 - inverted: true - mode: - input: true - pullup: true - tolerance: 40% - -climate: - - platform: daikin_arc - name: "AC" - receiver_id: rcvr +<<: !include common.yaml diff --git a/tests/components/daikin_brc/common.yaml b/tests/components/daikin_brc/common.yaml new file mode 100644 index 0000000000..c9d7baa989 --- /dev/null +++ b/tests/components/daikin_brc/common.yaml @@ -0,0 +1,7 @@ +remote_transmitter: + pin: ${pin} + carrier_duty_percent: 50% + +climate: + - platform: daikin_brc + name: Daikin_brc Climate diff --git a/tests/components/daikin_brc/test.esp32-ard.yaml b/tests/components/daikin_brc/test.esp32-ard.yaml index 89a5b00f5d..7b012aa64c 100644 --- a/tests/components/daikin_brc/test.esp32-ard.yaml +++ b/tests/components/daikin_brc/test.esp32-ard.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: daikin_brc - name: Daikin_brc Climate +<<: !include common.yaml diff --git a/tests/components/daikin_brc/test.esp32-c3-ard.yaml b/tests/components/daikin_brc/test.esp32-c3-ard.yaml index 89a5b00f5d..7b012aa64c 100644 --- a/tests/components/daikin_brc/test.esp32-c3-ard.yaml +++ b/tests/components/daikin_brc/test.esp32-c3-ard.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: daikin_brc - name: Daikin_brc Climate +<<: !include common.yaml diff --git a/tests/components/daikin_brc/test.esp32-c3-idf.yaml b/tests/components/daikin_brc/test.esp32-c3-idf.yaml index 89a5b00f5d..7b012aa64c 100644 --- a/tests/components/daikin_brc/test.esp32-c3-idf.yaml +++ b/tests/components/daikin_brc/test.esp32-c3-idf.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: daikin_brc - name: Daikin_brc Climate +<<: !include common.yaml diff --git a/tests/components/daikin_brc/test.esp32-idf.yaml b/tests/components/daikin_brc/test.esp32-idf.yaml index 89a5b00f5d..7b012aa64c 100644 --- a/tests/components/daikin_brc/test.esp32-idf.yaml +++ b/tests/components/daikin_brc/test.esp32-idf.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: daikin_brc - name: Daikin_brc Climate +<<: !include common.yaml diff --git a/tests/components/daikin_brc/test.esp8266-ard.yaml b/tests/components/daikin_brc/test.esp8266-ard.yaml index b8c74803a2..f5097fcf5f 100644 --- a/tests/components/daikin_brc/test.esp8266-ard.yaml +++ b/tests/components/daikin_brc/test.esp8266-ard.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 5 - carrier_duty_percent: 50% +substitutions: + pin: GPIO5 -climate: - - platform: daikin_brc - name: Daikin_brc Climate +<<: !include common.yaml diff --git a/tests/components/daly_bms/common.yaml b/tests/components/daly_bms/common.yaml new file mode 100644 index 0000000000..a4cb849f9f --- /dev/null +++ b/tests/components/daly_bms/common.yaml @@ -0,0 +1,53 @@ +uart: + - id: uart_daly_bms + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} + baud_rate: 4800 + +daly_bms: + update_interval: 20s + +binary_sensor: + - platform: daly_bms + charging_mos_enabled: + name: Charging MOS + discharging_mos_enabled: + name: Discharging MOS + +sensor: + - platform: daly_bms + voltage: + name: Battery Voltage + current: + name: Battery Current + battery_level: + name: Battery Level + max_cell_voltage: + name: Max Cell Voltage + max_cell_voltage_number: + name: Max Cell Voltage Number + min_cell_voltage: + name: Min Cell Voltage + min_cell_voltage_number: + name: Min Cell Voltage Number + max_temperature: + name: Max Temperature + max_temperature_probe_number: + name: Max Temperature Probe Number + min_temperature: + name: Min Temperature + min_temperature_probe_number: + name: Min Temperature Probe Number + remaining_capacity: + name: Remaining Capacity + cells_number: + name: Cells Number + temperature_1: + name: Temperature 1 + temperature_2: + name: Temperature 2 + +text_sensor: + - platform: daly_bms + status: + name: BMS Status diff --git a/tests/components/daly_bms/test.esp32-ard.yaml b/tests/components/daly_bms/test.esp32-ard.yaml index ec9607334d..811f6b72a6 100644 --- a/tests/components/daly_bms/test.esp32-ard.yaml +++ b/tests/components/daly_bms/test.esp32-ard.yaml @@ -1,55 +1,5 @@ -uart: - - id: uart_daly_bms - tx_pin: - number: 17 - rx_pin: - number: 16 - baud_rate: 4800 +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 -daly_bms: - update_interval: 20s - -binary_sensor: - - platform: daly_bms - charging_mos_enabled: - name: Charging MOS - discharging_mos_enabled: - name: Discharging MOS - -sensor: - - platform: daly_bms - voltage: - name: Battery Voltage - current: - name: Battery Current - battery_level: - name: Battery Level - max_cell_voltage: - name: Max Cell Voltage - max_cell_voltage_number: - name: Max Cell Voltage Number - min_cell_voltage: - name: Min Cell Voltage - min_cell_voltage_number: - name: Min Cell Voltage Number - max_temperature: - name: Max Temperature - max_temperature_probe_number: - name: Max Temperature Probe Number - min_temperature: - name: Min Temperature - min_temperature_probe_number: - name: Min Temperature Probe Number - remaining_capacity: - name: Remaining Capacity - cells_number: - name: Cells Number - temperature_1: - name: Temperature 1 - temperature_2: - name: Temperature 2 - -text_sensor: - - platform: daly_bms - status: - name: BMS Status +<<: !include common.yaml diff --git a/tests/components/daly_bms/test.esp32-c3-ard.yaml b/tests/components/daly_bms/test.esp32-c3-ard.yaml index 237a6570b5..c79d14c740 100644 --- a/tests/components/daly_bms/test.esp32-c3-ard.yaml +++ b/tests/components/daly_bms/test.esp32-c3-ard.yaml @@ -1,55 +1,5 @@ -uart: - - id: uart_daly_bms - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 4800 +substitutions: + tx_pin: GPIO7 + rx_pin: GPIO8 -daly_bms: - update_interval: 20s - -binary_sensor: - - platform: daly_bms - charging_mos_enabled: - name: Charging MOS - discharging_mos_enabled: - name: Discharging MOS - -sensor: - - platform: daly_bms - voltage: - name: Battery Voltage - current: - name: Battery Current - battery_level: - name: Battery Level - max_cell_voltage: - name: Max Cell Voltage - max_cell_voltage_number: - name: Max Cell Voltage Number - min_cell_voltage: - name: Min Cell Voltage - min_cell_voltage_number: - name: Min Cell Voltage Number - max_temperature: - name: Max Temperature - max_temperature_probe_number: - name: Max Temperature Probe Number - min_temperature: - name: Min Temperature - min_temperature_probe_number: - name: Min Temperature Probe Number - remaining_capacity: - name: Remaining Capacity - cells_number: - name: Cells Number - temperature_1: - name: Temperature 1 - temperature_2: - name: Temperature 2 - -text_sensor: - - platform: daly_bms - status: - name: BMS Status +<<: !include common.yaml diff --git a/tests/components/daly_bms/test.esp32-c3-idf.yaml b/tests/components/daly_bms/test.esp32-c3-idf.yaml index 237a6570b5..c79d14c740 100644 --- a/tests/components/daly_bms/test.esp32-c3-idf.yaml +++ b/tests/components/daly_bms/test.esp32-c3-idf.yaml @@ -1,55 +1,5 @@ -uart: - - id: uart_daly_bms - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 4800 +substitutions: + tx_pin: GPIO7 + rx_pin: GPIO8 -daly_bms: - update_interval: 20s - -binary_sensor: - - platform: daly_bms - charging_mos_enabled: - name: Charging MOS - discharging_mos_enabled: - name: Discharging MOS - -sensor: - - platform: daly_bms - voltage: - name: Battery Voltage - current: - name: Battery Current - battery_level: - name: Battery Level - max_cell_voltage: - name: Max Cell Voltage - max_cell_voltage_number: - name: Max Cell Voltage Number - min_cell_voltage: - name: Min Cell Voltage - min_cell_voltage_number: - name: Min Cell Voltage Number - max_temperature: - name: Max Temperature - max_temperature_probe_number: - name: Max Temperature Probe Number - min_temperature: - name: Min Temperature - min_temperature_probe_number: - name: Min Temperature Probe Number - remaining_capacity: - name: Remaining Capacity - cells_number: - name: Cells Number - temperature_1: - name: Temperature 1 - temperature_2: - name: Temperature 2 - -text_sensor: - - platform: daly_bms - status: - name: BMS Status +<<: !include common.yaml diff --git a/tests/components/daly_bms/test.esp32-idf.yaml b/tests/components/daly_bms/test.esp32-idf.yaml index ec9607334d..811f6b72a6 100644 --- a/tests/components/daly_bms/test.esp32-idf.yaml +++ b/tests/components/daly_bms/test.esp32-idf.yaml @@ -1,55 +1,5 @@ -uart: - - id: uart_daly_bms - tx_pin: - number: 17 - rx_pin: - number: 16 - baud_rate: 4800 +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 -daly_bms: - update_interval: 20s - -binary_sensor: - - platform: daly_bms - charging_mos_enabled: - name: Charging MOS - discharging_mos_enabled: - name: Discharging MOS - -sensor: - - platform: daly_bms - voltage: - name: Battery Voltage - current: - name: Battery Current - battery_level: - name: Battery Level - max_cell_voltage: - name: Max Cell Voltage - max_cell_voltage_number: - name: Max Cell Voltage Number - min_cell_voltage: - name: Min Cell Voltage - min_cell_voltage_number: - name: Min Cell Voltage Number - max_temperature: - name: Max Temperature - max_temperature_probe_number: - name: Max Temperature Probe Number - min_temperature: - name: Min Temperature - min_temperature_probe_number: - name: Min Temperature Probe Number - remaining_capacity: - name: Remaining Capacity - cells_number: - name: Cells Number - temperature_1: - name: Temperature 1 - temperature_2: - name: Temperature 2 - -text_sensor: - - platform: daly_bms - status: - name: BMS Status +<<: !include common.yaml diff --git a/tests/components/daly_bms/test.esp8266-ard.yaml b/tests/components/daly_bms/test.esp8266-ard.yaml index 237a6570b5..3b44f9c9c3 100644 --- a/tests/components/daly_bms/test.esp8266-ard.yaml +++ b/tests/components/daly_bms/test.esp8266-ard.yaml @@ -1,55 +1,5 @@ -uart: - - id: uart_daly_bms - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 4800 +substitutions: + tx_pin: GPIO1 + rx_pin: GPIO3 -daly_bms: - update_interval: 20s - -binary_sensor: - - platform: daly_bms - charging_mos_enabled: - name: Charging MOS - discharging_mos_enabled: - name: Discharging MOS - -sensor: - - platform: daly_bms - voltage: - name: Battery Voltage - current: - name: Battery Current - battery_level: - name: Battery Level - max_cell_voltage: - name: Max Cell Voltage - max_cell_voltage_number: - name: Max Cell Voltage Number - min_cell_voltage: - name: Min Cell Voltage - min_cell_voltage_number: - name: Min Cell Voltage Number - max_temperature: - name: Max Temperature - max_temperature_probe_number: - name: Max Temperature Probe Number - min_temperature: - name: Min Temperature - min_temperature_probe_number: - name: Min Temperature Probe Number - remaining_capacity: - name: Remaining Capacity - cells_number: - name: Cells Number - temperature_1: - name: Temperature 1 - temperature_2: - name: Temperature 2 - -text_sensor: - - platform: daly_bms - status: - name: BMS Status +<<: !include common.yaml diff --git a/tests/components/daly_bms/test.rp2040-ard.yaml b/tests/components/daly_bms/test.rp2040-ard.yaml index 237a6570b5..b516342f3b 100644 --- a/tests/components/daly_bms/test.rp2040-ard.yaml +++ b/tests/components/daly_bms/test.rp2040-ard.yaml @@ -1,55 +1,5 @@ -uart: - - id: uart_daly_bms - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 4800 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -daly_bms: - update_interval: 20s - -binary_sensor: - - platform: daly_bms - charging_mos_enabled: - name: Charging MOS - discharging_mos_enabled: - name: Discharging MOS - -sensor: - - platform: daly_bms - voltage: - name: Battery Voltage - current: - name: Battery Current - battery_level: - name: Battery Level - max_cell_voltage: - name: Max Cell Voltage - max_cell_voltage_number: - name: Max Cell Voltage Number - min_cell_voltage: - name: Min Cell Voltage - min_cell_voltage_number: - name: Min Cell Voltage Number - max_temperature: - name: Max Temperature - max_temperature_probe_number: - name: Max Temperature Probe Number - min_temperature: - name: Min Temperature - min_temperature_probe_number: - name: Min Temperature Probe Number - remaining_capacity: - name: Remaining Capacity - cells_number: - name: Cells Number - temperature_1: - name: Temperature 1 - temperature_2: - name: Temperature 2 - -text_sensor: - - platform: daly_bms - status: - name: BMS Status +<<: !include common.yaml diff --git a/tests/components/deep_sleep/common-esp32.yaml b/tests/components/deep_sleep/common-esp32.yaml new file mode 100644 index 0000000000..c20e1a902e --- /dev/null +++ b/tests/components/deep_sleep/common-esp32.yaml @@ -0,0 +1,7 @@ +deep_sleep: + run_duration: + default: 10s + gpio_wakeup_reason: 30s + sleep_duration: 50s + wakeup_pin: ${wakeup_pin} + wakeup_pin_mode: INVERT_WAKEUP diff --git a/tests/components/deep_sleep/common.yaml b/tests/components/deep_sleep/common.yaml new file mode 100644 index 0000000000..c090cb83e2 --- /dev/null +++ b/tests/components/deep_sleep/common.yaml @@ -0,0 +1,6 @@ +esphome: + on_boot: + then: + - deep_sleep.prevent + - delay: 1s + - deep_sleep.allow diff --git a/tests/components/deep_sleep/test.esp32-ard.yaml b/tests/components/deep_sleep/test.esp32-ard.yaml index 94942fd5b0..10c17af0f5 100644 --- a/tests/components/deep_sleep/test.esp32-ard.yaml +++ b/tests/components/deep_sleep/test.esp32-ard.yaml @@ -1,14 +1,5 @@ -esphome: - on_boot: - then: - - deep_sleep.prevent - - delay: 1s - - deep_sleep.allow +substitutions: + wakeup_pin: GPIO4 -deep_sleep: - run_duration: - default: 10s - gpio_wakeup_reason: 30s - sleep_duration: 50s - wakeup_pin: 4 - wakeup_pin_mode: INVERT_WAKEUP +<<: !include common.yaml +<<: !include common-esp32.yaml diff --git a/tests/components/deep_sleep/test.esp32-c3-ard.yaml b/tests/components/deep_sleep/test.esp32-c3-ard.yaml index 94942fd5b0..10c17af0f5 100644 --- a/tests/components/deep_sleep/test.esp32-c3-ard.yaml +++ b/tests/components/deep_sleep/test.esp32-c3-ard.yaml @@ -1,14 +1,5 @@ -esphome: - on_boot: - then: - - deep_sleep.prevent - - delay: 1s - - deep_sleep.allow +substitutions: + wakeup_pin: GPIO4 -deep_sleep: - run_duration: - default: 10s - gpio_wakeup_reason: 30s - sleep_duration: 50s - wakeup_pin: 4 - wakeup_pin_mode: INVERT_WAKEUP +<<: !include common.yaml +<<: !include common-esp32.yaml diff --git a/tests/components/deep_sleep/test.esp32-c3-idf.yaml b/tests/components/deep_sleep/test.esp32-c3-idf.yaml index 94942fd5b0..10c17af0f5 100644 --- a/tests/components/deep_sleep/test.esp32-c3-idf.yaml +++ b/tests/components/deep_sleep/test.esp32-c3-idf.yaml @@ -1,14 +1,5 @@ -esphome: - on_boot: - then: - - deep_sleep.prevent - - delay: 1s - - deep_sleep.allow +substitutions: + wakeup_pin: GPIO4 -deep_sleep: - run_duration: - default: 10s - gpio_wakeup_reason: 30s - sleep_duration: 50s - wakeup_pin: 4 - wakeup_pin_mode: INVERT_WAKEUP +<<: !include common.yaml +<<: !include common-esp32.yaml diff --git a/tests/components/deep_sleep/test.esp32-idf.yaml b/tests/components/deep_sleep/test.esp32-idf.yaml index 94942fd5b0..10c17af0f5 100644 --- a/tests/components/deep_sleep/test.esp32-idf.yaml +++ b/tests/components/deep_sleep/test.esp32-idf.yaml @@ -1,14 +1,5 @@ -esphome: - on_boot: - then: - - deep_sleep.prevent - - delay: 1s - - deep_sleep.allow +substitutions: + wakeup_pin: GPIO4 -deep_sleep: - run_duration: - default: 10s - gpio_wakeup_reason: 30s - sleep_duration: 50s - wakeup_pin: 4 - wakeup_pin_mode: INVERT_WAKEUP +<<: !include common.yaml +<<: !include common-esp32.yaml diff --git a/tests/components/deep_sleep/test.esp8266-ard.yaml b/tests/components/deep_sleep/test.esp8266-ard.yaml index 0992fa9696..df08ec8a14 100644 --- a/tests/components/deep_sleep/test.esp8266-ard.yaml +++ b/tests/components/deep_sleep/test.esp8266-ard.yaml @@ -1,10 +1,5 @@ -esphome: - on_boot: - then: - - deep_sleep.prevent - - delay: 1s - - deep_sleep.allow - deep_sleep: run_duration: 10s sleep_duration: 50s + +<<: !include common.yaml diff --git a/tests/components/delonghi/common.yaml b/tests/components/delonghi/common.yaml new file mode 100644 index 0000000000..8e9a1293d7 --- /dev/null +++ b/tests/components/delonghi/common.yaml @@ -0,0 +1,7 @@ +remote_transmitter: + pin: ${pin} + carrier_duty_percent: 50% + +climate: + - platform: delonghi + name: Delonghi Climate diff --git a/tests/components/delonghi/test.esp32-ard.yaml b/tests/components/delonghi/test.esp32-ard.yaml index cfe0f837f0..7b012aa64c 100644 --- a/tests/components/delonghi/test.esp32-ard.yaml +++ b/tests/components/delonghi/test.esp32-ard.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: delonghi - name: Delonghi Climate +<<: !include common.yaml diff --git a/tests/components/delonghi/test.esp32-c3-ard.yaml b/tests/components/delonghi/test.esp32-c3-ard.yaml index cfe0f837f0..7b012aa64c 100644 --- a/tests/components/delonghi/test.esp32-c3-ard.yaml +++ b/tests/components/delonghi/test.esp32-c3-ard.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: delonghi - name: Delonghi Climate +<<: !include common.yaml diff --git a/tests/components/delonghi/test.esp32-c3-idf.yaml b/tests/components/delonghi/test.esp32-c3-idf.yaml index cfe0f837f0..7b012aa64c 100644 --- a/tests/components/delonghi/test.esp32-c3-idf.yaml +++ b/tests/components/delonghi/test.esp32-c3-idf.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: delonghi - name: Delonghi Climate +<<: !include common.yaml diff --git a/tests/components/delonghi/test.esp32-idf.yaml b/tests/components/delonghi/test.esp32-idf.yaml index cfe0f837f0..7b012aa64c 100644 --- a/tests/components/delonghi/test.esp32-idf.yaml +++ b/tests/components/delonghi/test.esp32-idf.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: delonghi - name: Delonghi Climate +<<: !include common.yaml diff --git a/tests/components/delonghi/test.esp8266-ard.yaml b/tests/components/delonghi/test.esp8266-ard.yaml index adc478a6e6..f5097fcf5f 100644 --- a/tests/components/delonghi/test.esp8266-ard.yaml +++ b/tests/components/delonghi/test.esp8266-ard.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 5 - carrier_duty_percent: 50% +substitutions: + pin: GPIO5 -climate: - - platform: delonghi - name: Delonghi Climate +<<: !include common.yaml diff --git a/tests/components/dfplayer/common.yaml b/tests/components/dfplayer/common.yaml new file mode 100644 index 0000000000..d7446141c3 --- /dev/null +++ b/tests/components/dfplayer/common.yaml @@ -0,0 +1,42 @@ +esphome: + on_boot: + then: + - dfplayer.play: 5 + - dfplayer.play: + file: 4 + loop: true + - dfplayer.play_folder: + folder: 1 + file: 3 + - dfplayer.play_folder: + folder: 1 + loop: true + - dfplayer.set_device: + device: TF_CARD + - dfplayer.set_volume: 5 + - dfplayer.set_eq: ROCK + - dfplayer.play_next + - dfplayer.play_previous + - dfplayer.reset + - dfplayer.start + - dfplayer.pause + - dfplayer.stop + - dfplayer.random + - dfplayer.volume_up + - dfplayer.volume_down + - dfplayer.sleep + +uart: + - id: uart_dfplayer + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} + baud_rate: 9600 + +dfplayer: + on_finished_playback: + then: + if: + condition: + not: dfplayer.is_playing + then: + logger.log: Playback finished event diff --git a/tests/components/dfplayer/test.esp32-ard.yaml b/tests/components/dfplayer/test.esp32-ard.yaml index 03b44b8ca9..811f6b72a6 100644 --- a/tests/components/dfplayer/test.esp32-ard.yaml +++ b/tests/components/dfplayer/test.esp32-ard.yaml @@ -1,42 +1,5 @@ -esphome: - on_boot: - then: - - dfplayer.play: 5 - - dfplayer.play: - file: 4 - loop: true - - dfplayer.play_folder: - folder: 1 - file: 3 - - dfplayer.play_folder: - folder: 1 - loop: true - - dfplayer.set_device: - device: TF_CARD - - dfplayer.set_volume: 5 - - dfplayer.set_eq: ROCK - - dfplayer.play_next - - dfplayer.play_previous - - dfplayer.reset - - dfplayer.start - - dfplayer.pause - - dfplayer.stop - - dfplayer.random - - dfplayer.volume_up - - dfplayer.volume_down - - dfplayer.sleep +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 -uart: - - id: uart_dfplayer - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 - -dfplayer: - on_finished_playback: - then: - if: - condition: - not: dfplayer.is_playing - then: - logger.log: Playback finished event +<<: !include common.yaml diff --git a/tests/components/dfplayer/test.esp32-c3-ard.yaml b/tests/components/dfplayer/test.esp32-c3-ard.yaml index 94355915a7..c79d14c740 100644 --- a/tests/components/dfplayer/test.esp32-c3-ard.yaml +++ b/tests/components/dfplayer/test.esp32-c3-ard.yaml @@ -1,42 +1,5 @@ -esphome: - on_boot: - then: - - dfplayer.play: 5 - - dfplayer.play: - file: 4 - loop: true - - dfplayer.play_folder: - folder: 1 - file: 3 - - dfplayer.play_folder: - folder: 1 - loop: true - - dfplayer.set_device: - device: TF_CARD - - dfplayer.set_volume: 5 - - dfplayer.set_eq: ROCK - - dfplayer.play_next - - dfplayer.play_previous - - dfplayer.reset - - dfplayer.start - - dfplayer.pause - - dfplayer.stop - - dfplayer.random - - dfplayer.volume_up - - dfplayer.volume_down - - dfplayer.sleep +substitutions: + tx_pin: GPIO7 + rx_pin: GPIO8 -uart: - - id: uart_dfplayer - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 - -dfplayer: - on_finished_playback: - then: - if: - condition: - not: dfplayer.is_playing - then: - logger.log: Playback finished event +<<: !include common.yaml diff --git a/tests/components/dfplayer/test.esp32-c3-idf.yaml b/tests/components/dfplayer/test.esp32-c3-idf.yaml index 94355915a7..c79d14c740 100644 --- a/tests/components/dfplayer/test.esp32-c3-idf.yaml +++ b/tests/components/dfplayer/test.esp32-c3-idf.yaml @@ -1,42 +1,5 @@ -esphome: - on_boot: - then: - - dfplayer.play: 5 - - dfplayer.play: - file: 4 - loop: true - - dfplayer.play_folder: - folder: 1 - file: 3 - - dfplayer.play_folder: - folder: 1 - loop: true - - dfplayer.set_device: - device: TF_CARD - - dfplayer.set_volume: 5 - - dfplayer.set_eq: ROCK - - dfplayer.play_next - - dfplayer.play_previous - - dfplayer.reset - - dfplayer.start - - dfplayer.pause - - dfplayer.stop - - dfplayer.random - - dfplayer.volume_up - - dfplayer.volume_down - - dfplayer.sleep +substitutions: + tx_pin: GPIO7 + rx_pin: GPIO8 -uart: - - id: uart_dfplayer - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 - -dfplayer: - on_finished_playback: - then: - if: - condition: - not: dfplayer.is_playing - then: - logger.log: Playback finished event +<<: !include common.yaml diff --git a/tests/components/dfplayer/test.esp32-idf.yaml b/tests/components/dfplayer/test.esp32-idf.yaml index 03b44b8ca9..811f6b72a6 100644 --- a/tests/components/dfplayer/test.esp32-idf.yaml +++ b/tests/components/dfplayer/test.esp32-idf.yaml @@ -1,42 +1,5 @@ -esphome: - on_boot: - then: - - dfplayer.play: 5 - - dfplayer.play: - file: 4 - loop: true - - dfplayer.play_folder: - folder: 1 - file: 3 - - dfplayer.play_folder: - folder: 1 - loop: true - - dfplayer.set_device: - device: TF_CARD - - dfplayer.set_volume: 5 - - dfplayer.set_eq: ROCK - - dfplayer.play_next - - dfplayer.play_previous - - dfplayer.reset - - dfplayer.start - - dfplayer.pause - - dfplayer.stop - - dfplayer.random - - dfplayer.volume_up - - dfplayer.volume_down - - dfplayer.sleep +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 -uart: - - id: uart_dfplayer - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 - -dfplayer: - on_finished_playback: - then: - if: - condition: - not: dfplayer.is_playing - then: - logger.log: Playback finished event +<<: !include common.yaml diff --git a/tests/components/dfplayer/test.esp8266-ard.yaml b/tests/components/dfplayer/test.esp8266-ard.yaml index 94355915a7..3b44f9c9c3 100644 --- a/tests/components/dfplayer/test.esp8266-ard.yaml +++ b/tests/components/dfplayer/test.esp8266-ard.yaml @@ -1,42 +1,5 @@ -esphome: - on_boot: - then: - - dfplayer.play: 5 - - dfplayer.play: - file: 4 - loop: true - - dfplayer.play_folder: - folder: 1 - file: 3 - - dfplayer.play_folder: - folder: 1 - loop: true - - dfplayer.set_device: - device: TF_CARD - - dfplayer.set_volume: 5 - - dfplayer.set_eq: ROCK - - dfplayer.play_next - - dfplayer.play_previous - - dfplayer.reset - - dfplayer.start - - dfplayer.pause - - dfplayer.stop - - dfplayer.random - - dfplayer.volume_up - - dfplayer.volume_down - - dfplayer.sleep +substitutions: + tx_pin: GPIO1 + rx_pin: GPIO3 -uart: - - id: uart_dfplayer - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 - -dfplayer: - on_finished_playback: - then: - if: - condition: - not: dfplayer.is_playing - then: - logger.log: Playback finished event +<<: !include common.yaml diff --git a/tests/components/dfplayer/test.rp2040-ard.yaml b/tests/components/dfplayer/test.rp2040-ard.yaml index 94355915a7..b516342f3b 100644 --- a/tests/components/dfplayer/test.rp2040-ard.yaml +++ b/tests/components/dfplayer/test.rp2040-ard.yaml @@ -1,42 +1,5 @@ -esphome: - on_boot: - then: - - dfplayer.play: 5 - - dfplayer.play: - file: 4 - loop: true - - dfplayer.play_folder: - folder: 1 - file: 3 - - dfplayer.play_folder: - folder: 1 - loop: true - - dfplayer.set_device: - device: TF_CARD - - dfplayer.set_volume: 5 - - dfplayer.set_eq: ROCK - - dfplayer.play_next - - dfplayer.play_previous - - dfplayer.reset - - dfplayer.start - - dfplayer.pause - - dfplayer.stop - - dfplayer.random - - dfplayer.volume_up - - dfplayer.volume_down - - dfplayer.sleep +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -uart: - - id: uart_dfplayer - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 - -dfplayer: - on_finished_playback: - then: - if: - condition: - not: dfplayer.is_playing - then: - logger.log: Playback finished event +<<: !include common.yaml diff --git a/tests/components/dfrobot_sen0395/common.yaml b/tests/components/dfrobot_sen0395/common.yaml new file mode 100644 index 0000000000..69bcebf182 --- /dev/null +++ b/tests/components/dfrobot_sen0395/common.yaml @@ -0,0 +1,28 @@ +esphome: + on_boot: + then: + - dfrobot_sen0395.settings: + id: mmwave + factory_reset: true + detection_segments: + - [0cm, 5m] + - 600cm + - !lambda "return 7;" + output_latency: + delay_after_detect: 0s + delay_after_disappear: 0s + sensitivity: 6 + - dfrobot_sen0395.reset + +uart: + - id: uart_dfrobot_sen0395 + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} + baud_rate: 9600 + +dfrobot_sen0395: + - id: mmwave + +binary_sensor: + - platform: dfrobot_sen0395 + id: mmwave_detected diff --git a/tests/components/dfrobot_sen0395/test.esp32-ard.yaml b/tests/components/dfrobot_sen0395/test.esp32-ard.yaml index 5c06fc6660..811f6b72a6 100644 --- a/tests/components/dfrobot_sen0395/test.esp32-ard.yaml +++ b/tests/components/dfrobot_sen0395/test.esp32-ard.yaml @@ -1,28 +1,5 @@ -esphome: - on_boot: - then: - - dfrobot_sen0395.settings: - id: mmwave - factory_reset: true - detection_segments: - - [0cm, 5m] - - 600cm - - !lambda "return 7;" - output_latency: - delay_after_detect: 0s - delay_after_disappear: 0s - sensitivity: 6 - - dfrobot_sen0395.reset +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 -uart: - - id: uart_dfrobot_sen0395 - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 - -dfrobot_sen0395: - - id: mmwave - -binary_sensor: - - platform: dfrobot_sen0395 - id: mmwave_detected +<<: !include common.yaml diff --git a/tests/components/dfrobot_sen0395/test.esp32-c3-ard.yaml b/tests/components/dfrobot_sen0395/test.esp32-c3-ard.yaml index 71b17cecd5..c79d14c740 100644 --- a/tests/components/dfrobot_sen0395/test.esp32-c3-ard.yaml +++ b/tests/components/dfrobot_sen0395/test.esp32-c3-ard.yaml @@ -1,28 +1,5 @@ -esphome: - on_boot: - then: - - dfrobot_sen0395.settings: - id: mmwave - factory_reset: true - detection_segments: - - [0cm, 5m] - - 600cm - - !lambda "return 7;" - output_latency: - delay_after_detect: 0s - delay_after_disappear: 0s - sensitivity: 6 - - dfrobot_sen0395.reset +substitutions: + tx_pin: GPIO7 + rx_pin: GPIO8 -uart: - - id: uart_dfrobot_sen0395 - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 - -dfrobot_sen0395: - - id: mmwave - -binary_sensor: - - platform: dfrobot_sen0395 - id: mmwave_detected +<<: !include common.yaml diff --git a/tests/components/dfrobot_sen0395/test.esp32-c3-idf.yaml b/tests/components/dfrobot_sen0395/test.esp32-c3-idf.yaml index 71b17cecd5..c79d14c740 100644 --- a/tests/components/dfrobot_sen0395/test.esp32-c3-idf.yaml +++ b/tests/components/dfrobot_sen0395/test.esp32-c3-idf.yaml @@ -1,28 +1,5 @@ -esphome: - on_boot: - then: - - dfrobot_sen0395.settings: - id: mmwave - factory_reset: true - detection_segments: - - [0cm, 5m] - - 600cm - - !lambda "return 7;" - output_latency: - delay_after_detect: 0s - delay_after_disappear: 0s - sensitivity: 6 - - dfrobot_sen0395.reset +substitutions: + tx_pin: GPIO7 + rx_pin: GPIO8 -uart: - - id: uart_dfrobot_sen0395 - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 - -dfrobot_sen0395: - - id: mmwave - -binary_sensor: - - platform: dfrobot_sen0395 - id: mmwave_detected +<<: !include common.yaml diff --git a/tests/components/dfrobot_sen0395/test.esp32-idf.yaml b/tests/components/dfrobot_sen0395/test.esp32-idf.yaml index 5c06fc6660..811f6b72a6 100644 --- a/tests/components/dfrobot_sen0395/test.esp32-idf.yaml +++ b/tests/components/dfrobot_sen0395/test.esp32-idf.yaml @@ -1,28 +1,5 @@ -esphome: - on_boot: - then: - - dfrobot_sen0395.settings: - id: mmwave - factory_reset: true - detection_segments: - - [0cm, 5m] - - 600cm - - !lambda "return 7;" - output_latency: - delay_after_detect: 0s - delay_after_disappear: 0s - sensitivity: 6 - - dfrobot_sen0395.reset +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 -uart: - - id: uart_dfrobot_sen0395 - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 - -dfrobot_sen0395: - - id: mmwave - -binary_sensor: - - platform: dfrobot_sen0395 - id: mmwave_detected +<<: !include common.yaml diff --git a/tests/components/dfrobot_sen0395/test.esp8266-ard.yaml b/tests/components/dfrobot_sen0395/test.esp8266-ard.yaml index 71b17cecd5..3b44f9c9c3 100644 --- a/tests/components/dfrobot_sen0395/test.esp8266-ard.yaml +++ b/tests/components/dfrobot_sen0395/test.esp8266-ard.yaml @@ -1,28 +1,5 @@ -esphome: - on_boot: - then: - - dfrobot_sen0395.settings: - id: mmwave - factory_reset: true - detection_segments: - - [0cm, 5m] - - 600cm - - !lambda "return 7;" - output_latency: - delay_after_detect: 0s - delay_after_disappear: 0s - sensitivity: 6 - - dfrobot_sen0395.reset +substitutions: + tx_pin: GPIO1 + rx_pin: GPIO3 -uart: - - id: uart_dfrobot_sen0395 - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 - -dfrobot_sen0395: - - id: mmwave - -binary_sensor: - - platform: dfrobot_sen0395 - id: mmwave_detected +<<: !include common.yaml diff --git a/tests/components/dfrobot_sen0395/test.rp2040-ard.yaml b/tests/components/dfrobot_sen0395/test.rp2040-ard.yaml index 71b17cecd5..b516342f3b 100644 --- a/tests/components/dfrobot_sen0395/test.rp2040-ard.yaml +++ b/tests/components/dfrobot_sen0395/test.rp2040-ard.yaml @@ -1,28 +1,5 @@ -esphome: - on_boot: - then: - - dfrobot_sen0395.settings: - id: mmwave - factory_reset: true - detection_segments: - - [0cm, 5m] - - 600cm - - !lambda "return 7;" - output_latency: - delay_after_detect: 0s - delay_after_disappear: 0s - sensitivity: 6 - - dfrobot_sen0395.reset +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -uart: - - id: uart_dfrobot_sen0395 - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 - -dfrobot_sen0395: - - id: mmwave - -binary_sensor: - - platform: dfrobot_sen0395 - id: mmwave_detected +<<: !include common.yaml diff --git a/tests/components/dht12/common.yaml b/tests/components/dht12/common.yaml new file mode 100644 index 0000000000..91346e0e27 --- /dev/null +++ b/tests/components/dht12/common.yaml @@ -0,0 +1,12 @@ +i2c: + - id: i2c_dht12 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: dht12 + temperature: + name: DHT12 Temperature + humidity: + name: DHT12 Humidity + update_interval: 15s diff --git a/tests/components/dht12/test.esp32-ard.yaml b/tests/components/dht12/test.esp32-ard.yaml index 02a00f5df7..63c3bd6afd 100644 --- a/tests/components/dht12/test.esp32-ard.yaml +++ b/tests/components/dht12/test.esp32-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_dht12 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: dht12 - temperature: - name: DHT12 Temperature - humidity: - name: DHT12 Humidity - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/dht12/test.esp32-c3-ard.yaml b/tests/components/dht12/test.esp32-c3-ard.yaml index c06c20fd9f..ee2c29ca4e 100644 --- a/tests/components/dht12/test.esp32-c3-ard.yaml +++ b/tests/components/dht12/test.esp32-c3-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_dht12 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: dht12 - temperature: - name: DHT12 Temperature - humidity: - name: DHT12 Humidity - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/dht12/test.esp32-c3-idf.yaml b/tests/components/dht12/test.esp32-c3-idf.yaml index c06c20fd9f..ee2c29ca4e 100644 --- a/tests/components/dht12/test.esp32-c3-idf.yaml +++ b/tests/components/dht12/test.esp32-c3-idf.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_dht12 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: dht12 - temperature: - name: DHT12 Temperature - humidity: - name: DHT12 Humidity - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/dht12/test.esp32-idf.yaml b/tests/components/dht12/test.esp32-idf.yaml index 02a00f5df7..63c3bd6afd 100644 --- a/tests/components/dht12/test.esp32-idf.yaml +++ b/tests/components/dht12/test.esp32-idf.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_dht12 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: dht12 - temperature: - name: DHT12 Temperature - humidity: - name: DHT12 Humidity - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/dht12/test.esp8266-ard.yaml b/tests/components/dht12/test.esp8266-ard.yaml index c06c20fd9f..ee2c29ca4e 100644 --- a/tests/components/dht12/test.esp8266-ard.yaml +++ b/tests/components/dht12/test.esp8266-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_dht12 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: dht12 - temperature: - name: DHT12 Temperature - humidity: - name: DHT12 Humidity - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/dht12/test.rp2040-ard.yaml b/tests/components/dht12/test.rp2040-ard.yaml index c06c20fd9f..ee2c29ca4e 100644 --- a/tests/components/dht12/test.rp2040-ard.yaml +++ b/tests/components/dht12/test.rp2040-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_dht12 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: dht12 - temperature: - name: DHT12 Temperature - humidity: - name: DHT12 Humidity - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/dps310/common.yaml b/tests/components/dps310/common.yaml new file mode 100644 index 0000000000..e6c0c9fab8 --- /dev/null +++ b/tests/components/dps310/common.yaml @@ -0,0 +1,12 @@ +i2c: + - id: i2c_dps310 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: dps310 + temperature: + name: DPS310 Temperature + pressure: + name: DPS310 Pressure + address: 0x77 diff --git a/tests/components/dps310/test.esp32-ard.yaml b/tests/components/dps310/test.esp32-ard.yaml index 417cab5c40..63c3bd6afd 100644 --- a/tests/components/dps310/test.esp32-ard.yaml +++ b/tests/components/dps310/test.esp32-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_dps310 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: dps310 - temperature: - name: DPS310 Temperature - pressure: - name: DPS310 Pressure - address: 0x77 +<<: !include common.yaml diff --git a/tests/components/dps310/test.esp32-c3-ard.yaml b/tests/components/dps310/test.esp32-c3-ard.yaml index 0e15e9ccc5..ee2c29ca4e 100644 --- a/tests/components/dps310/test.esp32-c3-ard.yaml +++ b/tests/components/dps310/test.esp32-c3-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_dps310 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: dps310 - temperature: - name: DPS310 Temperature - pressure: - name: DPS310 Pressure - address: 0x77 +<<: !include common.yaml diff --git a/tests/components/dps310/test.esp32-c3-idf.yaml b/tests/components/dps310/test.esp32-c3-idf.yaml index 0e15e9ccc5..ee2c29ca4e 100644 --- a/tests/components/dps310/test.esp32-c3-idf.yaml +++ b/tests/components/dps310/test.esp32-c3-idf.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_dps310 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: dps310 - temperature: - name: DPS310 Temperature - pressure: - name: DPS310 Pressure - address: 0x77 +<<: !include common.yaml diff --git a/tests/components/dps310/test.esp32-idf.yaml b/tests/components/dps310/test.esp32-idf.yaml index 417cab5c40..63c3bd6afd 100644 --- a/tests/components/dps310/test.esp32-idf.yaml +++ b/tests/components/dps310/test.esp32-idf.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_dps310 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: dps310 - temperature: - name: DPS310 Temperature - pressure: - name: DPS310 Pressure - address: 0x77 +<<: !include common.yaml diff --git a/tests/components/dps310/test.esp8266-ard.yaml b/tests/components/dps310/test.esp8266-ard.yaml index 0e15e9ccc5..ee2c29ca4e 100644 --- a/tests/components/dps310/test.esp8266-ard.yaml +++ b/tests/components/dps310/test.esp8266-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_dps310 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: dps310 - temperature: - name: DPS310 Temperature - pressure: - name: DPS310 Pressure - address: 0x77 +<<: !include common.yaml diff --git a/tests/components/dps310/test.rp2040-ard.yaml b/tests/components/dps310/test.rp2040-ard.yaml index 0e15e9ccc5..ee2c29ca4e 100644 --- a/tests/components/dps310/test.rp2040-ard.yaml +++ b/tests/components/dps310/test.rp2040-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_dps310 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: dps310 - temperature: - name: DPS310 Temperature - pressure: - name: DPS310 Pressure - address: 0x77 +<<: !include common.yaml diff --git a/tests/components/ds1307/common.yaml b/tests/components/ds1307/common.yaml new file mode 100644 index 0000000000..3466a9eec8 --- /dev/null +++ b/tests/components/ds1307/common.yaml @@ -0,0 +1,9 @@ +i2c: + - id: i2c_ds1307 + scl: ${scl_pin} + sda: ${sda_pin} + +time: + - platform: ds1307 + id: ds1307_time + update_interval: never diff --git a/tests/components/ds1307/test.esp32-ard.yaml b/tests/components/ds1307/test.esp32-ard.yaml index 017c7aac92..63c3bd6afd 100644 --- a/tests/components/ds1307/test.esp32-ard.yaml +++ b/tests/components/ds1307/test.esp32-ard.yaml @@ -1,9 +1,5 @@ -i2c: - - id: i2c_ds1307 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -time: - - platform: ds1307 - id: ds1307_time - update_interval: never +<<: !include common.yaml diff --git a/tests/components/ds1307/test.esp32-c3-ard.yaml b/tests/components/ds1307/test.esp32-c3-ard.yaml index c309b9c212..ee2c29ca4e 100644 --- a/tests/components/ds1307/test.esp32-c3-ard.yaml +++ b/tests/components/ds1307/test.esp32-c3-ard.yaml @@ -1,9 +1,5 @@ -i2c: - - id: i2c_ds1307 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -time: - - platform: ds1307 - id: ds1307_time - update_interval: never +<<: !include common.yaml diff --git a/tests/components/ds1307/test.esp32-c3-idf.yaml b/tests/components/ds1307/test.esp32-c3-idf.yaml index c309b9c212..ee2c29ca4e 100644 --- a/tests/components/ds1307/test.esp32-c3-idf.yaml +++ b/tests/components/ds1307/test.esp32-c3-idf.yaml @@ -1,9 +1,5 @@ -i2c: - - id: i2c_ds1307 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -time: - - platform: ds1307 - id: ds1307_time - update_interval: never +<<: !include common.yaml diff --git a/tests/components/ds1307/test.esp32-idf.yaml b/tests/components/ds1307/test.esp32-idf.yaml index 017c7aac92..63c3bd6afd 100644 --- a/tests/components/ds1307/test.esp32-idf.yaml +++ b/tests/components/ds1307/test.esp32-idf.yaml @@ -1,9 +1,5 @@ -i2c: - - id: i2c_ds1307 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -time: - - platform: ds1307 - id: ds1307_time - update_interval: never +<<: !include common.yaml diff --git a/tests/components/ds1307/test.esp8266-ard.yaml b/tests/components/ds1307/test.esp8266-ard.yaml index c309b9c212..ee2c29ca4e 100644 --- a/tests/components/ds1307/test.esp8266-ard.yaml +++ b/tests/components/ds1307/test.esp8266-ard.yaml @@ -1,9 +1,5 @@ -i2c: - - id: i2c_ds1307 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -time: - - platform: ds1307 - id: ds1307_time - update_interval: never +<<: !include common.yaml diff --git a/tests/components/ds1307/test.rp2040-ard.yaml b/tests/components/ds1307/test.rp2040-ard.yaml index c309b9c212..ee2c29ca4e 100644 --- a/tests/components/ds1307/test.rp2040-ard.yaml +++ b/tests/components/ds1307/test.rp2040-ard.yaml @@ -1,9 +1,5 @@ -i2c: - - id: i2c_ds1307 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -time: - - platform: ds1307 - id: ds1307_time - update_interval: never +<<: !include common.yaml diff --git a/tests/components/dsmr/common.yaml b/tests/components/dsmr/common.yaml new file mode 100644 index 0000000000..2901b811fe --- /dev/null +++ b/tests/components/dsmr/common.yaml @@ -0,0 +1,12 @@ +uart: + - id: uart_dsmr + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} + baud_rate: 9600 + +dsmr: + decryption_key: 00112233445566778899aabbccddeeff + max_telegram_length: 1000 + request_pin: ${request_pin} + request_interval: 20s + receive_timeout: 100ms diff --git a/tests/components/dsmr/test.esp32-ard.yaml b/tests/components/dsmr/test.esp32-ard.yaml index 1fd0448ab3..7a65a48ec0 100644 --- a/tests/components/dsmr/test.esp32-ard.yaml +++ b/tests/components/dsmr/test.esp32-ard.yaml @@ -1,12 +1,6 @@ -uart: - - id: uart_dsmr - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 + request_pin: GPIO15 -dsmr: - decryption_key: 00112233445566778899aabbccddeeff - max_telegram_length: 1000 - request_pin: 15 - request_interval: 20s - receive_timeout: 100ms +<<: !include common.yaml diff --git a/tests/components/dsmr/test.esp32-c3-ard.yaml b/tests/components/dsmr/test.esp32-c3-ard.yaml index e813556be8..72998506ac 100644 --- a/tests/components/dsmr/test.esp32-c3-ard.yaml +++ b/tests/components/dsmr/test.esp32-c3-ard.yaml @@ -1,12 +1,6 @@ -uart: - - id: uart_dsmr - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + request_pin: GPIO6 -dsmr: - decryption_key: 00112233445566778899aabbccddeeff - max_telegram_length: 1000 - request_pin: 6 - request_interval: 20s - receive_timeout: 100ms +<<: !include common.yaml diff --git a/tests/components/dsmr/test.esp8266-ard.yaml b/tests/components/dsmr/test.esp8266-ard.yaml index 8037fb4b1a..a47bd58806 100644 --- a/tests/components/dsmr/test.esp8266-ard.yaml +++ b/tests/components/dsmr/test.esp8266-ard.yaml @@ -1,12 +1,6 @@ -uart: - - id: uart_dsmr - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + request_pin: GPIO15 -dsmr: - decryption_key: 00112233445566778899aabbccddeeff - max_telegram_length: 1000 - request_pin: 15 - request_interval: 20s - receive_timeout: 100ms +<<: !include common.yaml diff --git a/tests/components/dsmr/test.rp2040-ard.yaml b/tests/components/dsmr/test.rp2040-ard.yaml index e813556be8..72998506ac 100644 --- a/tests/components/dsmr/test.rp2040-ard.yaml +++ b/tests/components/dsmr/test.rp2040-ard.yaml @@ -1,12 +1,6 @@ -uart: - - id: uart_dsmr - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + request_pin: GPIO6 -dsmr: - decryption_key: 00112233445566778899aabbccddeeff - max_telegram_length: 1000 - request_pin: 6 - request_interval: 20s - receive_timeout: 100ms +<<: !include common.yaml diff --git a/tests/components/e131/common-ard.yaml b/tests/components/e131/common-ard.yaml new file mode 100644 index 0000000000..418453d6ef --- /dev/null +++ b/tests/components/e131/common-ard.yaml @@ -0,0 +1,14 @@ +<<: !include common.yaml + +light: + - platform: ${light_platform} + id: led_matrix_32x8 + default_transition_length: 500ms + chipset: ws2812 + rgb_order: GRB + num_leds: 256 + pin: ${pin} + rmt_channel: 0 + effects: + - e131: + universe: 1 diff --git a/tests/components/e131/common-idf.yaml b/tests/components/e131/common-idf.yaml new file mode 100644 index 0000000000..8300dbb01b --- /dev/null +++ b/tests/components/e131/common-idf.yaml @@ -0,0 +1,13 @@ +<<: !include common.yaml + +light: + - platform: ${light_platform} + id: led_matrix_32x8 + default_transition_length: 500ms + chipset: ws2812 + rgb_order: GRB + num_leds: 256 + pin: ${pin} + effects: + - e131: + universe: 1 diff --git a/tests/components/e131/common.yaml b/tests/components/e131/common.yaml new file mode 100644 index 0000000000..55e42dbc5a --- /dev/null +++ b/tests/components/e131/common.yaml @@ -0,0 +1,5 @@ +wifi: + ssid: MySSID + password: password1 + +e131: diff --git a/tests/components/e131/test.esp32-ard.yaml b/tests/components/e131/test.esp32-ard.yaml index 25304cd3b4..32cf2a64ba 100644 --- a/tests/components/e131/test.esp32-ard.yaml +++ b/tests/components/e131/test.esp32-ard.yaml @@ -1,18 +1,5 @@ -wifi: - ssid: MySSID - password: password1 +substitutions: + light_platform: esp32_rmt_led_strip + pin: GPIO2 -e131: - -light: - - platform: esp32_rmt_led_strip - id: led_matrix_32x8 - default_transition_length: 500ms - chipset: ws2812 - rgb_order: GRB - num_leds: 256 - pin: 2 - rmt_channel: 0 - effects: - - e131: - universe: 1 +<<: !include common-ard.yaml diff --git a/tests/components/e131/test.esp32-c3-ard.yaml b/tests/components/e131/test.esp32-c3-ard.yaml index 25304cd3b4..32cf2a64ba 100644 --- a/tests/components/e131/test.esp32-c3-ard.yaml +++ b/tests/components/e131/test.esp32-c3-ard.yaml @@ -1,18 +1,5 @@ -wifi: - ssid: MySSID - password: password1 +substitutions: + light_platform: esp32_rmt_led_strip + pin: GPIO2 -e131: - -light: - - platform: esp32_rmt_led_strip - id: led_matrix_32x8 - default_transition_length: 500ms - chipset: ws2812 - rgb_order: GRB - num_leds: 256 - pin: 2 - rmt_channel: 0 - effects: - - e131: - universe: 1 +<<: !include common-ard.yaml diff --git a/tests/components/e131/test.esp32-c3-idf.yaml b/tests/components/e131/test.esp32-c3-idf.yaml index a27e62c1fb..d9dc4f6804 100644 --- a/tests/components/e131/test.esp32-c3-idf.yaml +++ b/tests/components/e131/test.esp32-c3-idf.yaml @@ -1,17 +1,5 @@ -wifi: - ssid: MySSID - password: password1 +substitutions: + light_platform: esp32_rmt_led_strip + pin: GPIO2 -e131: - -light: - - platform: esp32_rmt_led_strip - id: led_matrix_32x8 - default_transition_length: 500ms - chipset: ws2812 - rgb_order: GRB - num_leds: 256 - pin: 2 - effects: - - e131: - universe: 1 +<<: !include common-idf.yaml diff --git a/tests/components/e131/test.esp32-idf.yaml b/tests/components/e131/test.esp32-idf.yaml index a27e62c1fb..d9dc4f6804 100644 --- a/tests/components/e131/test.esp32-idf.yaml +++ b/tests/components/e131/test.esp32-idf.yaml @@ -1,17 +1,5 @@ -wifi: - ssid: MySSID - password: password1 +substitutions: + light_platform: esp32_rmt_led_strip + pin: GPIO2 -e131: - -light: - - platform: esp32_rmt_led_strip - id: led_matrix_32x8 - default_transition_length: 500ms - chipset: ws2812 - rgb_order: GRB - num_leds: 256 - pin: 2 - effects: - - e131: - universe: 1 +<<: !include common-idf.yaml diff --git a/tests/components/e131/test.esp8266-ard.yaml b/tests/components/e131/test.esp8266-ard.yaml index 54245014a5..277928626e 100644 --- a/tests/components/e131/test.esp8266-ard.yaml +++ b/tests/components/e131/test.esp8266-ard.yaml @@ -1,8 +1,4 @@ -wifi: - ssid: MySSID - password: password1 - -e131: +<<: !include common.yaml light: - platform: neopixelbus diff --git a/tests/components/e131/test.rp2040-ard.yaml b/tests/components/e131/test.rp2040-ard.yaml index 0ae31f5403..25fe3b6796 100644 --- a/tests/components/e131/test.rp2040-ard.yaml +++ b/tests/components/e131/test.rp2040-ard.yaml @@ -1,8 +1,4 @@ -wifi: - ssid: MySSID - password: password1 - -e131: +<<: !include common.yaml light: - platform: rp2040_pio_led_strip diff --git a/tests/components/ee895/common.yaml b/tests/components/ee895/common.yaml new file mode 100644 index 0000000000..63d77abcaf --- /dev/null +++ b/tests/components/ee895/common.yaml @@ -0,0 +1,14 @@ +i2c: + - id: i2c_ee895 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: ee895 + address: 0x5F + co2: + name: EE895 CO2 + temperature: + name: EE895 Temperature + pressure: + name: EE895 Pressure diff --git a/tests/components/ee895/test.esp32-ard.yaml b/tests/components/ee895/test.esp32-ard.yaml index 241bdb9574..63c3bd6afd 100644 --- a/tests/components/ee895/test.esp32-ard.yaml +++ b/tests/components/ee895/test.esp32-ard.yaml @@ -1,14 +1,5 @@ -i2c: - - id: i2c_ee895 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: ee895 - address: 0x5F - co2: - name: EE895 CO2 - temperature: - name: EE895 Temperature - pressure: - name: EE895 Pressure +<<: !include common.yaml diff --git a/tests/components/ee895/test.esp32-c3-ard.yaml b/tests/components/ee895/test.esp32-c3-ard.yaml index 4a36117fab..ee2c29ca4e 100644 --- a/tests/components/ee895/test.esp32-c3-ard.yaml +++ b/tests/components/ee895/test.esp32-c3-ard.yaml @@ -1,14 +1,5 @@ -i2c: - - id: i2c_ee895 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ee895 - address: 0x5F - co2: - name: EE895 CO2 - temperature: - name: EE895 Temperature - pressure: - name: EE895 Pressure +<<: !include common.yaml diff --git a/tests/components/ee895/test.esp32-c3-idf.yaml b/tests/components/ee895/test.esp32-c3-idf.yaml index 4a36117fab..ee2c29ca4e 100644 --- a/tests/components/ee895/test.esp32-c3-idf.yaml +++ b/tests/components/ee895/test.esp32-c3-idf.yaml @@ -1,14 +1,5 @@ -i2c: - - id: i2c_ee895 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ee895 - address: 0x5F - co2: - name: EE895 CO2 - temperature: - name: EE895 Temperature - pressure: - name: EE895 Pressure +<<: !include common.yaml diff --git a/tests/components/ee895/test.esp32-idf.yaml b/tests/components/ee895/test.esp32-idf.yaml index 241bdb9574..63c3bd6afd 100644 --- a/tests/components/ee895/test.esp32-idf.yaml +++ b/tests/components/ee895/test.esp32-idf.yaml @@ -1,14 +1,5 @@ -i2c: - - id: i2c_ee895 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: ee895 - address: 0x5F - co2: - name: EE895 CO2 - temperature: - name: EE895 Temperature - pressure: - name: EE895 Pressure +<<: !include common.yaml diff --git a/tests/components/ee895/test.esp8266-ard.yaml b/tests/components/ee895/test.esp8266-ard.yaml index 4a36117fab..ee2c29ca4e 100644 --- a/tests/components/ee895/test.esp8266-ard.yaml +++ b/tests/components/ee895/test.esp8266-ard.yaml @@ -1,14 +1,5 @@ -i2c: - - id: i2c_ee895 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ee895 - address: 0x5F - co2: - name: EE895 CO2 - temperature: - name: EE895 Temperature - pressure: - name: EE895 Pressure +<<: !include common.yaml diff --git a/tests/components/ee895/test.rp2040-ard.yaml b/tests/components/ee895/test.rp2040-ard.yaml index 4a36117fab..ee2c29ca4e 100644 --- a/tests/components/ee895/test.rp2040-ard.yaml +++ b/tests/components/ee895/test.rp2040-ard.yaml @@ -1,14 +1,5 @@ -i2c: - - id: i2c_ee895 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ee895 - address: 0x5F - co2: - name: EE895 CO2 - temperature: - name: EE895 Temperature - pressure: - name: EE895 Pressure +<<: !include common.yaml diff --git a/tests/components/ektf2232/common.yaml b/tests/components/ektf2232/common.yaml new file mode 100644 index 0000000000..3271839fd4 --- /dev/null +++ b/tests/components/ektf2232/common.yaml @@ -0,0 +1,24 @@ +i2c: + - id: i2c_ektf2232 + scl: ${scl_pin} + sda: ${sda_pin} + +display: + - platform: ssd1306_i2c + id: ssd1306_display + model: SSD1306_128X64 + reset_pin: ${reset_pin} + pages: + - id: page1 + lambda: |- + it.rectangle(0, 0, it.get_width(), it.get_height()); + +touchscreen: + - platform: ektf2232 + interrupt_pin: ${interrupt_pin} + rts_pin: ${rts_pin} + display: ssd1306_display + on_touch: + - logger.log: + format: Touch at (%d, %d) + args: [touch.x, touch.y] diff --git a/tests/components/ektf2232/test.esp32-ard.yaml b/tests/components/ektf2232/test.esp32-ard.yaml index 9c6eef8bb3..b8f491c0c3 100644 --- a/tests/components/ektf2232/test.esp32-ard.yaml +++ b/tests/components/ektf2232/test.esp32-ard.yaml @@ -1,24 +1,8 @@ -i2c: - - id: i2c_ektf2232 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 + reset_pin: GPIO13 + interrupt_pin: GPIO14 + rts_pin: GPIO15 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 13 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -touchscreen: - - platform: ektf2232 - interrupt_pin: 14 - rts_pin: 15 - display: ssd1306_display - on_touch: - - logger.log: - format: Touch at (%d, %d) - args: [touch.x, touch.y] +<<: !include common.yaml diff --git a/tests/components/ektf2232/test.esp32-c3-ard.yaml b/tests/components/ektf2232/test.esp32-c3-ard.yaml index 371f2795a2..9f2149b9d7 100644 --- a/tests/components/ektf2232/test.esp32-c3-ard.yaml +++ b/tests/components/ektf2232/test.esp32-c3-ard.yaml @@ -1,24 +1,8 @@ -i2c: - - id: i2c_ektf2232 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + reset_pin: GPIO3 + interrupt_pin: GPIO6 + rts_pin: GPIO7 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 3 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -touchscreen: - - platform: ektf2232 - interrupt_pin: 6 - rts_pin: 7 - display: ssd1306_display - on_touch: - - logger.log: - format: Touch at (%d, %d) - args: [touch.x, touch.y] +<<: !include common.yaml diff --git a/tests/components/ektf2232/test.esp32-c3-idf.yaml b/tests/components/ektf2232/test.esp32-c3-idf.yaml index 371f2795a2..9f2149b9d7 100644 --- a/tests/components/ektf2232/test.esp32-c3-idf.yaml +++ b/tests/components/ektf2232/test.esp32-c3-idf.yaml @@ -1,24 +1,8 @@ -i2c: - - id: i2c_ektf2232 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + reset_pin: GPIO3 + interrupt_pin: GPIO6 + rts_pin: GPIO7 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 3 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -touchscreen: - - platform: ektf2232 - interrupt_pin: 6 - rts_pin: 7 - display: ssd1306_display - on_touch: - - logger.log: - format: Touch at (%d, %d) - args: [touch.x, touch.y] +<<: !include common.yaml diff --git a/tests/components/ektf2232/test.esp32-idf.yaml b/tests/components/ektf2232/test.esp32-idf.yaml index 9c6eef8bb3..b8f491c0c3 100644 --- a/tests/components/ektf2232/test.esp32-idf.yaml +++ b/tests/components/ektf2232/test.esp32-idf.yaml @@ -1,24 +1,8 @@ -i2c: - - id: i2c_ektf2232 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 + reset_pin: GPIO13 + interrupt_pin: GPIO14 + rts_pin: GPIO15 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 13 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -touchscreen: - - platform: ektf2232 - interrupt_pin: 14 - rts_pin: 15 - display: ssd1306_display - on_touch: - - logger.log: - format: Touch at (%d, %d) - args: [touch.x, touch.y] +<<: !include common.yaml diff --git a/tests/components/ektf2232/test.esp8266-ard.yaml b/tests/components/ektf2232/test.esp8266-ard.yaml index 03f18f7184..6d91a6533f 100644 --- a/tests/components/ektf2232/test.esp8266-ard.yaml +++ b/tests/components/ektf2232/test.esp8266-ard.yaml @@ -1,24 +1,8 @@ -i2c: - - id: i2c_ektf2232 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + reset_pin: GPIO3 + interrupt_pin: GPIO12 + rts_pin: GPIO13 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 3 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -touchscreen: - - platform: ektf2232 - interrupt_pin: 12 - rts_pin: 13 - display: ssd1306_display - on_touch: - - logger.log: - format: Touch at (%d, %d) - args: [touch.x, touch.y] +<<: !include common.yaml diff --git a/tests/components/ektf2232/test.rp2040-ard.yaml b/tests/components/ektf2232/test.rp2040-ard.yaml index 371f2795a2..9f2149b9d7 100644 --- a/tests/components/ektf2232/test.rp2040-ard.yaml +++ b/tests/components/ektf2232/test.rp2040-ard.yaml @@ -1,24 +1,8 @@ -i2c: - - id: i2c_ektf2232 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + reset_pin: GPIO3 + interrupt_pin: GPIO6 + rts_pin: GPIO7 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 3 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -touchscreen: - - platform: ektf2232 - interrupt_pin: 6 - rts_pin: 7 - display: ssd1306_display - on_touch: - - logger.log: - format: Touch at (%d, %d) - args: [touch.x, touch.y] +<<: !include common.yaml diff --git a/tests/components/emc2101/common.yaml b/tests/components/emc2101/common.yaml new file mode 100644 index 0000000000..795b02c6d3 --- /dev/null +++ b/tests/components/emc2101/common.yaml @@ -0,0 +1,25 @@ +i2c: + - id: i2c_emc2101 + scl: ${scl_pin} + sda: ${sda_pin} + +emc2101: + pwm: + resolution: 8 + +output: + - platform: emc2101 + id: fan_duty_cycle + +sensor: + - platform: emc2101 + internal_temperature: + id: internal_temperature_sensor + name: Internal Temperature Sensor + speed: + id: speed_sensor + name: Speed Sensor + duty_cycle: + id: duty_cycle_sensor + name: Duty Cycle Sensor + update_interval: 5s diff --git a/tests/components/emc2101/test.esp32-ard.yaml b/tests/components/emc2101/test.esp32-ard.yaml index 34a7d22b71..63c3bd6afd 100644 --- a/tests/components/emc2101/test.esp32-ard.yaml +++ b/tests/components/emc2101/test.esp32-ard.yaml @@ -1,25 +1,5 @@ -i2c: - - id: i2c_emc2101 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -emc2101: - pwm: - resolution: 8 - -output: - - platform: emc2101 - id: fan_duty_cycle - -sensor: - - platform: emc2101 - internal_temperature: - id: internal_temperature_sensor - name: Internal Temperature Sensor - speed: - id: speed_sensor - name: Speed Sensor - duty_cycle: - id: duty_cycle_sensor - name: Duty Cycle Sensor - update_interval: 5s +<<: !include common.yaml diff --git a/tests/components/emc2101/test.esp32-c3-ard.yaml b/tests/components/emc2101/test.esp32-c3-ard.yaml index d95bc1b001..ee2c29ca4e 100644 --- a/tests/components/emc2101/test.esp32-c3-ard.yaml +++ b/tests/components/emc2101/test.esp32-c3-ard.yaml @@ -1,25 +1,5 @@ -i2c: - - id: i2c_emc2101 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -emc2101: - pwm: - resolution: 8 - -output: - - platform: emc2101 - id: fan_duty_cycle - -sensor: - - platform: emc2101 - internal_temperature: - id: internal_temperature_sensor - name: Internal Temperature Sensor - speed: - id: speed_sensor - name: Speed Sensor - duty_cycle: - id: duty_cycle_sensor - name: Duty Cycle Sensor - update_interval: 5s +<<: !include common.yaml diff --git a/tests/components/emc2101/test.esp32-c3-idf.yaml b/tests/components/emc2101/test.esp32-c3-idf.yaml index d95bc1b001..ee2c29ca4e 100644 --- a/tests/components/emc2101/test.esp32-c3-idf.yaml +++ b/tests/components/emc2101/test.esp32-c3-idf.yaml @@ -1,25 +1,5 @@ -i2c: - - id: i2c_emc2101 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -emc2101: - pwm: - resolution: 8 - -output: - - platform: emc2101 - id: fan_duty_cycle - -sensor: - - platform: emc2101 - internal_temperature: - id: internal_temperature_sensor - name: Internal Temperature Sensor - speed: - id: speed_sensor - name: Speed Sensor - duty_cycle: - id: duty_cycle_sensor - name: Duty Cycle Sensor - update_interval: 5s +<<: !include common.yaml diff --git a/tests/components/emc2101/test.esp32-idf.yaml b/tests/components/emc2101/test.esp32-idf.yaml index 34a7d22b71..63c3bd6afd 100644 --- a/tests/components/emc2101/test.esp32-idf.yaml +++ b/tests/components/emc2101/test.esp32-idf.yaml @@ -1,25 +1,5 @@ -i2c: - - id: i2c_emc2101 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -emc2101: - pwm: - resolution: 8 - -output: - - platform: emc2101 - id: fan_duty_cycle - -sensor: - - platform: emc2101 - internal_temperature: - id: internal_temperature_sensor - name: Internal Temperature Sensor - speed: - id: speed_sensor - name: Speed Sensor - duty_cycle: - id: duty_cycle_sensor - name: Duty Cycle Sensor - update_interval: 5s +<<: !include common.yaml diff --git a/tests/components/emc2101/test.esp8266-ard.yaml b/tests/components/emc2101/test.esp8266-ard.yaml index d95bc1b001..ee2c29ca4e 100644 --- a/tests/components/emc2101/test.esp8266-ard.yaml +++ b/tests/components/emc2101/test.esp8266-ard.yaml @@ -1,25 +1,5 @@ -i2c: - - id: i2c_emc2101 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -emc2101: - pwm: - resolution: 8 - -output: - - platform: emc2101 - id: fan_duty_cycle - -sensor: - - platform: emc2101 - internal_temperature: - id: internal_temperature_sensor - name: Internal Temperature Sensor - speed: - id: speed_sensor - name: Speed Sensor - duty_cycle: - id: duty_cycle_sensor - name: Duty Cycle Sensor - update_interval: 5s +<<: !include common.yaml diff --git a/tests/components/emc2101/test.rp2040-ard.yaml b/tests/components/emc2101/test.rp2040-ard.yaml index d95bc1b001..ee2c29ca4e 100644 --- a/tests/components/emc2101/test.rp2040-ard.yaml +++ b/tests/components/emc2101/test.rp2040-ard.yaml @@ -1,25 +1,5 @@ -i2c: - - id: i2c_emc2101 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -emc2101: - pwm: - resolution: 8 - -output: - - platform: emc2101 - id: fan_duty_cycle - -sensor: - - platform: emc2101 - internal_temperature: - id: internal_temperature_sensor - name: Internal Temperature Sensor - speed: - id: speed_sensor - name: Speed Sensor - duty_cycle: - id: duty_cycle_sensor - name: Duty Cycle Sensor - update_interval: 5s +<<: !include common.yaml diff --git a/tests/components/ens210/common.yaml b/tests/components/ens210/common.yaml new file mode 100644 index 0000000000..b276154449 --- /dev/null +++ b/tests/components/ens210/common.yaml @@ -0,0 +1,12 @@ +i2c: + - id: i2c_ens210 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: ens210 + temperature: + name: ENS210 Temperature + humidity: + name: ENS210 Humidity + update_interval: 15s diff --git a/tests/components/ens210/test.esp32-ard.yaml b/tests/components/ens210/test.esp32-ard.yaml index 8b2d29cc25..63c3bd6afd 100644 --- a/tests/components/ens210/test.esp32-ard.yaml +++ b/tests/components/ens210/test.esp32-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_ens210 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: ens210 - temperature: - name: ENS210 Temperature - humidity: - name: ENS210 Humidity - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ens210/test.esp32-c3-ard.yaml b/tests/components/ens210/test.esp32-c3-ard.yaml index bacb71f9f8..ee2c29ca4e 100644 --- a/tests/components/ens210/test.esp32-c3-ard.yaml +++ b/tests/components/ens210/test.esp32-c3-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_ens210 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ens210 - temperature: - name: ENS210 Temperature - humidity: - name: ENS210 Humidity - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ens210/test.esp32-c3-idf.yaml b/tests/components/ens210/test.esp32-c3-idf.yaml index bacb71f9f8..ee2c29ca4e 100644 --- a/tests/components/ens210/test.esp32-c3-idf.yaml +++ b/tests/components/ens210/test.esp32-c3-idf.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_ens210 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ens210 - temperature: - name: ENS210 Temperature - humidity: - name: ENS210 Humidity - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ens210/test.esp32-idf.yaml b/tests/components/ens210/test.esp32-idf.yaml index 8b2d29cc25..63c3bd6afd 100644 --- a/tests/components/ens210/test.esp32-idf.yaml +++ b/tests/components/ens210/test.esp32-idf.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_ens210 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: ens210 - temperature: - name: ENS210 Temperature - humidity: - name: ENS210 Humidity - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ens210/test.esp8266-ard.yaml b/tests/components/ens210/test.esp8266-ard.yaml index bacb71f9f8..ee2c29ca4e 100644 --- a/tests/components/ens210/test.esp8266-ard.yaml +++ b/tests/components/ens210/test.esp8266-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_ens210 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ens210 - temperature: - name: ENS210 Temperature - humidity: - name: ENS210 Humidity - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ens210/test.rp2040-ard.yaml b/tests/components/ens210/test.rp2040-ard.yaml index bacb71f9f8..ee2c29ca4e 100644 --- a/tests/components/ens210/test.rp2040-ard.yaml +++ b/tests/components/ens210/test.rp2040-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_ens210 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ens210 - temperature: - name: ENS210 Temperature - humidity: - name: ENS210 Humidity - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/esp32_can/common.yaml b/tests/components/esp32_can/common.yaml new file mode 100644 index 0000000000..4349c470f3 --- /dev/null +++ b/tests/components/esp32_can/common.yaml @@ -0,0 +1,45 @@ +esphome: + on_boot: + then: + - canbus.send: + # Extended ID explicit + use_extended_id: true + can_id: 0x100 + data: [0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08] + - canbus.send: + # Standard ID by default + can_id: 0x100 + data: [0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08] + +canbus: + - platform: esp32_can + id: esp32_internal_can + rx_pin: ${rx_pin} + tx_pin: ${tx_pin} + can_id: 4 + bit_rate: 50kbps + on_frame: + - can_id: 500 + then: + - lambda: |- + std::string b(x.begin(), x.end()); + ESP_LOGD("canid 500", "%s", b.c_str() ); + - can_id: 0b00000000000000000000001000000 + can_id_mask: 0b11111000000000011111111000000 + use_extended_id: true + then: + - lambda: |- + auto pdo_id = can_id >> 14; + switch (pdo_id) + { + case 117: + ESP_LOGD("canbus", "exhaust_fan_duty"); + break; + case 118: + ESP_LOGD("canbus", "supply_fan_duty"); + break; + case 119: + ESP_LOGD("canbus", "supply_fan_flow"); + break; + // to be continued... + } diff --git a/tests/components/esp32_can/test.esp32-ard.yaml b/tests/components/esp32_can/test.esp32-ard.yaml index 159a695853..811f6b72a6 100644 --- a/tests/components/esp32_can/test.esp32-ard.yaml +++ b/tests/components/esp32_can/test.esp32-ard.yaml @@ -1,45 +1,5 @@ -esphome: - on_boot: - then: - - canbus.send: - # Extended ID explicit - use_extended_id: true - can_id: 0x100 - data: [0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08] - - canbus.send: - # Standard ID by default - can_id: 0x100 - data: [0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08] +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 -canbus: - - platform: esp32_can - id: esp32_internal_can - rx_pin: 13 - tx_pin: 14 - can_id: 4 - bit_rate: 50kbps - on_frame: - - can_id: 500 - then: - - lambda: |- - std::string b(x.begin(), x.end()); - ESP_LOGD("canid 500", "%s", b.c_str() ); - - can_id: 0b00000000000000000000001000000 - can_id_mask: 0b11111000000000011111111000000 - use_extended_id: true - then: - - lambda: |- - auto pdo_id = can_id >> 14; - switch (pdo_id) - { - case 117: - ESP_LOGD("canbus", "exhaust_fan_duty"); - break; - case 118: - ESP_LOGD("canbus", "supply_fan_duty"); - break; - case 119: - ESP_LOGD("canbus", "supply_fan_flow"); - break; - // to be continued... - } +<<: !include common.yaml diff --git a/tests/components/esp32_can/test.esp32-c3-ard.yaml b/tests/components/esp32_can/test.esp32-c3-ard.yaml index b4fd34cf51..c79d14c740 100644 --- a/tests/components/esp32_can/test.esp32-c3-ard.yaml +++ b/tests/components/esp32_can/test.esp32-c3-ard.yaml @@ -1,45 +1,5 @@ -esphome: - on_boot: - then: - - canbus.send: - # Extended ID explicit - use_extended_id: true - can_id: 0x100 - data: [0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08] - - canbus.send: - # Standard ID by default - can_id: 0x100 - data: [0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08] +substitutions: + tx_pin: GPIO7 + rx_pin: GPIO8 -canbus: - - platform: esp32_can - id: esp32_internal_can - rx_pin: 4 - tx_pin: 5 - can_id: 4 - bit_rate: 50kbps - on_frame: - - can_id: 500 - then: - - lambda: |- - std::string b(x.begin(), x.end()); - ESP_LOGD("canid 500", "%s", b.c_str() ); - - can_id: 0b00000000000000000000001000000 - can_id_mask: 0b11111000000000011111111000000 - use_extended_id: true - then: - - lambda: |- - auto pdo_id = can_id >> 14; - switch (pdo_id) - { - case 117: - ESP_LOGD("canbus", "exhaust_fan_duty"); - break; - case 118: - ESP_LOGD("canbus", "supply_fan_duty"); - break; - case 119: - ESP_LOGD("canbus", "supply_fan_flow"); - break; - // to be continued... - } +<<: !include common.yaml diff --git a/tests/components/esp32_can/test.esp32-c3-idf.yaml b/tests/components/esp32_can/test.esp32-c3-idf.yaml index b4fd34cf51..c79d14c740 100644 --- a/tests/components/esp32_can/test.esp32-c3-idf.yaml +++ b/tests/components/esp32_can/test.esp32-c3-idf.yaml @@ -1,45 +1,5 @@ -esphome: - on_boot: - then: - - canbus.send: - # Extended ID explicit - use_extended_id: true - can_id: 0x100 - data: [0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08] - - canbus.send: - # Standard ID by default - can_id: 0x100 - data: [0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08] +substitutions: + tx_pin: GPIO7 + rx_pin: GPIO8 -canbus: - - platform: esp32_can - id: esp32_internal_can - rx_pin: 4 - tx_pin: 5 - can_id: 4 - bit_rate: 50kbps - on_frame: - - can_id: 500 - then: - - lambda: |- - std::string b(x.begin(), x.end()); - ESP_LOGD("canid 500", "%s", b.c_str() ); - - can_id: 0b00000000000000000000001000000 - can_id_mask: 0b11111000000000011111111000000 - use_extended_id: true - then: - - lambda: |- - auto pdo_id = can_id >> 14; - switch (pdo_id) - { - case 117: - ESP_LOGD("canbus", "exhaust_fan_duty"); - break; - case 118: - ESP_LOGD("canbus", "supply_fan_duty"); - break; - case 119: - ESP_LOGD("canbus", "supply_fan_flow"); - break; - // to be continued... - } +<<: !include common.yaml diff --git a/tests/components/esp32_can/test.esp32-idf.yaml b/tests/components/esp32_can/test.esp32-idf.yaml index 159a695853..811f6b72a6 100644 --- a/tests/components/esp32_can/test.esp32-idf.yaml +++ b/tests/components/esp32_can/test.esp32-idf.yaml @@ -1,45 +1,5 @@ -esphome: - on_boot: - then: - - canbus.send: - # Extended ID explicit - use_extended_id: true - can_id: 0x100 - data: [0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08] - - canbus.send: - # Standard ID by default - can_id: 0x100 - data: [0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08] +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 -canbus: - - platform: esp32_can - id: esp32_internal_can - rx_pin: 13 - tx_pin: 14 - can_id: 4 - bit_rate: 50kbps - on_frame: - - can_id: 500 - then: - - lambda: |- - std::string b(x.begin(), x.end()); - ESP_LOGD("canid 500", "%s", b.c_str() ); - - can_id: 0b00000000000000000000001000000 - can_id_mask: 0b11111000000000011111111000000 - use_extended_id: true - then: - - lambda: |- - auto pdo_id = can_id >> 14; - switch (pdo_id) - { - case 117: - ESP_LOGD("canbus", "exhaust_fan_duty"); - break; - case 118: - ESP_LOGD("canbus", "supply_fan_duty"); - break; - case 119: - ESP_LOGD("canbus", "supply_fan_flow"); - break; - // to be continued... - } +<<: !include common.yaml diff --git a/tests/components/esp32_rmt_led_strip/common-ard.yaml b/tests/components/esp32_rmt_led_strip/common-ard.yaml new file mode 100644 index 0000000000..287690e86e --- /dev/null +++ b/tests/components/esp32_rmt_led_strip/common-ard.yaml @@ -0,0 +1,18 @@ +light: + - platform: esp32_rmt_led_strip + id: led_strip1 + pin: ${pin1} + num_leds: 60 + rmt_channel: 0 + rgb_order: GRB + chipset: ws2812 + - platform: esp32_rmt_led_strip + id: led_strip2 + pin: ${pin2} + num_leds: 60 + rmt_channel: 1 + rgb_order: RGB + bit0_high: 100us + bit0_low: 100us + bit1_high: 100us + bit1_low: 100us diff --git a/tests/components/esp32_rmt_led_strip/common-idf.yaml b/tests/components/esp32_rmt_led_strip/common-idf.yaml new file mode 100644 index 0000000000..f3ee86bcce --- /dev/null +++ b/tests/components/esp32_rmt_led_strip/common-idf.yaml @@ -0,0 +1,16 @@ +light: + - platform: esp32_rmt_led_strip + id: led_strip1 + pin: ${pin1} + num_leds: 60 + rgb_order: GRB + chipset: ws2812 + - platform: esp32_rmt_led_strip + id: led_strip2 + pin: ${pin2} + num_leds: 60 + rgb_order: RGB + bit0_high: 100us + bit0_low: 100us + bit1_high: 100us + bit1_low: 100us diff --git a/tests/components/esp32_rmt_led_strip/test.esp32-ard.yaml b/tests/components/esp32_rmt_led_strip/test.esp32-ard.yaml index d51a66451f..c75ac73ace 100644 --- a/tests/components/esp32_rmt_led_strip/test.esp32-ard.yaml +++ b/tests/components/esp32_rmt_led_strip/test.esp32-ard.yaml @@ -1,18 +1,5 @@ -light: - - platform: esp32_rmt_led_strip - id: led_strip - pin: 13 - num_leds: 60 - rmt_channel: 6 - rgb_order: GRB - chipset: ws2812 - - platform: esp32_rmt_led_strip - id: led_strip2 - pin: 14 - num_leds: 60 - rmt_channel: 2 - rgb_order: RGB - bit0_high: 100us - bit0_low: 100us - bit1_high: 100us - bit1_low: 100us +substitutions: + pin1: GPIO13 + pin2: GPIO14 + +<<: !include common-ard.yaml diff --git a/tests/components/esp32_rmt_led_strip/test.esp32-c3-ard.yaml b/tests/components/esp32_rmt_led_strip/test.esp32-c3-ard.yaml index b226d1de06..7b4560a0d7 100644 --- a/tests/components/esp32_rmt_led_strip/test.esp32-c3-ard.yaml +++ b/tests/components/esp32_rmt_led_strip/test.esp32-c3-ard.yaml @@ -1,18 +1,5 @@ -light: - - platform: esp32_rmt_led_strip - id: led_strip - pin: 4 - num_leds: 60 - rmt_channel: 0 - rgb_order: GRB - chipset: ws2812 - - platform: esp32_rmt_led_strip - id: led_strip2 - pin: 5 - num_leds: 60 - rmt_channel: 1 - rgb_order: RGB - bit0_high: 100us - bit0_low: 100us - bit1_high: 100us - bit1_low: 100us +substitutions: + pin1: GPIO3 + pin2: GPIO4 + +<<: !include common-ard.yaml diff --git a/tests/components/esp32_rmt_led_strip/test.esp32-c3-idf.yaml b/tests/components/esp32_rmt_led_strip/test.esp32-c3-idf.yaml index 93318d0581..b4110199f1 100644 --- a/tests/components/esp32_rmt_led_strip/test.esp32-c3-idf.yaml +++ b/tests/components/esp32_rmt_led_strip/test.esp32-c3-idf.yaml @@ -1,16 +1,5 @@ -light: - - platform: esp32_rmt_led_strip - id: led_strip - pin: 4 - num_leds: 60 - rgb_order: GRB - chipset: ws2812 - - platform: esp32_rmt_led_strip - id: led_strip2 - pin: 5 - num_leds: 60 - rgb_order: RGB - bit0_high: 100µs - bit0_low: 100µs - bit1_high: 100µs - bit1_low: 100µs +substitutions: + pin1: GPIO3 + pin2: GPIO4 + +<<: !include common-idf.yaml diff --git a/tests/components/esp32_rmt_led_strip/test.esp32-idf.yaml b/tests/components/esp32_rmt_led_strip/test.esp32-idf.yaml index 228af17189..5adeba4f8c 100644 --- a/tests/components/esp32_rmt_led_strip/test.esp32-idf.yaml +++ b/tests/components/esp32_rmt_led_strip/test.esp32-idf.yaml @@ -1,16 +1,5 @@ -light: - - platform: esp32_rmt_led_strip - id: led_strip - pin: 13 - num_leds: 60 - rgb_order: GRB - chipset: ws2812 - - platform: esp32_rmt_led_strip - id: led_strip2 - pin: 14 - num_leds: 60 - rgb_order: RGB - bit0_high: 100µs - bit0_low: 100µs - bit1_high: 100µs - bit1_low: 100µs +substitutions: + pin1: GPIO13 + pin2: GPIO14 + +<<: !include common-idf.yaml diff --git a/tests/components/ezo/common.yaml b/tests/components/ezo/common.yaml new file mode 100644 index 0000000000..edeebd1a12 --- /dev/null +++ b/tests/components/ezo/common.yaml @@ -0,0 +1,10 @@ +i2c: + - id: i2c_ezo + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: ezo + id: ph_ezo + address: 99 + unit_of_measurement: pH diff --git a/tests/components/ezo/test.esp32-ard.yaml b/tests/components/ezo/test.esp32-ard.yaml index 61a8d2b25f..63c3bd6afd 100644 --- a/tests/components/ezo/test.esp32-ard.yaml +++ b/tests/components/ezo/test.esp32-ard.yaml @@ -1,10 +1,5 @@ -i2c: - - id: i2c_ezo - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: ezo - id: ph_ezo - address: 99 - unit_of_measurement: pH +<<: !include common.yaml diff --git a/tests/components/ezo/test.esp32-c3-ard.yaml b/tests/components/ezo/test.esp32-c3-ard.yaml index 93ceb9efd3..ee2c29ca4e 100644 --- a/tests/components/ezo/test.esp32-c3-ard.yaml +++ b/tests/components/ezo/test.esp32-c3-ard.yaml @@ -1,10 +1,5 @@ -i2c: - - id: i2c_ezo - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ezo - id: ph_ezo - address: 99 - unit_of_measurement: pH +<<: !include common.yaml diff --git a/tests/components/ezo/test.esp32-c3-idf.yaml b/tests/components/ezo/test.esp32-c3-idf.yaml index 93ceb9efd3..ee2c29ca4e 100644 --- a/tests/components/ezo/test.esp32-c3-idf.yaml +++ b/tests/components/ezo/test.esp32-c3-idf.yaml @@ -1,10 +1,5 @@ -i2c: - - id: i2c_ezo - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ezo - id: ph_ezo - address: 99 - unit_of_measurement: pH +<<: !include common.yaml diff --git a/tests/components/ezo/test.esp32-idf.yaml b/tests/components/ezo/test.esp32-idf.yaml index 61a8d2b25f..63c3bd6afd 100644 --- a/tests/components/ezo/test.esp32-idf.yaml +++ b/tests/components/ezo/test.esp32-idf.yaml @@ -1,10 +1,5 @@ -i2c: - - id: i2c_ezo - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: ezo - id: ph_ezo - address: 99 - unit_of_measurement: pH +<<: !include common.yaml diff --git a/tests/components/ezo/test.esp8266-ard.yaml b/tests/components/ezo/test.esp8266-ard.yaml index 93ceb9efd3..ee2c29ca4e 100644 --- a/tests/components/ezo/test.esp8266-ard.yaml +++ b/tests/components/ezo/test.esp8266-ard.yaml @@ -1,10 +1,5 @@ -i2c: - - id: i2c_ezo - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ezo - id: ph_ezo - address: 99 - unit_of_measurement: pH +<<: !include common.yaml diff --git a/tests/components/ezo/test.rp2040-ard.yaml b/tests/components/ezo/test.rp2040-ard.yaml index 93ceb9efd3..ee2c29ca4e 100644 --- a/tests/components/ezo/test.rp2040-ard.yaml +++ b/tests/components/ezo/test.rp2040-ard.yaml @@ -1,10 +1,5 @@ -i2c: - - id: i2c_ezo - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ezo - id: ph_ezo - address: 99 - unit_of_measurement: pH +<<: !include common.yaml diff --git a/tests/components/ezo_pmp/common.yaml b/tests/components/ezo_pmp/common.yaml new file mode 100644 index 0000000000..00919797be --- /dev/null +++ b/tests/components/ezo_pmp/common.yaml @@ -0,0 +1,61 @@ +i2c: + - id: i2c_ezo_pmp + scl: ${scl_pin} + sda: ${sda_pin} + +ezo_pmp: + id: hcl_pump + update_interval: 1s + +binary_sensor: + - platform: ezo_pmp + pump_state: + name: Pump State + is_paused: + name: Is Paused + +sensor: + - platform: ezo_pmp + current_volume_dosed: + name: Current Volume Dosed + total_volume_dosed: + name: Total Volume Dosed + absolute_total_volume_dosed: + name: Absolute Total Volume Dosed + pump_voltage: + name: Pump Voltage + last_volume_requested: + name: Last Volume Requested + max_flow_rate: + name: Max Flow Rate + +text_sensor: + - platform: ezo_pmp + dosing_mode: + name: Dosing Mode + calibration_status: + name: Calibration Status + on_value: + - ezo_pmp.dose_volume: + id: hcl_pump + volume: 10 + - ezo_pmp.dose_volume_over_time: + id: hcl_pump + volume: 10 + duration: 2 + - ezo_pmp.dose_with_constant_flow_rate: + id: hcl_pump + volume_per_minute: 10 + duration: 2 + - ezo_pmp.set_calibration_volume: + id: hcl_pump + volume: 10 + - ezo_pmp.find: hcl_pump + - ezo_pmp.dose_continuously: hcl_pump + - ezo_pmp.clear_total_volume_dosed: hcl_pump + - ezo_pmp.clear_calibration: hcl_pump + - ezo_pmp.pause_dosing: hcl_pump + - ezo_pmp.stop_dosing: hcl_pump + - ezo_pmp.arbitrary_command: + id: hcl_pump + command: D,? diff --git a/tests/components/ezo_pmp/test.esp32-ard.yaml b/tests/components/ezo_pmp/test.esp32-ard.yaml index 9fc929b365..63c3bd6afd 100644 --- a/tests/components/ezo_pmp/test.esp32-ard.yaml +++ b/tests/components/ezo_pmp/test.esp32-ard.yaml @@ -1,61 +1,5 @@ -i2c: - - id: i2c_ezo_pmp - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -ezo_pmp: - id: hcl_pump - update_interval: 1s - -binary_sensor: - - platform: ezo_pmp - pump_state: - name: Pump State - is_paused: - name: Is Paused - -sensor: - - platform: ezo_pmp - current_volume_dosed: - name: Current Volume Dosed - total_volume_dosed: - name: Total Volume Dosed - absolute_total_volume_dosed: - name: Absolute Total Volume Dosed - pump_voltage: - name: Pump Voltage - last_volume_requested: - name: Last Volume Requested - max_flow_rate: - name: Max Flow Rate - -text_sensor: - - platform: ezo_pmp - dosing_mode: - name: Dosing Mode - calibration_status: - name: Calibration Status - on_value: - - ezo_pmp.dose_volume: - id: hcl_pump - volume: 10 - - ezo_pmp.dose_volume_over_time: - id: hcl_pump - volume: 10 - duration: 2 - - ezo_pmp.dose_with_constant_flow_rate: - id: hcl_pump - volume_per_minute: 10 - duration: 2 - - ezo_pmp.set_calibration_volume: - id: hcl_pump - volume: 10 - - ezo_pmp.find: hcl_pump - - ezo_pmp.dose_continuously: hcl_pump - - ezo_pmp.clear_total_volume_dosed: hcl_pump - - ezo_pmp.clear_calibration: hcl_pump - - ezo_pmp.pause_dosing: hcl_pump - - ezo_pmp.stop_dosing: hcl_pump - - ezo_pmp.arbitrary_command: - id: hcl_pump - command: D,? +<<: !include common.yaml diff --git a/tests/components/ezo_pmp/test.esp32-c3-ard.yaml b/tests/components/ezo_pmp/test.esp32-c3-ard.yaml index fa047de3de..ee2c29ca4e 100644 --- a/tests/components/ezo_pmp/test.esp32-c3-ard.yaml +++ b/tests/components/ezo_pmp/test.esp32-c3-ard.yaml @@ -1,61 +1,5 @@ -i2c: - - id: i2c_ezo_pmp - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -ezo_pmp: - id: hcl_pump - update_interval: 1s - -binary_sensor: - - platform: ezo_pmp - pump_state: - name: Pump State - is_paused: - name: Is Paused - -sensor: - - platform: ezo_pmp - current_volume_dosed: - name: Current Volume Dosed - total_volume_dosed: - name: Total Volume Dosed - absolute_total_volume_dosed: - name: Absolute Total Volume Dosed - pump_voltage: - name: Pump Voltage - last_volume_requested: - name: Last Volume Requested - max_flow_rate: - name: Max Flow Rate - -text_sensor: - - platform: ezo_pmp - dosing_mode: - name: Dosing Mode - calibration_status: - name: Calibration Status - on_value: - - ezo_pmp.dose_volume: - id: hcl_pump - volume: 10 - - ezo_pmp.dose_volume_over_time: - id: hcl_pump - volume: 10 - duration: 2 - - ezo_pmp.dose_with_constant_flow_rate: - id: hcl_pump - volume_per_minute: 10 - duration: 2 - - ezo_pmp.set_calibration_volume: - id: hcl_pump - volume: 10 - - ezo_pmp.find: hcl_pump - - ezo_pmp.dose_continuously: hcl_pump - - ezo_pmp.clear_total_volume_dosed: hcl_pump - - ezo_pmp.clear_calibration: hcl_pump - - ezo_pmp.pause_dosing: hcl_pump - - ezo_pmp.stop_dosing: hcl_pump - - ezo_pmp.arbitrary_command: - id: hcl_pump - command: D,? +<<: !include common.yaml diff --git a/tests/components/ezo_pmp/test.esp32-c3-idf.yaml b/tests/components/ezo_pmp/test.esp32-c3-idf.yaml index fa047de3de..ee2c29ca4e 100644 --- a/tests/components/ezo_pmp/test.esp32-c3-idf.yaml +++ b/tests/components/ezo_pmp/test.esp32-c3-idf.yaml @@ -1,61 +1,5 @@ -i2c: - - id: i2c_ezo_pmp - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -ezo_pmp: - id: hcl_pump - update_interval: 1s - -binary_sensor: - - platform: ezo_pmp - pump_state: - name: Pump State - is_paused: - name: Is Paused - -sensor: - - platform: ezo_pmp - current_volume_dosed: - name: Current Volume Dosed - total_volume_dosed: - name: Total Volume Dosed - absolute_total_volume_dosed: - name: Absolute Total Volume Dosed - pump_voltage: - name: Pump Voltage - last_volume_requested: - name: Last Volume Requested - max_flow_rate: - name: Max Flow Rate - -text_sensor: - - platform: ezo_pmp - dosing_mode: - name: Dosing Mode - calibration_status: - name: Calibration Status - on_value: - - ezo_pmp.dose_volume: - id: hcl_pump - volume: 10 - - ezo_pmp.dose_volume_over_time: - id: hcl_pump - volume: 10 - duration: 2 - - ezo_pmp.dose_with_constant_flow_rate: - id: hcl_pump - volume_per_minute: 10 - duration: 2 - - ezo_pmp.set_calibration_volume: - id: hcl_pump - volume: 10 - - ezo_pmp.find: hcl_pump - - ezo_pmp.dose_continuously: hcl_pump - - ezo_pmp.clear_total_volume_dosed: hcl_pump - - ezo_pmp.clear_calibration: hcl_pump - - ezo_pmp.pause_dosing: hcl_pump - - ezo_pmp.stop_dosing: hcl_pump - - ezo_pmp.arbitrary_command: - id: hcl_pump - command: D,? +<<: !include common.yaml diff --git a/tests/components/ezo_pmp/test.esp32-idf.yaml b/tests/components/ezo_pmp/test.esp32-idf.yaml index 9fc929b365..63c3bd6afd 100644 --- a/tests/components/ezo_pmp/test.esp32-idf.yaml +++ b/tests/components/ezo_pmp/test.esp32-idf.yaml @@ -1,61 +1,5 @@ -i2c: - - id: i2c_ezo_pmp - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -ezo_pmp: - id: hcl_pump - update_interval: 1s - -binary_sensor: - - platform: ezo_pmp - pump_state: - name: Pump State - is_paused: - name: Is Paused - -sensor: - - platform: ezo_pmp - current_volume_dosed: - name: Current Volume Dosed - total_volume_dosed: - name: Total Volume Dosed - absolute_total_volume_dosed: - name: Absolute Total Volume Dosed - pump_voltage: - name: Pump Voltage - last_volume_requested: - name: Last Volume Requested - max_flow_rate: - name: Max Flow Rate - -text_sensor: - - platform: ezo_pmp - dosing_mode: - name: Dosing Mode - calibration_status: - name: Calibration Status - on_value: - - ezo_pmp.dose_volume: - id: hcl_pump - volume: 10 - - ezo_pmp.dose_volume_over_time: - id: hcl_pump - volume: 10 - duration: 2 - - ezo_pmp.dose_with_constant_flow_rate: - id: hcl_pump - volume_per_minute: 10 - duration: 2 - - ezo_pmp.set_calibration_volume: - id: hcl_pump - volume: 10 - - ezo_pmp.find: hcl_pump - - ezo_pmp.dose_continuously: hcl_pump - - ezo_pmp.clear_total_volume_dosed: hcl_pump - - ezo_pmp.clear_calibration: hcl_pump - - ezo_pmp.pause_dosing: hcl_pump - - ezo_pmp.stop_dosing: hcl_pump - - ezo_pmp.arbitrary_command: - id: hcl_pump - command: D,? +<<: !include common.yaml diff --git a/tests/components/ezo_pmp/test.esp8266-ard.yaml b/tests/components/ezo_pmp/test.esp8266-ard.yaml index fa047de3de..ee2c29ca4e 100644 --- a/tests/components/ezo_pmp/test.esp8266-ard.yaml +++ b/tests/components/ezo_pmp/test.esp8266-ard.yaml @@ -1,61 +1,5 @@ -i2c: - - id: i2c_ezo_pmp - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -ezo_pmp: - id: hcl_pump - update_interval: 1s - -binary_sensor: - - platform: ezo_pmp - pump_state: - name: Pump State - is_paused: - name: Is Paused - -sensor: - - platform: ezo_pmp - current_volume_dosed: - name: Current Volume Dosed - total_volume_dosed: - name: Total Volume Dosed - absolute_total_volume_dosed: - name: Absolute Total Volume Dosed - pump_voltage: - name: Pump Voltage - last_volume_requested: - name: Last Volume Requested - max_flow_rate: - name: Max Flow Rate - -text_sensor: - - platform: ezo_pmp - dosing_mode: - name: Dosing Mode - calibration_status: - name: Calibration Status - on_value: - - ezo_pmp.dose_volume: - id: hcl_pump - volume: 10 - - ezo_pmp.dose_volume_over_time: - id: hcl_pump - volume: 10 - duration: 2 - - ezo_pmp.dose_with_constant_flow_rate: - id: hcl_pump - volume_per_minute: 10 - duration: 2 - - ezo_pmp.set_calibration_volume: - id: hcl_pump - volume: 10 - - ezo_pmp.find: hcl_pump - - ezo_pmp.dose_continuously: hcl_pump - - ezo_pmp.clear_total_volume_dosed: hcl_pump - - ezo_pmp.clear_calibration: hcl_pump - - ezo_pmp.pause_dosing: hcl_pump - - ezo_pmp.stop_dosing: hcl_pump - - ezo_pmp.arbitrary_command: - id: hcl_pump - command: D,? +<<: !include common.yaml diff --git a/tests/components/ezo_pmp/test.rp2040-ard.yaml b/tests/components/ezo_pmp/test.rp2040-ard.yaml index fa047de3de..ee2c29ca4e 100644 --- a/tests/components/ezo_pmp/test.rp2040-ard.yaml +++ b/tests/components/ezo_pmp/test.rp2040-ard.yaml @@ -1,61 +1,5 @@ -i2c: - - id: i2c_ezo_pmp - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -ezo_pmp: - id: hcl_pump - update_interval: 1s - -binary_sensor: - - platform: ezo_pmp - pump_state: - name: Pump State - is_paused: - name: Is Paused - -sensor: - - platform: ezo_pmp - current_volume_dosed: - name: Current Volume Dosed - total_volume_dosed: - name: Total Volume Dosed - absolute_total_volume_dosed: - name: Absolute Total Volume Dosed - pump_voltage: - name: Pump Voltage - last_volume_requested: - name: Last Volume Requested - max_flow_rate: - name: Max Flow Rate - -text_sensor: - - platform: ezo_pmp - dosing_mode: - name: Dosing Mode - calibration_status: - name: Calibration Status - on_value: - - ezo_pmp.dose_volume: - id: hcl_pump - volume: 10 - - ezo_pmp.dose_volume_over_time: - id: hcl_pump - volume: 10 - duration: 2 - - ezo_pmp.dose_with_constant_flow_rate: - id: hcl_pump - volume_per_minute: 10 - duration: 2 - - ezo_pmp.set_calibration_volume: - id: hcl_pump - volume: 10 - - ezo_pmp.find: hcl_pump - - ezo_pmp.dose_continuously: hcl_pump - - ezo_pmp.clear_total_volume_dosed: hcl_pump - - ezo_pmp.clear_calibration: hcl_pump - - ezo_pmp.pause_dosing: hcl_pump - - ezo_pmp.stop_dosing: hcl_pump - - ezo_pmp.arbitrary_command: - id: hcl_pump - command: D,? +<<: !include common.yaml diff --git a/tests/components/fingerprint_grow/common.yaml b/tests/components/fingerprint_grow/common.yaml new file mode 100644 index 0000000000..e759ea5a02 --- /dev/null +++ b/tests/components/fingerprint_grow/common.yaml @@ -0,0 +1,56 @@ +esphome: + on_boot: + then: + - fingerprint_grow.enroll: + finger_id: 2 + num_scans: 2 + - fingerprint_grow.cancel_enroll: + - fingerprint_grow.delete: + finger_id: 2 + - fingerprint_grow.delete_all: + +uart: + - id: uart_fingerprint_grow + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} + baud_rate: 57600 + +fingerprint_grow: + sensing_pin: ${sensing_pin} + password: 0x12FE37DC + new_password: 0xA65B9840 + on_finger_scan_start: + - logger.log: test_fingerprint_grow_finger_scan_start + on_finger_scan_invalid: + - logger.log: test_fingerprint_grow_finger_scan_invalid + on_finger_scan_matched: + - logger.log: test_fingerprint_grow_finger_scan_matched + on_finger_scan_unmatched: + - logger.log: test_fingerprint_grow_finger_scan_unmatched + on_finger_scan_misplaced: + - logger.log: test_fingerprint_grow_finger_scan_misplaced + on_enrollment_scan: + - logger.log: test_fingerprint_grow_enrollment_scan + on_enrollment_done: + - logger.log: test_fingerprint_grow_node_enrollment_done + on_enrollment_failed: + - logger.log: test_fingerprint_grow_enrollment_failed + +binary_sensor: + - platform: fingerprint_grow + name: Fingerprint Enrolling + +sensor: + - platform: fingerprint_grow + fingerprint_count: + name: Fingerprint Count + status: + name: Fingerprint Status + capacity: + name: Fingerprint Capacity + security_level: + name: Fingerprint Security Level + last_finger_id: + name: Fingerprint Last Finger ID + last_confidence: + name: Fingerprint Last Confidence diff --git a/tests/components/fingerprint_grow/test.esp32-ard.yaml b/tests/components/fingerprint_grow/test.esp32-ard.yaml index 0950145a05..4aef3d8be6 100644 --- a/tests/components/fingerprint_grow/test.esp32-ard.yaml +++ b/tests/components/fingerprint_grow/test.esp32-ard.yaml @@ -1,56 +1,6 @@ -esphome: - on_boot: - then: - - fingerprint_grow.enroll: - finger_id: 2 - num_scans: 2 - - fingerprint_grow.cancel_enroll: - - fingerprint_grow.delete: - finger_id: 2 - - fingerprint_grow.delete_all: +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 + sensing_pin: GPIO15 -uart: - - id: uart_fingerprint_grow - tx_pin: 17 - rx_pin: 16 - baud_rate: 57600 - -fingerprint_grow: - sensing_pin: 18 - password: 0x12FE37DC - new_password: 0xA65B9840 - on_finger_scan_start: - - logger.log: test_fingerprint_grow_finger_scan_start - on_finger_scan_invalid: - - logger.log: test_fingerprint_grow_finger_scan_invalid - on_finger_scan_matched: - - logger.log: test_fingerprint_grow_finger_scan_matched - on_finger_scan_unmatched: - - logger.log: test_fingerprint_grow_finger_scan_unmatched - on_finger_scan_misplaced: - - logger.log: test_fingerprint_grow_finger_scan_misplaced - on_enrollment_scan: - - logger.log: test_fingerprint_grow_enrollment_scan - on_enrollment_done: - - logger.log: test_fingerprint_grow_node_enrollment_done - on_enrollment_failed: - - logger.log: test_fingerprint_grow_enrollment_failed - -binary_sensor: - - platform: fingerprint_grow - name: Fingerprint Enrolling - -sensor: - - platform: fingerprint_grow - fingerprint_count: - name: Fingerprint Count - status: - name: Fingerprint Status - capacity: - name: Fingerprint Capacity - security_level: - name: Fingerprint Security Level - last_finger_id: - name: Fingerprint Last Finger ID - last_confidence: - name: Fingerprint Last Confidence +<<: !include common.yaml diff --git a/tests/components/fingerprint_grow/test.esp32-c3-ard.yaml b/tests/components/fingerprint_grow/test.esp32-c3-ard.yaml index e7ac08eb28..faab50e152 100644 --- a/tests/components/fingerprint_grow/test.esp32-c3-ard.yaml +++ b/tests/components/fingerprint_grow/test.esp32-c3-ard.yaml @@ -1,56 +1,6 @@ -esphome: - on_boot: - then: - - fingerprint_grow.enroll: - finger_id: 2 - num_scans: 2 - - fingerprint_grow.cancel_enroll: - - fingerprint_grow.delete: - finger_id: 2 - - fingerprint_grow.delete_all: +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + sensing_pin: GPIO6 -uart: - - id: uart_fingerprint_grow - tx_pin: 4 - rx_pin: 5 - baud_rate: 57600 - -fingerprint_grow: - sensing_pin: 6 - password: 0x12FE37DC - new_password: 0xA65B9840 - on_finger_scan_start: - - logger.log: test_fingerprint_grow_finger_scan_start - on_finger_scan_invalid: - - logger.log: test_fingerprint_grow_finger_scan_invalid - on_finger_scan_matched: - - logger.log: test_fingerprint_grow_finger_scan_matched - on_finger_scan_unmatched: - - logger.log: test_fingerprint_grow_finger_scan_unmatched - on_finger_scan_misplaced: - - logger.log: test_fingerprint_grow_finger_scan_misplaced - on_enrollment_scan: - - logger.log: test_fingerprint_grow_enrollment_scan - on_enrollment_done: - - logger.log: test_fingerprint_grow_node_enrollment_done - on_enrollment_failed: - - logger.log: test_fingerprint_grow_enrollment_failed - -binary_sensor: - - platform: fingerprint_grow - name: Fingerprint Enrolling - -sensor: - - platform: fingerprint_grow - fingerprint_count: - name: Fingerprint Count - status: - name: Fingerprint Status - capacity: - name: Fingerprint Capacity - security_level: - name: Fingerprint Security Level - last_finger_id: - name: Fingerprint Last Finger ID - last_confidence: - name: Fingerprint Last Confidence +<<: !include common.yaml diff --git a/tests/components/fingerprint_grow/test.esp32-c3-idf.yaml b/tests/components/fingerprint_grow/test.esp32-c3-idf.yaml index e7ac08eb28..faab50e152 100644 --- a/tests/components/fingerprint_grow/test.esp32-c3-idf.yaml +++ b/tests/components/fingerprint_grow/test.esp32-c3-idf.yaml @@ -1,56 +1,6 @@ -esphome: - on_boot: - then: - - fingerprint_grow.enroll: - finger_id: 2 - num_scans: 2 - - fingerprint_grow.cancel_enroll: - - fingerprint_grow.delete: - finger_id: 2 - - fingerprint_grow.delete_all: +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + sensing_pin: GPIO6 -uart: - - id: uart_fingerprint_grow - tx_pin: 4 - rx_pin: 5 - baud_rate: 57600 - -fingerprint_grow: - sensing_pin: 6 - password: 0x12FE37DC - new_password: 0xA65B9840 - on_finger_scan_start: - - logger.log: test_fingerprint_grow_finger_scan_start - on_finger_scan_invalid: - - logger.log: test_fingerprint_grow_finger_scan_invalid - on_finger_scan_matched: - - logger.log: test_fingerprint_grow_finger_scan_matched - on_finger_scan_unmatched: - - logger.log: test_fingerprint_grow_finger_scan_unmatched - on_finger_scan_misplaced: - - logger.log: test_fingerprint_grow_finger_scan_misplaced - on_enrollment_scan: - - logger.log: test_fingerprint_grow_enrollment_scan - on_enrollment_done: - - logger.log: test_fingerprint_grow_node_enrollment_done - on_enrollment_failed: - - logger.log: test_fingerprint_grow_enrollment_failed - -binary_sensor: - - platform: fingerprint_grow - name: Fingerprint Enrolling - -sensor: - - platform: fingerprint_grow - fingerprint_count: - name: Fingerprint Count - status: - name: Fingerprint Status - capacity: - name: Fingerprint Capacity - security_level: - name: Fingerprint Security Level - last_finger_id: - name: Fingerprint Last Finger ID - last_confidence: - name: Fingerprint Last Confidence +<<: !include common.yaml diff --git a/tests/components/fingerprint_grow/test.esp32-idf.yaml b/tests/components/fingerprint_grow/test.esp32-idf.yaml index 0950145a05..4aef3d8be6 100644 --- a/tests/components/fingerprint_grow/test.esp32-idf.yaml +++ b/tests/components/fingerprint_grow/test.esp32-idf.yaml @@ -1,56 +1,6 @@ -esphome: - on_boot: - then: - - fingerprint_grow.enroll: - finger_id: 2 - num_scans: 2 - - fingerprint_grow.cancel_enroll: - - fingerprint_grow.delete: - finger_id: 2 - - fingerprint_grow.delete_all: +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 + sensing_pin: GPIO15 -uart: - - id: uart_fingerprint_grow - tx_pin: 17 - rx_pin: 16 - baud_rate: 57600 - -fingerprint_grow: - sensing_pin: 18 - password: 0x12FE37DC - new_password: 0xA65B9840 - on_finger_scan_start: - - logger.log: test_fingerprint_grow_finger_scan_start - on_finger_scan_invalid: - - logger.log: test_fingerprint_grow_finger_scan_invalid - on_finger_scan_matched: - - logger.log: test_fingerprint_grow_finger_scan_matched - on_finger_scan_unmatched: - - logger.log: test_fingerprint_grow_finger_scan_unmatched - on_finger_scan_misplaced: - - logger.log: test_fingerprint_grow_finger_scan_misplaced - on_enrollment_scan: - - logger.log: test_fingerprint_grow_enrollment_scan - on_enrollment_done: - - logger.log: test_fingerprint_grow_node_enrollment_done - on_enrollment_failed: - - logger.log: test_fingerprint_grow_enrollment_failed - -binary_sensor: - - platform: fingerprint_grow - name: Fingerprint Enrolling - -sensor: - - platform: fingerprint_grow - fingerprint_count: - name: Fingerprint Count - status: - name: Fingerprint Status - capacity: - name: Fingerprint Capacity - security_level: - name: Fingerprint Security Level - last_finger_id: - name: Fingerprint Last Finger ID - last_confidence: - name: Fingerprint Last Confidence +<<: !include common.yaml diff --git a/tests/components/fingerprint_grow/test.esp8266-ard.yaml b/tests/components/fingerprint_grow/test.esp8266-ard.yaml index 1d00d977b9..f2a864596a 100644 --- a/tests/components/fingerprint_grow/test.esp8266-ard.yaml +++ b/tests/components/fingerprint_grow/test.esp8266-ard.yaml @@ -1,56 +1,6 @@ -esphome: - on_boot: - then: - - fingerprint_grow.enroll: - finger_id: 2 - num_scans: 2 - - fingerprint_grow.cancel_enroll: - - fingerprint_grow.delete: - finger_id: 2 - - fingerprint_grow.delete_all: +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + sensing_pin: GPIO15 -uart: - - id: uart_fingerprint_grow - tx_pin: 4 - rx_pin: 5 - baud_rate: 57600 - -fingerprint_grow: - sensing_pin: 16 - password: 0x12FE37DC - new_password: 0xA65B9840 - on_finger_scan_start: - - logger.log: test_fingerprint_grow_finger_scan_start - on_finger_scan_invalid: - - logger.log: test_fingerprint_grow_finger_scan_invalid - on_finger_scan_matched: - - logger.log: test_fingerprint_grow_finger_scan_matched - on_finger_scan_unmatched: - - logger.log: test_fingerprint_grow_finger_scan_unmatched - on_finger_scan_misplaced: - - logger.log: test_fingerprint_grow_finger_scan_misplaced - on_enrollment_scan: - - logger.log: test_fingerprint_grow_enrollment_scan - on_enrollment_done: - - logger.log: test_fingerprint_grow_node_enrollment_done - on_enrollment_failed: - - logger.log: test_fingerprint_grow_enrollment_failed - -binary_sensor: - - platform: fingerprint_grow - name: Fingerprint Enrolling - -sensor: - - platform: fingerprint_grow - fingerprint_count: - name: Fingerprint Count - status: - name: Fingerprint Status - capacity: - name: Fingerprint Capacity - security_level: - name: Fingerprint Security Level - last_finger_id: - name: Fingerprint Last Finger ID - last_confidence: - name: Fingerprint Last Confidence +<<: !include common.yaml diff --git a/tests/components/fingerprint_grow/test.rp2040-ard.yaml b/tests/components/fingerprint_grow/test.rp2040-ard.yaml index e7ac08eb28..faab50e152 100644 --- a/tests/components/fingerprint_grow/test.rp2040-ard.yaml +++ b/tests/components/fingerprint_grow/test.rp2040-ard.yaml @@ -1,56 +1,6 @@ -esphome: - on_boot: - then: - - fingerprint_grow.enroll: - finger_id: 2 - num_scans: 2 - - fingerprint_grow.cancel_enroll: - - fingerprint_grow.delete: - finger_id: 2 - - fingerprint_grow.delete_all: +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + sensing_pin: GPIO6 -uart: - - id: uart_fingerprint_grow - tx_pin: 4 - rx_pin: 5 - baud_rate: 57600 - -fingerprint_grow: - sensing_pin: 6 - password: 0x12FE37DC - new_password: 0xA65B9840 - on_finger_scan_start: - - logger.log: test_fingerprint_grow_finger_scan_start - on_finger_scan_invalid: - - logger.log: test_fingerprint_grow_finger_scan_invalid - on_finger_scan_matched: - - logger.log: test_fingerprint_grow_finger_scan_matched - on_finger_scan_unmatched: - - logger.log: test_fingerprint_grow_finger_scan_unmatched - on_finger_scan_misplaced: - - logger.log: test_fingerprint_grow_finger_scan_misplaced - on_enrollment_scan: - - logger.log: test_fingerprint_grow_enrollment_scan - on_enrollment_done: - - logger.log: test_fingerprint_grow_node_enrollment_done - on_enrollment_failed: - - logger.log: test_fingerprint_grow_enrollment_failed - -binary_sensor: - - platform: fingerprint_grow - name: Fingerprint Enrolling - -sensor: - - platform: fingerprint_grow - fingerprint_count: - name: Fingerprint Count - status: - name: Fingerprint Status - capacity: - name: Fingerprint Capacity - security_level: - name: Fingerprint Security Level - last_finger_id: - name: Fingerprint Last Finger ID - last_confidence: - name: Fingerprint Last Confidence +<<: !include common.yaml diff --git a/tests/components/fs3000/common.yaml b/tests/components/fs3000/common.yaml new file mode 100644 index 0000000000..e87ac28aa9 --- /dev/null +++ b/tests/components/fs3000/common.yaml @@ -0,0 +1,10 @@ +i2c: + - id: i2c_fs3000 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: fs3000 + name: Air Velocity + model: 1005 + update_interval: 60s diff --git a/tests/components/fs3000/test.esp32-ard.yaml b/tests/components/fs3000/test.esp32-ard.yaml index 53b49cc9a2..63c3bd6afd 100644 --- a/tests/components/fs3000/test.esp32-ard.yaml +++ b/tests/components/fs3000/test.esp32-ard.yaml @@ -1,10 +1,5 @@ -i2c: - - id: i2c_fs3000 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: fs3000 - name: Air Velocity - model: 1005 - update_interval: 60s +<<: !include common.yaml diff --git a/tests/components/fs3000/test.esp32-c3-ard.yaml b/tests/components/fs3000/test.esp32-c3-ard.yaml index 69de83b463..ee2c29ca4e 100644 --- a/tests/components/fs3000/test.esp32-c3-ard.yaml +++ b/tests/components/fs3000/test.esp32-c3-ard.yaml @@ -1,10 +1,5 @@ -i2c: - - id: i2c_fs3000 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: fs3000 - name: Air Velocity - model: 1005 - update_interval: 60s +<<: !include common.yaml diff --git a/tests/components/fs3000/test.esp32-c3-idf.yaml b/tests/components/fs3000/test.esp32-c3-idf.yaml index 69de83b463..ee2c29ca4e 100644 --- a/tests/components/fs3000/test.esp32-c3-idf.yaml +++ b/tests/components/fs3000/test.esp32-c3-idf.yaml @@ -1,10 +1,5 @@ -i2c: - - id: i2c_fs3000 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: fs3000 - name: Air Velocity - model: 1005 - update_interval: 60s +<<: !include common.yaml diff --git a/tests/components/fs3000/test.esp32-idf.yaml b/tests/components/fs3000/test.esp32-idf.yaml index 53b49cc9a2..63c3bd6afd 100644 --- a/tests/components/fs3000/test.esp32-idf.yaml +++ b/tests/components/fs3000/test.esp32-idf.yaml @@ -1,10 +1,5 @@ -i2c: - - id: i2c_fs3000 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: fs3000 - name: Air Velocity - model: 1005 - update_interval: 60s +<<: !include common.yaml diff --git a/tests/components/fs3000/test.esp8266-ard.yaml b/tests/components/fs3000/test.esp8266-ard.yaml index 69de83b463..ee2c29ca4e 100644 --- a/tests/components/fs3000/test.esp8266-ard.yaml +++ b/tests/components/fs3000/test.esp8266-ard.yaml @@ -1,10 +1,5 @@ -i2c: - - id: i2c_fs3000 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: fs3000 - name: Air Velocity - model: 1005 - update_interval: 60s +<<: !include common.yaml diff --git a/tests/components/fs3000/test.rp2040-ard.yaml b/tests/components/fs3000/test.rp2040-ard.yaml index 69de83b463..ee2c29ca4e 100644 --- a/tests/components/fs3000/test.rp2040-ard.yaml +++ b/tests/components/fs3000/test.rp2040-ard.yaml @@ -1,10 +1,5 @@ -i2c: - - id: i2c_fs3000 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: fs3000 - name: Air Velocity - model: 1005 - update_interval: 60s +<<: !include common.yaml diff --git a/tests/components/ft5x06/common.yaml b/tests/components/ft5x06/common.yaml new file mode 100644 index 0000000000..322ee88b6d --- /dev/null +++ b/tests/components/ft5x06/common.yaml @@ -0,0 +1,21 @@ +i2c: + - id: i2c_ft5x06 + scl: ${scl_pin} + sda: ${sda_pin} + +display: + - platform: ssd1306_i2c + id: ssd1306_display + model: SSD1306_128X64 + reset_pin: ${reset_pin} + pages: + - id: page1 + lambda: |- + it.rectangle(0, 0, it.get_width(), it.get_height()); + +touchscreen: + - platform: ft5x06 + on_touch: + - logger.log: + format: Touch at (%d, %d) + args: [touch.x, touch.y] diff --git a/tests/components/ft5x06/test.esp32-ard.yaml b/tests/components/ft5x06/test.esp32-ard.yaml index 648929896d..1ca773e06c 100644 --- a/tests/components/ft5x06/test.esp32-ard.yaml +++ b/tests/components/ft5x06/test.esp32-ard.yaml @@ -1,21 +1,6 @@ -i2c: - - id: i2c_ft5x06 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 + reset_pin: GPIO15 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 18 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -touchscreen: - - platform: ft5x06 - on_touch: - - logger.log: - format: Touch at (%d, %d) - args: [touch.x, touch.y] +<<: !include common.yaml diff --git a/tests/components/ft5x06/test.esp32-c3-ard.yaml b/tests/components/ft5x06/test.esp32-c3-ard.yaml index 4fa9532f53..1e6670c196 100644 --- a/tests/components/ft5x06/test.esp32-c3-ard.yaml +++ b/tests/components/ft5x06/test.esp32-c3-ard.yaml @@ -1,21 +1,6 @@ -i2c: - - id: i2c_ft5x06 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + reset_pin: GPIO6 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 3 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -touchscreen: - - platform: ft5x06 - on_touch: - - logger.log: - format: Touch at (%d, %d) - args: [touch.x, touch.y] +<<: !include common.yaml diff --git a/tests/components/ft5x06/test.esp32-c3-idf.yaml b/tests/components/ft5x06/test.esp32-c3-idf.yaml index 4fa9532f53..1e6670c196 100644 --- a/tests/components/ft5x06/test.esp32-c3-idf.yaml +++ b/tests/components/ft5x06/test.esp32-c3-idf.yaml @@ -1,21 +1,6 @@ -i2c: - - id: i2c_ft5x06 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + reset_pin: GPIO6 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 3 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -touchscreen: - - platform: ft5x06 - on_touch: - - logger.log: - format: Touch at (%d, %d) - args: [touch.x, touch.y] +<<: !include common.yaml diff --git a/tests/components/ft5x06/test.esp32-idf.yaml b/tests/components/ft5x06/test.esp32-idf.yaml index 648929896d..1ca773e06c 100644 --- a/tests/components/ft5x06/test.esp32-idf.yaml +++ b/tests/components/ft5x06/test.esp32-idf.yaml @@ -1,21 +1,6 @@ -i2c: - - id: i2c_ft5x06 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 + reset_pin: GPIO15 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 18 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -touchscreen: - - platform: ft5x06 - on_touch: - - logger.log: - format: Touch at (%d, %d) - args: [touch.x, touch.y] +<<: !include common.yaml diff --git a/tests/components/ft5x06/test.esp8266-ard.yaml b/tests/components/ft5x06/test.esp8266-ard.yaml index 4fa9532f53..dfdc12a3d1 100644 --- a/tests/components/ft5x06/test.esp8266-ard.yaml +++ b/tests/components/ft5x06/test.esp8266-ard.yaml @@ -1,21 +1,6 @@ -i2c: - - id: i2c_ft5x06 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + reset_pin: GPIO15 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 3 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -touchscreen: - - platform: ft5x06 - on_touch: - - logger.log: - format: Touch at (%d, %d) - args: [touch.x, touch.y] +<<: !include common.yaml diff --git a/tests/components/ft5x06/test.rp2040-ard.yaml b/tests/components/ft5x06/test.rp2040-ard.yaml index 4fa9532f53..1e6670c196 100644 --- a/tests/components/ft5x06/test.rp2040-ard.yaml +++ b/tests/components/ft5x06/test.rp2040-ard.yaml @@ -1,21 +1,6 @@ -i2c: - - id: i2c_ft5x06 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + reset_pin: GPIO6 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 3 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -touchscreen: - - platform: ft5x06 - on_touch: - - logger.log: - format: Touch at (%d, %d) - args: [touch.x, touch.y] +<<: !include common.yaml diff --git a/tests/components/ft63x6/common.yaml b/tests/components/ft63x6/common.yaml new file mode 100644 index 0000000000..e91266123e --- /dev/null +++ b/tests/components/ft63x6/common.yaml @@ -0,0 +1,36 @@ +spi: + - id: spi_ft63x6 + clk_pin: ${clk_pin} + mosi_pin: ${mosi_pin} + +i2c: + - id: i2c_ft63x6 + scl: ${scl_pin} + sda: ${sda_pin} + +display: + - platform: ssd1306_i2c + id: ssd1306_display + model: SSD1306_128X64 + reset_pin: ${reset_pin} + pages: + - id: page1 + lambda: |- + it.rectangle(0, 0, it.get_width(), it.get_height()); + +touchscreen: + - platform: ft63x6 + interrupt_pin: ${interrupt_pin} + transform: + swap_xy: true + mirror_x: false + mirror_y: true + on_touch: + - logger.log: + format: tp touched + on_update: + - logger.log: + format: to updated + on_release: + - logger.log: + format: to released diff --git a/tests/components/ft63x6/test.esp32-ard.yaml b/tests/components/ft63x6/test.esp32-ard.yaml index 5c43cdff45..47b5796e8b 100644 --- a/tests/components/ft63x6/test.esp32-ard.yaml +++ b/tests/components/ft63x6/test.esp32-ard.yaml @@ -1,39 +1,9 @@ -spi: - clk_pin: 14 - mosi_pin: 13 +substitutions: + clk_pin: GPIO0 + mosi_pin: GPIO2 + scl_pin: GPIO13 + sda_pin: GPIO14 + interrupt_pin: GPIO15 + reset_pin: GPIO16 -i2c: - sda: GPIO18 - scl: GPIO19 - -display: - - id: my_display - platform: ili9xxx - dimensions: 480x320 - model: ST7796 - cs_pin: 15 - dc_pin: 21 - reset_pin: 22 - transform: - swap_xy: true - mirror_x: true - mirror_y: true - auto_clear_enabled: false - invert_colors: false - -touchscreen: - - platform: ft63x6 - interrupt_pin: GPIO39 - transform: - swap_xy: true - mirror_x: false - mirror_y: true - on_touch: - - logger.log: - format: tp touched - on_update: - - logger.log: - format: to updated - on_release: - - logger.log: - format: to released +<<: !include common.yaml diff --git a/tests/components/ft63x6/test.esp32-c3-ard.yaml b/tests/components/ft63x6/test.esp32-c3-ard.yaml index 19ca4cfc19..397ac1e464 100644 --- a/tests/components/ft63x6/test.esp32-c3-ard.yaml +++ b/tests/components/ft63x6/test.esp32-c3-ard.yaml @@ -1,21 +1,9 @@ -i2c: - - id: i2c_ft63x6 - scl: 5 - sda: 4 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + scl_pin: GPIO0 + sda_pin: GPIO1 + interrupt_pin: GPIO2 + reset_pin: GPIO3 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 3 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -touchscreen: - - platform: ft63x6 - on_touch: - - logger.log: - format: Touch at (%d, %d) - args: [touch.x, touch.y] +<<: !include common.yaml diff --git a/tests/components/ft63x6/test.esp32-c3-idf.yaml b/tests/components/ft63x6/test.esp32-c3-idf.yaml index 19ca4cfc19..397ac1e464 100644 --- a/tests/components/ft63x6/test.esp32-c3-idf.yaml +++ b/tests/components/ft63x6/test.esp32-c3-idf.yaml @@ -1,21 +1,9 @@ -i2c: - - id: i2c_ft63x6 - scl: 5 - sda: 4 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + scl_pin: GPIO0 + sda_pin: GPIO1 + interrupt_pin: GPIO2 + reset_pin: GPIO3 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 3 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -touchscreen: - - platform: ft63x6 - on_touch: - - logger.log: - format: Touch at (%d, %d) - args: [touch.x, touch.y] +<<: !include common.yaml diff --git a/tests/components/ft63x6/test.esp32-idf.yaml b/tests/components/ft63x6/test.esp32-idf.yaml index 5ceb107e31..47b5796e8b 100644 --- a/tests/components/ft63x6/test.esp32-idf.yaml +++ b/tests/components/ft63x6/test.esp32-idf.yaml @@ -1,21 +1,9 @@ -i2c: - - id: i2c_ft63x6 - scl: 16 - sda: 17 +substitutions: + clk_pin: GPIO0 + mosi_pin: GPIO2 + scl_pin: GPIO13 + sda_pin: GPIO14 + interrupt_pin: GPIO15 + reset_pin: GPIO16 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 18 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -touchscreen: - - platform: ft63x6 - on_touch: - - logger.log: - format: Touch at (%d, %d) - args: [touch.x, touch.y] +<<: !include common.yaml diff --git a/tests/components/ft63x6/test.esp8266-ard.yaml b/tests/components/ft63x6/test.esp8266-ard.yaml index 19ca4cfc19..a4223733af 100644 --- a/tests/components/ft63x6/test.esp8266-ard.yaml +++ b/tests/components/ft63x6/test.esp8266-ard.yaml @@ -1,21 +1,9 @@ -i2c: - - id: i2c_ft63x6 - scl: 5 - sda: 4 +substitutions: + clk_pin: GPIO14 + mosi_pin: GPIO13 + scl_pin: GPIO5 + sda_pin: GPIO4 + interrupt_pin: GPIO12 + reset_pin: GPIO16 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 3 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -touchscreen: - - platform: ft63x6 - on_touch: - - logger.log: - format: Touch at (%d, %d) - args: [touch.x, touch.y] +<<: !include common.yaml diff --git a/tests/components/ft63x6/test.rp2040-ard.yaml b/tests/components/ft63x6/test.rp2040-ard.yaml index 19ca4cfc19..397ac1e464 100644 --- a/tests/components/ft63x6/test.rp2040-ard.yaml +++ b/tests/components/ft63x6/test.rp2040-ard.yaml @@ -1,21 +1,9 @@ -i2c: - - id: i2c_ft63x6 - scl: 5 - sda: 4 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + scl_pin: GPIO0 + sda_pin: GPIO1 + interrupt_pin: GPIO2 + reset_pin: GPIO3 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 3 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -touchscreen: - - platform: ft63x6 - on_touch: - - logger.log: - format: Touch at (%d, %d) - args: [touch.x, touch.y] +<<: !include common.yaml diff --git a/tests/components/fujitsu_general/common.yaml b/tests/components/fujitsu_general/common.yaml new file mode 100644 index 0000000000..3359b89f2a --- /dev/null +++ b/tests/components/fujitsu_general/common.yaml @@ -0,0 +1,7 @@ +remote_transmitter: + pin: ${pin} + carrier_duty_percent: 50% + +climate: + - platform: fujitsu_general + name: Fujitsu General Climate diff --git a/tests/components/fujitsu_general/test.esp32-ard.yaml b/tests/components/fujitsu_general/test.esp32-ard.yaml index b4146f2a18..7b012aa64c 100644 --- a/tests/components/fujitsu_general/test.esp32-ard.yaml +++ b/tests/components/fujitsu_general/test.esp32-ard.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: fujitsu_general - name: Fujitsu General Climate +<<: !include common.yaml diff --git a/tests/components/fujitsu_general/test.esp32-c3-ard.yaml b/tests/components/fujitsu_general/test.esp32-c3-ard.yaml index b4146f2a18..7b012aa64c 100644 --- a/tests/components/fujitsu_general/test.esp32-c3-ard.yaml +++ b/tests/components/fujitsu_general/test.esp32-c3-ard.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: fujitsu_general - name: Fujitsu General Climate +<<: !include common.yaml diff --git a/tests/components/fujitsu_general/test.esp32-c3-idf.yaml b/tests/components/fujitsu_general/test.esp32-c3-idf.yaml index b4146f2a18..7b012aa64c 100644 --- a/tests/components/fujitsu_general/test.esp32-c3-idf.yaml +++ b/tests/components/fujitsu_general/test.esp32-c3-idf.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: fujitsu_general - name: Fujitsu General Climate +<<: !include common.yaml diff --git a/tests/components/fujitsu_general/test.esp32-idf.yaml b/tests/components/fujitsu_general/test.esp32-idf.yaml index b4146f2a18..7b012aa64c 100644 --- a/tests/components/fujitsu_general/test.esp32-idf.yaml +++ b/tests/components/fujitsu_general/test.esp32-idf.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: fujitsu_general - name: Fujitsu General Climate +<<: !include common.yaml diff --git a/tests/components/fujitsu_general/test.esp8266-ard.yaml b/tests/components/fujitsu_general/test.esp8266-ard.yaml index 2a05bdde6b..f5097fcf5f 100644 --- a/tests/components/fujitsu_general/test.esp8266-ard.yaml +++ b/tests/components/fujitsu_general/test.esp8266-ard.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 5 - carrier_duty_percent: 50% +substitutions: + pin: GPIO5 -climate: - - platform: fujitsu_general - name: Fujitsu General Climate +<<: !include common.yaml diff --git a/tests/components/gcja5/common.yaml b/tests/components/gcja5/common.yaml new file mode 100644 index 0000000000..8f6250045d --- /dev/null +++ b/tests/components/gcja5/common.yaml @@ -0,0 +1,25 @@ +uart: + - id: uart_gcja5 + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} + baud_rate: 9600 + parity: EVEN + +sensor: + - platform: gcja5 + pm_1_0: + name: "Particulate Matter <1.0µm Concentration" + pm_2_5: + name: "Particulate Matter <2.5µm Concentration" + pm_10_0: + name: "Particulate Matter <10.0µm Concentration" + pmc_0_5: + name: "PMC 0.5" + pmc_1_0: + name: "PMC 1.0" + pmc_2_5: + name: "PMC 2.5" + pmc_5_0: + name: "PMC 5.0" + pmc_10_0: + name: "PMC 10.0" diff --git a/tests/components/gcja5/test.esp32-ard.yaml b/tests/components/gcja5/test.esp32-ard.yaml index bc0f89eb9e..811f6b72a6 100644 --- a/tests/components/gcja5/test.esp32-ard.yaml +++ b/tests/components/gcja5/test.esp32-ard.yaml @@ -1,25 +1,5 @@ -uart: - - id: uart_gcja5 - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 - parity: EVEN +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 -sensor: - - platform: gcja5 - pm_1_0: - name: "Particulate Matter <1.0µm Concentration" - pm_2_5: - name: "Particulate Matter <2.5µm Concentration" - pm_10_0: - name: "Particulate Matter <10.0µm Concentration" - pmc_0_5: - name: "PMC 0.5" - pmc_1_0: - name: "PMC 1.0" - pmc_2_5: - name: "PMC 2.5" - pmc_5_0: - name: "PMC 5.0" - pmc_10_0: - name: "PMC 10.0" +<<: !include common.yaml diff --git a/tests/components/gcja5/test.esp32-c3-ard.yaml b/tests/components/gcja5/test.esp32-c3-ard.yaml index ec8765be52..b516342f3b 100644 --- a/tests/components/gcja5/test.esp32-c3-ard.yaml +++ b/tests/components/gcja5/test.esp32-c3-ard.yaml @@ -1,25 +1,5 @@ -uart: - - id: uart_gcja5 - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 - parity: EVEN +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -sensor: - - platform: gcja5 - pm_1_0: - name: "Particulate Matter <1.0µm Concentration" - pm_2_5: - name: "Particulate Matter <2.5µm Concentration" - pm_10_0: - name: "Particulate Matter <10.0µm Concentration" - pmc_0_5: - name: "PMC 0.5" - pmc_1_0: - name: "PMC 1.0" - pmc_2_5: - name: "PMC 2.5" - pmc_5_0: - name: "PMC 5.0" - pmc_10_0: - name: "PMC 10.0" +<<: !include common.yaml diff --git a/tests/components/gcja5/test.esp32-c3-idf.yaml b/tests/components/gcja5/test.esp32-c3-idf.yaml index ec8765be52..b516342f3b 100644 --- a/tests/components/gcja5/test.esp32-c3-idf.yaml +++ b/tests/components/gcja5/test.esp32-c3-idf.yaml @@ -1,25 +1,5 @@ -uart: - - id: uart_gcja5 - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 - parity: EVEN +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -sensor: - - platform: gcja5 - pm_1_0: - name: "Particulate Matter <1.0µm Concentration" - pm_2_5: - name: "Particulate Matter <2.5µm Concentration" - pm_10_0: - name: "Particulate Matter <10.0µm Concentration" - pmc_0_5: - name: "PMC 0.5" - pmc_1_0: - name: "PMC 1.0" - pmc_2_5: - name: "PMC 2.5" - pmc_5_0: - name: "PMC 5.0" - pmc_10_0: - name: "PMC 10.0" +<<: !include common.yaml diff --git a/tests/components/gcja5/test.esp32-idf.yaml b/tests/components/gcja5/test.esp32-idf.yaml index bc0f89eb9e..811f6b72a6 100644 --- a/tests/components/gcja5/test.esp32-idf.yaml +++ b/tests/components/gcja5/test.esp32-idf.yaml @@ -1,25 +1,5 @@ -uart: - - id: uart_gcja5 - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 - parity: EVEN +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 -sensor: - - platform: gcja5 - pm_1_0: - name: "Particulate Matter <1.0µm Concentration" - pm_2_5: - name: "Particulate Matter <2.5µm Concentration" - pm_10_0: - name: "Particulate Matter <10.0µm Concentration" - pmc_0_5: - name: "PMC 0.5" - pmc_1_0: - name: "PMC 1.0" - pmc_2_5: - name: "PMC 2.5" - pmc_5_0: - name: "PMC 5.0" - pmc_10_0: - name: "PMC 10.0" +<<: !include common.yaml diff --git a/tests/components/gcja5/test.esp8266-ard.yaml b/tests/components/gcja5/test.esp8266-ard.yaml index ec8765be52..b516342f3b 100644 --- a/tests/components/gcja5/test.esp8266-ard.yaml +++ b/tests/components/gcja5/test.esp8266-ard.yaml @@ -1,25 +1,5 @@ -uart: - - id: uart_gcja5 - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 - parity: EVEN +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -sensor: - - platform: gcja5 - pm_1_0: - name: "Particulate Matter <1.0µm Concentration" - pm_2_5: - name: "Particulate Matter <2.5µm Concentration" - pm_10_0: - name: "Particulate Matter <10.0µm Concentration" - pmc_0_5: - name: "PMC 0.5" - pmc_1_0: - name: "PMC 1.0" - pmc_2_5: - name: "PMC 2.5" - pmc_5_0: - name: "PMC 5.0" - pmc_10_0: - name: "PMC 10.0" +<<: !include common.yaml diff --git a/tests/components/gcja5/test.rp2040-ard.yaml b/tests/components/gcja5/test.rp2040-ard.yaml index ec8765be52..b516342f3b 100644 --- a/tests/components/gcja5/test.rp2040-ard.yaml +++ b/tests/components/gcja5/test.rp2040-ard.yaml @@ -1,25 +1,5 @@ -uart: - - id: uart_gcja5 - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 - parity: EVEN +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -sensor: - - platform: gcja5 - pm_1_0: - name: "Particulate Matter <1.0µm Concentration" - pm_2_5: - name: "Particulate Matter <2.5µm Concentration" - pm_10_0: - name: "Particulate Matter <10.0µm Concentration" - pmc_0_5: - name: "PMC 0.5" - pmc_1_0: - name: "PMC 1.0" - pmc_2_5: - name: "PMC 2.5" - pmc_5_0: - name: "PMC 5.0" - pmc_10_0: - name: "PMC 10.0" +<<: !include common.yaml diff --git a/tests/components/gdk101/common.yaml b/tests/components/gdk101/common.yaml index f886fc415b..7805ad43f0 100644 --- a/tests/components/gdk101/common.yaml +++ b/tests/components/gdk101/common.yaml @@ -1,11 +1,10 @@ i2c: - id: i2c_bus - sda: ${i2c_sda} - scl: ${i2c_scl} + - id: i2c_gdk101 + scl: ${scl_pin} + sda: ${sda_pin} gdk101: id: my_gdk101 - i2c_id: i2c_bus sensor: - platform: gdk101 diff --git a/tests/components/gdk101/test.esp32-ard.yaml b/tests/components/gdk101/test.esp32-ard.yaml index 1037d5d35b..63c3bd6afd 100644 --- a/tests/components/gdk101/test.esp32-ard.yaml +++ b/tests/components/gdk101/test.esp32-ard.yaml @@ -1,5 +1,5 @@ substitutions: - i2c_scl: GPIO16 - i2c_sda: GPIO17 + scl_pin: GPIO16 + sda_pin: GPIO17 <<: !include common.yaml diff --git a/tests/components/gdk101/test.esp32-idf.yaml b/tests/components/gdk101/test.esp32-idf.yaml index 1037d5d35b..63c3bd6afd 100644 --- a/tests/components/gdk101/test.esp32-idf.yaml +++ b/tests/components/gdk101/test.esp32-idf.yaml @@ -1,5 +1,5 @@ substitutions: - i2c_scl: GPIO16 - i2c_sda: GPIO17 + scl_pin: GPIO16 + sda_pin: GPIO17 <<: !include common.yaml diff --git a/tests/components/gdk101/test.esp8266-ard.yaml b/tests/components/gdk101/test.esp8266-ard.yaml index d7ae0d5161..ee2c29ca4e 100644 --- a/tests/components/gdk101/test.esp8266-ard.yaml +++ b/tests/components/gdk101/test.esp8266-ard.yaml @@ -1,5 +1,5 @@ substitutions: - i2c_scl: GPIO5 - i2c_sda: GPIO4 + scl_pin: GPIO5 + sda_pin: GPIO4 <<: !include common.yaml diff --git a/tests/components/gdk101/test.rp2040-ard.yaml b/tests/components/gdk101/test.rp2040-ard.yaml index d7ae0d5161..ee2c29ca4e 100644 --- a/tests/components/gdk101/test.rp2040-ard.yaml +++ b/tests/components/gdk101/test.rp2040-ard.yaml @@ -1,5 +1,5 @@ substitutions: - i2c_scl: GPIO5 - i2c_sda: GPIO4 + scl_pin: GPIO5 + sda_pin: GPIO4 <<: !include common.yaml diff --git a/tests/components/gp2y1010au0f/common.yaml b/tests/components/gp2y1010au0f/common.yaml new file mode 100644 index 0000000000..95112fa712 --- /dev/null +++ b/tests/components/gp2y1010au0f/common.yaml @@ -0,0 +1,15 @@ +sensor: + - platform: adc + id: adc_sensor + pin: ${adc_pin} + - platform: gp2y1010au0f + sensor: adc_sensor + name: Dust Sensor + adc_voltage_offset: 0.2 + adc_voltage_multiplier: 3.3 + output: dust_sensor_led + +output: + - platform: gpio + id: dust_sensor_led + pin: ${output_pin} diff --git a/tests/components/gp2y1010au0f/test.esp32-ard.yaml b/tests/components/gp2y1010au0f/test.esp32-ard.yaml new file mode 100644 index 0000000000..d9494a95b7 --- /dev/null +++ b/tests/components/gp2y1010au0f/test.esp32-ard.yaml @@ -0,0 +1,5 @@ +substitutions: + adc_pin: A0 + output_pin: GPIO14 + +<<: !include common.yaml diff --git a/tests/components/gp2y1010au0f/test.esp32-c3-ard.yaml b/tests/components/gp2y1010au0f/test.esp32-c3-ard.yaml new file mode 100644 index 0000000000..0e331c893c --- /dev/null +++ b/tests/components/gp2y1010au0f/test.esp32-c3-ard.yaml @@ -0,0 +1,5 @@ +substitutions: + adc_pin: GPIO0 + output_pin: GPIO1 + +<<: !include common.yaml diff --git a/tests/components/gp2y1010au0f/test.esp32-c3-idf.yaml b/tests/components/gp2y1010au0f/test.esp32-c3-idf.yaml new file mode 100644 index 0000000000..0e331c893c --- /dev/null +++ b/tests/components/gp2y1010au0f/test.esp32-c3-idf.yaml @@ -0,0 +1,5 @@ +substitutions: + adc_pin: GPIO0 + output_pin: GPIO1 + +<<: !include common.yaml diff --git a/tests/components/gp2y1010au0f/test.esp32-idf.yaml b/tests/components/gp2y1010au0f/test.esp32-idf.yaml index eb5ad0ea67..d9494a95b7 100644 --- a/tests/components/gp2y1010au0f/test.esp32-idf.yaml +++ b/tests/components/gp2y1010au0f/test.esp32-idf.yaml @@ -1,16 +1,5 @@ -sensor: - - platform: adc - pin: GPIO36 - id: adc_sensor +substitutions: + adc_pin: A0 + output_pin: GPIO14 - - platform: gp2y1010au0f - sensor: adc_sensor - name: Dust Sensor - adc_voltage_offset: 0.2 - adc_voltage_multiplier: 3.3 - output: dust_sensor_led - -output: - - platform: gpio - id: dust_sensor_led - pin: GPIO32 +<<: !include common.yaml diff --git a/tests/components/gp2y1010au0f/test.esp8266-ard.yaml b/tests/components/gp2y1010au0f/test.esp8266-ard.yaml new file mode 100644 index 0000000000..a61053426a --- /dev/null +++ b/tests/components/gp2y1010au0f/test.esp8266-ard.yaml @@ -0,0 +1,5 @@ +substitutions: + adc_pin: A0 + output_pin: GPIO5 + +<<: !include common.yaml diff --git a/tests/components/gp2y1010au0f/test.rp2040-ard.yaml b/tests/components/gp2y1010au0f/test.rp2040-ard.yaml new file mode 100644 index 0000000000..e00f19941c --- /dev/null +++ b/tests/components/gp2y1010au0f/test.rp2040-ard.yaml @@ -0,0 +1,5 @@ +substitutions: + adc_pin: GPIO26 + output_pin: GPIO5 + +<<: !include common.yaml diff --git a/tests/components/gp8403/common.yaml b/tests/components/gp8403/common.yaml new file mode 100644 index 0000000000..7074185273 --- /dev/null +++ b/tests/components/gp8403/common.yaml @@ -0,0 +1,20 @@ +i2c: + - id: i2c_gp8403 + scl: ${scl_pin} + sda: ${sda_pin} + +gp8403: + - id: gp8403_5v + voltage: 5V + - id: gp8403_10v + voltage: 10V + +output: + - platform: gp8403 + id: gp8403_output_0 + gp8403_id: gp8403_5v + channel: 0 + - platform: gp8403 + gp8403_id: gp8403_10v + id: gp8403_output_1 + channel: 1 diff --git a/tests/components/gp8403/test.esp32-ard.yaml b/tests/components/gp8403/test.esp32-ard.yaml index 8470a303e1..63c3bd6afd 100644 --- a/tests/components/gp8403/test.esp32-ard.yaml +++ b/tests/components/gp8403/test.esp32-ard.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_gp8403 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -gp8403: - - id: gp8403_5v - voltage: 5V - - id: gp8403_10v - voltage: 10V - -output: - - platform: gp8403 - id: gp8403_output_0 - gp8403_id: gp8403_5v - channel: 0 - - platform: gp8403 - gp8403_id: gp8403_10v - id: gp8403_output_1 - channel: 1 +<<: !include common.yaml diff --git a/tests/components/gp8403/test.esp32-c3-ard.yaml b/tests/components/gp8403/test.esp32-c3-ard.yaml index fbc40b948b..ee2c29ca4e 100644 --- a/tests/components/gp8403/test.esp32-c3-ard.yaml +++ b/tests/components/gp8403/test.esp32-c3-ard.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_gp8403 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -gp8403: - - id: gp8403_5v - voltage: 5V - - id: gp8403_10v - voltage: 10V - -output: - - platform: gp8403 - id: gp8403_output_0 - gp8403_id: gp8403_5v - channel: 0 - - platform: gp8403 - gp8403_id: gp8403_10v - id: gp8403_output_1 - channel: 1 +<<: !include common.yaml diff --git a/tests/components/gp8403/test.esp32-c3-idf.yaml b/tests/components/gp8403/test.esp32-c3-idf.yaml index fbc40b948b..ee2c29ca4e 100644 --- a/tests/components/gp8403/test.esp32-c3-idf.yaml +++ b/tests/components/gp8403/test.esp32-c3-idf.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_gp8403 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -gp8403: - - id: gp8403_5v - voltage: 5V - - id: gp8403_10v - voltage: 10V - -output: - - platform: gp8403 - id: gp8403_output_0 - gp8403_id: gp8403_5v - channel: 0 - - platform: gp8403 - gp8403_id: gp8403_10v - id: gp8403_output_1 - channel: 1 +<<: !include common.yaml diff --git a/tests/components/gp8403/test.esp32-idf.yaml b/tests/components/gp8403/test.esp32-idf.yaml index 8470a303e1..63c3bd6afd 100644 --- a/tests/components/gp8403/test.esp32-idf.yaml +++ b/tests/components/gp8403/test.esp32-idf.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_gp8403 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -gp8403: - - id: gp8403_5v - voltage: 5V - - id: gp8403_10v - voltage: 10V - -output: - - platform: gp8403 - id: gp8403_output_0 - gp8403_id: gp8403_5v - channel: 0 - - platform: gp8403 - gp8403_id: gp8403_10v - id: gp8403_output_1 - channel: 1 +<<: !include common.yaml diff --git a/tests/components/gp8403/test.esp8266-ard.yaml b/tests/components/gp8403/test.esp8266-ard.yaml index fbc40b948b..ee2c29ca4e 100644 --- a/tests/components/gp8403/test.esp8266-ard.yaml +++ b/tests/components/gp8403/test.esp8266-ard.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_gp8403 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -gp8403: - - id: gp8403_5v - voltage: 5V - - id: gp8403_10v - voltage: 10V - -output: - - platform: gp8403 - id: gp8403_output_0 - gp8403_id: gp8403_5v - channel: 0 - - platform: gp8403 - gp8403_id: gp8403_10v - id: gp8403_output_1 - channel: 1 +<<: !include common.yaml diff --git a/tests/components/gp8403/test.rp2040-ard.yaml b/tests/components/gp8403/test.rp2040-ard.yaml index fbc40b948b..ee2c29ca4e 100644 --- a/tests/components/gp8403/test.rp2040-ard.yaml +++ b/tests/components/gp8403/test.rp2040-ard.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_gp8403 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -gp8403: - - id: gp8403_5v - voltage: 5V - - id: gp8403_10v - voltage: 10V - -output: - - platform: gp8403 - id: gp8403_output_0 - gp8403_id: gp8403_5v - channel: 0 - - platform: gp8403 - gp8403_id: gp8403_10v - id: gp8403_output_1 - channel: 1 +<<: !include common.yaml diff --git a/tests/components/gpio/common.yaml b/tests/components/gpio/common.yaml new file mode 100644 index 0000000000..4e237349d9 --- /dev/null +++ b/tests/components/gpio/common.yaml @@ -0,0 +1,14 @@ +binary_sensor: + - platform: gpio + pin: ${binary_sensor_pin} + id: gpio_binary_sensor + +output: + - platform: gpio + pin: ${output_pin} + id: gpio_output + +switch: + - platform: gpio + pin: ${switch_pin} + id: gpio_switch diff --git a/tests/components/gpio/test.esp32-ard.yaml b/tests/components/gpio/test.esp32-ard.yaml index 30dfa94b68..09f41abb79 100644 --- a/tests/components/gpio/test.esp32-ard.yaml +++ b/tests/components/gpio/test.esp32-ard.yaml @@ -1,14 +1,6 @@ -binary_sensor: - - platform: gpio - pin: 12 - id: gpio_binary_sensor +substitutions: + binary_sensor_pin: GPIO12 + output_pin: GPIO13 + switch_pin: GPIO14 -output: - - platform: gpio - pin: 13 - id: gpio_output - -switch: - - platform: gpio - pin: 14 - id: gpio_switch +<<: !include common.yaml diff --git a/tests/components/gpio/test.esp32-c3-ard.yaml b/tests/components/gpio/test.esp32-c3-ard.yaml index 3ca285117d..fc7c9942d0 100644 --- a/tests/components/gpio/test.esp32-c3-ard.yaml +++ b/tests/components/gpio/test.esp32-c3-ard.yaml @@ -1,14 +1,6 @@ -binary_sensor: - - platform: gpio - pin: 2 - id: gpio_binary_sensor +substitutions: + binary_sensor_pin: GPIO2 + output_pin: GPIO3 + switch_pin: GPIO4 -output: - - platform: gpio - pin: 3 - id: gpio_output - -switch: - - platform: gpio - pin: 4 - id: gpio_switch +<<: !include common.yaml diff --git a/tests/components/gpio/test.esp32-c3-idf.yaml b/tests/components/gpio/test.esp32-c3-idf.yaml index 3ca285117d..fc7c9942d0 100644 --- a/tests/components/gpio/test.esp32-c3-idf.yaml +++ b/tests/components/gpio/test.esp32-c3-idf.yaml @@ -1,14 +1,6 @@ -binary_sensor: - - platform: gpio - pin: 2 - id: gpio_binary_sensor +substitutions: + binary_sensor_pin: GPIO2 + output_pin: GPIO3 + switch_pin: GPIO4 -output: - - platform: gpio - pin: 3 - id: gpio_output - -switch: - - platform: gpio - pin: 4 - id: gpio_switch +<<: !include common.yaml diff --git a/tests/components/gpio/test.esp32-idf.yaml b/tests/components/gpio/test.esp32-idf.yaml index 30dfa94b68..09f41abb79 100644 --- a/tests/components/gpio/test.esp32-idf.yaml +++ b/tests/components/gpio/test.esp32-idf.yaml @@ -1,14 +1,6 @@ -binary_sensor: - - platform: gpio - pin: 12 - id: gpio_binary_sensor +substitutions: + binary_sensor_pin: GPIO12 + output_pin: GPIO13 + switch_pin: GPIO14 -output: - - platform: gpio - pin: 13 - id: gpio_output - -switch: - - platform: gpio - pin: 14 - id: gpio_switch +<<: !include common.yaml diff --git a/tests/components/gpio/test.esp8266-ard.yaml b/tests/components/gpio/test.esp8266-ard.yaml index 30dfa94b68..09f41abb79 100644 --- a/tests/components/gpio/test.esp8266-ard.yaml +++ b/tests/components/gpio/test.esp8266-ard.yaml @@ -1,14 +1,6 @@ -binary_sensor: - - platform: gpio - pin: 12 - id: gpio_binary_sensor +substitutions: + binary_sensor_pin: GPIO12 + output_pin: GPIO13 + switch_pin: GPIO14 -output: - - platform: gpio - pin: 13 - id: gpio_output - -switch: - - platform: gpio - pin: 14 - id: gpio_switch +<<: !include common.yaml diff --git a/tests/components/gpio/test.rp2040-ard.yaml b/tests/components/gpio/test.rp2040-ard.yaml index 3ca285117d..fc7c9942d0 100644 --- a/tests/components/gpio/test.rp2040-ard.yaml +++ b/tests/components/gpio/test.rp2040-ard.yaml @@ -1,14 +1,6 @@ -binary_sensor: - - platform: gpio - pin: 2 - id: gpio_binary_sensor +substitutions: + binary_sensor_pin: GPIO2 + output_pin: GPIO3 + switch_pin: GPIO4 -output: - - platform: gpio - pin: 3 - id: gpio_output - -switch: - - platform: gpio - pin: 4 - id: gpio_switch +<<: !include common.yaml diff --git a/tests/components/gps/common.yaml b/tests/components/gps/common.yaml new file mode 100644 index 0000000000..fc8228c909 --- /dev/null +++ b/tests/components/gps/common.yaml @@ -0,0 +1,14 @@ +uart: + - id: uart_gps + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} + baud_rate: 9600 + parity: EVEN + +gps: + +time: + - platform: gps + on_time_sync: + then: + logger.log: "It's time!" diff --git a/tests/components/gps/test.esp32-ard.yaml b/tests/components/gps/test.esp32-ard.yaml index c4e4cf9f6f..811f6b72a6 100644 --- a/tests/components/gps/test.esp32-ard.yaml +++ b/tests/components/gps/test.esp32-ard.yaml @@ -1,14 +1,5 @@ -uart: - - id: uart_gps - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 - parity: EVEN +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 -gps: - -time: - - platform: gps - on_time_sync: - then: - logger.log: "It's time!" +<<: !include common.yaml diff --git a/tests/components/gps/test.esp32-c3-ard.yaml b/tests/components/gps/test.esp32-c3-ard.yaml index 031f45b873..b516342f3b 100644 --- a/tests/components/gps/test.esp32-c3-ard.yaml +++ b/tests/components/gps/test.esp32-c3-ard.yaml @@ -1,14 +1,5 @@ -uart: - - id: uart_gps - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 - parity: EVEN +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -gps: - -time: - - platform: gps - on_time_sync: - then: - logger.log: "It's time!" +<<: !include common.yaml diff --git a/tests/components/gps/test.esp8266-ard.yaml b/tests/components/gps/test.esp8266-ard.yaml index 031f45b873..b516342f3b 100644 --- a/tests/components/gps/test.esp8266-ard.yaml +++ b/tests/components/gps/test.esp8266-ard.yaml @@ -1,14 +1,5 @@ -uart: - - id: uart_gps - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 - parity: EVEN +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -gps: - -time: - - platform: gps - on_time_sync: - then: - logger.log: "It's time!" +<<: !include common.yaml diff --git a/tests/components/gps/test.rp2040-ard.yaml b/tests/components/gps/test.rp2040-ard.yaml index 031f45b873..b516342f3b 100644 --- a/tests/components/gps/test.rp2040-ard.yaml +++ b/tests/components/gps/test.rp2040-ard.yaml @@ -1,14 +1,5 @@ -uart: - - id: uart_gps - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 - parity: EVEN +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -gps: - -time: - - platform: gps - on_time_sync: - then: - logger.log: "It's time!" +<<: !include common.yaml diff --git a/tests/components/graph/common.yaml b/tests/components/graph/common.yaml new file mode 100644 index 0000000000..d2a6a9422d --- /dev/null +++ b/tests/components/graph/common.yaml @@ -0,0 +1,25 @@ +i2c: + - id: i2c_graph + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: template + id: some_sensor + +graph: + - id: some_graph + sensor: some_sensor + duration: 1h + width: 100 + height: 100 + +display: + - platform: ssd1306_i2c + id: ssd1306_display + model: SSD1306_128X64 + reset_pin: ${reset_pin} + pages: + - id: page1 + lambda: |- + it.rectangle(0, 0, it.get_width(), it.get_height()); diff --git a/tests/components/graph/test.esp32-ard.yaml b/tests/components/graph/test.esp32-ard.yaml index 8c0c0d4c9e..1ca773e06c 100644 --- a/tests/components/graph/test.esp32-ard.yaml +++ b/tests/components/graph/test.esp32-ard.yaml @@ -1,25 +1,6 @@ -i2c: - - id: i2c_graph - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 + reset_pin: GPIO15 -sensor: - - platform: template - id: some_sensor - -graph: - - id: some_graph - sensor: some_sensor - duration: 1h - width: 100 - height: 100 - -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 13 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); +<<: !include common.yaml diff --git a/tests/components/graph/test.esp32-c3-ard.yaml b/tests/components/graph/test.esp32-c3-ard.yaml index 8ce40e84ac..1e6670c196 100644 --- a/tests/components/graph/test.esp32-c3-ard.yaml +++ b/tests/components/graph/test.esp32-c3-ard.yaml @@ -1,25 +1,6 @@ -i2c: - - id: i2c_graph - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + reset_pin: GPIO6 -sensor: - - platform: template - id: some_sensor - -graph: - - id: some_graph - sensor: some_sensor - duration: 1h - width: 100 - height: 100 - -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 3 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); +<<: !include common.yaml diff --git a/tests/components/graph/test.esp32-c3-idf.yaml b/tests/components/graph/test.esp32-c3-idf.yaml index 8ce40e84ac..1e6670c196 100644 --- a/tests/components/graph/test.esp32-c3-idf.yaml +++ b/tests/components/graph/test.esp32-c3-idf.yaml @@ -1,25 +1,6 @@ -i2c: - - id: i2c_graph - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + reset_pin: GPIO6 -sensor: - - platform: template - id: some_sensor - -graph: - - id: some_graph - sensor: some_sensor - duration: 1h - width: 100 - height: 100 - -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 3 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); +<<: !include common.yaml diff --git a/tests/components/graph/test.esp32-idf.yaml b/tests/components/graph/test.esp32-idf.yaml index 8c0c0d4c9e..1ca773e06c 100644 --- a/tests/components/graph/test.esp32-idf.yaml +++ b/tests/components/graph/test.esp32-idf.yaml @@ -1,25 +1,6 @@ -i2c: - - id: i2c_graph - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 + reset_pin: GPIO15 -sensor: - - platform: template - id: some_sensor - -graph: - - id: some_graph - sensor: some_sensor - duration: 1h - width: 100 - height: 100 - -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 13 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); +<<: !include common.yaml diff --git a/tests/components/graph/test.esp8266-ard.yaml b/tests/components/graph/test.esp8266-ard.yaml index 33318355d5..dfdc12a3d1 100644 --- a/tests/components/graph/test.esp8266-ard.yaml +++ b/tests/components/graph/test.esp8266-ard.yaml @@ -1,25 +1,6 @@ -i2c: - - id: i2c_graph - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + reset_pin: GPIO15 -sensor: - - platform: template - id: some_sensor - -graph: - - id: some_graph - sensor: some_sensor - duration: 1h - width: 100 - height: 100 - -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 13 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); +<<: !include common.yaml diff --git a/tests/components/graph/test.rp2040-ard.yaml b/tests/components/graph/test.rp2040-ard.yaml index 8ce40e84ac..1e6670c196 100644 --- a/tests/components/graph/test.rp2040-ard.yaml +++ b/tests/components/graph/test.rp2040-ard.yaml @@ -1,25 +1,6 @@ -i2c: - - id: i2c_graph - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + reset_pin: GPIO6 -sensor: - - platform: template - id: some_sensor - -graph: - - id: some_graph - sensor: some_sensor - duration: 1h - width: 100 - height: 100 - -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 3 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); +<<: !include common.yaml diff --git a/tests/components/graphical_display_menu/common.yaml b/tests/components/graphical_display_menu/common.yaml new file mode 100644 index 0000000000..d979a6a30e --- /dev/null +++ b/tests/components/graphical_display_menu/common.yaml @@ -0,0 +1,120 @@ +i2c: + - id: i2c_graphical_display_menu + scl: ${scl_pin} + sda: ${sda_pin} + +display: + - platform: ssd1306_i2c + id: ssd1306_display + model: SSD1306_128X64 + reset_pin: ${reset_pin} + pages: + - id: page1 + lambda: |- + it.rectangle(0, 0, it.get_width(), it.get_height()); + +font: + - file: "gfonts://Roboto" + id: roboto + size: 20 + +number: + - platform: template + id: test_number + min_value: 0 + step: 1 + max_value: 10 + optimistic: true + +select: + - platform: template + id: test_select + options: + - one + - two + optimistic: true + +switch: + - platform: template + id: test_switch + optimistic: true + +graphical_display_menu: + id: test_graphical_display_menu + display: ssd1306_display + font: roboto + active: false + mode: rotary + on_enter: + then: + lambda: 'ESP_LOGI("graphical_display_menu", "root enter");' + on_leave: + then: + lambda: 'ESP_LOGI("graphical_display_menu", "root leave");' + items: + - type: back + text: "Back" + - type: label + - type: menu + text: "Submenu 1" + items: + - type: back + text: "Back" + - type: menu + text: "Submenu 21" + items: + - type: back + text: "Back" + - type: command + text: "Show Main" + on_value: + then: + - display_menu.show_main: test_graphical_display_menu + - type: select + text: "Enum Item" + immediate_edit: true + select: test_select + on_enter: + then: + lambda: 'ESP_LOGI("graphical_display_menu", "select enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' + on_leave: + then: + lambda: 'ESP_LOGI("graphical_display_menu", "select leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' + on_value: + then: + lambda: 'ESP_LOGI("graphical_display_menu", "select value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' + - type: number + text: "Number" + number: test_number + on_enter: + then: + lambda: 'ESP_LOGI("graphical_display_menu", "number enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' + on_leave: + then: + lambda: 'ESP_LOGI("graphical_display_menu", "number leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' + on_value: + then: + lambda: 'ESP_LOGI("graphical_display_menu", "number value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' + - type: command + text: "Hide" + on_value: + then: + - display_menu.hide: test_graphical_display_menu + - type: switch + text: "Switch" + switch: test_switch + on_text: "Bright" + off_text: "Dark" + immediate_edit: false + on_value: + then: + lambda: 'ESP_LOGI("graphical_display_menu", "switch value: %s", it->get_value_text().c_str());' + - type: custom + text: !lambda 'return "Custom";' + value_lambda: 'return "Val";' + on_next: + then: + lambda: 'ESP_LOGI("graphical_display_menu", "custom next: %s", it->get_text().c_str());' + on_prev: + then: + lambda: 'ESP_LOGI("graphical_display_menu", "custom prev: %s", it->get_text().c_str());' diff --git a/tests/components/graphical_display_menu/test.esp32-ard.yaml b/tests/components/graphical_display_menu/test.esp32-ard.yaml index a0897536d7..1ca773e06c 100644 --- a/tests/components/graphical_display_menu/test.esp32-ard.yaml +++ b/tests/components/graphical_display_menu/test.esp32-ard.yaml @@ -1,120 +1,6 @@ -i2c: - - id: i2c_graphical_display_menu - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 + reset_pin: GPIO15 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 13 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -font: - - file: "gfonts://Roboto" - id: roboto - size: 20 - -number: - - platform: template - id: test_number - min_value: 0 - step: 1 - max_value: 10 - optimistic: true - -select: - - platform: template - id: test_select - options: - - one - - two - optimistic: true - -switch: - - platform: template - id: test_switch - optimistic: true - -graphical_display_menu: - id: test_graphical_display_menu - display: ssd1306_display - font: roboto - active: false - mode: rotary - on_enter: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "root enter");' - on_leave: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "root leave");' - items: - - type: back - text: "Back" - - type: label - - type: menu - text: "Submenu 1" - items: - - type: back - text: "Back" - - type: menu - text: "Submenu 21" - items: - - type: back - text: "Back" - - type: command - text: "Show Main" - on_value: - then: - - display_menu.show_main: test_graphical_display_menu - - type: select - text: "Enum Item" - immediate_edit: true - select: test_select - on_enter: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "select enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_leave: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "select leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_value: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "select value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - - type: number - text: "Number" - number: test_number - on_enter: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "number enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_leave: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "number leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_value: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "number value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - - type: command - text: "Hide" - on_value: - then: - - display_menu.hide: test_graphical_display_menu - - type: switch - text: "Switch" - switch: test_switch - on_text: "Bright" - off_text: "Dark" - immediate_edit: false - on_value: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "switch value: %s", it->get_value_text().c_str());' - - type: custom - text: !lambda 'return "Custom";' - value_lambda: 'return "Val";' - on_next: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "custom next: %s", it->get_text().c_str());' - on_prev: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "custom prev: %s", it->get_text().c_str());' +<<: !include common.yaml diff --git a/tests/components/graphical_display_menu/test.esp32-c3-ard.yaml b/tests/components/graphical_display_menu/test.esp32-c3-ard.yaml index 23acd4e4d9..1e6670c196 100644 --- a/tests/components/graphical_display_menu/test.esp32-c3-ard.yaml +++ b/tests/components/graphical_display_menu/test.esp32-c3-ard.yaml @@ -1,120 +1,6 @@ -i2c: - - id: i2c_graphical_display_menu - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + reset_pin: GPIO6 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 3 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -font: - - file: "gfonts://Roboto" - id: roboto - size: 20 - -number: - - platform: template - id: test_number - min_value: 0 - step: 1 - max_value: 10 - optimistic: true - -select: - - platform: template - id: test_select - options: - - one - - two - optimistic: true - -switch: - - platform: template - id: test_switch - optimistic: true - -graphical_display_menu: - id: test_graphical_display_menu - display: ssd1306_display - font: roboto - active: false - mode: rotary - on_enter: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "root enter");' - on_leave: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "root leave");' - items: - - type: back - text: "Back" - - type: label - - type: menu - text: "Submenu 1" - items: - - type: back - text: "Back" - - type: menu - text: "Submenu 21" - items: - - type: back - text: "Back" - - type: command - text: "Show Main" - on_value: - then: - - display_menu.show_main: test_graphical_display_menu - - type: select - text: "Enum Item" - immediate_edit: true - select: test_select - on_enter: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "select enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_leave: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "select leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_value: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "select value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - - type: number - text: "Number" - number: test_number - on_enter: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "number enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_leave: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "number leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_value: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "number value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - - type: command - text: "Hide" - on_value: - then: - - display_menu.hide: test_graphical_display_menu - - type: switch - text: "Switch" - switch: test_switch - on_text: "Bright" - off_text: "Dark" - immediate_edit: false - on_value: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "switch value: %s", it->get_value_text().c_str());' - - type: custom - text: !lambda 'return "Custom";' - value_lambda: 'return "Val";' - on_next: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "custom next: %s", it->get_text().c_str());' - on_prev: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "custom prev: %s", it->get_text().c_str());' +<<: !include common.yaml diff --git a/tests/components/graphical_display_menu/test.esp32-c3-idf.yaml b/tests/components/graphical_display_menu/test.esp32-c3-idf.yaml index 23acd4e4d9..1e6670c196 100644 --- a/tests/components/graphical_display_menu/test.esp32-c3-idf.yaml +++ b/tests/components/graphical_display_menu/test.esp32-c3-idf.yaml @@ -1,120 +1,6 @@ -i2c: - - id: i2c_graphical_display_menu - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + reset_pin: GPIO6 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 3 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -font: - - file: "gfonts://Roboto" - id: roboto - size: 20 - -number: - - platform: template - id: test_number - min_value: 0 - step: 1 - max_value: 10 - optimistic: true - -select: - - platform: template - id: test_select - options: - - one - - two - optimistic: true - -switch: - - platform: template - id: test_switch - optimistic: true - -graphical_display_menu: - id: test_graphical_display_menu - display: ssd1306_display - font: roboto - active: false - mode: rotary - on_enter: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "root enter");' - on_leave: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "root leave");' - items: - - type: back - text: "Back" - - type: label - - type: menu - text: "Submenu 1" - items: - - type: back - text: "Back" - - type: menu - text: "Submenu 21" - items: - - type: back - text: "Back" - - type: command - text: "Show Main" - on_value: - then: - - display_menu.show_main: test_graphical_display_menu - - type: select - text: "Enum Item" - immediate_edit: true - select: test_select - on_enter: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "select enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_leave: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "select leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_value: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "select value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - - type: number - text: "Number" - number: test_number - on_enter: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "number enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_leave: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "number leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_value: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "number value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - - type: command - text: "Hide" - on_value: - then: - - display_menu.hide: test_graphical_display_menu - - type: switch - text: "Switch" - switch: test_switch - on_text: "Bright" - off_text: "Dark" - immediate_edit: false - on_value: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "switch value: %s", it->get_value_text().c_str());' - - type: custom - text: !lambda 'return "Custom";' - value_lambda: 'return "Val";' - on_next: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "custom next: %s", it->get_text().c_str());' - on_prev: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "custom prev: %s", it->get_text().c_str());' +<<: !include common.yaml diff --git a/tests/components/graphical_display_menu/test.esp32-idf.yaml b/tests/components/graphical_display_menu/test.esp32-idf.yaml index a0897536d7..1ca773e06c 100644 --- a/tests/components/graphical_display_menu/test.esp32-idf.yaml +++ b/tests/components/graphical_display_menu/test.esp32-idf.yaml @@ -1,120 +1,6 @@ -i2c: - - id: i2c_graphical_display_menu - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 + reset_pin: GPIO15 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 13 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -font: - - file: "gfonts://Roboto" - id: roboto - size: 20 - -number: - - platform: template - id: test_number - min_value: 0 - step: 1 - max_value: 10 - optimistic: true - -select: - - platform: template - id: test_select - options: - - one - - two - optimistic: true - -switch: - - platform: template - id: test_switch - optimistic: true - -graphical_display_menu: - id: test_graphical_display_menu - display: ssd1306_display - font: roboto - active: false - mode: rotary - on_enter: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "root enter");' - on_leave: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "root leave");' - items: - - type: back - text: "Back" - - type: label - - type: menu - text: "Submenu 1" - items: - - type: back - text: "Back" - - type: menu - text: "Submenu 21" - items: - - type: back - text: "Back" - - type: command - text: "Show Main" - on_value: - then: - - display_menu.show_main: test_graphical_display_menu - - type: select - text: "Enum Item" - immediate_edit: true - select: test_select - on_enter: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "select enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_leave: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "select leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_value: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "select value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - - type: number - text: "Number" - number: test_number - on_enter: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "number enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_leave: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "number leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_value: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "number value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - - type: command - text: "Hide" - on_value: - then: - - display_menu.hide: test_graphical_display_menu - - type: switch - text: "Switch" - switch: test_switch - on_text: "Bright" - off_text: "Dark" - immediate_edit: false - on_value: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "switch value: %s", it->get_value_text().c_str());' - - type: custom - text: !lambda 'return "Custom";' - value_lambda: 'return "Val";' - on_next: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "custom next: %s", it->get_text().c_str());' - on_prev: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "custom prev: %s", it->get_text().c_str());' +<<: !include common.yaml diff --git a/tests/components/graphical_display_menu/test.esp8266-ard.yaml b/tests/components/graphical_display_menu/test.esp8266-ard.yaml index 28c1a7298d..dfdc12a3d1 100644 --- a/tests/components/graphical_display_menu/test.esp8266-ard.yaml +++ b/tests/components/graphical_display_menu/test.esp8266-ard.yaml @@ -1,120 +1,6 @@ -i2c: - - id: i2c_graphical_display_menu - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + reset_pin: GPIO15 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 13 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -font: - - file: "gfonts://Roboto" - id: roboto - size: 20 - -number: - - platform: template - id: test_number - min_value: 0 - step: 1 - max_value: 10 - optimistic: true - -select: - - platform: template - id: test_select - options: - - one - - two - optimistic: true - -switch: - - platform: template - id: test_switch - optimistic: true - -graphical_display_menu: - id: test_graphical_display_menu - display: ssd1306_display - font: roboto - active: false - mode: rotary - on_enter: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "root enter");' - on_leave: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "root leave");' - items: - - type: back - text: "Back" - - type: label - - type: menu - text: "Submenu 1" - items: - - type: back - text: "Back" - - type: menu - text: "Submenu 21" - items: - - type: back - text: "Back" - - type: command - text: "Show Main" - on_value: - then: - - display_menu.show_main: test_graphical_display_menu - - type: select - text: "Enum Item" - immediate_edit: true - select: test_select - on_enter: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "select enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_leave: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "select leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_value: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "select value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - - type: number - text: "Number" - number: test_number - on_enter: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "number enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_leave: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "number leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_value: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "number value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - - type: command - text: "Hide" - on_value: - then: - - display_menu.hide: test_graphical_display_menu - - type: switch - text: "Switch" - switch: test_switch - on_text: "Bright" - off_text: "Dark" - immediate_edit: false - on_value: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "switch value: %s", it->get_value_text().c_str());' - - type: custom - text: !lambda 'return "Custom";' - value_lambda: 'return "Val";' - on_next: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "custom next: %s", it->get_text().c_str());' - on_prev: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "custom prev: %s", it->get_text().c_str());' +<<: !include common.yaml diff --git a/tests/components/graphical_display_menu/test.rp2040-ard.yaml b/tests/components/graphical_display_menu/test.rp2040-ard.yaml index 23acd4e4d9..1e6670c196 100644 --- a/tests/components/graphical_display_menu/test.rp2040-ard.yaml +++ b/tests/components/graphical_display_menu/test.rp2040-ard.yaml @@ -1,120 +1,6 @@ -i2c: - - id: i2c_graphical_display_menu - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + reset_pin: GPIO6 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 3 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -font: - - file: "gfonts://Roboto" - id: roboto - size: 20 - -number: - - platform: template - id: test_number - min_value: 0 - step: 1 - max_value: 10 - optimistic: true - -select: - - platform: template - id: test_select - options: - - one - - two - optimistic: true - -switch: - - platform: template - id: test_switch - optimistic: true - -graphical_display_menu: - id: test_graphical_display_menu - display: ssd1306_display - font: roboto - active: false - mode: rotary - on_enter: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "root enter");' - on_leave: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "root leave");' - items: - - type: back - text: "Back" - - type: label - - type: menu - text: "Submenu 1" - items: - - type: back - text: "Back" - - type: menu - text: "Submenu 21" - items: - - type: back - text: "Back" - - type: command - text: "Show Main" - on_value: - then: - - display_menu.show_main: test_graphical_display_menu - - type: select - text: "Enum Item" - immediate_edit: true - select: test_select - on_enter: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "select enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_leave: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "select leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_value: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "select value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - - type: number - text: "Number" - number: test_number - on_enter: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "number enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_leave: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "number leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_value: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "number value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - - type: command - text: "Hide" - on_value: - then: - - display_menu.hide: test_graphical_display_menu - - type: switch - text: "Switch" - switch: test_switch - on_text: "Bright" - off_text: "Dark" - immediate_edit: false - on_value: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "switch value: %s", it->get_value_text().c_str());' - - type: custom - text: !lambda 'return "Custom";' - value_lambda: 'return "Val";' - on_next: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "custom next: %s", it->get_text().c_str());' - on_prev: - then: - lambda: 'ESP_LOGI("graphical_display_menu", "custom prev: %s", it->get_text().c_str());' +<<: !include common.yaml diff --git a/tests/components/gree/common.yaml b/tests/components/gree/common.yaml new file mode 100644 index 0000000000..c221184bbf --- /dev/null +++ b/tests/components/gree/common.yaml @@ -0,0 +1,8 @@ +remote_transmitter: + pin: ${pin} + carrier_duty_percent: 50% + +climate: + - platform: gree + name: GREE + model: generic diff --git a/tests/components/gree/test.esp32-ard.yaml b/tests/components/gree/test.esp32-ard.yaml index 91491d7e16..7b012aa64c 100644 --- a/tests/components/gree/test.esp32-ard.yaml +++ b/tests/components/gree/test.esp32-ard.yaml @@ -1,8 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: gree - name: GREE - model: generic +<<: !include common.yaml diff --git a/tests/components/gree/test.esp32-c3-ard.yaml b/tests/components/gree/test.esp32-c3-ard.yaml index 91491d7e16..7b012aa64c 100644 --- a/tests/components/gree/test.esp32-c3-ard.yaml +++ b/tests/components/gree/test.esp32-c3-ard.yaml @@ -1,8 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: gree - name: GREE - model: generic +<<: !include common.yaml diff --git a/tests/components/gree/test.esp32-c3-idf.yaml b/tests/components/gree/test.esp32-c3-idf.yaml index 91491d7e16..7b012aa64c 100644 --- a/tests/components/gree/test.esp32-c3-idf.yaml +++ b/tests/components/gree/test.esp32-c3-idf.yaml @@ -1,8 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: gree - name: GREE - model: generic +<<: !include common.yaml diff --git a/tests/components/gree/test.esp32-idf.yaml b/tests/components/gree/test.esp32-idf.yaml index 91491d7e16..7b012aa64c 100644 --- a/tests/components/gree/test.esp32-idf.yaml +++ b/tests/components/gree/test.esp32-idf.yaml @@ -1,8 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: gree - name: GREE - model: generic +<<: !include common.yaml diff --git a/tests/components/gree/test.esp8266-ard.yaml b/tests/components/gree/test.esp8266-ard.yaml index d0542973ce..f5097fcf5f 100644 --- a/tests/components/gree/test.esp8266-ard.yaml +++ b/tests/components/gree/test.esp8266-ard.yaml @@ -1,8 +1,4 @@ -remote_transmitter: - pin: 5 - carrier_duty_percent: 50% +substitutions: + pin: GPIO5 -climate: - - platform: gree - name: GREE - model: generic +<<: !include common.yaml diff --git a/tests/components/grove_gas_mc_v2/common.yaml b/tests/components/grove_gas_mc_v2/common.yaml index 0729e6b9c7..dbdb950033 100644 --- a/tests/components/grove_gas_mc_v2/common.yaml +++ b/tests/components/grove_gas_mc_v2/common.yaml @@ -1,6 +1,10 @@ +i2c: + - id: i2c_grove_gas_mc_v2 + scl: ${scl_pin} + sda: ${sda_pin} + sensor: - platform: grove_gas_mc_v2 - i2c_id: i2c_bus nitrogen_dioxide: name: "Nitrogen Dioxide" ethanol: diff --git a/tests/components/grove_gas_mc_v2/test.esp32-ard.yaml b/tests/components/grove_gas_mc_v2/test.esp32-ard.yaml index 00c7856c36..63c3bd6afd 100644 --- a/tests/components/grove_gas_mc_v2/test.esp32-ard.yaml +++ b/tests/components/grove_gas_mc_v2/test.esp32-ard.yaml @@ -1,6 +1,5 @@ -i2c: - sda: 21 - scl: 22 - id: i2c_bus +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 <<: !include common.yaml diff --git a/tests/components/grove_gas_mc_v2/test.esp32-c3-ard.yaml b/tests/components/grove_gas_mc_v2/test.esp32-c3-ard.yaml new file mode 100644 index 0000000000..ee2c29ca4e --- /dev/null +++ b/tests/components/grove_gas_mc_v2/test.esp32-c3-ard.yaml @@ -0,0 +1,5 @@ +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + +<<: !include common.yaml diff --git a/tests/components/grove_gas_mc_v2/test.esp32-c3-idf.yaml b/tests/components/grove_gas_mc_v2/test.esp32-c3-idf.yaml new file mode 100644 index 0000000000..ee2c29ca4e --- /dev/null +++ b/tests/components/grove_gas_mc_v2/test.esp32-c3-idf.yaml @@ -0,0 +1,5 @@ +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + +<<: !include common.yaml diff --git a/tests/components/grove_gas_mc_v2/test.esp32-idf.yaml b/tests/components/grove_gas_mc_v2/test.esp32-idf.yaml index 00c7856c36..63c3bd6afd 100644 --- a/tests/components/grove_gas_mc_v2/test.esp32-idf.yaml +++ b/tests/components/grove_gas_mc_v2/test.esp32-idf.yaml @@ -1,6 +1,5 @@ -i2c: - sda: 21 - scl: 22 - id: i2c_bus +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 <<: !include common.yaml diff --git a/tests/components/grove_gas_mc_v2/test.esp8266-ard.yaml b/tests/components/grove_gas_mc_v2/test.esp8266-ard.yaml index 2de18bdf39..ee2c29ca4e 100644 --- a/tests/components/grove_gas_mc_v2/test.esp8266-ard.yaml +++ b/tests/components/grove_gas_mc_v2/test.esp8266-ard.yaml @@ -1,6 +1,5 @@ -i2c: - sda: 4 - scl: 5 - id: i2c_bus +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 <<: !include common.yaml diff --git a/tests/components/grove_gas_mc_v2/test.rp2040-ard.yaml b/tests/components/grove_gas_mc_v2/test.rp2040-ard.yaml index 00c7856c36..ee2c29ca4e 100644 --- a/tests/components/grove_gas_mc_v2/test.rp2040-ard.yaml +++ b/tests/components/grove_gas_mc_v2/test.rp2040-ard.yaml @@ -1,6 +1,5 @@ -i2c: - sda: 21 - scl: 22 - id: i2c_bus +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 <<: !include common.yaml diff --git a/tests/components/grove_tb6612fng/common.yaml b/tests/components/grove_tb6612fng/common.yaml new file mode 100644 index 0000000000..0db6c00bf7 --- /dev/null +++ b/tests/components/grove_tb6612fng/common.yaml @@ -0,0 +1,23 @@ +esphome: + on_boot: + then: + - grove_tb6612fng.run: + channel: 1 + speed: 255 + direction: BACKWARD + id: test_motor + - grove_tb6612fng.stop: + channel: 1 + id: test_motor + - grove_tb6612fng.break: + channel: 1 + id: test_motor + +i2c: + - id: i2c_grove_tb6612fng + scl: ${scl_pin} + sda: ${sda_pin} + +grove_tb6612fng: + id: test_motor + address: 0x14 diff --git a/tests/components/grove_tb6612fng/test.esp32-ard.yaml b/tests/components/grove_tb6612fng/test.esp32-ard.yaml index 3271fb754f..63c3bd6afd 100644 --- a/tests/components/grove_tb6612fng/test.esp32-ard.yaml +++ b/tests/components/grove_tb6612fng/test.esp32-ard.yaml @@ -1,23 +1,5 @@ -esphome: - on_boot: - then: - - grove_tb6612fng.run: - channel: 1 - speed: 255 - direction: BACKWARD - id: test_motor - - grove_tb6612fng.stop: - channel: 1 - id: test_motor - - grove_tb6612fng.break: - channel: 1 - id: test_motor +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -i2c: - - id: i2c_grove_tb6612fng - scl: 16 - sda: 17 - -grove_tb6612fng: - id: test_motor - address: 0x14 +<<: !include common.yaml diff --git a/tests/components/grove_tb6612fng/test.esp32-c3-ard.yaml b/tests/components/grove_tb6612fng/test.esp32-c3-ard.yaml index ef6dff6539..ee2c29ca4e 100644 --- a/tests/components/grove_tb6612fng/test.esp32-c3-ard.yaml +++ b/tests/components/grove_tb6612fng/test.esp32-c3-ard.yaml @@ -1,23 +1,5 @@ -esphome: - on_boot: - then: - - grove_tb6612fng.run: - channel: 1 - speed: 255 - direction: BACKWARD - id: test_motor - - grove_tb6612fng.stop: - channel: 1 - id: test_motor - - grove_tb6612fng.break: - channel: 1 - id: test_motor +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -i2c: - - id: i2c_grove_tb6612fng - scl: 5 - sda: 4 - -grove_tb6612fng: - id: test_motor - address: 0x14 +<<: !include common.yaml diff --git a/tests/components/grove_tb6612fng/test.esp32-c3-idf.yaml b/tests/components/grove_tb6612fng/test.esp32-c3-idf.yaml index ef6dff6539..ee2c29ca4e 100644 --- a/tests/components/grove_tb6612fng/test.esp32-c3-idf.yaml +++ b/tests/components/grove_tb6612fng/test.esp32-c3-idf.yaml @@ -1,23 +1,5 @@ -esphome: - on_boot: - then: - - grove_tb6612fng.run: - channel: 1 - speed: 255 - direction: BACKWARD - id: test_motor - - grove_tb6612fng.stop: - channel: 1 - id: test_motor - - grove_tb6612fng.break: - channel: 1 - id: test_motor +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -i2c: - - id: i2c_grove_tb6612fng - scl: 5 - sda: 4 - -grove_tb6612fng: - id: test_motor - address: 0x14 +<<: !include common.yaml diff --git a/tests/components/grove_tb6612fng/test.esp32-idf.yaml b/tests/components/grove_tb6612fng/test.esp32-idf.yaml index 3271fb754f..63c3bd6afd 100644 --- a/tests/components/grove_tb6612fng/test.esp32-idf.yaml +++ b/tests/components/grove_tb6612fng/test.esp32-idf.yaml @@ -1,23 +1,5 @@ -esphome: - on_boot: - then: - - grove_tb6612fng.run: - channel: 1 - speed: 255 - direction: BACKWARD - id: test_motor - - grove_tb6612fng.stop: - channel: 1 - id: test_motor - - grove_tb6612fng.break: - channel: 1 - id: test_motor +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -i2c: - - id: i2c_grove_tb6612fng - scl: 16 - sda: 17 - -grove_tb6612fng: - id: test_motor - address: 0x14 +<<: !include common.yaml diff --git a/tests/components/grove_tb6612fng/test.esp8266-ard.yaml b/tests/components/grove_tb6612fng/test.esp8266-ard.yaml index ef6dff6539..ee2c29ca4e 100644 --- a/tests/components/grove_tb6612fng/test.esp8266-ard.yaml +++ b/tests/components/grove_tb6612fng/test.esp8266-ard.yaml @@ -1,23 +1,5 @@ -esphome: - on_boot: - then: - - grove_tb6612fng.run: - channel: 1 - speed: 255 - direction: BACKWARD - id: test_motor - - grove_tb6612fng.stop: - channel: 1 - id: test_motor - - grove_tb6612fng.break: - channel: 1 - id: test_motor +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -i2c: - - id: i2c_grove_tb6612fng - scl: 5 - sda: 4 - -grove_tb6612fng: - id: test_motor - address: 0x14 +<<: !include common.yaml diff --git a/tests/components/grove_tb6612fng/test.rp2040-ard.yaml b/tests/components/grove_tb6612fng/test.rp2040-ard.yaml index ef6dff6539..ee2c29ca4e 100644 --- a/tests/components/grove_tb6612fng/test.rp2040-ard.yaml +++ b/tests/components/grove_tb6612fng/test.rp2040-ard.yaml @@ -1,23 +1,5 @@ -esphome: - on_boot: - then: - - grove_tb6612fng.run: - channel: 1 - speed: 255 - direction: BACKWARD - id: test_motor - - grove_tb6612fng.stop: - channel: 1 - id: test_motor - - grove_tb6612fng.break: - channel: 1 - id: test_motor +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -i2c: - - id: i2c_grove_tb6612fng - scl: 5 - sda: 4 - -grove_tb6612fng: - id: test_motor - address: 0x14 +<<: !include common.yaml diff --git a/tests/components/growatt_solar/common.yaml b/tests/components/growatt_solar/common.yaml new file mode 100644 index 0000000000..7cc6b2a139 --- /dev/null +++ b/tests/components/growatt_solar/common.yaml @@ -0,0 +1,62 @@ +uart: + - id: uart_growatt_solar + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} + baud_rate: 9600 + +modbus: + flow_control_pin: ${flow_control_pin} + +sensor: + - platform: growatt_solar + update_interval: 10s + protocol_version: RTU + inverter_status: + name: Growatt Status Code + phase_a: + voltage: + name: Growatt Voltage Phase A + current: + name: Growatt Current Phase A + active_power: + name: Growatt Power Phase A + phase_b: + voltage: + name: Growatt Voltage Phase B + current: + name: Growatt Current Phase B + active_power: + name: Growatt Power Phase B + phase_c: + voltage: + name: Growatt Voltage Phase C + current: + name: Growatt Current Phase C + active_power: + name: Growatt Power Phase C + pv1: + voltage: + name: Growatt PV1 Voltage + current: + name: Growatt PV1 Current + active_power: + name: Growatt PV1 Active Power + pv2: + voltage: + name: Growatt PV2 Voltage + current: + name: Growatt PV2 Current + active_power: + name: Growatt PV2 Active Power + active_power: + name: Growatt Grid Active Power + pv_active_power: + name: Growatt PV Active Power + frequency: + name: Growatt Frequency + energy_production_day: + name: Growatt Today's Generation + total_energy_production: + name: Growatt Total Energy Production + inverter_module_temp: + name: Growatt Inverter Module Temp diff --git a/tests/components/growatt_solar/test.esp32-ard.yaml b/tests/components/growatt_solar/test.esp32-ard.yaml index 654f2ccedf..bd767a8ece 100644 --- a/tests/components/growatt_solar/test.esp32-ard.yaml +++ b/tests/components/growatt_solar/test.esp32-ard.yaml @@ -1,62 +1,6 @@ -uart: - - id: uart_growatt_solar - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 + flow_control_pin: GPIO13 -modbus: - flow_control_pin: 13 - -sensor: - - platform: growatt_solar - update_interval: 10s - protocol_version: RTU - inverter_status: - name: Growatt Status Code - phase_a: - voltage: - name: Growatt Voltage Phase A - current: - name: Growatt Current Phase A - active_power: - name: Growatt Power Phase A - phase_b: - voltage: - name: Growatt Voltage Phase B - current: - name: Growatt Current Phase B - active_power: - name: Growatt Power Phase B - phase_c: - voltage: - name: Growatt Voltage Phase C - current: - name: Growatt Current Phase C - active_power: - name: Growatt Power Phase C - pv1: - voltage: - name: Growatt PV1 Voltage - current: - name: Growatt PV1 Current - active_power: - name: Growatt PV1 Active Power - pv2: - voltage: - name: Growatt PV2 Voltage - current: - name: Growatt PV2 Current - active_power: - name: Growatt PV2 Active Power - active_power: - name: Growatt Grid Active Power - pv_active_power: - name: Growatt PV Active Power - frequency: - name: Growatt Frequency - energy_production_day: - name: Growatt Today's Generation - total_energy_production: - name: Growatt Total Energy Production - inverter_module_temp: - name: Growatt Inverter Module Temp +<<: !include common.yaml diff --git a/tests/components/growatt_solar/test.esp32-c3-ard.yaml b/tests/components/growatt_solar/test.esp32-c3-ard.yaml index 7e73897856..452031a5aa 100644 --- a/tests/components/growatt_solar/test.esp32-c3-ard.yaml +++ b/tests/components/growatt_solar/test.esp32-c3-ard.yaml @@ -1,62 +1,6 @@ -uart: - - id: uart_growatt_solar - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + flow_control_pin: GPIO3 -modbus: - flow_control_pin: 3 - -sensor: - - platform: growatt_solar - update_interval: 10s - protocol_version: RTU - inverter_status: - name: Growatt Status Code - phase_a: - voltage: - name: Growatt Voltage Phase A - current: - name: Growatt Current Phase A - active_power: - name: Growatt Power Phase A - phase_b: - voltage: - name: Growatt Voltage Phase B - current: - name: Growatt Current Phase B - active_power: - name: Growatt Power Phase B - phase_c: - voltage: - name: Growatt Voltage Phase C - current: - name: Growatt Current Phase C - active_power: - name: Growatt Power Phase C - pv1: - voltage: - name: Growatt PV1 Voltage - current: - name: Growatt PV1 Current - active_power: - name: Growatt PV1 Active Power - pv2: - voltage: - name: Growatt PV2 Voltage - current: - name: Growatt PV2 Current - active_power: - name: Growatt PV2 Active Power - active_power: - name: Growatt Grid Active Power - pv_active_power: - name: Growatt PV Active Power - frequency: - name: Growatt Frequency - energy_production_day: - name: Growatt Today's Generation - total_energy_production: - name: Growatt Total Energy Production - inverter_module_temp: - name: Growatt Inverter Module Temp +<<: !include common.yaml diff --git a/tests/components/growatt_solar/test.esp32-c3-idf.yaml b/tests/components/growatt_solar/test.esp32-c3-idf.yaml index 7e73897856..452031a5aa 100644 --- a/tests/components/growatt_solar/test.esp32-c3-idf.yaml +++ b/tests/components/growatt_solar/test.esp32-c3-idf.yaml @@ -1,62 +1,6 @@ -uart: - - id: uart_growatt_solar - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + flow_control_pin: GPIO3 -modbus: - flow_control_pin: 3 - -sensor: - - platform: growatt_solar - update_interval: 10s - protocol_version: RTU - inverter_status: - name: Growatt Status Code - phase_a: - voltage: - name: Growatt Voltage Phase A - current: - name: Growatt Current Phase A - active_power: - name: Growatt Power Phase A - phase_b: - voltage: - name: Growatt Voltage Phase B - current: - name: Growatt Current Phase B - active_power: - name: Growatt Power Phase B - phase_c: - voltage: - name: Growatt Voltage Phase C - current: - name: Growatt Current Phase C - active_power: - name: Growatt Power Phase C - pv1: - voltage: - name: Growatt PV1 Voltage - current: - name: Growatt PV1 Current - active_power: - name: Growatt PV1 Active Power - pv2: - voltage: - name: Growatt PV2 Voltage - current: - name: Growatt PV2 Current - active_power: - name: Growatt PV2 Active Power - active_power: - name: Growatt Grid Active Power - pv_active_power: - name: Growatt PV Active Power - frequency: - name: Growatt Frequency - energy_production_day: - name: Growatt Today's Generation - total_energy_production: - name: Growatt Total Energy Production - inverter_module_temp: - name: Growatt Inverter Module Temp +<<: !include common.yaml diff --git a/tests/components/growatt_solar/test.esp32-idf.yaml b/tests/components/growatt_solar/test.esp32-idf.yaml index 654f2ccedf..bd767a8ece 100644 --- a/tests/components/growatt_solar/test.esp32-idf.yaml +++ b/tests/components/growatt_solar/test.esp32-idf.yaml @@ -1,62 +1,6 @@ -uart: - - id: uart_growatt_solar - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 + flow_control_pin: GPIO13 -modbus: - flow_control_pin: 13 - -sensor: - - platform: growatt_solar - update_interval: 10s - protocol_version: RTU - inverter_status: - name: Growatt Status Code - phase_a: - voltage: - name: Growatt Voltage Phase A - current: - name: Growatt Current Phase A - active_power: - name: Growatt Power Phase A - phase_b: - voltage: - name: Growatt Voltage Phase B - current: - name: Growatt Current Phase B - active_power: - name: Growatt Power Phase B - phase_c: - voltage: - name: Growatt Voltage Phase C - current: - name: Growatt Current Phase C - active_power: - name: Growatt Power Phase C - pv1: - voltage: - name: Growatt PV1 Voltage - current: - name: Growatt PV1 Current - active_power: - name: Growatt PV1 Active Power - pv2: - voltage: - name: Growatt PV2 Voltage - current: - name: Growatt PV2 Current - active_power: - name: Growatt PV2 Active Power - active_power: - name: Growatt Grid Active Power - pv_active_power: - name: Growatt PV Active Power - frequency: - name: Growatt Frequency - energy_production_day: - name: Growatt Today's Generation - total_energy_production: - name: Growatt Total Energy Production - inverter_module_temp: - name: Growatt Inverter Module Temp +<<: !include common.yaml diff --git a/tests/components/growatt_solar/test.esp8266-ard.yaml b/tests/components/growatt_solar/test.esp8266-ard.yaml index a1cf8267ae..29c98d0957 100644 --- a/tests/components/growatt_solar/test.esp8266-ard.yaml +++ b/tests/components/growatt_solar/test.esp8266-ard.yaml @@ -1,62 +1,6 @@ -uart: - - id: uart_growatt_solar - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + flow_control_pin: GPIO13 -modbus: - flow_control_pin: 13 - -sensor: - - platform: growatt_solar - update_interval: 10s - protocol_version: RTU - inverter_status: - name: Growatt Status Code - phase_a: - voltage: - name: Growatt Voltage Phase A - current: - name: Growatt Current Phase A - active_power: - name: Growatt Power Phase A - phase_b: - voltage: - name: Growatt Voltage Phase B - current: - name: Growatt Current Phase B - active_power: - name: Growatt Power Phase B - phase_c: - voltage: - name: Growatt Voltage Phase C - current: - name: Growatt Current Phase C - active_power: - name: Growatt Power Phase C - pv1: - voltage: - name: Growatt PV1 Voltage - current: - name: Growatt PV1 Current - active_power: - name: Growatt PV1 Active Power - pv2: - voltage: - name: Growatt PV2 Voltage - current: - name: Growatt PV2 Current - active_power: - name: Growatt PV2 Active Power - active_power: - name: Growatt Grid Active Power - pv_active_power: - name: Growatt PV Active Power - frequency: - name: Growatt Frequency - energy_production_day: - name: Growatt Today's Generation - total_energy_production: - name: Growatt Total Energy Production - inverter_module_temp: - name: Growatt Inverter Module Temp +<<: !include common.yaml diff --git a/tests/components/growatt_solar/test.rp2040-ard.yaml b/tests/components/growatt_solar/test.rp2040-ard.yaml index 7e73897856..452031a5aa 100644 --- a/tests/components/growatt_solar/test.rp2040-ard.yaml +++ b/tests/components/growatt_solar/test.rp2040-ard.yaml @@ -1,62 +1,6 @@ -uart: - - id: uart_growatt_solar - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + flow_control_pin: GPIO3 -modbus: - flow_control_pin: 3 - -sensor: - - platform: growatt_solar - update_interval: 10s - protocol_version: RTU - inverter_status: - name: Growatt Status Code - phase_a: - voltage: - name: Growatt Voltage Phase A - current: - name: Growatt Current Phase A - active_power: - name: Growatt Power Phase A - phase_b: - voltage: - name: Growatt Voltage Phase B - current: - name: Growatt Current Phase B - active_power: - name: Growatt Power Phase B - phase_c: - voltage: - name: Growatt Voltage Phase C - current: - name: Growatt Current Phase C - active_power: - name: Growatt Power Phase C - pv1: - voltage: - name: Growatt PV1 Voltage - current: - name: Growatt PV1 Current - active_power: - name: Growatt PV1 Active Power - pv2: - voltage: - name: Growatt PV2 Voltage - current: - name: Growatt PV2 Current - active_power: - name: Growatt PV2 Active Power - active_power: - name: Growatt Grid Active Power - pv_active_power: - name: Growatt PV Active Power - frequency: - name: Growatt Frequency - energy_production_day: - name: Growatt Today's Generation - total_energy_production: - name: Growatt Total Energy Production - inverter_module_temp: - name: Growatt Inverter Module Temp +<<: !include common.yaml diff --git a/tests/components/havells_solar/common.yaml b/tests/components/havells_solar/common.yaml new file mode 100644 index 0000000000..370b0d357d --- /dev/null +++ b/tests/components/havells_solar/common.yaml @@ -0,0 +1,79 @@ +uart: + - id: uart_havells_solar + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} + baud_rate: 9600 + +modbus: + flow_control_pin: ${flow_control_pin} + +sensor: + - platform: havells_solar + update_interval: 60s + phase_a: + voltage: + name: Phase A Voltage + current: + name: Phase A Current + phase_b: + voltage: + name: Voltage Phase B + current: + name: Current Phase B + phase_c: + voltage: + name: Voltage Phase C + current: + name: Current Phase C + pv1: + voltage: + name: PV1 Voltage + current: + name: PV1 Current + active_power: + name: PV1 Active Power + voltage_sampled_by_secondary_cpu: + name: PV1 Voltage Sampled By Secondary CPU + insulation_of_p_to_ground: + name: PV1 Insulation Of +VE To Ground + pv2: + voltage: + name: PV2 Voltage + current: + name: PV2 Current + active_power: + name: PV2 Active Power + voltage_sampled_by_secondary_cpu: + name: PV2 Voltage Sampled By Secondary CPU + insulation_of_p_to_ground: + name: PV2 Insulation Of +VE To Ground + active_power: + name: Active Power + reactive_power: + name: Reactive Power + frequency: + name: Frequency + energy_production_day: + name: Today's Generation + total_energy_production: + name: Total Energy Production + total_generation_time: + name: Total Generation Time + today_generation_time: + name: Today Generation Time + inverter_module_temp: + name: Inverter Module Temp + inverter_inner_temp: + name: Inverter Inner Temp + inverter_bus_voltage: + name: Inverter BUS Voltage + insulation_of_pv_n_to_ground: + name: Insulation Of PV- To Ground + gfci_value: + name: GFCI Value + dci_of_r: + name: DCI Of R + dci_of_s: + name: DCI Of S + dci_of_t: + name: DCI Of T diff --git a/tests/components/havells_solar/test.esp32-ard.yaml b/tests/components/havells_solar/test.esp32-ard.yaml index 2cda8e37be..bd767a8ece 100644 --- a/tests/components/havells_solar/test.esp32-ard.yaml +++ b/tests/components/havells_solar/test.esp32-ard.yaml @@ -1,79 +1,6 @@ -uart: - - id: uart_havells_solar - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 + flow_control_pin: GPIO13 -modbus: - flow_control_pin: 3 - -sensor: - - platform: havells_solar - update_interval: 60s - phase_a: - voltage: - name: Phase A Voltage - current: - name: Phase A Current - phase_b: - voltage: - name: Voltage Phase B - current: - name: Current Phase B - phase_c: - voltage: - name: Voltage Phase C - current: - name: Current Phase C - pv1: - voltage: - name: PV1 Voltage - current: - name: PV1 Current - active_power: - name: PV1 Active Power - voltage_sampled_by_secondary_cpu: - name: PV1 Voltage Sampled By Secondary CPU - insulation_of_p_to_ground: - name: PV1 Insulation Of +VE To Ground - pv2: - voltage: - name: PV2 Voltage - current: - name: PV2 Current - active_power: - name: PV2 Active Power - voltage_sampled_by_secondary_cpu: - name: PV2 Voltage Sampled By Secondary CPU - insulation_of_p_to_ground: - name: PV2 Insulation Of +VE To Ground - active_power: - name: Active Power - reactive_power: - name: Reactive Power - frequency: - name: Frequency - energy_production_day: - name: Today's Generation - total_energy_production: - name: Total Energy Production - total_generation_time: - name: Total Generation Time - today_generation_time: - name: Today Generation Time - inverter_module_temp: - name: Inverter Module Temp - inverter_inner_temp: - name: Inverter Inner Temp - inverter_bus_voltage: - name: Inverter BUS Voltage - insulation_of_pv_n_to_ground: - name: Insulation Of PV- To Ground - gfci_value: - name: GFCI Value - dci_of_r: - name: DCI Of R - dci_of_s: - name: DCI Of S - dci_of_t: - name: DCI Of T +<<: !include common.yaml diff --git a/tests/components/havells_solar/test.esp32-c3-ard.yaml b/tests/components/havells_solar/test.esp32-c3-ard.yaml index 5cb911cf71..452031a5aa 100644 --- a/tests/components/havells_solar/test.esp32-c3-ard.yaml +++ b/tests/components/havells_solar/test.esp32-c3-ard.yaml @@ -1,79 +1,6 @@ -uart: - - id: uart_havells_solar - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + flow_control_pin: GPIO3 -modbus: - flow_control_pin: 3 - -sensor: - - platform: havells_solar - update_interval: 60s - phase_a: - voltage: - name: Phase A Voltage - current: - name: Phase A Current - phase_b: - voltage: - name: Voltage Phase B - current: - name: Current Phase B - phase_c: - voltage: - name: Voltage Phase C - current: - name: Current Phase C - pv1: - voltage: - name: PV1 Voltage - current: - name: PV1 Current - active_power: - name: PV1 Active Power - voltage_sampled_by_secondary_cpu: - name: PV1 Voltage Sampled By Secondary CPU - insulation_of_p_to_ground: - name: PV1 Insulation Of +VE To Ground - pv2: - voltage: - name: PV2 Voltage - current: - name: PV2 Current - active_power: - name: PV2 Active Power - voltage_sampled_by_secondary_cpu: - name: PV2 Voltage Sampled By Secondary CPU - insulation_of_p_to_ground: - name: PV2 Insulation Of +VE To Ground - active_power: - name: Active Power - reactive_power: - name: Reactive Power - frequency: - name: Frequency - energy_production_day: - name: Today's Generation - total_energy_production: - name: Total Energy Production - total_generation_time: - name: Total Generation Time - today_generation_time: - name: Today Generation Time - inverter_module_temp: - name: Inverter Module Temp - inverter_inner_temp: - name: Inverter Inner Temp - inverter_bus_voltage: - name: Inverter BUS Voltage - insulation_of_pv_n_to_ground: - name: Insulation Of PV- To Ground - gfci_value: - name: GFCI Value - dci_of_r: - name: DCI Of R - dci_of_s: - name: DCI Of S - dci_of_t: - name: DCI Of T +<<: !include common.yaml diff --git a/tests/components/havells_solar/test.esp32-c3-idf.yaml b/tests/components/havells_solar/test.esp32-c3-idf.yaml index 5cb911cf71..452031a5aa 100644 --- a/tests/components/havells_solar/test.esp32-c3-idf.yaml +++ b/tests/components/havells_solar/test.esp32-c3-idf.yaml @@ -1,79 +1,6 @@ -uart: - - id: uart_havells_solar - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + flow_control_pin: GPIO3 -modbus: - flow_control_pin: 3 - -sensor: - - platform: havells_solar - update_interval: 60s - phase_a: - voltage: - name: Phase A Voltage - current: - name: Phase A Current - phase_b: - voltage: - name: Voltage Phase B - current: - name: Current Phase B - phase_c: - voltage: - name: Voltage Phase C - current: - name: Current Phase C - pv1: - voltage: - name: PV1 Voltage - current: - name: PV1 Current - active_power: - name: PV1 Active Power - voltage_sampled_by_secondary_cpu: - name: PV1 Voltage Sampled By Secondary CPU - insulation_of_p_to_ground: - name: PV1 Insulation Of +VE To Ground - pv2: - voltage: - name: PV2 Voltage - current: - name: PV2 Current - active_power: - name: PV2 Active Power - voltage_sampled_by_secondary_cpu: - name: PV2 Voltage Sampled By Secondary CPU - insulation_of_p_to_ground: - name: PV2 Insulation Of +VE To Ground - active_power: - name: Active Power - reactive_power: - name: Reactive Power - frequency: - name: Frequency - energy_production_day: - name: Today's Generation - total_energy_production: - name: Total Energy Production - total_generation_time: - name: Total Generation Time - today_generation_time: - name: Today Generation Time - inverter_module_temp: - name: Inverter Module Temp - inverter_inner_temp: - name: Inverter Inner Temp - inverter_bus_voltage: - name: Inverter BUS Voltage - insulation_of_pv_n_to_ground: - name: Insulation Of PV- To Ground - gfci_value: - name: GFCI Value - dci_of_r: - name: DCI Of R - dci_of_s: - name: DCI Of S - dci_of_t: - name: DCI Of T +<<: !include common.yaml diff --git a/tests/components/havells_solar/test.esp32-idf.yaml b/tests/components/havells_solar/test.esp32-idf.yaml index 2cda8e37be..bd767a8ece 100644 --- a/tests/components/havells_solar/test.esp32-idf.yaml +++ b/tests/components/havells_solar/test.esp32-idf.yaml @@ -1,79 +1,6 @@ -uart: - - id: uart_havells_solar - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 + flow_control_pin: GPIO13 -modbus: - flow_control_pin: 3 - -sensor: - - platform: havells_solar - update_interval: 60s - phase_a: - voltage: - name: Phase A Voltage - current: - name: Phase A Current - phase_b: - voltage: - name: Voltage Phase B - current: - name: Current Phase B - phase_c: - voltage: - name: Voltage Phase C - current: - name: Current Phase C - pv1: - voltage: - name: PV1 Voltage - current: - name: PV1 Current - active_power: - name: PV1 Active Power - voltage_sampled_by_secondary_cpu: - name: PV1 Voltage Sampled By Secondary CPU - insulation_of_p_to_ground: - name: PV1 Insulation Of +VE To Ground - pv2: - voltage: - name: PV2 Voltage - current: - name: PV2 Current - active_power: - name: PV2 Active Power - voltage_sampled_by_secondary_cpu: - name: PV2 Voltage Sampled By Secondary CPU - insulation_of_p_to_ground: - name: PV2 Insulation Of +VE To Ground - active_power: - name: Active Power - reactive_power: - name: Reactive Power - frequency: - name: Frequency - energy_production_day: - name: Today's Generation - total_energy_production: - name: Total Energy Production - total_generation_time: - name: Total Generation Time - today_generation_time: - name: Today Generation Time - inverter_module_temp: - name: Inverter Module Temp - inverter_inner_temp: - name: Inverter Inner Temp - inverter_bus_voltage: - name: Inverter BUS Voltage - insulation_of_pv_n_to_ground: - name: Insulation Of PV- To Ground - gfci_value: - name: GFCI Value - dci_of_r: - name: DCI Of R - dci_of_s: - name: DCI Of S - dci_of_t: - name: DCI Of T +<<: !include common.yaml diff --git a/tests/components/havells_solar/test.esp8266-ard.yaml b/tests/components/havells_solar/test.esp8266-ard.yaml index 5cb911cf71..29c98d0957 100644 --- a/tests/components/havells_solar/test.esp8266-ard.yaml +++ b/tests/components/havells_solar/test.esp8266-ard.yaml @@ -1,79 +1,6 @@ -uart: - - id: uart_havells_solar - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + flow_control_pin: GPIO13 -modbus: - flow_control_pin: 3 - -sensor: - - platform: havells_solar - update_interval: 60s - phase_a: - voltage: - name: Phase A Voltage - current: - name: Phase A Current - phase_b: - voltage: - name: Voltage Phase B - current: - name: Current Phase B - phase_c: - voltage: - name: Voltage Phase C - current: - name: Current Phase C - pv1: - voltage: - name: PV1 Voltage - current: - name: PV1 Current - active_power: - name: PV1 Active Power - voltage_sampled_by_secondary_cpu: - name: PV1 Voltage Sampled By Secondary CPU - insulation_of_p_to_ground: - name: PV1 Insulation Of +VE To Ground - pv2: - voltage: - name: PV2 Voltage - current: - name: PV2 Current - active_power: - name: PV2 Active Power - voltage_sampled_by_secondary_cpu: - name: PV2 Voltage Sampled By Secondary CPU - insulation_of_p_to_ground: - name: PV2 Insulation Of +VE To Ground - active_power: - name: Active Power - reactive_power: - name: Reactive Power - frequency: - name: Frequency - energy_production_day: - name: Today's Generation - total_energy_production: - name: Total Energy Production - total_generation_time: - name: Total Generation Time - today_generation_time: - name: Today Generation Time - inverter_module_temp: - name: Inverter Module Temp - inverter_inner_temp: - name: Inverter Inner Temp - inverter_bus_voltage: - name: Inverter BUS Voltage - insulation_of_pv_n_to_ground: - name: Insulation Of PV- To Ground - gfci_value: - name: GFCI Value - dci_of_r: - name: DCI Of R - dci_of_s: - name: DCI Of S - dci_of_t: - name: DCI Of T +<<: !include common.yaml diff --git a/tests/components/havells_solar/test.rp2040-ard.yaml b/tests/components/havells_solar/test.rp2040-ard.yaml index 5cb911cf71..452031a5aa 100644 --- a/tests/components/havells_solar/test.rp2040-ard.yaml +++ b/tests/components/havells_solar/test.rp2040-ard.yaml @@ -1,79 +1,6 @@ -uart: - - id: uart_havells_solar - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + flow_control_pin: GPIO3 -modbus: - flow_control_pin: 3 - -sensor: - - platform: havells_solar - update_interval: 60s - phase_a: - voltage: - name: Phase A Voltage - current: - name: Phase A Current - phase_b: - voltage: - name: Voltage Phase B - current: - name: Current Phase B - phase_c: - voltage: - name: Voltage Phase C - current: - name: Current Phase C - pv1: - voltage: - name: PV1 Voltage - current: - name: PV1 Current - active_power: - name: PV1 Active Power - voltage_sampled_by_secondary_cpu: - name: PV1 Voltage Sampled By Secondary CPU - insulation_of_p_to_ground: - name: PV1 Insulation Of +VE To Ground - pv2: - voltage: - name: PV2 Voltage - current: - name: PV2 Current - active_power: - name: PV2 Active Power - voltage_sampled_by_secondary_cpu: - name: PV2 Voltage Sampled By Secondary CPU - insulation_of_p_to_ground: - name: PV2 Insulation Of +VE To Ground - active_power: - name: Active Power - reactive_power: - name: Reactive Power - frequency: - name: Frequency - energy_production_day: - name: Today's Generation - total_energy_production: - name: Total Energy Production - total_generation_time: - name: Total Generation Time - today_generation_time: - name: Today Generation Time - inverter_module_temp: - name: Inverter Module Temp - inverter_inner_temp: - name: Inverter Inner Temp - inverter_bus_voltage: - name: Inverter BUS Voltage - insulation_of_pv_n_to_ground: - name: Insulation Of PV- To Ground - gfci_value: - name: GFCI Value - dci_of_r: - name: DCI Of R - dci_of_s: - name: DCI Of S - dci_of_t: - name: DCI Of T +<<: !include common.yaml diff --git a/tests/components/hdc1080/common.yaml b/tests/components/hdc1080/common.yaml new file mode 100644 index 0000000000..d260d4737c --- /dev/null +++ b/tests/components/hdc1080/common.yaml @@ -0,0 +1,12 @@ +i2c: + - id: i2c_hdc1080 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: hdc1080 + temperature: + name: Temperature + humidity: + name: Humidity + update_interval: 15s diff --git a/tests/components/hdc1080/test.esp32-ard.yaml b/tests/components/hdc1080/test.esp32-ard.yaml index 8e313dfa40..63c3bd6afd 100644 --- a/tests/components/hdc1080/test.esp32-ard.yaml +++ b/tests/components/hdc1080/test.esp32-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_hdc1080 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: hdc1080 - temperature: - name: Temperature - humidity: - name: Humidity - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/hdc1080/test.esp32-c3-ard.yaml b/tests/components/hdc1080/test.esp32-c3-ard.yaml index 7bf7af6fa7..ee2c29ca4e 100644 --- a/tests/components/hdc1080/test.esp32-c3-ard.yaml +++ b/tests/components/hdc1080/test.esp32-c3-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_hdc1080 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: hdc1080 - temperature: - name: Temperature - humidity: - name: Humidity - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/hdc1080/test.esp32-c3-idf.yaml b/tests/components/hdc1080/test.esp32-c3-idf.yaml index 7bf7af6fa7..ee2c29ca4e 100644 --- a/tests/components/hdc1080/test.esp32-c3-idf.yaml +++ b/tests/components/hdc1080/test.esp32-c3-idf.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_hdc1080 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: hdc1080 - temperature: - name: Temperature - humidity: - name: Humidity - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/hdc1080/test.esp32-idf.yaml b/tests/components/hdc1080/test.esp32-idf.yaml index 8e313dfa40..63c3bd6afd 100644 --- a/tests/components/hdc1080/test.esp32-idf.yaml +++ b/tests/components/hdc1080/test.esp32-idf.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_hdc1080 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: hdc1080 - temperature: - name: Temperature - humidity: - name: Humidity - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/hdc1080/test.esp8266-ard.yaml b/tests/components/hdc1080/test.esp8266-ard.yaml index 7bf7af6fa7..ee2c29ca4e 100644 --- a/tests/components/hdc1080/test.esp8266-ard.yaml +++ b/tests/components/hdc1080/test.esp8266-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_hdc1080 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: hdc1080 - temperature: - name: Temperature - humidity: - name: Humidity - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/hdc1080/test.rp2040-ard.yaml b/tests/components/hdc1080/test.rp2040-ard.yaml index 7bf7af6fa7..ee2c29ca4e 100644 --- a/tests/components/hdc1080/test.rp2040-ard.yaml +++ b/tests/components/hdc1080/test.rp2040-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_hdc1080 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: hdc1080 - temperature: - name: Temperature - humidity: - name: Humidity - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/he60r/common.yaml b/tests/components/he60r/common.yaml new file mode 100644 index 0000000000..e10e745f57 --- /dev/null +++ b/tests/components/he60r/common.yaml @@ -0,0 +1,13 @@ +uart: + - id: uart_he60r + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} + baud_rate: 1200 + parity: EVEN + +cover: + - platform: he60r + id: garage_door + name: Garage Door + open_duration: 14s + close_duration: 14s diff --git a/tests/components/he60r/test.esp32-ard.yaml b/tests/components/he60r/test.esp32-ard.yaml index 840387ae36..f486544afa 100644 --- a/tests/components/he60r/test.esp32-ard.yaml +++ b/tests/components/he60r/test.esp32-ard.yaml @@ -1,13 +1,5 @@ -uart: - - id: uart_he60r - tx_pin: 17 - rx_pin: 16 - baud_rate: 1200 - parity: EVEN +substitutions: + tx_pin: GPIO17 + rx_pin: GPIO16 -cover: - - platform: he60r - id: garage_door - name: Garage Door - open_duration: 14s - close_duration: 14s +<<: !include common.yaml diff --git a/tests/components/he60r/test.esp32-c3-ard.yaml b/tests/components/he60r/test.esp32-c3-ard.yaml index bcbb544442..b516342f3b 100644 --- a/tests/components/he60r/test.esp32-c3-ard.yaml +++ b/tests/components/he60r/test.esp32-c3-ard.yaml @@ -1,13 +1,5 @@ -uart: - - id: uart_he60r - tx_pin: 4 - rx_pin: 5 - baud_rate: 1200 - parity: EVEN +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -cover: - - platform: he60r - id: garage_door - name: Garage Door - open_duration: 14s - close_duration: 14s +<<: !include common.yaml diff --git a/tests/components/he60r/test.esp32-c3-idf.yaml b/tests/components/he60r/test.esp32-c3-idf.yaml index bcbb544442..b516342f3b 100644 --- a/tests/components/he60r/test.esp32-c3-idf.yaml +++ b/tests/components/he60r/test.esp32-c3-idf.yaml @@ -1,13 +1,5 @@ -uart: - - id: uart_he60r - tx_pin: 4 - rx_pin: 5 - baud_rate: 1200 - parity: EVEN +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -cover: - - platform: he60r - id: garage_door - name: Garage Door - open_duration: 14s - close_duration: 14s +<<: !include common.yaml diff --git a/tests/components/he60r/test.esp32-idf.yaml b/tests/components/he60r/test.esp32-idf.yaml index 840387ae36..f486544afa 100644 --- a/tests/components/he60r/test.esp32-idf.yaml +++ b/tests/components/he60r/test.esp32-idf.yaml @@ -1,13 +1,5 @@ -uart: - - id: uart_he60r - tx_pin: 17 - rx_pin: 16 - baud_rate: 1200 - parity: EVEN +substitutions: + tx_pin: GPIO17 + rx_pin: GPIO16 -cover: - - platform: he60r - id: garage_door - name: Garage Door - open_duration: 14s - close_duration: 14s +<<: !include common.yaml diff --git a/tests/components/he60r/test.esp8266-ard.yaml b/tests/components/he60r/test.esp8266-ard.yaml index bcbb544442..b516342f3b 100644 --- a/tests/components/he60r/test.esp8266-ard.yaml +++ b/tests/components/he60r/test.esp8266-ard.yaml @@ -1,13 +1,5 @@ -uart: - - id: uart_he60r - tx_pin: 4 - rx_pin: 5 - baud_rate: 1200 - parity: EVEN +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -cover: - - platform: he60r - id: garage_door - name: Garage Door - open_duration: 14s - close_duration: 14s +<<: !include common.yaml diff --git a/tests/components/he60r/test.rp2040-ard.yaml b/tests/components/he60r/test.rp2040-ard.yaml index bcbb544442..b516342f3b 100644 --- a/tests/components/he60r/test.rp2040-ard.yaml +++ b/tests/components/he60r/test.rp2040-ard.yaml @@ -1,13 +1,5 @@ -uart: - - id: uart_he60r - tx_pin: 4 - rx_pin: 5 - baud_rate: 1200 - parity: EVEN +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -cover: - - platform: he60r - id: garage_door - name: Garage Door - open_duration: 14s - close_duration: 14s +<<: !include common.yaml diff --git a/tests/components/heatpumpir/common.yaml b/tests/components/heatpumpir/common.yaml new file mode 100644 index 0000000000..2df195c5de --- /dev/null +++ b/tests/components/heatpumpir/common.yaml @@ -0,0 +1,26 @@ +remote_transmitter: + pin: ${pin} + carrier_duty_percent: 50% + +climate: + - platform: heatpumpir + protocol: mitsubishi_heavy_zm + horizontal_default: left + vertical_default: up + name: HeatpumpIR Climate + min_temperature: 18 + max_temperature: 30 + - platform: heatpumpir + protocol: daikin + horizontal_default: mleft + vertical_default: mup + name: HeatpumpIR Climate + min_temperature: 18 + max_temperature: 30 + - platform: heatpumpir + protocol: panasonic_altdke + horizontal_default: mright + vertical_default: mdown + name: HeatpumpIR Climate + min_temperature: 18 + max_temperature: 30 diff --git a/tests/components/heatpumpir/test.bk72xx-ard.yaml b/tests/components/heatpumpir/test.bk72xx-ard.yaml index b616f9157c..06e1aea364 100644 --- a/tests/components/heatpumpir/test.bk72xx-ard.yaml +++ b/tests/components/heatpumpir/test.bk72xx-ard.yaml @@ -1,26 +1,4 @@ -remote_transmitter: - pin: 6 - carrier_duty_percent: 50% +substitutions: + pin: GPIO6 -climate: - - platform: heatpumpir - protocol: mitsubishi_heavy_zm - horizontal_default: left - vertical_default: up - name: HeatpumpIR Climate - min_temperature: 18 - max_temperature: 30 - - platform: heatpumpir - protocol: daikin - horizontal_default: mleft - vertical_default: mup - name: HeatpumpIR Climate - min_temperature: 18 - max_temperature: 30 - - platform: heatpumpir - protocol: panasonic_altdke - horizontal_default: mright - vertical_default: mdown - name: HeatpumpIR Climate - min_temperature: 18 - max_temperature: 30 +<<: !include common.yaml diff --git a/tests/components/heatpumpir/test.esp32-ard.yaml b/tests/components/heatpumpir/test.esp32-ard.yaml index db3f81f6a0..7b012aa64c 100644 --- a/tests/components/heatpumpir/test.esp32-ard.yaml +++ b/tests/components/heatpumpir/test.esp32-ard.yaml @@ -1,19 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: heatpumpir - protocol: mitsubishi_heavy_zm - horizontal_default: left - vertical_default: up - name: HeatpumpIR Climate - min_temperature: 18 - max_temperature: 30 - - platform: heatpumpir - protocol: greeyt - horizontal_default: left - vertical_default: up - name: HeatpumpIR Climate - min_temperature: 18 - max_temperature: 30 +<<: !include common.yaml diff --git a/tests/components/heatpumpir/test.esp32-c3-ard.yaml b/tests/components/heatpumpir/test.esp32-c3-ard.yaml new file mode 100644 index 0000000000..7b012aa64c --- /dev/null +++ b/tests/components/heatpumpir/test.esp32-c3-ard.yaml @@ -0,0 +1,4 @@ +substitutions: + pin: GPIO2 + +<<: !include common.yaml diff --git a/tests/components/heatpumpir/test.esp8266-ard.yaml b/tests/components/heatpumpir/test.esp8266-ard.yaml index 26a01cb198..f5097fcf5f 100644 --- a/tests/components/heatpumpir/test.esp8266-ard.yaml +++ b/tests/components/heatpumpir/test.esp8266-ard.yaml @@ -1,19 +1,4 @@ -remote_transmitter: - pin: 5 - carrier_duty_percent: 50% +substitutions: + pin: GPIO5 -climate: - - platform: heatpumpir - protocol: mitsubishi_heavy_zm - horizontal_default: left - vertical_default: up - name: HeatpumpIR Climate - min_temperature: 18 - max_temperature: 30 - - platform: heatpumpir - protocol: greeyt - horizontal_default: left - vertical_default: up - name: HeatpumpIR Climate - min_temperature: 18 - max_temperature: 30 +<<: !include common.yaml diff --git a/tests/components/hitachi_ac344/common.yaml b/tests/components/hitachi_ac344/common.yaml new file mode 100644 index 0000000000..960f032035 --- /dev/null +++ b/tests/components/hitachi_ac344/common.yaml @@ -0,0 +1,7 @@ +remote_transmitter: + pin: ${pin} + carrier_duty_percent: 50% + +climate: + - platform: hitachi_ac344 + name: Hitachi Climate diff --git a/tests/components/hitachi_ac344/test.bk72xx-ard.yaml b/tests/components/hitachi_ac344/test.bk72xx-ard.yaml new file mode 100644 index 0000000000..06e1aea364 --- /dev/null +++ b/tests/components/hitachi_ac344/test.bk72xx-ard.yaml @@ -0,0 +1,4 @@ +substitutions: + pin: GPIO6 + +<<: !include common.yaml diff --git a/tests/components/hitachi_ac344/test.esp32-ard.yaml b/tests/components/hitachi_ac344/test.esp32-ard.yaml index 684d5899de..7b012aa64c 100644 --- a/tests/components/hitachi_ac344/test.esp32-ard.yaml +++ b/tests/components/hitachi_ac344/test.esp32-ard.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: hitachi_ac344 - name: Hitachi Climate +<<: !include common.yaml diff --git a/tests/components/hitachi_ac344/test.esp32-c3-ard.yaml b/tests/components/hitachi_ac344/test.esp32-c3-ard.yaml index 684d5899de..7b012aa64c 100644 --- a/tests/components/hitachi_ac344/test.esp32-c3-ard.yaml +++ b/tests/components/hitachi_ac344/test.esp32-c3-ard.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: hitachi_ac344 - name: Hitachi Climate +<<: !include common.yaml diff --git a/tests/components/hitachi_ac344/test.esp32-c3-idf.yaml b/tests/components/hitachi_ac344/test.esp32-c3-idf.yaml index 684d5899de..7b012aa64c 100644 --- a/tests/components/hitachi_ac344/test.esp32-c3-idf.yaml +++ b/tests/components/hitachi_ac344/test.esp32-c3-idf.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: hitachi_ac344 - name: Hitachi Climate +<<: !include common.yaml diff --git a/tests/components/hitachi_ac344/test.esp32-idf.yaml b/tests/components/hitachi_ac344/test.esp32-idf.yaml index 684d5899de..7b012aa64c 100644 --- a/tests/components/hitachi_ac344/test.esp32-idf.yaml +++ b/tests/components/hitachi_ac344/test.esp32-idf.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: hitachi_ac344 - name: Hitachi Climate +<<: !include common.yaml diff --git a/tests/components/hitachi_ac344/test.esp8266-ard.yaml b/tests/components/hitachi_ac344/test.esp8266-ard.yaml index e6203e3084..f5097fcf5f 100644 --- a/tests/components/hitachi_ac344/test.esp8266-ard.yaml +++ b/tests/components/hitachi_ac344/test.esp8266-ard.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 5 - carrier_duty_percent: 50% +substitutions: + pin: GPIO5 -climate: - - platform: hitachi_ac344 - name: Hitachi Climate +<<: !include common.yaml diff --git a/tests/components/hitachi_ac424/common.yaml b/tests/components/hitachi_ac424/common.yaml new file mode 100644 index 0000000000..ad904c73a3 --- /dev/null +++ b/tests/components/hitachi_ac424/common.yaml @@ -0,0 +1,7 @@ +remote_transmitter: + pin: ${pin} + carrier_duty_percent: 50% + +climate: + - platform: hitachi_ac424 + name: Hitachi Climate diff --git a/tests/components/hitachi_ac424/test.bk72xx-ard.yaml b/tests/components/hitachi_ac424/test.bk72xx-ard.yaml new file mode 100644 index 0000000000..06e1aea364 --- /dev/null +++ b/tests/components/hitachi_ac424/test.bk72xx-ard.yaml @@ -0,0 +1,4 @@ +substitutions: + pin: GPIO6 + +<<: !include common.yaml diff --git a/tests/components/hitachi_ac424/test.esp32-ard.yaml b/tests/components/hitachi_ac424/test.esp32-ard.yaml index a09821b9c6..7b012aa64c 100644 --- a/tests/components/hitachi_ac424/test.esp32-ard.yaml +++ b/tests/components/hitachi_ac424/test.esp32-ard.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: hitachi_ac424 - name: Hitachi Climate +<<: !include common.yaml diff --git a/tests/components/hitachi_ac424/test.esp32-c3-ard.yaml b/tests/components/hitachi_ac424/test.esp32-c3-ard.yaml index a09821b9c6..7b012aa64c 100644 --- a/tests/components/hitachi_ac424/test.esp32-c3-ard.yaml +++ b/tests/components/hitachi_ac424/test.esp32-c3-ard.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: hitachi_ac424 - name: Hitachi Climate +<<: !include common.yaml diff --git a/tests/components/hitachi_ac424/test.esp32-c3-idf.yaml b/tests/components/hitachi_ac424/test.esp32-c3-idf.yaml index a09821b9c6..7b012aa64c 100644 --- a/tests/components/hitachi_ac424/test.esp32-c3-idf.yaml +++ b/tests/components/hitachi_ac424/test.esp32-c3-idf.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: hitachi_ac424 - name: Hitachi Climate +<<: !include common.yaml diff --git a/tests/components/hitachi_ac424/test.esp32-idf.yaml b/tests/components/hitachi_ac424/test.esp32-idf.yaml index a09821b9c6..7b012aa64c 100644 --- a/tests/components/hitachi_ac424/test.esp32-idf.yaml +++ b/tests/components/hitachi_ac424/test.esp32-idf.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% +substitutions: + pin: GPIO2 -climate: - - platform: hitachi_ac424 - name: Hitachi Climate +<<: !include common.yaml diff --git a/tests/components/hitachi_ac424/test.esp8266-ard.yaml b/tests/components/hitachi_ac424/test.esp8266-ard.yaml index 78b9e7c98c..f5097fcf5f 100644 --- a/tests/components/hitachi_ac424/test.esp8266-ard.yaml +++ b/tests/components/hitachi_ac424/test.esp8266-ard.yaml @@ -1,7 +1,4 @@ -remote_transmitter: - pin: 5 - carrier_duty_percent: 50% +substitutions: + pin: GPIO5 -climate: - - platform: hitachi_ac424 - name: Hitachi Climate +<<: !include common.yaml diff --git a/tests/components/hlw8012/common.yaml b/tests/components/hlw8012/common.yaml new file mode 100644 index 0000000000..d0d376a43a --- /dev/null +++ b/tests/components/hlw8012/common.yaml @@ -0,0 +1,21 @@ +sensor: + - platform: hlw8012 + model: hlw8012 + sel_pin: ${sel_pin} + cf_pin: ${cf_pin} + cf1_pin: ${cf1_pin} + current: + name: HLW8012 Current + voltage: + name: HLW8012 Voltage + power: + name: HLW8012 Power + id: hlw8012_power + energy: + name: HLW8012 Energy + id: hlw8012_energy + update_interval: 15s + current_resistor: 0.001 ohm + voltage_divider: 2351 + change_mode_every: "never" + initial_mode: VOLTAGE diff --git a/tests/components/hlw8012/test.esp32-ard.yaml b/tests/components/hlw8012/test.esp32-ard.yaml index 5b2d865722..8b42b21b54 100644 --- a/tests/components/hlw8012/test.esp32-ard.yaml +++ b/tests/components/hlw8012/test.esp32-ard.yaml @@ -1,21 +1,6 @@ -sensor: - - platform: hlw8012 - model: hlw8012 - sel_pin: 12 - cf_pin: 14 - cf1_pin: 13 - current: - name: HLW8012 Current - voltage: - name: HLW8012 Voltage - power: - name: HLW8012 Power - id: hlw8012_power - energy: - name: HLW8012 Energy - id: hlw8012_energy - update_interval: 15s - current_resistor: 0.001 ohm - voltage_divider: 2351 - change_mode_every: "never" - initial_mode: VOLTAGE +substitutions: + sel_pin: GPIO12 + cf_pin: GPIO13 + cf1_pin: GPIO14 + +<<: !include common.yaml diff --git a/tests/components/hlw8012/test.esp32-c3-ard.yaml b/tests/components/hlw8012/test.esp32-c3-ard.yaml index da6053a1b9..8b0d069ce2 100644 --- a/tests/components/hlw8012/test.esp32-c3-ard.yaml +++ b/tests/components/hlw8012/test.esp32-c3-ard.yaml @@ -1,21 +1,6 @@ -sensor: - - platform: hlw8012 - model: hlw8012 - sel_pin: 2 - cf_pin: 4 - cf1_pin: 3 - current: - name: HLW8012 Current - voltage: - name: HLW8012 Voltage - power: - name: HLW8012 Power - id: hlw8012_power - energy: - name: HLW8012 Energy - id: hlw8012_energy - update_interval: 15s - current_resistor: 0.001 ohm - voltage_divider: 2351 - change_mode_every: "never" - initial_mode: VOLTAGE +substitutions: + sel_pin: GPIO2 + cf_pin: GPIO3 + cf1_pin: GPIO4 + +<<: !include common.yaml diff --git a/tests/components/hlw8012/test.esp32-c3-idf.yaml b/tests/components/hlw8012/test.esp32-c3-idf.yaml index da6053a1b9..8b0d069ce2 100644 --- a/tests/components/hlw8012/test.esp32-c3-idf.yaml +++ b/tests/components/hlw8012/test.esp32-c3-idf.yaml @@ -1,21 +1,6 @@ -sensor: - - platform: hlw8012 - model: hlw8012 - sel_pin: 2 - cf_pin: 4 - cf1_pin: 3 - current: - name: HLW8012 Current - voltage: - name: HLW8012 Voltage - power: - name: HLW8012 Power - id: hlw8012_power - energy: - name: HLW8012 Energy - id: hlw8012_energy - update_interval: 15s - current_resistor: 0.001 ohm - voltage_divider: 2351 - change_mode_every: "never" - initial_mode: VOLTAGE +substitutions: + sel_pin: GPIO2 + cf_pin: GPIO3 + cf1_pin: GPIO4 + +<<: !include common.yaml diff --git a/tests/components/hlw8012/test.esp32-idf.yaml b/tests/components/hlw8012/test.esp32-idf.yaml index 5b2d865722..8b42b21b54 100644 --- a/tests/components/hlw8012/test.esp32-idf.yaml +++ b/tests/components/hlw8012/test.esp32-idf.yaml @@ -1,21 +1,6 @@ -sensor: - - platform: hlw8012 - model: hlw8012 - sel_pin: 12 - cf_pin: 14 - cf1_pin: 13 - current: - name: HLW8012 Current - voltage: - name: HLW8012 Voltage - power: - name: HLW8012 Power - id: hlw8012_power - energy: - name: HLW8012 Energy - id: hlw8012_energy - update_interval: 15s - current_resistor: 0.001 ohm - voltage_divider: 2351 - change_mode_every: "never" - initial_mode: VOLTAGE +substitutions: + sel_pin: GPIO12 + cf_pin: GPIO13 + cf1_pin: GPIO14 + +<<: !include common.yaml diff --git a/tests/components/hlw8012/test.esp8266-ard.yaml b/tests/components/hlw8012/test.esp8266-ard.yaml index 5b2d865722..8b42b21b54 100644 --- a/tests/components/hlw8012/test.esp8266-ard.yaml +++ b/tests/components/hlw8012/test.esp8266-ard.yaml @@ -1,21 +1,6 @@ -sensor: - - platform: hlw8012 - model: hlw8012 - sel_pin: 12 - cf_pin: 14 - cf1_pin: 13 - current: - name: HLW8012 Current - voltage: - name: HLW8012 Voltage - power: - name: HLW8012 Power - id: hlw8012_power - energy: - name: HLW8012 Energy - id: hlw8012_energy - update_interval: 15s - current_resistor: 0.001 ohm - voltage_divider: 2351 - change_mode_every: "never" - initial_mode: VOLTAGE +substitutions: + sel_pin: GPIO12 + cf_pin: GPIO13 + cf1_pin: GPIO14 + +<<: !include common.yaml diff --git a/tests/components/hlw8012/test.rp2040-ard.yaml b/tests/components/hlw8012/test.rp2040-ard.yaml index da6053a1b9..8b0d069ce2 100644 --- a/tests/components/hlw8012/test.rp2040-ard.yaml +++ b/tests/components/hlw8012/test.rp2040-ard.yaml @@ -1,21 +1,6 @@ -sensor: - - platform: hlw8012 - model: hlw8012 - sel_pin: 2 - cf_pin: 4 - cf1_pin: 3 - current: - name: HLW8012 Current - voltage: - name: HLW8012 Voltage - power: - name: HLW8012 Power - id: hlw8012_power - energy: - name: HLW8012 Energy - id: hlw8012_energy - update_interval: 15s - current_resistor: 0.001 ohm - voltage_divider: 2351 - change_mode_every: "never" - initial_mode: VOLTAGE +substitutions: + sel_pin: GPIO2 + cf_pin: GPIO3 + cf1_pin: GPIO4 + +<<: !include common.yaml diff --git a/tests/components/hm3301/common.yaml b/tests/components/hm3301/common.yaml new file mode 100644 index 0000000000..b533130569 --- /dev/null +++ b/tests/components/hm3301/common.yaml @@ -0,0 +1,16 @@ +i2c: + - id: i2c_hm3301 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: hm3301 + pm_1_0: + name: PM1.0 + pm_2_5: + name: PM2.5 + pm_10_0: + name: PM10.0 + aqi: + name: AQI + calculation_type: CAQI diff --git a/tests/components/hm3301/test.esp32-ard.yaml b/tests/components/hm3301/test.esp32-ard.yaml index 413e88a265..63c3bd6afd 100644 --- a/tests/components/hm3301/test.esp32-ard.yaml +++ b/tests/components/hm3301/test.esp32-ard.yaml @@ -1,16 +1,5 @@ -i2c: - - id: i2c_hm3301 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: hm3301 - pm_1_0: - name: PM1.0 - pm_2_5: - name: PM2.5 - pm_10_0: - name: PM10.0 - aqi: - name: AQI - calculation_type: CAQI +<<: !include common.yaml diff --git a/tests/components/hm3301/test.esp32-c3-ard.yaml b/tests/components/hm3301/test.esp32-c3-ard.yaml index eb6c4a14e6..ee2c29ca4e 100644 --- a/tests/components/hm3301/test.esp32-c3-ard.yaml +++ b/tests/components/hm3301/test.esp32-c3-ard.yaml @@ -1,16 +1,5 @@ -i2c: - - id: i2c_hm3301 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: hm3301 - pm_1_0: - name: PM1.0 - pm_2_5: - name: PM2.5 - pm_10_0: - name: PM10.0 - aqi: - name: AQI - calculation_type: CAQI +<<: !include common.yaml diff --git a/tests/components/hm3301/test.esp32-c3-idf.yaml b/tests/components/hm3301/test.esp32-c3-idf.yaml index eb6c4a14e6..ee2c29ca4e 100644 --- a/tests/components/hm3301/test.esp32-c3-idf.yaml +++ b/tests/components/hm3301/test.esp32-c3-idf.yaml @@ -1,16 +1,5 @@ -i2c: - - id: i2c_hm3301 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: hm3301 - pm_1_0: - name: PM1.0 - pm_2_5: - name: PM2.5 - pm_10_0: - name: PM10.0 - aqi: - name: AQI - calculation_type: CAQI +<<: !include common.yaml diff --git a/tests/components/hm3301/test.esp32-idf.yaml b/tests/components/hm3301/test.esp32-idf.yaml index 413e88a265..63c3bd6afd 100644 --- a/tests/components/hm3301/test.esp32-idf.yaml +++ b/tests/components/hm3301/test.esp32-idf.yaml @@ -1,16 +1,5 @@ -i2c: - - id: i2c_hm3301 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: hm3301 - pm_1_0: - name: PM1.0 - pm_2_5: - name: PM2.5 - pm_10_0: - name: PM10.0 - aqi: - name: AQI - calculation_type: CAQI +<<: !include common.yaml diff --git a/tests/components/hm3301/test.esp8266-ard.yaml b/tests/components/hm3301/test.esp8266-ard.yaml index eb6c4a14e6..ee2c29ca4e 100644 --- a/tests/components/hm3301/test.esp8266-ard.yaml +++ b/tests/components/hm3301/test.esp8266-ard.yaml @@ -1,16 +1,5 @@ -i2c: - - id: i2c_hm3301 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: hm3301 - pm_1_0: - name: PM1.0 - pm_2_5: - name: PM2.5 - pm_10_0: - name: PM10.0 - aqi: - name: AQI - calculation_type: CAQI +<<: !include common.yaml diff --git a/tests/components/hm3301/test.rp2040-ard.yaml b/tests/components/hm3301/test.rp2040-ard.yaml index eb6c4a14e6..ee2c29ca4e 100644 --- a/tests/components/hm3301/test.rp2040-ard.yaml +++ b/tests/components/hm3301/test.rp2040-ard.yaml @@ -1,16 +1,5 @@ -i2c: - - id: i2c_hm3301 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: hm3301 - pm_1_0: - name: PM1.0 - pm_2_5: - name: PM2.5 - pm_10_0: - name: PM10.0 - aqi: - name: AQI - calculation_type: CAQI +<<: !include common.yaml diff --git a/tests/components/hmc5883l/common.yaml b/tests/components/hmc5883l/common.yaml new file mode 100644 index 0000000000..1c90f5f1c6 --- /dev/null +++ b/tests/components/hmc5883l/common.yaml @@ -0,0 +1,19 @@ +i2c: + - id: i2c_hmc5883l + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: hmc5883l + address: 0x68 + field_strength_x: + name: HMC5883L Field Strength X + field_strength_y: + name: HMC5883L Field Strength Y + field_strength_z: + name: HMC5883L Field Strength Z + heading: + name: HMC5883L Heading + range: 130uT + oversampling: 8x + update_interval: 15s diff --git a/tests/components/hmc5883l/test.esp32-ard.yaml b/tests/components/hmc5883l/test.esp32-ard.yaml index db632fc411..63c3bd6afd 100644 --- a/tests/components/hmc5883l/test.esp32-ard.yaml +++ b/tests/components/hmc5883l/test.esp32-ard.yaml @@ -1,19 +1,5 @@ -i2c: - - id: i2c_hmc5883l - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: hmc5883l - address: 0x68 - field_strength_x: - name: HMC5883L Field Strength X - field_strength_y: - name: HMC5883L Field Strength Y - field_strength_z: - name: HMC5883L Field Strength Z - heading: - name: HMC5883L Heading - range: 130uT - oversampling: 8x - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/hmc5883l/test.esp32-c3-ard.yaml b/tests/components/hmc5883l/test.esp32-c3-ard.yaml index e65b2e5c5b..ee2c29ca4e 100644 --- a/tests/components/hmc5883l/test.esp32-c3-ard.yaml +++ b/tests/components/hmc5883l/test.esp32-c3-ard.yaml @@ -1,19 +1,5 @@ -i2c: - - id: i2c_hmc5883l - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: hmc5883l - address: 0x68 - field_strength_x: - name: HMC5883L Field Strength X - field_strength_y: - name: HMC5883L Field Strength Y - field_strength_z: - name: HMC5883L Field Strength Z - heading: - name: HMC5883L Heading - range: 130uT - oversampling: 8x - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/hmc5883l/test.esp32-c3-idf.yaml b/tests/components/hmc5883l/test.esp32-c3-idf.yaml index e65b2e5c5b..ee2c29ca4e 100644 --- a/tests/components/hmc5883l/test.esp32-c3-idf.yaml +++ b/tests/components/hmc5883l/test.esp32-c3-idf.yaml @@ -1,19 +1,5 @@ -i2c: - - id: i2c_hmc5883l - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: hmc5883l - address: 0x68 - field_strength_x: - name: HMC5883L Field Strength X - field_strength_y: - name: HMC5883L Field Strength Y - field_strength_z: - name: HMC5883L Field Strength Z - heading: - name: HMC5883L Heading - range: 130uT - oversampling: 8x - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/hmc5883l/test.esp32-idf.yaml b/tests/components/hmc5883l/test.esp32-idf.yaml index db632fc411..63c3bd6afd 100644 --- a/tests/components/hmc5883l/test.esp32-idf.yaml +++ b/tests/components/hmc5883l/test.esp32-idf.yaml @@ -1,19 +1,5 @@ -i2c: - - id: i2c_hmc5883l - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: hmc5883l - address: 0x68 - field_strength_x: - name: HMC5883L Field Strength X - field_strength_y: - name: HMC5883L Field Strength Y - field_strength_z: - name: HMC5883L Field Strength Z - heading: - name: HMC5883L Heading - range: 130uT - oversampling: 8x - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/hmc5883l/test.esp8266-ard.yaml b/tests/components/hmc5883l/test.esp8266-ard.yaml index e65b2e5c5b..ee2c29ca4e 100644 --- a/tests/components/hmc5883l/test.esp8266-ard.yaml +++ b/tests/components/hmc5883l/test.esp8266-ard.yaml @@ -1,19 +1,5 @@ -i2c: - - id: i2c_hmc5883l - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: hmc5883l - address: 0x68 - field_strength_x: - name: HMC5883L Field Strength X - field_strength_y: - name: HMC5883L Field Strength Y - field_strength_z: - name: HMC5883L Field Strength Z - heading: - name: HMC5883L Heading - range: 130uT - oversampling: 8x - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/hmc5883l/test.rp2040-ard.yaml b/tests/components/hmc5883l/test.rp2040-ard.yaml index e65b2e5c5b..ee2c29ca4e 100644 --- a/tests/components/hmc5883l/test.rp2040-ard.yaml +++ b/tests/components/hmc5883l/test.rp2040-ard.yaml @@ -1,19 +1,5 @@ -i2c: - - id: i2c_hmc5883l - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: hmc5883l - address: 0x68 - field_strength_x: - name: HMC5883L Field Strength X - field_strength_y: - name: HMC5883L Field Strength Y - field_strength_z: - name: HMC5883L Field Strength Z - heading: - name: HMC5883L Heading - range: 130uT - oversampling: 8x - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/honeywell_hih_i2c/common.yaml b/tests/components/honeywell_hih_i2c/common.yaml new file mode 100644 index 0000000000..a5f3eef187 --- /dev/null +++ b/tests/components/honeywell_hih_i2c/common.yaml @@ -0,0 +1,12 @@ +i2c: + - id: i2c_honeywell_hih + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: honeywell_hih_i2c + temperature: + name: Temperature + humidity: + name: Humidity + update_interval: 15s diff --git a/tests/components/honeywell_hih_i2c/test.esp32-ard.yaml b/tests/components/honeywell_hih_i2c/test.esp32-ard.yaml index 0119aec3f3..63c3bd6afd 100644 --- a/tests/components/honeywell_hih_i2c/test.esp32-ard.yaml +++ b/tests/components/honeywell_hih_i2c/test.esp32-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_honeywell_hih - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: honeywell_hih_i2c - temperature: - name: Temperature - humidity: - name: Humidity - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/honeywell_hih_i2c/test.esp32-c3-ard.yaml b/tests/components/honeywell_hih_i2c/test.esp32-c3-ard.yaml index 5dae3d5d52..ee2c29ca4e 100644 --- a/tests/components/honeywell_hih_i2c/test.esp32-c3-ard.yaml +++ b/tests/components/honeywell_hih_i2c/test.esp32-c3-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_honeywell_hih - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: honeywell_hih_i2c - temperature: - name: Temperature - humidity: - name: Humidity - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/honeywell_hih_i2c/test.esp32-c3-idf.yaml b/tests/components/honeywell_hih_i2c/test.esp32-c3-idf.yaml index 5dae3d5d52..ee2c29ca4e 100644 --- a/tests/components/honeywell_hih_i2c/test.esp32-c3-idf.yaml +++ b/tests/components/honeywell_hih_i2c/test.esp32-c3-idf.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_honeywell_hih - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: honeywell_hih_i2c - temperature: - name: Temperature - humidity: - name: Humidity - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/honeywell_hih_i2c/test.esp32-idf.yaml b/tests/components/honeywell_hih_i2c/test.esp32-idf.yaml index 0119aec3f3..63c3bd6afd 100644 --- a/tests/components/honeywell_hih_i2c/test.esp32-idf.yaml +++ b/tests/components/honeywell_hih_i2c/test.esp32-idf.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_honeywell_hih - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: honeywell_hih_i2c - temperature: - name: Temperature - humidity: - name: Humidity - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/honeywell_hih_i2c/test.esp8266-ard.yaml b/tests/components/honeywell_hih_i2c/test.esp8266-ard.yaml index 5dae3d5d52..ee2c29ca4e 100644 --- a/tests/components/honeywell_hih_i2c/test.esp8266-ard.yaml +++ b/tests/components/honeywell_hih_i2c/test.esp8266-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_honeywell_hih - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: honeywell_hih_i2c - temperature: - name: Temperature - humidity: - name: Humidity - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/honeywell_hih_i2c/test.rp2040-ard.yaml b/tests/components/honeywell_hih_i2c/test.rp2040-ard.yaml index 5dae3d5d52..ee2c29ca4e 100644 --- a/tests/components/honeywell_hih_i2c/test.rp2040-ard.yaml +++ b/tests/components/honeywell_hih_i2c/test.rp2040-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_honeywell_hih - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: honeywell_hih_i2c - temperature: - name: Temperature - humidity: - name: Humidity - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/honeywellabp/common.yaml b/tests/components/honeywellabp/common.yaml new file mode 100644 index 0000000000..21a3ef6ee3 --- /dev/null +++ b/tests/components/honeywellabp/common.yaml @@ -0,0 +1,15 @@ +spi: + - id: spi_bme280 + clk_pin: ${clk_pin} + mosi_pin: ${mosi_pin} + miso_pin: ${miso_pin} + +sensor: + - platform: honeywellabp + cs_pin: ${cs_pin} + pressure: + name: Honeywell pressure + min_pressure: 0 + max_pressure: 15 + temperature: + name: Honeywell temperature diff --git a/tests/components/honeywellabp/test.esp32-ard.yaml b/tests/components/honeywellabp/test.esp32-ard.yaml index 6bf9fa0f4d..54e027a614 100644 --- a/tests/components/honeywellabp/test.esp32-ard.yaml +++ b/tests/components/honeywellabp/test.esp32-ard.yaml @@ -1,15 +1,7 @@ -spi: - - id: spi_bme280 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -sensor: - - platform: honeywellabp - cs_pin: 12 - pressure: - name: Honeywell pressure - min_pressure: 0 - max_pressure: 15 - temperature: - name: Honeywell temperature +<<: !include common.yaml diff --git a/tests/components/honeywellabp/test.esp32-c3-ard.yaml b/tests/components/honeywellabp/test.esp32-c3-ard.yaml index a53e3296dd..2415ba5dc6 100644 --- a/tests/components/honeywellabp/test.esp32-c3-ard.yaml +++ b/tests/components/honeywellabp/test.esp32-c3-ard.yaml @@ -1,15 +1,7 @@ -spi: - - id: spi_honeywellabp - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -sensor: - - platform: honeywellabp - cs_pin: 8 - pressure: - name: Honeywell pressure - min_pressure: 0 - max_pressure: 15 - temperature: - name: Honeywell temperature +<<: !include common.yaml diff --git a/tests/components/honeywellabp/test.esp32-c3-idf.yaml b/tests/components/honeywellabp/test.esp32-c3-idf.yaml index a53e3296dd..2415ba5dc6 100644 --- a/tests/components/honeywellabp/test.esp32-c3-idf.yaml +++ b/tests/components/honeywellabp/test.esp32-c3-idf.yaml @@ -1,15 +1,7 @@ -spi: - - id: spi_honeywellabp - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -sensor: - - platform: honeywellabp - cs_pin: 8 - pressure: - name: Honeywell pressure - min_pressure: 0 - max_pressure: 15 - temperature: - name: Honeywell temperature +<<: !include common.yaml diff --git a/tests/components/honeywellabp/test.esp32-idf.yaml b/tests/components/honeywellabp/test.esp32-idf.yaml index 6bf9fa0f4d..54e027a614 100644 --- a/tests/components/honeywellabp/test.esp32-idf.yaml +++ b/tests/components/honeywellabp/test.esp32-idf.yaml @@ -1,15 +1,7 @@ -spi: - - id: spi_bme280 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -sensor: - - platform: honeywellabp - cs_pin: 12 - pressure: - name: Honeywell pressure - min_pressure: 0 - max_pressure: 15 - temperature: - name: Honeywell temperature +<<: !include common.yaml diff --git a/tests/components/honeywellabp/test.esp8266-ard.yaml b/tests/components/honeywellabp/test.esp8266-ard.yaml index 31988c035e..dbd158d030 100644 --- a/tests/components/honeywellabp/test.esp8266-ard.yaml +++ b/tests/components/honeywellabp/test.esp8266-ard.yaml @@ -1,15 +1,7 @@ -spi: - - id: spi_bme280 - clk_pin: 14 - mosi_pin: 13 - miso_pin: 12 +substitutions: + clk_pin: GPIO14 + mosi_pin: GPIO13 + miso_pin: GPIO12 + cs_pin: GPIO15 -sensor: - - platform: honeywellabp - cs_pin: 15 - pressure: - name: Honeywell pressure - min_pressure: 0 - max_pressure: 15 - temperature: - name: Honeywell temperature +<<: !include common.yaml diff --git a/tests/components/honeywellabp/test.rp2040-ard.yaml b/tests/components/honeywellabp/test.rp2040-ard.yaml index 2e0c471fa0..f6c3f1eeca 100644 --- a/tests/components/honeywellabp/test.rp2040-ard.yaml +++ b/tests/components/honeywellabp/test.rp2040-ard.yaml @@ -1,15 +1,7 @@ -spi: - - id: spi_bme280 - clk_pin: 2 - mosi_pin: 3 - miso_pin: 4 +substitutions: + clk_pin: GPIO2 + mosi_pin: GPIO3 + miso_pin: GPIO4 + cs_pin: GPIO5 -sensor: - - platform: honeywellabp - cs_pin: 6 - pressure: - name: Honeywell pressure - min_pressure: 0 - max_pressure: 15 - temperature: - name: Honeywell temperature +<<: !include common.yaml diff --git a/tests/components/honeywellabp2_i2c/common.yaml b/tests/components/honeywellabp2_i2c/common.yaml new file mode 100644 index 0000000000..6752a69866 --- /dev/null +++ b/tests/components/honeywellabp2_i2c/common.yaml @@ -0,0 +1,15 @@ +i2c: + - id: i2c_honeywellabp2 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: honeywellabp2_i2c + address: 0x28 + pressure: + name: Honeywell2 pressure + min_pressure: 0 + max_pressure: 16000 + transfer_function: A + temperature: + name: Honeywell temperature diff --git a/tests/components/honeywellabp2_i2c/test.esp32-ard.yaml b/tests/components/honeywellabp2_i2c/test.esp32-ard.yaml index 0f0d61ca06..63c3bd6afd 100644 --- a/tests/components/honeywellabp2_i2c/test.esp32-ard.yaml +++ b/tests/components/honeywellabp2_i2c/test.esp32-ard.yaml @@ -1,15 +1,5 @@ -i2c: - - id: i2c_honeywellabp2 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: honeywellabp2_i2c - address: 0x28 - pressure: - name: Honeywell2 pressure - min_pressure: 0 - max_pressure: 16000 - transfer_function: A - temperature: - name: Honeywell temperature +<<: !include common.yaml diff --git a/tests/components/honeywellabp2_i2c/test.esp32-c3-ard.yaml b/tests/components/honeywellabp2_i2c/test.esp32-c3-ard.yaml index b47411c238..ee2c29ca4e 100644 --- a/tests/components/honeywellabp2_i2c/test.esp32-c3-ard.yaml +++ b/tests/components/honeywellabp2_i2c/test.esp32-c3-ard.yaml @@ -1,15 +1,5 @@ -i2c: - - id: i2c_honeywellabp2 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: honeywellabp2_i2c - address: 0x28 - pressure: - name: Honeywell2 pressure - min_pressure: 0 - max_pressure: 16000 - transfer_function: A - temperature: - name: Honeywell temperature +<<: !include common.yaml diff --git a/tests/components/honeywellabp2_i2c/test.esp32-c3-idf.yaml b/tests/components/honeywellabp2_i2c/test.esp32-c3-idf.yaml index b47411c238..ee2c29ca4e 100644 --- a/tests/components/honeywellabp2_i2c/test.esp32-c3-idf.yaml +++ b/tests/components/honeywellabp2_i2c/test.esp32-c3-idf.yaml @@ -1,15 +1,5 @@ -i2c: - - id: i2c_honeywellabp2 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: honeywellabp2_i2c - address: 0x28 - pressure: - name: Honeywell2 pressure - min_pressure: 0 - max_pressure: 16000 - transfer_function: A - temperature: - name: Honeywell temperature +<<: !include common.yaml diff --git a/tests/components/honeywellabp2_i2c/test.esp32-idf.yaml b/tests/components/honeywellabp2_i2c/test.esp32-idf.yaml index 0f0d61ca06..63c3bd6afd 100644 --- a/tests/components/honeywellabp2_i2c/test.esp32-idf.yaml +++ b/tests/components/honeywellabp2_i2c/test.esp32-idf.yaml @@ -1,15 +1,5 @@ -i2c: - - id: i2c_honeywellabp2 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: honeywellabp2_i2c - address: 0x28 - pressure: - name: Honeywell2 pressure - min_pressure: 0 - max_pressure: 16000 - transfer_function: A - temperature: - name: Honeywell temperature +<<: !include common.yaml diff --git a/tests/components/honeywellabp2_i2c/test.esp8266-ard.yaml b/tests/components/honeywellabp2_i2c/test.esp8266-ard.yaml index b47411c238..ee2c29ca4e 100644 --- a/tests/components/honeywellabp2_i2c/test.esp8266-ard.yaml +++ b/tests/components/honeywellabp2_i2c/test.esp8266-ard.yaml @@ -1,15 +1,5 @@ -i2c: - - id: i2c_honeywellabp2 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: honeywellabp2_i2c - address: 0x28 - pressure: - name: Honeywell2 pressure - min_pressure: 0 - max_pressure: 16000 - transfer_function: A - temperature: - name: Honeywell temperature +<<: !include common.yaml diff --git a/tests/components/honeywellabp2_i2c/test.rp2040-ard.yaml b/tests/components/honeywellabp2_i2c/test.rp2040-ard.yaml index b47411c238..ee2c29ca4e 100644 --- a/tests/components/honeywellabp2_i2c/test.rp2040-ard.yaml +++ b/tests/components/honeywellabp2_i2c/test.rp2040-ard.yaml @@ -1,15 +1,5 @@ -i2c: - - id: i2c_honeywellabp2 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: honeywellabp2_i2c - address: 0x28 - pressure: - name: Honeywell2 pressure - min_pressure: 0 - max_pressure: 16000 - transfer_function: A - temperature: - name: Honeywell temperature +<<: !include common.yaml diff --git a/tests/components/hrxl_maxsonar_wr/common.yaml b/tests/components/hrxl_maxsonar_wr/common.yaml new file mode 100644 index 0000000000..d74ada716d --- /dev/null +++ b/tests/components/hrxl_maxsonar_wr/common.yaml @@ -0,0 +1,10 @@ +uart: + - id: uart_hrxl_maxsonar_wr + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} + baud_rate: 115200 + +sensor: + - platform: hrxl_maxsonar_wr + id: hrxl_maxsonar_wr_sensor + name: Rainwater Tank Level diff --git a/tests/components/hrxl_maxsonar_wr/test.esp32-ard.yaml b/tests/components/hrxl_maxsonar_wr/test.esp32-ard.yaml index da283cc072..811f6b72a6 100644 --- a/tests/components/hrxl_maxsonar_wr/test.esp32-ard.yaml +++ b/tests/components/hrxl_maxsonar_wr/test.esp32-ard.yaml @@ -1,10 +1,5 @@ -uart: - - id: uart_hrxl_maxsonar_wr - tx_pin: 17 - rx_pin: 16 - baud_rate: 115200 +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 -sensor: - - platform: hrxl_maxsonar_wr - id: hrxl_maxsonar_wr_sensor - name: Rainwater Tank Level +<<: !include common.yaml diff --git a/tests/components/hrxl_maxsonar_wr/test.esp32-c3-ard.yaml b/tests/components/hrxl_maxsonar_wr/test.esp32-c3-ard.yaml index 729cb96120..b516342f3b 100644 --- a/tests/components/hrxl_maxsonar_wr/test.esp32-c3-ard.yaml +++ b/tests/components/hrxl_maxsonar_wr/test.esp32-c3-ard.yaml @@ -1,10 +1,5 @@ -uart: - - id: uart_hrxl_maxsonar_wr - tx_pin: 4 - rx_pin: 5 - baud_rate: 115200 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -sensor: - - platform: hrxl_maxsonar_wr - id: hrxl_maxsonar_wr_sensor - name: Rainwater Tank Level +<<: !include common.yaml diff --git a/tests/components/hrxl_maxsonar_wr/test.esp32-c3-idf.yaml b/tests/components/hrxl_maxsonar_wr/test.esp32-c3-idf.yaml index 729cb96120..b516342f3b 100644 --- a/tests/components/hrxl_maxsonar_wr/test.esp32-c3-idf.yaml +++ b/tests/components/hrxl_maxsonar_wr/test.esp32-c3-idf.yaml @@ -1,10 +1,5 @@ -uart: - - id: uart_hrxl_maxsonar_wr - tx_pin: 4 - rx_pin: 5 - baud_rate: 115200 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -sensor: - - platform: hrxl_maxsonar_wr - id: hrxl_maxsonar_wr_sensor - name: Rainwater Tank Level +<<: !include common.yaml diff --git a/tests/components/hrxl_maxsonar_wr/test.esp32-idf.yaml b/tests/components/hrxl_maxsonar_wr/test.esp32-idf.yaml index da283cc072..811f6b72a6 100644 --- a/tests/components/hrxl_maxsonar_wr/test.esp32-idf.yaml +++ b/tests/components/hrxl_maxsonar_wr/test.esp32-idf.yaml @@ -1,10 +1,5 @@ -uart: - - id: uart_hrxl_maxsonar_wr - tx_pin: 17 - rx_pin: 16 - baud_rate: 115200 +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 -sensor: - - platform: hrxl_maxsonar_wr - id: hrxl_maxsonar_wr_sensor - name: Rainwater Tank Level +<<: !include common.yaml diff --git a/tests/components/hrxl_maxsonar_wr/test.esp8266-ard.yaml b/tests/components/hrxl_maxsonar_wr/test.esp8266-ard.yaml index 729cb96120..b516342f3b 100644 --- a/tests/components/hrxl_maxsonar_wr/test.esp8266-ard.yaml +++ b/tests/components/hrxl_maxsonar_wr/test.esp8266-ard.yaml @@ -1,10 +1,5 @@ -uart: - - id: uart_hrxl_maxsonar_wr - tx_pin: 4 - rx_pin: 5 - baud_rate: 115200 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -sensor: - - platform: hrxl_maxsonar_wr - id: hrxl_maxsonar_wr_sensor - name: Rainwater Tank Level +<<: !include common.yaml diff --git a/tests/components/hrxl_maxsonar_wr/test.rp2040-ard.yaml b/tests/components/hrxl_maxsonar_wr/test.rp2040-ard.yaml index 729cb96120..b516342f3b 100644 --- a/tests/components/hrxl_maxsonar_wr/test.rp2040-ard.yaml +++ b/tests/components/hrxl_maxsonar_wr/test.rp2040-ard.yaml @@ -1,10 +1,5 @@ -uart: - - id: uart_hrxl_maxsonar_wr - tx_pin: 4 - rx_pin: 5 - baud_rate: 115200 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -sensor: - - platform: hrxl_maxsonar_wr - id: hrxl_maxsonar_wr_sensor - name: Rainwater Tank Level +<<: !include common.yaml diff --git a/tests/components/hte501/common.yaml b/tests/components/hte501/common.yaml new file mode 100644 index 0000000000..7c57b5bc6a --- /dev/null +++ b/tests/components/hte501/common.yaml @@ -0,0 +1,12 @@ +i2c: + - id: i2c_hte501 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: hte501 + address: 0x40 + temperature: + name: Temperature + humidity: + name: Humidity diff --git a/tests/components/hte501/test.esp32-ard.yaml b/tests/components/hte501/test.esp32-ard.yaml index 83e4d26603..63c3bd6afd 100644 --- a/tests/components/hte501/test.esp32-ard.yaml +++ b/tests/components/hte501/test.esp32-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_hte501 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: hte501 - address: 0x40 - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/hte501/test.esp32-c3-ard.yaml b/tests/components/hte501/test.esp32-c3-ard.yaml index e14b589dbd..ee2c29ca4e 100644 --- a/tests/components/hte501/test.esp32-c3-ard.yaml +++ b/tests/components/hte501/test.esp32-c3-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_hte501 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: hte501 - address: 0x40 - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/hte501/test.esp32-c3-idf.yaml b/tests/components/hte501/test.esp32-c3-idf.yaml index e14b589dbd..ee2c29ca4e 100644 --- a/tests/components/hte501/test.esp32-c3-idf.yaml +++ b/tests/components/hte501/test.esp32-c3-idf.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_hte501 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: hte501 - address: 0x40 - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/hte501/test.esp32-idf.yaml b/tests/components/hte501/test.esp32-idf.yaml index 83e4d26603..63c3bd6afd 100644 --- a/tests/components/hte501/test.esp32-idf.yaml +++ b/tests/components/hte501/test.esp32-idf.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_hte501 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: hte501 - address: 0x40 - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/hte501/test.esp8266-ard.yaml b/tests/components/hte501/test.esp8266-ard.yaml index e14b589dbd..ee2c29ca4e 100644 --- a/tests/components/hte501/test.esp8266-ard.yaml +++ b/tests/components/hte501/test.esp8266-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_hte501 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: hte501 - address: 0x40 - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/hte501/test.rp2040-ard.yaml b/tests/components/hte501/test.rp2040-ard.yaml index e14b589dbd..ee2c29ca4e 100644 --- a/tests/components/hte501/test.rp2040-ard.yaml +++ b/tests/components/hte501/test.rp2040-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_hte501 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: hte501 - address: 0x40 - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/htu21d/common.yaml b/tests/components/htu21d/common.yaml new file mode 100644 index 0000000000..f12c1ca46e --- /dev/null +++ b/tests/components/htu21d/common.yaml @@ -0,0 +1,15 @@ +i2c: + - id: i2c_htu21d + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: htu21d + model: htu21d + temperature: + name: Temperature + humidity: + name: Humidity + heater: + name: Heater + update_interval: 15s diff --git a/tests/components/htu21d/test.esp32-ard.yaml b/tests/components/htu21d/test.esp32-ard.yaml index 6655a1cc1a..63c3bd6afd 100644 --- a/tests/components/htu21d/test.esp32-ard.yaml +++ b/tests/components/htu21d/test.esp32-ard.yaml @@ -1,15 +1,5 @@ -i2c: - - id: i2c_htu21d - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: htu21d - model: htu21d - temperature: - name: Temperature - humidity: - name: Humidity - heater: - name: Heater - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/htu21d/test.esp32-c3-ard.yaml b/tests/components/htu21d/test.esp32-c3-ard.yaml index 8131d13661..ee2c29ca4e 100644 --- a/tests/components/htu21d/test.esp32-c3-ard.yaml +++ b/tests/components/htu21d/test.esp32-c3-ard.yaml @@ -1,15 +1,5 @@ -i2c: - - id: i2c_htu21d - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: htu21d - model: htu21d - temperature: - name: Temperature - humidity: - name: Humidity - heater: - name: Heater - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/htu21d/test.esp32-c3-idf.yaml b/tests/components/htu21d/test.esp32-c3-idf.yaml index 8131d13661..ee2c29ca4e 100644 --- a/tests/components/htu21d/test.esp32-c3-idf.yaml +++ b/tests/components/htu21d/test.esp32-c3-idf.yaml @@ -1,15 +1,5 @@ -i2c: - - id: i2c_htu21d - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: htu21d - model: htu21d - temperature: - name: Temperature - humidity: - name: Humidity - heater: - name: Heater - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/htu21d/test.esp32-idf.yaml b/tests/components/htu21d/test.esp32-idf.yaml index 6655a1cc1a..63c3bd6afd 100644 --- a/tests/components/htu21d/test.esp32-idf.yaml +++ b/tests/components/htu21d/test.esp32-idf.yaml @@ -1,15 +1,5 @@ -i2c: - - id: i2c_htu21d - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: htu21d - model: htu21d - temperature: - name: Temperature - humidity: - name: Humidity - heater: - name: Heater - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/htu21d/test.esp8266-ard.yaml b/tests/components/htu21d/test.esp8266-ard.yaml index 8131d13661..ee2c29ca4e 100644 --- a/tests/components/htu21d/test.esp8266-ard.yaml +++ b/tests/components/htu21d/test.esp8266-ard.yaml @@ -1,15 +1,5 @@ -i2c: - - id: i2c_htu21d - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: htu21d - model: htu21d - temperature: - name: Temperature - humidity: - name: Humidity - heater: - name: Heater - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/htu21d/test.rp2040-ard.yaml b/tests/components/htu21d/test.rp2040-ard.yaml index 8131d13661..ee2c29ca4e 100644 --- a/tests/components/htu21d/test.rp2040-ard.yaml +++ b/tests/components/htu21d/test.rp2040-ard.yaml @@ -1,15 +1,5 @@ -i2c: - - id: i2c_htu21d - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: htu21d - model: htu21d - temperature: - name: Temperature - humidity: - name: Humidity - heater: - name: Heater - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/htu31d/common.yaml b/tests/components/htu31d/common.yaml index c8ef2fede9..735cdc7cbf 100644 --- a/tests/components/htu31d/common.yaml +++ b/tests/components/htu31d/common.yaml @@ -1,9 +1,12 @@ i2c: + - id: i2c_htu31d + scl: ${scl_pin} + sda: ${sda_pin} sensor: - platform: htu31d temperature: - name: Living Room Temperature 7 + name: Living Room Temperature humidity: - name: Living Room Humidity 7 + name: Living Room Humidity update_interval: 15s diff --git a/tests/components/htu31d/test.esp32-ard.yaml b/tests/components/htu31d/test.esp32-ard.yaml index dade44d145..63c3bd6afd 100644 --- a/tests/components/htu31d/test.esp32-ard.yaml +++ b/tests/components/htu31d/test.esp32-ard.yaml @@ -1 +1,5 @@ +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 + <<: !include common.yaml diff --git a/tests/components/htu31d/test.esp32-c3-ard.yaml b/tests/components/htu31d/test.esp32-c3-ard.yaml new file mode 100644 index 0000000000..ee2c29ca4e --- /dev/null +++ b/tests/components/htu31d/test.esp32-c3-ard.yaml @@ -0,0 +1,5 @@ +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + +<<: !include common.yaml diff --git a/tests/components/htu31d/test.esp32-c3-idf.yaml b/tests/components/htu31d/test.esp32-c3-idf.yaml new file mode 100644 index 0000000000..ee2c29ca4e --- /dev/null +++ b/tests/components/htu31d/test.esp32-c3-idf.yaml @@ -0,0 +1,5 @@ +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + +<<: !include common.yaml diff --git a/tests/components/htu31d/test.esp32-idf.yaml b/tests/components/htu31d/test.esp32-idf.yaml index dade44d145..63c3bd6afd 100644 --- a/tests/components/htu31d/test.esp32-idf.yaml +++ b/tests/components/htu31d/test.esp32-idf.yaml @@ -1 +1,5 @@ +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 + <<: !include common.yaml diff --git a/tests/components/htu31d/test.esp8266-ard.yaml b/tests/components/htu31d/test.esp8266-ard.yaml index dade44d145..ee2c29ca4e 100644 --- a/tests/components/htu31d/test.esp8266-ard.yaml +++ b/tests/components/htu31d/test.esp8266-ard.yaml @@ -1 +1,5 @@ +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + <<: !include common.yaml diff --git a/tests/components/htu31d/test.rp2040-ard.yaml b/tests/components/htu31d/test.rp2040-ard.yaml new file mode 100644 index 0000000000..ee2c29ca4e --- /dev/null +++ b/tests/components/htu31d/test.rp2040-ard.yaml @@ -0,0 +1,5 @@ +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + +<<: !include common.yaml diff --git a/tests/components/hx711/common.yaml b/tests/components/hx711/common.yaml new file mode 100644 index 0000000000..be22fca678 --- /dev/null +++ b/tests/components/hx711/common.yaml @@ -0,0 +1,7 @@ +sensor: + - platform: hx711 + name: HX711 Value + clk_pin: ${clk_pin} + dout_pin: ${dout_pin} + gain: 128 + update_interval: 15s diff --git a/tests/components/hx711/test.esp32-ard.yaml b/tests/components/hx711/test.esp32-ard.yaml index 554b184422..6423867395 100644 --- a/tests/components/hx711/test.esp32-ard.yaml +++ b/tests/components/hx711/test.esp32-ard.yaml @@ -1,7 +1,5 @@ -sensor: - - platform: hx711 - name: HX711 Value - dout_pin: 14 - clk_pin: 15 - gain: 128 - update_interval: 15s +substitutions: + clk_pin: GPIO16 + dout_pin: GPIO17 + +<<: !include common.yaml diff --git a/tests/components/hx711/test.esp32-c3-ard.yaml b/tests/components/hx711/test.esp32-c3-ard.yaml index 9850417440..08a6e705c0 100644 --- a/tests/components/hx711/test.esp32-c3-ard.yaml +++ b/tests/components/hx711/test.esp32-c3-ard.yaml @@ -1,7 +1,5 @@ -sensor: - - platform: hx711 - name: HX711 Value - dout_pin: 4 - clk_pin: 5 - gain: 128 - update_interval: 15s +substitutions: + clk_pin: GPIO5 + dout_pin: GPIO4 + +<<: !include common.yaml diff --git a/tests/components/hx711/test.esp32-c3-idf.yaml b/tests/components/hx711/test.esp32-c3-idf.yaml index 9850417440..08a6e705c0 100644 --- a/tests/components/hx711/test.esp32-c3-idf.yaml +++ b/tests/components/hx711/test.esp32-c3-idf.yaml @@ -1,7 +1,5 @@ -sensor: - - platform: hx711 - name: HX711 Value - dout_pin: 4 - clk_pin: 5 - gain: 128 - update_interval: 15s +substitutions: + clk_pin: GPIO5 + dout_pin: GPIO4 + +<<: !include common.yaml diff --git a/tests/components/hx711/test.esp32-idf.yaml b/tests/components/hx711/test.esp32-idf.yaml index 554b184422..6423867395 100644 --- a/tests/components/hx711/test.esp32-idf.yaml +++ b/tests/components/hx711/test.esp32-idf.yaml @@ -1,7 +1,5 @@ -sensor: - - platform: hx711 - name: HX711 Value - dout_pin: 14 - clk_pin: 15 - gain: 128 - update_interval: 15s +substitutions: + clk_pin: GPIO16 + dout_pin: GPIO17 + +<<: !include common.yaml diff --git a/tests/components/hx711/test.esp8266-ard.yaml b/tests/components/hx711/test.esp8266-ard.yaml index 9850417440..08a6e705c0 100644 --- a/tests/components/hx711/test.esp8266-ard.yaml +++ b/tests/components/hx711/test.esp8266-ard.yaml @@ -1,7 +1,5 @@ -sensor: - - platform: hx711 - name: HX711 Value - dout_pin: 4 - clk_pin: 5 - gain: 128 - update_interval: 15s +substitutions: + clk_pin: GPIO5 + dout_pin: GPIO4 + +<<: !include common.yaml diff --git a/tests/components/hx711/test.rp2040-ard.yaml b/tests/components/hx711/test.rp2040-ard.yaml index 9850417440..08a6e705c0 100644 --- a/tests/components/hx711/test.rp2040-ard.yaml +++ b/tests/components/hx711/test.rp2040-ard.yaml @@ -1,7 +1,5 @@ -sensor: - - platform: hx711 - name: HX711 Value - dout_pin: 4 - clk_pin: 5 - gain: 128 - update_interval: 15s +substitutions: + clk_pin: GPIO5 + dout_pin: GPIO4 + +<<: !include common.yaml diff --git a/tests/components/hydreon_rgxx/common.yaml b/tests/components/hydreon_rgxx/common.yaml new file mode 100644 index 0000000000..e11c6c91c9 --- /dev/null +++ b/tests/components/hydreon_rgxx/common.yaml @@ -0,0 +1,37 @@ +uart: + - id: uart_hydreon_rgxx + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} + baud_rate: 115200 + +binary_sensor: + - platform: hydreon_rgxx + hydreon_rgxx_id: hydreon_rg9 + too_cold: + name: rg9_toocold + em_sat: + name: rg9_emsat + lens_bad: + name: rg9_lens_bad + +sensor: + - platform: hydreon_rgxx + id: hydreon_rg9 + model: RG 9 + moisture: + name: hydreon_rain + id: hydreon_rain + temperature: + name: hydreon_temperature + disable_led: true + - platform: hydreon_rgxx + id: hydreon_rg15 + model: RG_15 + acc: + name: hydreon_acc + event_acc: + name: hydreon_event_acc + total_acc: + name: hydreon_total_acc + r_int: + name: hydreon_r_int diff --git a/tests/components/hydreon_rgxx/test.esp32-ard.yaml b/tests/components/hydreon_rgxx/test.esp32-ard.yaml index b6f9486d86..f486544afa 100644 --- a/tests/components/hydreon_rgxx/test.esp32-ard.yaml +++ b/tests/components/hydreon_rgxx/test.esp32-ard.yaml @@ -1,37 +1,5 @@ -uart: - - id: uart_hydreon_rgxx - tx_pin: 17 - rx_pin: 16 - baud_rate: 115200 +substitutions: + tx_pin: GPIO17 + rx_pin: GPIO16 -binary_sensor: - - platform: hydreon_rgxx - hydreon_rgxx_id: hydreon_rg9 - too_cold: - name: rg9_toocold - em_sat: - name: rg9_emsat - lens_bad: - name: rg9_lens_bad - -sensor: - - platform: hydreon_rgxx - id: hydreon_rg9 - model: RG 9 - moisture: - name: hydreon_rain - id: hydreon_rain - temperature: - name: hydreon_temperature - disable_led: true - - platform: hydreon_rgxx - id: hydreon_rg15 - model: RG_15 - acc: - name: hydreon_acc - event_acc: - name: hydreon_event_acc - total_acc: - name: hydreon_total_acc - r_int: - name: hydreon_r_int +<<: !include common.yaml diff --git a/tests/components/hydreon_rgxx/test.esp32-c3-ard.yaml b/tests/components/hydreon_rgxx/test.esp32-c3-ard.yaml index f62f4942db..b516342f3b 100644 --- a/tests/components/hydreon_rgxx/test.esp32-c3-ard.yaml +++ b/tests/components/hydreon_rgxx/test.esp32-c3-ard.yaml @@ -1,37 +1,5 @@ -uart: - - id: uart_hydreon_rgxx - tx_pin: 4 - rx_pin: 5 - baud_rate: 115200 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -binary_sensor: - - platform: hydreon_rgxx - hydreon_rgxx_id: hydreon_rg9 - too_cold: - name: rg9_toocold - em_sat: - name: rg9_emsat - lens_bad: - name: rg9_lens_bad - -sensor: - - platform: hydreon_rgxx - id: hydreon_rg9 - model: RG 9 - moisture: - name: hydreon_rain - id: hydreon_rain - temperature: - name: hydreon_temperature - disable_led: true - - platform: hydreon_rgxx - id: hydreon_rg15 - model: RG_15 - acc: - name: hydreon_acc - event_acc: - name: hydreon_event_acc - total_acc: - name: hydreon_total_acc - r_int: - name: hydreon_r_int +<<: !include common.yaml diff --git a/tests/components/hydreon_rgxx/test.esp32-c3-idf.yaml b/tests/components/hydreon_rgxx/test.esp32-c3-idf.yaml index f62f4942db..b516342f3b 100644 --- a/tests/components/hydreon_rgxx/test.esp32-c3-idf.yaml +++ b/tests/components/hydreon_rgxx/test.esp32-c3-idf.yaml @@ -1,37 +1,5 @@ -uart: - - id: uart_hydreon_rgxx - tx_pin: 4 - rx_pin: 5 - baud_rate: 115200 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -binary_sensor: - - platform: hydreon_rgxx - hydreon_rgxx_id: hydreon_rg9 - too_cold: - name: rg9_toocold - em_sat: - name: rg9_emsat - lens_bad: - name: rg9_lens_bad - -sensor: - - platform: hydreon_rgxx - id: hydreon_rg9 - model: RG 9 - moisture: - name: hydreon_rain - id: hydreon_rain - temperature: - name: hydreon_temperature - disable_led: true - - platform: hydreon_rgxx - id: hydreon_rg15 - model: RG_15 - acc: - name: hydreon_acc - event_acc: - name: hydreon_event_acc - total_acc: - name: hydreon_total_acc - r_int: - name: hydreon_r_int +<<: !include common.yaml diff --git a/tests/components/hydreon_rgxx/test.esp32-idf.yaml b/tests/components/hydreon_rgxx/test.esp32-idf.yaml index b6f9486d86..f486544afa 100644 --- a/tests/components/hydreon_rgxx/test.esp32-idf.yaml +++ b/tests/components/hydreon_rgxx/test.esp32-idf.yaml @@ -1,37 +1,5 @@ -uart: - - id: uart_hydreon_rgxx - tx_pin: 17 - rx_pin: 16 - baud_rate: 115200 +substitutions: + tx_pin: GPIO17 + rx_pin: GPIO16 -binary_sensor: - - platform: hydreon_rgxx - hydreon_rgxx_id: hydreon_rg9 - too_cold: - name: rg9_toocold - em_sat: - name: rg9_emsat - lens_bad: - name: rg9_lens_bad - -sensor: - - platform: hydreon_rgxx - id: hydreon_rg9 - model: RG 9 - moisture: - name: hydreon_rain - id: hydreon_rain - temperature: - name: hydreon_temperature - disable_led: true - - platform: hydreon_rgxx - id: hydreon_rg15 - model: RG_15 - acc: - name: hydreon_acc - event_acc: - name: hydreon_event_acc - total_acc: - name: hydreon_total_acc - r_int: - name: hydreon_r_int +<<: !include common.yaml diff --git a/tests/components/hydreon_rgxx/test.esp8266-ard.yaml b/tests/components/hydreon_rgxx/test.esp8266-ard.yaml index f62f4942db..b516342f3b 100644 --- a/tests/components/hydreon_rgxx/test.esp8266-ard.yaml +++ b/tests/components/hydreon_rgxx/test.esp8266-ard.yaml @@ -1,37 +1,5 @@ -uart: - - id: uart_hydreon_rgxx - tx_pin: 4 - rx_pin: 5 - baud_rate: 115200 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -binary_sensor: - - platform: hydreon_rgxx - hydreon_rgxx_id: hydreon_rg9 - too_cold: - name: rg9_toocold - em_sat: - name: rg9_emsat - lens_bad: - name: rg9_lens_bad - -sensor: - - platform: hydreon_rgxx - id: hydreon_rg9 - model: RG 9 - moisture: - name: hydreon_rain - id: hydreon_rain - temperature: - name: hydreon_temperature - disable_led: true - - platform: hydreon_rgxx - id: hydreon_rg15 - model: RG_15 - acc: - name: hydreon_acc - event_acc: - name: hydreon_event_acc - total_acc: - name: hydreon_total_acc - r_int: - name: hydreon_r_int +<<: !include common.yaml diff --git a/tests/components/hydreon_rgxx/test.rp2040-ard.yaml b/tests/components/hydreon_rgxx/test.rp2040-ard.yaml index f62f4942db..b516342f3b 100644 --- a/tests/components/hydreon_rgxx/test.rp2040-ard.yaml +++ b/tests/components/hydreon_rgxx/test.rp2040-ard.yaml @@ -1,37 +1,5 @@ -uart: - - id: uart_hydreon_rgxx - tx_pin: 4 - rx_pin: 5 - baud_rate: 115200 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -binary_sensor: - - platform: hydreon_rgxx - hydreon_rgxx_id: hydreon_rg9 - too_cold: - name: rg9_toocold - em_sat: - name: rg9_emsat - lens_bad: - name: rg9_lens_bad - -sensor: - - platform: hydreon_rgxx - id: hydreon_rg9 - model: RG 9 - moisture: - name: hydreon_rain - id: hydreon_rain - temperature: - name: hydreon_temperature - disable_led: true - - platform: hydreon_rgxx - id: hydreon_rg15 - model: RG_15 - acc: - name: hydreon_acc - event_acc: - name: hydreon_event_acc - total_acc: - name: hydreon_total_acc - r_int: - name: hydreon_r_int +<<: !include common.yaml diff --git a/tests/components/hyt271/common.yaml b/tests/components/hyt271/common.yaml new file mode 100644 index 0000000000..7a4371173f --- /dev/null +++ b/tests/components/hyt271/common.yaml @@ -0,0 +1,11 @@ +i2c: + - id: i2c_hyt271 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: hyt271 + temperature: + name: Temperature + humidity: + name: Humidity diff --git a/tests/components/hyt271/test.esp32-ard.yaml b/tests/components/hyt271/test.esp32-ard.yaml index 297611a89b..63c3bd6afd 100644 --- a/tests/components/hyt271/test.esp32-ard.yaml +++ b/tests/components/hyt271/test.esp32-ard.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_hyt271 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: hyt271 - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/hyt271/test.esp32-c3-ard.yaml b/tests/components/hyt271/test.esp32-c3-ard.yaml index c44f0a1f5d..ee2c29ca4e 100644 --- a/tests/components/hyt271/test.esp32-c3-ard.yaml +++ b/tests/components/hyt271/test.esp32-c3-ard.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_hyt271 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: hyt271 - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/hyt271/test.esp32-c3-idf.yaml b/tests/components/hyt271/test.esp32-c3-idf.yaml index c44f0a1f5d..ee2c29ca4e 100644 --- a/tests/components/hyt271/test.esp32-c3-idf.yaml +++ b/tests/components/hyt271/test.esp32-c3-idf.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_hyt271 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: hyt271 - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/hyt271/test.esp32-idf.yaml b/tests/components/hyt271/test.esp32-idf.yaml index 297611a89b..63c3bd6afd 100644 --- a/tests/components/hyt271/test.esp32-idf.yaml +++ b/tests/components/hyt271/test.esp32-idf.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_hyt271 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: hyt271 - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/hyt271/test.esp8266-ard.yaml b/tests/components/hyt271/test.esp8266-ard.yaml index c44f0a1f5d..ee2c29ca4e 100644 --- a/tests/components/hyt271/test.esp8266-ard.yaml +++ b/tests/components/hyt271/test.esp8266-ard.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_hyt271 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: hyt271 - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/hyt271/test.rp2040-ard.yaml b/tests/components/hyt271/test.rp2040-ard.yaml index c44f0a1f5d..ee2c29ca4e 100644 --- a/tests/components/hyt271/test.rp2040-ard.yaml +++ b/tests/components/hyt271/test.rp2040-ard.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_hyt271 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: hyt271 - temperature: - name: Temperature - humidity: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/i2c/common.yaml b/tests/components/i2c/common.yaml new file mode 100644 index 0000000000..d70cd595ad --- /dev/null +++ b/tests/components/i2c/common.yaml @@ -0,0 +1,4 @@ +i2c: + - id: i2c_i2c + scl: ${scl_pin} + sda: ${sda_pin} diff --git a/tests/components/i2c/test.esp32-ard.yaml b/tests/components/i2c/test.esp32-ard.yaml index 19114a9e5d..63c3bd6afd 100644 --- a/tests/components/i2c/test.esp32-ard.yaml +++ b/tests/components/i2c/test.esp32-ard.yaml @@ -1,4 +1,5 @@ -i2c: - - id: i2c_i2c - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 + +<<: !include common.yaml diff --git a/tests/components/i2c/test.esp32-c3-ard.yaml b/tests/components/i2c/test.esp32-c3-ard.yaml index a881438faa..ee2c29ca4e 100644 --- a/tests/components/i2c/test.esp32-c3-ard.yaml +++ b/tests/components/i2c/test.esp32-c3-ard.yaml @@ -1,4 +1,5 @@ -i2c: - - id: i2c_i2c - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + +<<: !include common.yaml diff --git a/tests/components/i2c/test.esp32-c3-idf.yaml b/tests/components/i2c/test.esp32-c3-idf.yaml index a881438faa..ee2c29ca4e 100644 --- a/tests/components/i2c/test.esp32-c3-idf.yaml +++ b/tests/components/i2c/test.esp32-c3-idf.yaml @@ -1,4 +1,5 @@ -i2c: - - id: i2c_i2c - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + +<<: !include common.yaml diff --git a/tests/components/i2c/test.esp32-idf.yaml b/tests/components/i2c/test.esp32-idf.yaml index 19114a9e5d..63c3bd6afd 100644 --- a/tests/components/i2c/test.esp32-idf.yaml +++ b/tests/components/i2c/test.esp32-idf.yaml @@ -1,4 +1,5 @@ -i2c: - - id: i2c_i2c - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 + +<<: !include common.yaml diff --git a/tests/components/i2c/test.esp8266-ard.yaml b/tests/components/i2c/test.esp8266-ard.yaml index a881438faa..ee2c29ca4e 100644 --- a/tests/components/i2c/test.esp8266-ard.yaml +++ b/tests/components/i2c/test.esp8266-ard.yaml @@ -1,4 +1,5 @@ -i2c: - - id: i2c_i2c - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + +<<: !include common.yaml diff --git a/tests/components/i2c/test.rp2040-ard.yaml b/tests/components/i2c/test.rp2040-ard.yaml index a881438faa..ee2c29ca4e 100644 --- a/tests/components/i2c/test.rp2040-ard.yaml +++ b/tests/components/i2c/test.rp2040-ard.yaml @@ -1,4 +1,5 @@ -i2c: - - id: i2c_i2c - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + +<<: !include common.yaml diff --git a/tests/components/i2c_device/common.yaml b/tests/components/i2c_device/common.yaml new file mode 100644 index 0000000000..35a6f8f7f0 --- /dev/null +++ b/tests/components/i2c_device/common.yaml @@ -0,0 +1,8 @@ +i2c: + - id: i2c_i2c_device + scl: ${scl_pin} + sda: ${sda_pin} + +i2c_device: + id: i2cdev + address: 0x2C diff --git a/tests/components/i2c_device/test.esp32-ard.yaml b/tests/components/i2c_device/test.esp32-ard.yaml index 6169d113f8..63c3bd6afd 100644 --- a/tests/components/i2c_device/test.esp32-ard.yaml +++ b/tests/components/i2c_device/test.esp32-ard.yaml @@ -1,8 +1,5 @@ -i2c: - - id: i2c_i2c - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -i2c_device: - id: i2cdev - address: 0x2C +<<: !include common.yaml diff --git a/tests/components/i2c_device/test.esp32-c3-ard.yaml b/tests/components/i2c_device/test.esp32-c3-ard.yaml index 5d53d12208..ee2c29ca4e 100644 --- a/tests/components/i2c_device/test.esp32-c3-ard.yaml +++ b/tests/components/i2c_device/test.esp32-c3-ard.yaml @@ -1,8 +1,5 @@ -i2c: - - id: i2c_i2c - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -i2c_device: - id: i2cdev - address: 0x2C +<<: !include common.yaml diff --git a/tests/components/i2c_device/test.esp32-c3-idf.yaml b/tests/components/i2c_device/test.esp32-c3-idf.yaml index 5d53d12208..ee2c29ca4e 100644 --- a/tests/components/i2c_device/test.esp32-c3-idf.yaml +++ b/tests/components/i2c_device/test.esp32-c3-idf.yaml @@ -1,8 +1,5 @@ -i2c: - - id: i2c_i2c - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -i2c_device: - id: i2cdev - address: 0x2C +<<: !include common.yaml diff --git a/tests/components/i2c_device/test.esp32-idf.yaml b/tests/components/i2c_device/test.esp32-idf.yaml index 6169d113f8..63c3bd6afd 100644 --- a/tests/components/i2c_device/test.esp32-idf.yaml +++ b/tests/components/i2c_device/test.esp32-idf.yaml @@ -1,8 +1,5 @@ -i2c: - - id: i2c_i2c - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -i2c_device: - id: i2cdev - address: 0x2C +<<: !include common.yaml diff --git a/tests/components/i2c_device/test.esp8266-ard.yaml b/tests/components/i2c_device/test.esp8266-ard.yaml index 5d53d12208..ee2c29ca4e 100644 --- a/tests/components/i2c_device/test.esp8266-ard.yaml +++ b/tests/components/i2c_device/test.esp8266-ard.yaml @@ -1,8 +1,5 @@ -i2c: - - id: i2c_i2c - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -i2c_device: - id: i2cdev - address: 0x2C +<<: !include common.yaml diff --git a/tests/components/i2c_device/test.rp2040-ard.yaml b/tests/components/i2c_device/test.rp2040-ard.yaml index 5d53d12208..ee2c29ca4e 100644 --- a/tests/components/i2c_device/test.rp2040-ard.yaml +++ b/tests/components/i2c_device/test.rp2040-ard.yaml @@ -1,8 +1,5 @@ -i2c: - - id: i2c_i2c - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -i2c_device: - id: i2cdev - address: 0x2C +<<: !include common.yaml diff --git a/tests/components/i2s_audio/common.yaml b/tests/components/i2s_audio/common.yaml new file mode 100644 index 0000000000..2cecdc93b7 --- /dev/null +++ b/tests/components/i2s_audio/common.yaml @@ -0,0 +1,4 @@ +i2s_audio: + i2s_bclk_pin: ${i2s_bclk_pin} + i2s_lrclk_pin: ${i2s_lrclk_pin} + i2s_mclk_pin: ${i2s_mclk_pin} diff --git a/tests/components/i2s_audio/test.esp32-ard.yaml b/tests/components/i2s_audio/test.esp32-ard.yaml index 938dd5c25f..ce751d7d4a 100644 --- a/tests/components/i2s_audio/test.esp32-ard.yaml +++ b/tests/components/i2s_audio/test.esp32-ard.yaml @@ -1,4 +1,6 @@ -i2s_audio: - i2s_bclk_pin: 27 - i2s_lrclk_pin: 26 - i2s_mclk_pin: 25 +substitutions: + i2s_bclk_pin: GPIO15 + i2s_lrclk_pin: GPIO16 + i2s_mclk_pin: GPIO17 + +<<: !include common.yaml diff --git a/tests/components/i2s_audio/test.esp32-c3-ard.yaml b/tests/components/i2s_audio/test.esp32-c3-ard.yaml index 08cd56b1a7..5490846ae9 100644 --- a/tests/components/i2s_audio/test.esp32-c3-ard.yaml +++ b/tests/components/i2s_audio/test.esp32-c3-ard.yaml @@ -1,4 +1,6 @@ -i2s_audio: - i2s_bclk_pin: 7 - i2s_lrclk_pin: 6 - i2s_mclk_pin: 5 +substitutions: + i2s_bclk_pin: GPIO5 + i2s_lrclk_pin: GPIO6 + i2s_mclk_pin: GPIO7 + +<<: !include common.yaml diff --git a/tests/components/i2s_audio/test.esp32-c3-idf.yaml b/tests/components/i2s_audio/test.esp32-c3-idf.yaml index 08cd56b1a7..5490846ae9 100644 --- a/tests/components/i2s_audio/test.esp32-c3-idf.yaml +++ b/tests/components/i2s_audio/test.esp32-c3-idf.yaml @@ -1,4 +1,6 @@ -i2s_audio: - i2s_bclk_pin: 7 - i2s_lrclk_pin: 6 - i2s_mclk_pin: 5 +substitutions: + i2s_bclk_pin: GPIO5 + i2s_lrclk_pin: GPIO6 + i2s_mclk_pin: GPIO7 + +<<: !include common.yaml diff --git a/tests/components/i2s_audio/test.esp32-idf.yaml b/tests/components/i2s_audio/test.esp32-idf.yaml index 938dd5c25f..ce751d7d4a 100644 --- a/tests/components/i2s_audio/test.esp32-idf.yaml +++ b/tests/components/i2s_audio/test.esp32-idf.yaml @@ -1,4 +1,6 @@ -i2s_audio: - i2s_bclk_pin: 27 - i2s_lrclk_pin: 26 - i2s_mclk_pin: 25 +substitutions: + i2s_bclk_pin: GPIO15 + i2s_lrclk_pin: GPIO16 + i2s_mclk_pin: GPIO17 + +<<: !include common.yaml diff --git a/tests/components/iaqcore/common.yaml b/tests/components/iaqcore/common.yaml new file mode 100644 index 0000000000..927b836c52 --- /dev/null +++ b/tests/components/iaqcore/common.yaml @@ -0,0 +1,11 @@ +i2c: + - id: i2c_iaqcore + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: iaqcore + co2: + name: iAQ Core CO2 Sensor + tvoc: + name: iAQ Core TVOC Sensor diff --git a/tests/components/iaqcore/test.esp32-ard.yaml b/tests/components/iaqcore/test.esp32-ard.yaml index 26b01dadf9..63c3bd6afd 100644 --- a/tests/components/iaqcore/test.esp32-ard.yaml +++ b/tests/components/iaqcore/test.esp32-ard.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_iaqcore - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: iaqcore - co2: - name: iAQ Core CO2 Sensor - tvoc: - name: iAQ Core TVOC Sensor +<<: !include common.yaml diff --git a/tests/components/iaqcore/test.esp32-c3-ard.yaml b/tests/components/iaqcore/test.esp32-c3-ard.yaml index a1809dffd7..ee2c29ca4e 100644 --- a/tests/components/iaqcore/test.esp32-c3-ard.yaml +++ b/tests/components/iaqcore/test.esp32-c3-ard.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_iaqcore - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: iaqcore - co2: - name: iAQ Core CO2 Sensor - tvoc: - name: iAQ Core TVOC Sensor +<<: !include common.yaml diff --git a/tests/components/iaqcore/test.esp32-c3-idf.yaml b/tests/components/iaqcore/test.esp32-c3-idf.yaml index a1809dffd7..ee2c29ca4e 100644 --- a/tests/components/iaqcore/test.esp32-c3-idf.yaml +++ b/tests/components/iaqcore/test.esp32-c3-idf.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_iaqcore - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: iaqcore - co2: - name: iAQ Core CO2 Sensor - tvoc: - name: iAQ Core TVOC Sensor +<<: !include common.yaml diff --git a/tests/components/iaqcore/test.esp32-idf.yaml b/tests/components/iaqcore/test.esp32-idf.yaml index 26b01dadf9..63c3bd6afd 100644 --- a/tests/components/iaqcore/test.esp32-idf.yaml +++ b/tests/components/iaqcore/test.esp32-idf.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_iaqcore - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: iaqcore - co2: - name: iAQ Core CO2 Sensor - tvoc: - name: iAQ Core TVOC Sensor +<<: !include common.yaml diff --git a/tests/components/iaqcore/test.esp8266-ard.yaml b/tests/components/iaqcore/test.esp8266-ard.yaml index a1809dffd7..ee2c29ca4e 100644 --- a/tests/components/iaqcore/test.esp8266-ard.yaml +++ b/tests/components/iaqcore/test.esp8266-ard.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_iaqcore - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: iaqcore - co2: - name: iAQ Core CO2 Sensor - tvoc: - name: iAQ Core TVOC Sensor +<<: !include common.yaml diff --git a/tests/components/iaqcore/test.rp2040-ard.yaml b/tests/components/iaqcore/test.rp2040-ard.yaml index a1809dffd7..ee2c29ca4e 100644 --- a/tests/components/iaqcore/test.rp2040-ard.yaml +++ b/tests/components/iaqcore/test.rp2040-ard.yaml @@ -1,11 +1,5 @@ -i2c: - - id: i2c_iaqcore - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: iaqcore - co2: - name: iAQ Core CO2 Sensor - tvoc: - name: iAQ Core TVOC Sensor +<<: !include common.yaml diff --git a/tests/components/ili9xxx/common.yaml b/tests/components/ili9xxx/common.yaml new file mode 100644 index 0000000000..b182d110cd --- /dev/null +++ b/tests/components/ili9xxx/common.yaml @@ -0,0 +1,36 @@ +spi: + - id: spi_main_lcd + clk_pin: ${clk_pin} + mosi_pin: ${mosi_pin} + +display: + - platform: ili9xxx + invert_colors: true + dimensions: 320x240 + transform: + swap_xy: true + mirror_x: true + mirror_y: false + model: TFT 2.4 + color_palette: GRAYSCALE + cs_pin: ${cs_pin1} + dc_pin: ${dc_pin1} + reset_pin: ${reset_pin1} + lambda: |- + it.rectangle(0, 0, it.get_width(), it.get_height()); + - platform: ili9xxx + invert_colors: false + color_palette: 8bit + dimensions: + width: 320 + height: 240 + offset_width: 20 + offset_height: 10 + model: TFT 2.4 + cs_pin: ${cs_pin2} + dc_pin: ${dc_pin2} + reset_pin: ${reset_pin2} + auto_clear_enabled: false + rotation: 90 + lambda: |- + it.fill(Color::WHITE); diff --git a/tests/components/ili9xxx/test.esp32-ard.yaml b/tests/components/ili9xxx/test.esp32-ard.yaml index c00c38ce3e..2e006d2521 100644 --- a/tests/components/ili9xxx/test.esp32-ard.yaml +++ b/tests/components/ili9xxx/test.esp32-ard.yaml @@ -1,36 +1,11 @@ -spi: - - id: spi_main_lcd - clk_pin: 16 - mosi_pin: 17 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + cs_pin1: GPIO12 + dc_pin1: GPIO13 + reset_pin1: GPIO14 + cs_pin2: GPIO25 + dc_pin2: GPIO26 + reset_pin2: GPIO27 -display: - - platform: ili9xxx - invert_colors: true - dimensions: 320x240 - transform: - swap_xy: true - mirror_x: true - mirror_y: false - model: TFT 2.4 - color_palette: GRAYSCALE - cs_pin: 12 - dc_pin: 13 - reset_pin: 14 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - - platform: ili9xxx - invert_colors: false - color_palette: 8bit - dimensions: - width: 320 - height: 240 - offset_width: 20 - offset_height: 10 - model: TFT 2.4 - cs_pin: 25 - dc_pin: 26 - reset_pin: 27 - auto_clear_enabled: false - rotation: 90 - lambda: |- - it.fill(Color::WHITE); +<<: !include common.yaml diff --git a/tests/components/ili9xxx/test.esp32-c3-ard.yaml b/tests/components/ili9xxx/test.esp32-c3-ard.yaml index fd03bd54b7..3037785e81 100644 --- a/tests/components/ili9xxx/test.esp32-c3-ard.yaml +++ b/tests/components/ili9xxx/test.esp32-c3-ard.yaml @@ -1,36 +1,12 @@ -spi: - - id: spi_main_lcd - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin1: GPIO8 + dc_pin1: GPIO9 + reset_pin1: GPIO10 + cs_pin2: GPIO2 + dc_pin2: GPIO3 + reset_pin2: GPIO4 -display: - - platform: ili9xxx - invert_colors: true - dimensions: 320x240 - transform: - swap_xy: true - mirror_x: true - mirror_y: false - model: TFT 2.4 - color_palette: GRAYSCALE - cs_pin: 8 - dc_pin: 9 - reset_pin: 10 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - - platform: ili9xxx - invert_colors: false - dimensions: - width: 320 - height: 240 - offset_width: 20 - offset_height: 10 - model: TFT 2.4 - cs_pin: 2 - dc_pin: 3 - reset_pin: 4 - auto_clear_enabled: false - rotation: 90 - lambda: |- - it.fill(Color::WHITE); +<<: !include common.yaml diff --git a/tests/components/ili9xxx/test.esp32-c3-idf.yaml b/tests/components/ili9xxx/test.esp32-c3-idf.yaml index fd03bd54b7..3037785e81 100644 --- a/tests/components/ili9xxx/test.esp32-c3-idf.yaml +++ b/tests/components/ili9xxx/test.esp32-c3-idf.yaml @@ -1,36 +1,12 @@ -spi: - - id: spi_main_lcd - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin1: GPIO8 + dc_pin1: GPIO9 + reset_pin1: GPIO10 + cs_pin2: GPIO2 + dc_pin2: GPIO3 + reset_pin2: GPIO4 -display: - - platform: ili9xxx - invert_colors: true - dimensions: 320x240 - transform: - swap_xy: true - mirror_x: true - mirror_y: false - model: TFT 2.4 - color_palette: GRAYSCALE - cs_pin: 8 - dc_pin: 9 - reset_pin: 10 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - - platform: ili9xxx - invert_colors: false - dimensions: - width: 320 - height: 240 - offset_width: 20 - offset_height: 10 - model: TFT 2.4 - cs_pin: 2 - dc_pin: 3 - reset_pin: 4 - auto_clear_enabled: false - rotation: 90 - lambda: |- - it.fill(Color::WHITE); +<<: !include common.yaml diff --git a/tests/components/ili9xxx/test.esp32-idf.yaml b/tests/components/ili9xxx/test.esp32-idf.yaml index 6da62f69d2..2e006d2521 100644 --- a/tests/components/ili9xxx/test.esp32-idf.yaml +++ b/tests/components/ili9xxx/test.esp32-idf.yaml @@ -1,23 +1,11 @@ -spi: - - id: spi_main_lcd - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + cs_pin1: GPIO12 + dc_pin1: GPIO13 + reset_pin1: GPIO14 + cs_pin2: GPIO25 + dc_pin2: GPIO26 + reset_pin2: GPIO27 -display: - - platform: ili9xxx - invert_colors: true - dimensions: 320x240 - transform: - swap_xy: true - mirror_x: true - mirror_y: false - model: custom - cs_pin: 12 - dc_pin: 13 - reset_pin: 14 - init_sequence: - - [0xFF, 0x77, 0x01, 0x00, 0x00, 0x10] - - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); +<<: !include common.yaml diff --git a/tests/components/ili9xxx/test.esp8266-ard.yaml b/tests/components/ili9xxx/test.esp8266-ard.yaml index b8192e69d1..5dee055fd4 100644 --- a/tests/components/ili9xxx/test.esp8266-ard.yaml +++ b/tests/components/ili9xxx/test.esp8266-ard.yaml @@ -1,36 +1,12 @@ -spi: - - id: spi_main_lcd - clk_pin: 14 - mosi_pin: 13 - miso_pin: 12 +substitutions: + clk_pin: GPIO14 + mosi_pin: GPIO13 + miso_pin: GPIO12 + cs_pin1: GPIO5 + dc_pin1: GPIO15 + reset_pin1: GPIO16 + cs_pin2: GPIO2 + dc_pin2: GPIO4 + reset_pin2: GPIO0 -display: - - platform: ili9xxx - invert_colors: true - dimensions: 320x240 - transform: - swap_xy: true - mirror_x: true - mirror_y: false - model: TFT 2.4 - color_palette: GRAYSCALE - cs_pin: 5 - dc_pin: 15 - reset_pin: 16 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - - platform: ili9xxx - invert_colors: false - dimensions: - width: 320 - height: 240 - offset_width: 20 - offset_height: 10 - model: TFT 2.4 - cs_pin: 2 - dc_pin: 4 - reset_pin: 0 - auto_clear_enabled: false - rotation: 90 - lambda: |- - it.fill(Color::WHITE); +<<: !include common.yaml diff --git a/tests/components/ili9xxx/test.rp2040-ard.yaml b/tests/components/ili9xxx/test.rp2040-ard.yaml index 0423f41a1c..74c9b906e9 100644 --- a/tests/components/ili9xxx/test.rp2040-ard.yaml +++ b/tests/components/ili9xxx/test.rp2040-ard.yaml @@ -1,36 +1,12 @@ -spi: - - id: spi_main_lcd - clk_pin: 2 - mosi_pin: 3 - miso_pin: 4 +substitutions: + clk_pin: GPIO2 + mosi_pin: GPIO3 + miso_pin: GPIO4 + cs_pin1: GPIO5 + dc_pin1: GPIO15 + reset_pin1: GPIO16 + cs_pin2: GPIO20 + dc_pin2: GPIO21 + reset_pin2: GPIO22 -display: - - platform: ili9xxx - invert_colors: true - dimensions: 320x240 - transform: - swap_xy: true - mirror_x: true - mirror_y: false - model: TFT 2.4 - color_palette: GRAYSCALE - cs_pin: 5 - dc_pin: 15 - reset_pin: 16 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - - platform: ili9xxx - invert_colors: false - dimensions: - width: 320 - height: 240 - offset_width: 20 - offset_height: 10 - model: TFT 2.4 - cs_pin: 20 - dc_pin: 21 - reset_pin: 22 - auto_clear_enabled: false - rotation: 90 - lambda: |- - it.fill(Color::WHITE); +<<: !include common.yaml diff --git a/tests/components/ina219/common.yaml b/tests/components/ina219/common.yaml new file mode 100644 index 0000000000..4ca4c9ed8f --- /dev/null +++ b/tests/components/ina219/common.yaml @@ -0,0 +1,20 @@ +i2c: + - id: i2c_ina219 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: ina219 + address: 0x40 + shunt_resistance: 0.1 ohm + current: + name: INA219 Current + power: + name: INA219 Power + bus_voltage: + name: INA219 Bus Voltage + shunt_voltage: + name: INA219 Shunt Voltage + max_voltage: 32.0V + max_current: 3.2A + update_interval: 15s diff --git a/tests/components/ina219/test.esp32-ard.yaml b/tests/components/ina219/test.esp32-ard.yaml index affbec67c4..63c3bd6afd 100644 --- a/tests/components/ina219/test.esp32-ard.yaml +++ b/tests/components/ina219/test.esp32-ard.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_ina219 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: ina219 - address: 0x40 - shunt_resistance: 0.1 ohm - current: - name: INA219 Current - power: - name: INA219 Power - bus_voltage: - name: INA219 Bus Voltage - shunt_voltage: - name: INA219 Shunt Voltage - max_voltage: 32.0V - max_current: 3.2A - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ina219/test.esp32-c3-ard.yaml b/tests/components/ina219/test.esp32-c3-ard.yaml index 586add9d16..ee2c29ca4e 100644 --- a/tests/components/ina219/test.esp32-c3-ard.yaml +++ b/tests/components/ina219/test.esp32-c3-ard.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_ina219 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ina219 - address: 0x40 - shunt_resistance: 0.1 ohm - current: - name: INA219 Current - power: - name: INA219 Power - bus_voltage: - name: INA219 Bus Voltage - shunt_voltage: - name: INA219 Shunt Voltage - max_voltage: 32.0V - max_current: 3.2A - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ina219/test.esp32-c3-idf.yaml b/tests/components/ina219/test.esp32-c3-idf.yaml index 586add9d16..ee2c29ca4e 100644 --- a/tests/components/ina219/test.esp32-c3-idf.yaml +++ b/tests/components/ina219/test.esp32-c3-idf.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_ina219 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ina219 - address: 0x40 - shunt_resistance: 0.1 ohm - current: - name: INA219 Current - power: - name: INA219 Power - bus_voltage: - name: INA219 Bus Voltage - shunt_voltage: - name: INA219 Shunt Voltage - max_voltage: 32.0V - max_current: 3.2A - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ina219/test.esp32-idf.yaml b/tests/components/ina219/test.esp32-idf.yaml index affbec67c4..63c3bd6afd 100644 --- a/tests/components/ina219/test.esp32-idf.yaml +++ b/tests/components/ina219/test.esp32-idf.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_ina219 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: ina219 - address: 0x40 - shunt_resistance: 0.1 ohm - current: - name: INA219 Current - power: - name: INA219 Power - bus_voltage: - name: INA219 Bus Voltage - shunt_voltage: - name: INA219 Shunt Voltage - max_voltage: 32.0V - max_current: 3.2A - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ina219/test.esp8266-ard.yaml b/tests/components/ina219/test.esp8266-ard.yaml index 586add9d16..ee2c29ca4e 100644 --- a/tests/components/ina219/test.esp8266-ard.yaml +++ b/tests/components/ina219/test.esp8266-ard.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_ina219 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ina219 - address: 0x40 - shunt_resistance: 0.1 ohm - current: - name: INA219 Current - power: - name: INA219 Power - bus_voltage: - name: INA219 Bus Voltage - shunt_voltage: - name: INA219 Shunt Voltage - max_voltage: 32.0V - max_current: 3.2A - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ina219/test.rp2040-ard.yaml b/tests/components/ina219/test.rp2040-ard.yaml index 586add9d16..ee2c29ca4e 100644 --- a/tests/components/ina219/test.rp2040-ard.yaml +++ b/tests/components/ina219/test.rp2040-ard.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_ina219 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ina219 - address: 0x40 - shunt_resistance: 0.1 ohm - current: - name: INA219 Current - power: - name: INA219 Power - bus_voltage: - name: INA219 Bus Voltage - shunt_voltage: - name: INA219 Shunt Voltage - max_voltage: 32.0V - max_current: 3.2A - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ina226/common.yaml b/tests/components/ina226/common.yaml new file mode 100644 index 0000000000..8bcd038e50 --- /dev/null +++ b/tests/components/ina226/common.yaml @@ -0,0 +1,19 @@ +i2c: + - id: i2c_ina226 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: ina226 + address: 0x40 + shunt_resistance: 0.1 ohm + current: + name: INA226 Current + power: + name: INA226 Power + bus_voltage: + name: INA226 Bus Voltage + shunt_voltage: + name: INA226 Shunt Voltage + max_current: 3.2A + update_interval: 15s diff --git a/tests/components/ina226/test.esp32-ard.yaml b/tests/components/ina226/test.esp32-ard.yaml index feab5e146c..63c3bd6afd 100644 --- a/tests/components/ina226/test.esp32-ard.yaml +++ b/tests/components/ina226/test.esp32-ard.yaml @@ -1,19 +1,5 @@ -i2c: - - id: i2c_ina226 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: ina226 - address: 0x40 - shunt_resistance: 0.1 ohm - current: - name: INA226 Current - power: - name: INA226 Power - bus_voltage: - name: INA226 Bus Voltage - shunt_voltage: - name: INA226 Shunt Voltage - max_current: 3.2A - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ina226/test.esp32-c3-ard.yaml b/tests/components/ina226/test.esp32-c3-ard.yaml index 6581763294..ee2c29ca4e 100644 --- a/tests/components/ina226/test.esp32-c3-ard.yaml +++ b/tests/components/ina226/test.esp32-c3-ard.yaml @@ -1,19 +1,5 @@ -i2c: - - id: i2c_ina226 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ina226 - address: 0x40 - shunt_resistance: 0.1 ohm - current: - name: INA226 Current - power: - name: INA226 Power - bus_voltage: - name: INA226 Bus Voltage - shunt_voltage: - name: INA226 Shunt Voltage - max_current: 3.2A - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ina226/test.esp32-c3-idf.yaml b/tests/components/ina226/test.esp32-c3-idf.yaml index 6581763294..ee2c29ca4e 100644 --- a/tests/components/ina226/test.esp32-c3-idf.yaml +++ b/tests/components/ina226/test.esp32-c3-idf.yaml @@ -1,19 +1,5 @@ -i2c: - - id: i2c_ina226 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ina226 - address: 0x40 - shunt_resistance: 0.1 ohm - current: - name: INA226 Current - power: - name: INA226 Power - bus_voltage: - name: INA226 Bus Voltage - shunt_voltage: - name: INA226 Shunt Voltage - max_current: 3.2A - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ina226/test.esp32-idf.yaml b/tests/components/ina226/test.esp32-idf.yaml index feab5e146c..63c3bd6afd 100644 --- a/tests/components/ina226/test.esp32-idf.yaml +++ b/tests/components/ina226/test.esp32-idf.yaml @@ -1,19 +1,5 @@ -i2c: - - id: i2c_ina226 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: ina226 - address: 0x40 - shunt_resistance: 0.1 ohm - current: - name: INA226 Current - power: - name: INA226 Power - bus_voltage: - name: INA226 Bus Voltage - shunt_voltage: - name: INA226 Shunt Voltage - max_current: 3.2A - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ina226/test.esp8266-ard.yaml b/tests/components/ina226/test.esp8266-ard.yaml index 6581763294..ee2c29ca4e 100644 --- a/tests/components/ina226/test.esp8266-ard.yaml +++ b/tests/components/ina226/test.esp8266-ard.yaml @@ -1,19 +1,5 @@ -i2c: - - id: i2c_ina226 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ina226 - address: 0x40 - shunt_resistance: 0.1 ohm - current: - name: INA226 Current - power: - name: INA226 Power - bus_voltage: - name: INA226 Bus Voltage - shunt_voltage: - name: INA226 Shunt Voltage - max_current: 3.2A - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ina226/test.rp2040-ard.yaml b/tests/components/ina226/test.rp2040-ard.yaml index 6581763294..ee2c29ca4e 100644 --- a/tests/components/ina226/test.rp2040-ard.yaml +++ b/tests/components/ina226/test.rp2040-ard.yaml @@ -1,19 +1,5 @@ -i2c: - - id: i2c_ina226 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ina226 - address: 0x40 - shunt_resistance: 0.1 ohm - current: - name: INA226 Current - power: - name: INA226 Power - bus_voltage: - name: INA226 Bus Voltage - shunt_voltage: - name: INA226 Shunt Voltage - max_current: 3.2A - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ina260/common.yaml b/tests/components/ina260/common.yaml new file mode 100644 index 0000000000..ab94b2e509 --- /dev/null +++ b/tests/components/ina260/common.yaml @@ -0,0 +1,15 @@ +i2c: + - id: i2c_ina260 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: ina260 + address: 0x40 + current: + name: INA260 Current + power: + name: INA260 Power + bus_voltage: + name: INA260 Voltage + update_interval: 60s diff --git a/tests/components/ina260/test.esp32-ard.yaml b/tests/components/ina260/test.esp32-ard.yaml index be6cf73bff..63c3bd6afd 100644 --- a/tests/components/ina260/test.esp32-ard.yaml +++ b/tests/components/ina260/test.esp32-ard.yaml @@ -1,15 +1,5 @@ -i2c: - - id: i2c_ina260 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: ina260 - address: 0x40 - current: - name: INA260 Current - power: - name: INA260 Power - bus_voltage: - name: INA260 Voltage - update_interval: 60s +<<: !include common.yaml diff --git a/tests/components/ina260/test.esp32-c3-ard.yaml b/tests/components/ina260/test.esp32-c3-ard.yaml index a1da63351d..ee2c29ca4e 100644 --- a/tests/components/ina260/test.esp32-c3-ard.yaml +++ b/tests/components/ina260/test.esp32-c3-ard.yaml @@ -1,15 +1,5 @@ -i2c: - - id: i2c_ina260 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ina260 - address: 0x40 - current: - name: INA260 Current - power: - name: INA260 Power - bus_voltage: - name: INA260 Voltage - update_interval: 60s +<<: !include common.yaml diff --git a/tests/components/ina260/test.esp32-c3-idf.yaml b/tests/components/ina260/test.esp32-c3-idf.yaml index a1da63351d..ee2c29ca4e 100644 --- a/tests/components/ina260/test.esp32-c3-idf.yaml +++ b/tests/components/ina260/test.esp32-c3-idf.yaml @@ -1,15 +1,5 @@ -i2c: - - id: i2c_ina260 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ina260 - address: 0x40 - current: - name: INA260 Current - power: - name: INA260 Power - bus_voltage: - name: INA260 Voltage - update_interval: 60s +<<: !include common.yaml diff --git a/tests/components/ina260/test.esp32-idf.yaml b/tests/components/ina260/test.esp32-idf.yaml index be6cf73bff..63c3bd6afd 100644 --- a/tests/components/ina260/test.esp32-idf.yaml +++ b/tests/components/ina260/test.esp32-idf.yaml @@ -1,15 +1,5 @@ -i2c: - - id: i2c_ina260 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: ina260 - address: 0x40 - current: - name: INA260 Current - power: - name: INA260 Power - bus_voltage: - name: INA260 Voltage - update_interval: 60s +<<: !include common.yaml diff --git a/tests/components/ina260/test.esp8266-ard.yaml b/tests/components/ina260/test.esp8266-ard.yaml index a1da63351d..ee2c29ca4e 100644 --- a/tests/components/ina260/test.esp8266-ard.yaml +++ b/tests/components/ina260/test.esp8266-ard.yaml @@ -1,15 +1,5 @@ -i2c: - - id: i2c_ina260 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ina260 - address: 0x40 - current: - name: INA260 Current - power: - name: INA260 Power - bus_voltage: - name: INA260 Voltage - update_interval: 60s +<<: !include common.yaml diff --git a/tests/components/ina260/test.rp2040-ard.yaml b/tests/components/ina260/test.rp2040-ard.yaml index a1da63351d..ee2c29ca4e 100644 --- a/tests/components/ina260/test.rp2040-ard.yaml +++ b/tests/components/ina260/test.rp2040-ard.yaml @@ -1,15 +1,5 @@ -i2c: - - id: i2c_ina260 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ina260 - address: 0x40 - current: - name: INA260 Current - power: - name: INA260 Power - bus_voltage: - name: INA260 Voltage - update_interval: 60s +<<: !include common.yaml diff --git a/tests/components/ina3221/common.yaml b/tests/components/ina3221/common.yaml new file mode 100644 index 0000000000..ba1abdfe3a --- /dev/null +++ b/tests/components/ina3221/common.yaml @@ -0,0 +1,19 @@ +i2c: + - id: i2c_ina3221 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: ina3221 + address: 0x40 + channel_1: + shunt_resistance: 0.1 ohm + current: + name: INA3221 Channel 1 Current + power: + name: INA3221 Channel 1 Power + bus_voltage: + name: INA3221 Channel 1 Bus Voltage + shunt_voltage: + name: INA3221 Channel 1 Shunt Voltage + update_interval: 15s diff --git a/tests/components/ina3221/test.esp32-ard.yaml b/tests/components/ina3221/test.esp32-ard.yaml index ad9cf79e38..63c3bd6afd 100644 --- a/tests/components/ina3221/test.esp32-ard.yaml +++ b/tests/components/ina3221/test.esp32-ard.yaml @@ -1,19 +1,5 @@ -i2c: - - id: i2c_ina3221 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: ina3221 - address: 0x40 - channel_1: - shunt_resistance: 0.1 ohm - current: - name: INA3221 Channel 1 Current - power: - name: INA3221 Channel 1 Power - bus_voltage: - name: INA3221 Channel 1 Bus Voltage - shunt_voltage: - name: INA3221 Channel 1 Shunt Voltage - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ina3221/test.esp32-c3-ard.yaml b/tests/components/ina3221/test.esp32-c3-ard.yaml index 55990871a0..ee2c29ca4e 100644 --- a/tests/components/ina3221/test.esp32-c3-ard.yaml +++ b/tests/components/ina3221/test.esp32-c3-ard.yaml @@ -1,19 +1,5 @@ -i2c: - - id: i2c_ina3221 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ina3221 - address: 0x40 - channel_1: - shunt_resistance: 0.1 ohm - current: - name: INA3221 Channel 1 Current - power: - name: INA3221 Channel 1 Power - bus_voltage: - name: INA3221 Channel 1 Bus Voltage - shunt_voltage: - name: INA3221 Channel 1 Shunt Voltage - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ina3221/test.esp32-c3-idf.yaml b/tests/components/ina3221/test.esp32-c3-idf.yaml index 55990871a0..ee2c29ca4e 100644 --- a/tests/components/ina3221/test.esp32-c3-idf.yaml +++ b/tests/components/ina3221/test.esp32-c3-idf.yaml @@ -1,19 +1,5 @@ -i2c: - - id: i2c_ina3221 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ina3221 - address: 0x40 - channel_1: - shunt_resistance: 0.1 ohm - current: - name: INA3221 Channel 1 Current - power: - name: INA3221 Channel 1 Power - bus_voltage: - name: INA3221 Channel 1 Bus Voltage - shunt_voltage: - name: INA3221 Channel 1 Shunt Voltage - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ina3221/test.esp32-idf.yaml b/tests/components/ina3221/test.esp32-idf.yaml index ad9cf79e38..63c3bd6afd 100644 --- a/tests/components/ina3221/test.esp32-idf.yaml +++ b/tests/components/ina3221/test.esp32-idf.yaml @@ -1,19 +1,5 @@ -i2c: - - id: i2c_ina3221 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: ina3221 - address: 0x40 - channel_1: - shunt_resistance: 0.1 ohm - current: - name: INA3221 Channel 1 Current - power: - name: INA3221 Channel 1 Power - bus_voltage: - name: INA3221 Channel 1 Bus Voltage - shunt_voltage: - name: INA3221 Channel 1 Shunt Voltage - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ina3221/test.esp8266-ard.yaml b/tests/components/ina3221/test.esp8266-ard.yaml index 55990871a0..ee2c29ca4e 100644 --- a/tests/components/ina3221/test.esp8266-ard.yaml +++ b/tests/components/ina3221/test.esp8266-ard.yaml @@ -1,19 +1,5 @@ -i2c: - - id: i2c_ina3221 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ina3221 - address: 0x40 - channel_1: - shunt_resistance: 0.1 ohm - current: - name: INA3221 Channel 1 Current - power: - name: INA3221 Channel 1 Power - bus_voltage: - name: INA3221 Channel 1 Bus Voltage - shunt_voltage: - name: INA3221 Channel 1 Shunt Voltage - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ina3221/test.rp2040-ard.yaml b/tests/components/ina3221/test.rp2040-ard.yaml index 55990871a0..ee2c29ca4e 100644 --- a/tests/components/ina3221/test.rp2040-ard.yaml +++ b/tests/components/ina3221/test.rp2040-ard.yaml @@ -1,19 +1,5 @@ -i2c: - - id: i2c_ina3221 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ina3221 - address: 0x40 - channel_1: - shunt_resistance: 0.1 ohm - current: - name: INA3221 Channel 1 Current - power: - name: INA3221 Channel 1 Power - bus_voltage: - name: INA3221 Channel 1 Bus Voltage - shunt_voltage: - name: INA3221 Channel 1 Shunt Voltage - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/integration/test.esp32-s2-ard.yaml b/tests/components/integration/common-esp32.yaml similarity index 78% rename from tests/components/integration/test.esp32-s2-ard.yaml rename to tests/components/integration/common-esp32.yaml index 1415952571..248106fd60 100644 --- a/tests/components/integration/test.esp32-s2-ard.yaml +++ b/tests/components/integration/common-esp32.yaml @@ -1,8 +1,8 @@ sensor: - platform: adc id: my_sensor - pin: 1 - attenuation: 11db + pin: ${pin} + attenuation: 12db - platform: integration sensor: my_sensor name: Integration Sensor diff --git a/tests/components/integration/test.esp32-ard.yaml b/tests/components/integration/test.esp32-ard.yaml index 0095fdb1ff..f84495e521 100644 --- a/tests/components/integration/test.esp32-ard.yaml +++ b/tests/components/integration/test.esp32-ard.yaml @@ -1,9 +1,4 @@ -sensor: - - platform: adc - id: my_sensor - pin: A0 - attenuation: 2.5db - - platform: integration - sensor: my_sensor - name: Integration Sensor - time_unit: s +substitutions: + pin: A0 + +<<: !include common-esp32.yaml diff --git a/tests/components/integration/test.esp32-c3-ard.yaml b/tests/components/integration/test.esp32-c3-ard.yaml index b68cb9f87d..5105e645f3 100644 --- a/tests/components/integration/test.esp32-c3-ard.yaml +++ b/tests/components/integration/test.esp32-c3-ard.yaml @@ -1,9 +1,4 @@ -sensor: - - platform: adc - id: my_sensor - pin: 4 - attenuation: 11db - - platform: integration - sensor: my_sensor - name: Integration Sensor - time_unit: s +substitutions: + pin: GPIO1 + +<<: !include common-esp32.yaml diff --git a/tests/components/integration/test.esp32-c3-idf.yaml b/tests/components/integration/test.esp32-c3-idf.yaml new file mode 100644 index 0000000000..5105e645f3 --- /dev/null +++ b/tests/components/integration/test.esp32-c3-idf.yaml @@ -0,0 +1,4 @@ +substitutions: + pin: GPIO1 + +<<: !include common-esp32.yaml diff --git a/tests/components/integration/test.esp32-idf.yaml b/tests/components/integration/test.esp32-idf.yaml index 0095fdb1ff..f84495e521 100644 --- a/tests/components/integration/test.esp32-idf.yaml +++ b/tests/components/integration/test.esp32-idf.yaml @@ -1,9 +1,4 @@ -sensor: - - platform: adc - id: my_sensor - pin: A0 - attenuation: 2.5db - - platform: integration - sensor: my_sensor - name: Integration Sensor - time_unit: s +substitutions: + pin: A0 + +<<: !include common-esp32.yaml diff --git a/tests/components/integration/test.esp32-s3-ard.yaml b/tests/components/integration/test.esp32-s3-ard.yaml deleted file mode 100644 index 1415952571..0000000000 --- a/tests/components/integration/test.esp32-s3-ard.yaml +++ /dev/null @@ -1,9 +0,0 @@ -sensor: - - platform: adc - id: my_sensor - pin: 1 - attenuation: 11db - - platform: integration - sensor: my_sensor - name: Integration Sensor - time_unit: s diff --git a/tests/components/internal_temperature/common.yaml b/tests/components/internal_temperature/common.yaml new file mode 100644 index 0000000000..19f740339d --- /dev/null +++ b/tests/components/internal_temperature/common.yaml @@ -0,0 +1,3 @@ +sensor: + - platform: internal_temperature + name: Internal Temperature diff --git a/tests/components/internal_temperature/test.bk72xx-ard.yaml b/tests/components/internal_temperature/test.bk72xx-ard.yaml index 28df4a6d9f..dade44d145 100644 --- a/tests/components/internal_temperature/test.bk72xx-ard.yaml +++ b/tests/components/internal_temperature/test.bk72xx-ard.yaml @@ -1,3 +1 @@ -sensor: - - platform: internal_temperature - name: "Internal Temperature" +<<: !include common.yaml diff --git a/tests/components/internal_temperature/test.esp32-ard.yaml b/tests/components/internal_temperature/test.esp32-ard.yaml index 19f740339d..dade44d145 100644 --- a/tests/components/internal_temperature/test.esp32-ard.yaml +++ b/tests/components/internal_temperature/test.esp32-ard.yaml @@ -1,3 +1 @@ -sensor: - - platform: internal_temperature - name: Internal Temperature +<<: !include common.yaml diff --git a/tests/components/internal_temperature/test.esp32-c3-ard.yaml b/tests/components/internal_temperature/test.esp32-c3-ard.yaml index 19f740339d..dade44d145 100644 --- a/tests/components/internal_temperature/test.esp32-c3-ard.yaml +++ b/tests/components/internal_temperature/test.esp32-c3-ard.yaml @@ -1,3 +1 @@ -sensor: - - platform: internal_temperature - name: Internal Temperature +<<: !include common.yaml diff --git a/tests/components/internal_temperature/test.esp32-c3-idf.yaml b/tests/components/internal_temperature/test.esp32-c3-idf.yaml index 28df4a6d9f..dade44d145 100644 --- a/tests/components/internal_temperature/test.esp32-c3-idf.yaml +++ b/tests/components/internal_temperature/test.esp32-c3-idf.yaml @@ -1,3 +1 @@ -sensor: - - platform: internal_temperature - name: "Internal Temperature" +<<: !include common.yaml diff --git a/tests/components/internal_temperature/test.esp32-idf.yaml b/tests/components/internal_temperature/test.esp32-idf.yaml index 19f740339d..dade44d145 100644 --- a/tests/components/internal_temperature/test.esp32-idf.yaml +++ b/tests/components/internal_temperature/test.esp32-idf.yaml @@ -1,3 +1 @@ -sensor: - - platform: internal_temperature - name: Internal Temperature +<<: !include common.yaml diff --git a/tests/components/internal_temperature/test.esp32-s2-ard.yaml b/tests/components/internal_temperature/test.esp32-s2-ard.yaml index 19f740339d..dade44d145 100644 --- a/tests/components/internal_temperature/test.esp32-s2-ard.yaml +++ b/tests/components/internal_temperature/test.esp32-s2-ard.yaml @@ -1,3 +1 @@ -sensor: - - platform: internal_temperature - name: Internal Temperature +<<: !include common.yaml diff --git a/tests/components/internal_temperature/test.esp32-s2-idf.yaml b/tests/components/internal_temperature/test.esp32-s2-idf.yaml new file mode 100644 index 0000000000..dade44d145 --- /dev/null +++ b/tests/components/internal_temperature/test.esp32-s2-idf.yaml @@ -0,0 +1 @@ +<<: !include common.yaml diff --git a/tests/components/internal_temperature/test.esp32-s3-ard.yaml b/tests/components/internal_temperature/test.esp32-s3-ard.yaml index 9eb1ec0b0f..bdd704756c 100644 --- a/tests/components/internal_temperature/test.esp32-s3-ard.yaml +++ b/tests/components/internal_temperature/test.esp32-s3-ard.yaml @@ -1,6 +1,4 @@ -sensor: - - platform: internal_temperature - name: Internal Temperature +<<: !include common.yaml esp32: framework: diff --git a/tests/components/internal_temperature/test.esp32-s3-idf.yaml b/tests/components/internal_temperature/test.esp32-s3-idf.yaml new file mode 100644 index 0000000000..dade44d145 --- /dev/null +++ b/tests/components/internal_temperature/test.esp32-s3-idf.yaml @@ -0,0 +1 @@ +<<: !include common.yaml diff --git a/tests/components/internal_temperature/test.rp2040-ard.yaml b/tests/components/internal_temperature/test.rp2040-ard.yaml index 19f740339d..dade44d145 100644 --- a/tests/components/internal_temperature/test.rp2040-ard.yaml +++ b/tests/components/internal_temperature/test.rp2040-ard.yaml @@ -1,3 +1 @@ -sensor: - - platform: internal_temperature - name: Internal Temperature +<<: !include common.yaml diff --git a/tests/components/jsn_sr04t/common.yaml b/tests/components/jsn_sr04t/common.yaml new file mode 100644 index 0000000000..d6871d5e91 --- /dev/null +++ b/tests/components/jsn_sr04t/common.yaml @@ -0,0 +1,11 @@ +uart: + - id: uart_jsn_sr04t + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} + baud_rate: 9600 + +sensor: + - platform: jsn_sr04t + id: jsn_sr04t_sensor + name: jsn_sr04t Distance + update_interval: 1s diff --git a/tests/components/jsn_sr04t/test.esp32-ard.yaml b/tests/components/jsn_sr04t/test.esp32-ard.yaml index 32b4221b3f..f486544afa 100644 --- a/tests/components/jsn_sr04t/test.esp32-ard.yaml +++ b/tests/components/jsn_sr04t/test.esp32-ard.yaml @@ -1,14 +1,5 @@ -uart: - - id: uart_jsn_sr04t - tx_pin: - number: 17 - rx_pin: - number: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO17 + rx_pin: GPIO16 -sensor: - - platform: jsn_sr04t - id: jsn_sr04t_sensor - name: "jsn_sr04t Distance" - uart_id: uart_jsn_sr04t - update_interval: 1s +<<: !include common.yaml diff --git a/tests/components/jsn_sr04t/test.esp32-c3-ard.yaml b/tests/components/jsn_sr04t/test.esp32-c3-ard.yaml index 5a37418a7d..b516342f3b 100644 --- a/tests/components/jsn_sr04t/test.esp32-c3-ard.yaml +++ b/tests/components/jsn_sr04t/test.esp32-c3-ard.yaml @@ -1,14 +1,5 @@ -uart: - - id: uart_jsn_sr04t - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -sensor: - - platform: jsn_sr04t - id: jsn_sr04t_sensor - name: "jsn_sr04t Distance" - uart_id: uart_jsn_sr04t - update_interval: 1s +<<: !include common.yaml diff --git a/tests/components/jsn_sr04t/test.esp32-c3-idf.yaml b/tests/components/jsn_sr04t/test.esp32-c3-idf.yaml index 5a37418a7d..b516342f3b 100644 --- a/tests/components/jsn_sr04t/test.esp32-c3-idf.yaml +++ b/tests/components/jsn_sr04t/test.esp32-c3-idf.yaml @@ -1,14 +1,5 @@ -uart: - - id: uart_jsn_sr04t - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -sensor: - - platform: jsn_sr04t - id: jsn_sr04t_sensor - name: "jsn_sr04t Distance" - uart_id: uart_jsn_sr04t - update_interval: 1s +<<: !include common.yaml diff --git a/tests/components/jsn_sr04t/test.esp32-idf.yaml b/tests/components/jsn_sr04t/test.esp32-idf.yaml index 32b4221b3f..f486544afa 100644 --- a/tests/components/jsn_sr04t/test.esp32-idf.yaml +++ b/tests/components/jsn_sr04t/test.esp32-idf.yaml @@ -1,14 +1,5 @@ -uart: - - id: uart_jsn_sr04t - tx_pin: - number: 17 - rx_pin: - number: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO17 + rx_pin: GPIO16 -sensor: - - platform: jsn_sr04t - id: jsn_sr04t_sensor - name: "jsn_sr04t Distance" - uart_id: uart_jsn_sr04t - update_interval: 1s +<<: !include common.yaml diff --git a/tests/components/jsn_sr04t/test.esp8266-ard.yaml b/tests/components/jsn_sr04t/test.esp8266-ard.yaml index 5a37418a7d..b516342f3b 100644 --- a/tests/components/jsn_sr04t/test.esp8266-ard.yaml +++ b/tests/components/jsn_sr04t/test.esp8266-ard.yaml @@ -1,14 +1,5 @@ -uart: - - id: uart_jsn_sr04t - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -sensor: - - platform: jsn_sr04t - id: jsn_sr04t_sensor - name: "jsn_sr04t Distance" - uart_id: uart_jsn_sr04t - update_interval: 1s +<<: !include common.yaml diff --git a/tests/components/jsn_sr04t/test.rp2040-ard.yaml b/tests/components/jsn_sr04t/test.rp2040-ard.yaml index 5a37418a7d..b516342f3b 100644 --- a/tests/components/jsn_sr04t/test.rp2040-ard.yaml +++ b/tests/components/jsn_sr04t/test.rp2040-ard.yaml @@ -1,14 +1,5 @@ -uart: - - id: uart_jsn_sr04t - tx_pin: - number: 4 - rx_pin: - number: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -sensor: - - platform: jsn_sr04t - id: jsn_sr04t_sensor - name: "jsn_sr04t Distance" - uart_id: uart_jsn_sr04t - update_interval: 1s +<<: !include common.yaml diff --git a/tests/components/key_collector/common.yaml b/tests/components/key_collector/common.yaml new file mode 100644 index 0000000000..d58922ca91 --- /dev/null +++ b/tests/components/key_collector/common.yaml @@ -0,0 +1,28 @@ +matrix_keypad: + id: keypad + rows: + - pin: ${pin_r0} + - pin: ${pin_r1} + columns: + - pin: ${pin_c0} + - pin: ${pin_c1} + keys: "1234" + has_pulldowns: true + +key_collector: + - id: reader + source_id: keypad + min_length: 4 + max_length: 4 + on_progress: + - logger.log: + format: "input progress: '%s', started by '%c'" + args: ['x.c_str()', "(start == 0 ? '~' : start)"] + on_result: + - logger.log: + format: "input result: '%s', started by '%c', ended by '%c'" + args: ['x.c_str()', "(start == 0 ? '~' : start)", "(end == 0 ? '~' : end)"] + on_timeout: + - logger.log: + format: "input timeout: '%s', started by '%c'" + args: ['x.c_str()', "(start == 0 ? '~' : start)"] diff --git a/tests/components/key_collector/test.esp32-ard.yaml b/tests/components/key_collector/test.esp32-ard.yaml index 7cbe9c0fc1..de144aa46b 100644 --- a/tests/components/key_collector/test.esp32-ard.yaml +++ b/tests/components/key_collector/test.esp32-ard.yaml @@ -1,28 +1,7 @@ -matrix_keypad: - id: keypad - rows: - - pin: 12 - - pin: 13 - columns: - - pin: 14 - - pin: 15 - keys: "1234" - has_pulldowns: true +substitutions: + pin_r0: GPIO12 + pin_r1: GPIO13 + pin_c0: GPIO14 + pin_c1: GPIO15 -key_collector: - - id: reader - source_id: keypad - min_length: 4 - max_length: 4 - on_progress: - - logger.log: - format: "input progress: '%s', started by '%c'" - args: ['x.c_str()', "(start == 0 ? '~' : start)"] - on_result: - - logger.log: - format: "input result: '%s', started by '%c', ended by '%c'" - args: ['x.c_str()', "(start == 0 ? '~' : start)", "(end == 0 ? '~' : end)"] - on_timeout: - - logger.log: - format: "input timeout: '%s', started by '%c'" - args: ['x.c_str()', "(start == 0 ? '~' : start)"] +<<: !include common.yaml diff --git a/tests/components/key_collector/test.esp32-c3-ard.yaml b/tests/components/key_collector/test.esp32-c3-ard.yaml index 1f133c5cd8..b580ab7843 100644 --- a/tests/components/key_collector/test.esp32-c3-ard.yaml +++ b/tests/components/key_collector/test.esp32-c3-ard.yaml @@ -1,28 +1,7 @@ -matrix_keypad: - id: keypad - rows: - - pin: 1 - - pin: 2 - columns: - - pin: 3 - - pin: 4 - keys: "1234" - has_pulldowns: true +substitutions: + pin_r0: GPIO2 + pin_r1: GPIO3 + pin_c0: GPIO4 + pin_c1: GPIO5 -key_collector: - - id: reader - source_id: keypad - min_length: 4 - max_length: 4 - on_progress: - - logger.log: - format: "input progress: '%s', started by '%c'" - args: ['x.c_str()', "(start == 0 ? '~' : start)"] - on_result: - - logger.log: - format: "input result: '%s', started by '%c', ended by '%c'" - args: ['x.c_str()', "(start == 0 ? '~' : start)", "(end == 0 ? '~' : end)"] - on_timeout: - - logger.log: - format: "input timeout: '%s', started by '%c'" - args: ['x.c_str()', "(start == 0 ? '~' : start)"] +<<: !include common.yaml diff --git a/tests/components/key_collector/test.esp32-c3-idf.yaml b/tests/components/key_collector/test.esp32-c3-idf.yaml index 1f133c5cd8..b580ab7843 100644 --- a/tests/components/key_collector/test.esp32-c3-idf.yaml +++ b/tests/components/key_collector/test.esp32-c3-idf.yaml @@ -1,28 +1,7 @@ -matrix_keypad: - id: keypad - rows: - - pin: 1 - - pin: 2 - columns: - - pin: 3 - - pin: 4 - keys: "1234" - has_pulldowns: true +substitutions: + pin_r0: GPIO2 + pin_r1: GPIO3 + pin_c0: GPIO4 + pin_c1: GPIO5 -key_collector: - - id: reader - source_id: keypad - min_length: 4 - max_length: 4 - on_progress: - - logger.log: - format: "input progress: '%s', started by '%c'" - args: ['x.c_str()', "(start == 0 ? '~' : start)"] - on_result: - - logger.log: - format: "input result: '%s', started by '%c', ended by '%c'" - args: ['x.c_str()', "(start == 0 ? '~' : start)", "(end == 0 ? '~' : end)"] - on_timeout: - - logger.log: - format: "input timeout: '%s', started by '%c'" - args: ['x.c_str()', "(start == 0 ? '~' : start)"] +<<: !include common.yaml diff --git a/tests/components/key_collector/test.esp32-idf.yaml b/tests/components/key_collector/test.esp32-idf.yaml index 7cbe9c0fc1..de144aa46b 100644 --- a/tests/components/key_collector/test.esp32-idf.yaml +++ b/tests/components/key_collector/test.esp32-idf.yaml @@ -1,28 +1,7 @@ -matrix_keypad: - id: keypad - rows: - - pin: 12 - - pin: 13 - columns: - - pin: 14 - - pin: 15 - keys: "1234" - has_pulldowns: true +substitutions: + pin_r0: GPIO12 + pin_r1: GPIO13 + pin_c0: GPIO14 + pin_c1: GPIO15 -key_collector: - - id: reader - source_id: keypad - min_length: 4 - max_length: 4 - on_progress: - - logger.log: - format: "input progress: '%s', started by '%c'" - args: ['x.c_str()', "(start == 0 ? '~' : start)"] - on_result: - - logger.log: - format: "input result: '%s', started by '%c', ended by '%c'" - args: ['x.c_str()', "(start == 0 ? '~' : start)", "(end == 0 ? '~' : end)"] - on_timeout: - - logger.log: - format: "input timeout: '%s', started by '%c'" - args: ['x.c_str()', "(start == 0 ? '~' : start)"] +<<: !include common.yaml diff --git a/tests/components/key_collector/test.esp8266-ard.yaml b/tests/components/key_collector/test.esp8266-ard.yaml index 7cbe9c0fc1..de144aa46b 100644 --- a/tests/components/key_collector/test.esp8266-ard.yaml +++ b/tests/components/key_collector/test.esp8266-ard.yaml @@ -1,28 +1,7 @@ -matrix_keypad: - id: keypad - rows: - - pin: 12 - - pin: 13 - columns: - - pin: 14 - - pin: 15 - keys: "1234" - has_pulldowns: true +substitutions: + pin_r0: GPIO12 + pin_r1: GPIO13 + pin_c0: GPIO14 + pin_c1: GPIO15 -key_collector: - - id: reader - source_id: keypad - min_length: 4 - max_length: 4 - on_progress: - - logger.log: - format: "input progress: '%s', started by '%c'" - args: ['x.c_str()', "(start == 0 ? '~' : start)"] - on_result: - - logger.log: - format: "input result: '%s', started by '%c', ended by '%c'" - args: ['x.c_str()', "(start == 0 ? '~' : start)", "(end == 0 ? '~' : end)"] - on_timeout: - - logger.log: - format: "input timeout: '%s', started by '%c'" - args: ['x.c_str()', "(start == 0 ? '~' : start)"] +<<: !include common.yaml diff --git a/tests/components/key_collector/test.rp2040-ard.yaml b/tests/components/key_collector/test.rp2040-ard.yaml index 1f133c5cd8..b580ab7843 100644 --- a/tests/components/key_collector/test.rp2040-ard.yaml +++ b/tests/components/key_collector/test.rp2040-ard.yaml @@ -1,28 +1,7 @@ -matrix_keypad: - id: keypad - rows: - - pin: 1 - - pin: 2 - columns: - - pin: 3 - - pin: 4 - keys: "1234" - has_pulldowns: true +substitutions: + pin_r0: GPIO2 + pin_r1: GPIO3 + pin_c0: GPIO4 + pin_c1: GPIO5 -key_collector: - - id: reader - source_id: keypad - min_length: 4 - max_length: 4 - on_progress: - - logger.log: - format: "input progress: '%s', started by '%c'" - args: ['x.c_str()', "(start == 0 ? '~' : start)"] - on_result: - - logger.log: - format: "input result: '%s', started by '%c', ended by '%c'" - args: ['x.c_str()', "(start == 0 ? '~' : start)", "(end == 0 ? '~' : end)"] - on_timeout: - - logger.log: - format: "input timeout: '%s', started by '%c'" - args: ['x.c_str()', "(start == 0 ? '~' : start)"] +<<: !include common.yaml diff --git a/tests/components/kmeteriso/common.yaml b/tests/components/kmeteriso/common.yaml new file mode 100644 index 0000000000..6b68175904 --- /dev/null +++ b/tests/components/kmeteriso/common.yaml @@ -0,0 +1,12 @@ +i2c: + - id: i2c_kmeteriso + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: kmeteriso + temperature: + name: Outside Temperature + internal_temperature: + name: Internal Temperature + update_interval: 15s diff --git a/tests/components/kmeteriso/test.esp32-ard.yaml b/tests/components/kmeteriso/test.esp32-ard.yaml index 2c375dda31..63c3bd6afd 100644 --- a/tests/components/kmeteriso/test.esp32-ard.yaml +++ b/tests/components/kmeteriso/test.esp32-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_kmeteriso - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: kmeteriso - temperature: - name: Outside Temperature - internal_temperature: - name: Internal Temperature - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/kmeteriso/test.esp32-c3-ard.yaml b/tests/components/kmeteriso/test.esp32-c3-ard.yaml index 7780cfea32..ee2c29ca4e 100644 --- a/tests/components/kmeteriso/test.esp32-c3-ard.yaml +++ b/tests/components/kmeteriso/test.esp32-c3-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_kmeteriso - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: kmeteriso - temperature: - name: Outside Temperature - internal_temperature: - name: Internal Temperature - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/kmeteriso/test.esp32-c3-idf.yaml b/tests/components/kmeteriso/test.esp32-c3-idf.yaml index 7780cfea32..ee2c29ca4e 100644 --- a/tests/components/kmeteriso/test.esp32-c3-idf.yaml +++ b/tests/components/kmeteriso/test.esp32-c3-idf.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_kmeteriso - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: kmeteriso - temperature: - name: Outside Temperature - internal_temperature: - name: Internal Temperature - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/kmeteriso/test.esp32-idf.yaml b/tests/components/kmeteriso/test.esp32-idf.yaml index 2c375dda31..63c3bd6afd 100644 --- a/tests/components/kmeteriso/test.esp32-idf.yaml +++ b/tests/components/kmeteriso/test.esp32-idf.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_kmeteriso - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: kmeteriso - temperature: - name: Outside Temperature - internal_temperature: - name: Internal Temperature - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/kmeteriso/test.esp8266-ard.yaml b/tests/components/kmeteriso/test.esp8266-ard.yaml index 7780cfea32..ee2c29ca4e 100644 --- a/tests/components/kmeteriso/test.esp8266-ard.yaml +++ b/tests/components/kmeteriso/test.esp8266-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_kmeteriso - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: kmeteriso - temperature: - name: Outside Temperature - internal_temperature: - name: Internal Temperature - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/kmeteriso/test.rp2040-ard.yaml b/tests/components/kmeteriso/test.rp2040-ard.yaml index 7780cfea32..ee2c29ca4e 100644 --- a/tests/components/kmeteriso/test.rp2040-ard.yaml +++ b/tests/components/kmeteriso/test.rp2040-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_kmeteriso - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: kmeteriso - temperature: - name: Outside Temperature - internal_temperature: - name: Internal Temperature - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/kuntze/common.yaml b/tests/components/kuntze/common.yaml new file mode 100644 index 0000000000..4daecea242 --- /dev/null +++ b/tests/components/kuntze/common.yaml @@ -0,0 +1,15 @@ +uart: + - id: uart_kuntze + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} + baud_rate: 9600 + +modbus: + flow_control_pin: ${flow_control_pin} + +sensor: + - platform: kuntze + ph: + name: Kuntze pH + temperature: + name: Kuntze temperature diff --git a/tests/components/kuntze/test.esp32-ard.yaml b/tests/components/kuntze/test.esp32-ard.yaml index 6b6c638971..bd767a8ece 100644 --- a/tests/components/kuntze/test.esp32-ard.yaml +++ b/tests/components/kuntze/test.esp32-ard.yaml @@ -1,15 +1,6 @@ -uart: - - id: uart_kuntze - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 + flow_control_pin: GPIO13 -modbus: - flow_control_pin: 13 - -sensor: - - platform: kuntze - ph: - name: Kuntze pH - temperature: - name: Kuntze temperature +<<: !include common.yaml diff --git a/tests/components/kuntze/test.esp32-c3-ard.yaml b/tests/components/kuntze/test.esp32-c3-ard.yaml index 08278c3c82..452031a5aa 100644 --- a/tests/components/kuntze/test.esp32-c3-ard.yaml +++ b/tests/components/kuntze/test.esp32-c3-ard.yaml @@ -1,15 +1,6 @@ -uart: - - id: uart_kuntze - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + flow_control_pin: GPIO3 -modbus: - flow_control_pin: 3 - -sensor: - - platform: kuntze - ph: - name: Kuntze pH - temperature: - name: Kuntze temperature +<<: !include common.yaml diff --git a/tests/components/kuntze/test.esp32-c3-idf.yaml b/tests/components/kuntze/test.esp32-c3-idf.yaml index 08278c3c82..452031a5aa 100644 --- a/tests/components/kuntze/test.esp32-c3-idf.yaml +++ b/tests/components/kuntze/test.esp32-c3-idf.yaml @@ -1,15 +1,6 @@ -uart: - - id: uart_kuntze - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + flow_control_pin: GPIO3 -modbus: - flow_control_pin: 3 - -sensor: - - platform: kuntze - ph: - name: Kuntze pH - temperature: - name: Kuntze temperature +<<: !include common.yaml diff --git a/tests/components/kuntze/test.esp32-idf.yaml b/tests/components/kuntze/test.esp32-idf.yaml index 6b6c638971..bd767a8ece 100644 --- a/tests/components/kuntze/test.esp32-idf.yaml +++ b/tests/components/kuntze/test.esp32-idf.yaml @@ -1,15 +1,6 @@ -uart: - - id: uart_kuntze - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 + flow_control_pin: GPIO13 -modbus: - flow_control_pin: 13 - -sensor: - - platform: kuntze - ph: - name: Kuntze pH - temperature: - name: Kuntze temperature +<<: !include common.yaml diff --git a/tests/components/kuntze/test.esp8266-ard.yaml b/tests/components/kuntze/test.esp8266-ard.yaml index eba6cddc2d..29c98d0957 100644 --- a/tests/components/kuntze/test.esp8266-ard.yaml +++ b/tests/components/kuntze/test.esp8266-ard.yaml @@ -1,15 +1,6 @@ -uart: - - id: uart_kuntze - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + flow_control_pin: GPIO13 -modbus: - flow_control_pin: 13 - -sensor: - - platform: kuntze - ph: - name: Kuntze pH - temperature: - name: Kuntze temperature +<<: !include common.yaml diff --git a/tests/components/kuntze/test.rp2040-ard.yaml b/tests/components/kuntze/test.rp2040-ard.yaml index 08278c3c82..452031a5aa 100644 --- a/tests/components/kuntze/test.rp2040-ard.yaml +++ b/tests/components/kuntze/test.rp2040-ard.yaml @@ -1,15 +1,6 @@ -uart: - - id: uart_kuntze - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + flow_control_pin: GPIO3 -modbus: - flow_control_pin: 3 - -sensor: - - platform: kuntze - ph: - name: Kuntze pH - temperature: - name: Kuntze temperature +<<: !include common.yaml diff --git a/tests/components/lcd_gpio/common.yaml b/tests/components/lcd_gpio/common.yaml new file mode 100644 index 0000000000..bd842454a1 --- /dev/null +++ b/tests/components/lcd_gpio/common.yaml @@ -0,0 +1,13 @@ +display: + - platform: lcd_gpio + id: my_lcd_gpio + dimensions: 18x4 + data_pins: + - number: ${d0_pin} + - number: ${d1_pin} + - number: ${d2_pin} + - number: ${d3_pin} + enable_pin: ${enable_pin} + rs_pin: ${rs_pin} + lambda: |- + it.print("Hello World!"); diff --git a/tests/components/lcd_gpio/test.esp32-ard.yaml b/tests/components/lcd_gpio/test.esp32-ard.yaml index d2b33aeb3a..9c2af456b5 100644 --- a/tests/components/lcd_gpio/test.esp32-ard.yaml +++ b/tests/components/lcd_gpio/test.esp32-ard.yaml @@ -1,13 +1,9 @@ -display: - - platform: lcd_gpio - id: my_lcd_gpio - dimensions: 18x4 - data_pins: - - number: 12 - - number: 13 - - number: 14 - - number: 15 - enable_pin: 16 - rs_pin: 5 - lambda: |- - it.print("Hello World!"); +substitutions: + d0_pin: GPIO12 + d1_pin: GPIO13 + d2_pin: GPIO14 + d3_pin: GPIO15 + enable_pin: GPIO16 + rs_pin: GPIO5 + +<<: !include common.yaml diff --git a/tests/components/lcd_gpio/test.esp32-c3-ard.yaml b/tests/components/lcd_gpio/test.esp32-c3-ard.yaml index b89715a755..b6b05f3ab4 100644 --- a/tests/components/lcd_gpio/test.esp32-c3-ard.yaml +++ b/tests/components/lcd_gpio/test.esp32-c3-ard.yaml @@ -1,13 +1,9 @@ -display: - - platform: lcd_gpio - id: my_lcd_gpio - dimensions: 18x4 - data_pins: - - number: 1 - - number: 2 - - number: 3 - - number: 4 - enable_pin: 5 - rs_pin: 6 - lambda: |- - it.print("Hello World!"); +substitutions: + d0_pin: GPIO1 + d1_pin: GPIO2 + d2_pin: GPIO3 + d3_pin: GPIO4 + enable_pin: GPIO5 + rs_pin: GPIO6 + +<<: !include common.yaml diff --git a/tests/components/lcd_gpio/test.esp32-c3-idf.yaml b/tests/components/lcd_gpio/test.esp32-c3-idf.yaml index b89715a755..b6b05f3ab4 100644 --- a/tests/components/lcd_gpio/test.esp32-c3-idf.yaml +++ b/tests/components/lcd_gpio/test.esp32-c3-idf.yaml @@ -1,13 +1,9 @@ -display: - - platform: lcd_gpio - id: my_lcd_gpio - dimensions: 18x4 - data_pins: - - number: 1 - - number: 2 - - number: 3 - - number: 4 - enable_pin: 5 - rs_pin: 6 - lambda: |- - it.print("Hello World!"); +substitutions: + d0_pin: GPIO1 + d1_pin: GPIO2 + d2_pin: GPIO3 + d3_pin: GPIO4 + enable_pin: GPIO5 + rs_pin: GPIO6 + +<<: !include common.yaml diff --git a/tests/components/lcd_gpio/test.esp32-idf.yaml b/tests/components/lcd_gpio/test.esp32-idf.yaml index d2b33aeb3a..9c2af456b5 100644 --- a/tests/components/lcd_gpio/test.esp32-idf.yaml +++ b/tests/components/lcd_gpio/test.esp32-idf.yaml @@ -1,13 +1,9 @@ -display: - - platform: lcd_gpio - id: my_lcd_gpio - dimensions: 18x4 - data_pins: - - number: 12 - - number: 13 - - number: 14 - - number: 15 - enable_pin: 16 - rs_pin: 5 - lambda: |- - it.print("Hello World!"); +substitutions: + d0_pin: GPIO12 + d1_pin: GPIO13 + d2_pin: GPIO14 + d3_pin: GPIO15 + enable_pin: GPIO16 + rs_pin: GPIO5 + +<<: !include common.yaml diff --git a/tests/components/lcd_gpio/test.esp8266-ard.yaml b/tests/components/lcd_gpio/test.esp8266-ard.yaml index d2b33aeb3a..9c2af456b5 100644 --- a/tests/components/lcd_gpio/test.esp8266-ard.yaml +++ b/tests/components/lcd_gpio/test.esp8266-ard.yaml @@ -1,13 +1,9 @@ -display: - - platform: lcd_gpio - id: my_lcd_gpio - dimensions: 18x4 - data_pins: - - number: 12 - - number: 13 - - number: 14 - - number: 15 - enable_pin: 16 - rs_pin: 5 - lambda: |- - it.print("Hello World!"); +substitutions: + d0_pin: GPIO12 + d1_pin: GPIO13 + d2_pin: GPIO14 + d3_pin: GPIO15 + enable_pin: GPIO16 + rs_pin: GPIO5 + +<<: !include common.yaml diff --git a/tests/components/lcd_gpio/test.rp2040-ard.yaml b/tests/components/lcd_gpio/test.rp2040-ard.yaml index b89715a755..b6b05f3ab4 100644 --- a/tests/components/lcd_gpio/test.rp2040-ard.yaml +++ b/tests/components/lcd_gpio/test.rp2040-ard.yaml @@ -1,13 +1,9 @@ -display: - - platform: lcd_gpio - id: my_lcd_gpio - dimensions: 18x4 - data_pins: - - number: 1 - - number: 2 - - number: 3 - - number: 4 - enable_pin: 5 - rs_pin: 6 - lambda: |- - it.print("Hello World!"); +substitutions: + d0_pin: GPIO1 + d1_pin: GPIO2 + d2_pin: GPIO3 + d3_pin: GPIO4 + enable_pin: GPIO5 + rs_pin: GPIO6 + +<<: !include common.yaml diff --git a/tests/components/lcd_menu/common.yaml b/tests/components/lcd_menu/common.yaml new file mode 100644 index 0000000000..970c18e0d2 --- /dev/null +++ b/tests/components/lcd_menu/common.yaml @@ -0,0 +1,118 @@ +number: + - platform: template + id: test_number + min_value: 0 + step: 1 + max_value: 10 + optimistic: true + +select: + - platform: template + id: test_select + options: + - one + - two + optimistic: true + +switch: + - platform: template + name: Template Switch + id: my_switch + optimistic: true + +display: + - platform: lcd_gpio + id: my_lcd_gpio + dimensions: 18x4 + data_pins: + - number: ${d0_pin} + - number: ${d1_pin} + - number: ${d2_pin} + - number: ${d3_pin} + enable_pin: ${enable_pin} + rs_pin: ${rs_pin} + lambda: |- + it.print("Hello World!"); + +lcd_menu: + id: test_lcd_menu + display_id: my_lcd_gpio + mark_back: 0x5e + mark_selected: 0x3e + mark_editing: 0x2a + mark_submenu: 0x7e + active: false + mode: rotary + on_enter: + then: + lambda: 'ESP_LOGI("lcd_menu", "root enter");' + on_leave: + then: + lambda: 'ESP_LOGI("lcd_menu", "root leave");' + items: + - type: back + text: Back + - type: label + - type: menu + text: Submenu 1 + items: + - type: back + text: Back + - type: menu + text: Submenu 21 + items: + - type: back + text: Back + - type: command + text: Show Main + on_value: + then: + - display_menu.show_main: test_lcd_menu + - type: select + text: Enum Item + immediate_edit: true + select: test_select + on_enter: + then: + lambda: 'ESP_LOGI("lcd_menu", "select enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' + on_leave: + then: + lambda: 'ESP_LOGI("lcd_menu", "select leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' + on_value: + then: + lambda: 'ESP_LOGI("lcd_menu", "select value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' + - type: number + text: Number + number: test_number + on_enter: + then: + lambda: 'ESP_LOGI("lcd_menu", "number enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' + on_leave: + then: + lambda: 'ESP_LOGI("lcd_menu", "number leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' + on_value: + then: + lambda: 'ESP_LOGI("lcd_menu", "number value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' + - type: command + text: Hide + on_value: + then: + - display_menu.hide: test_lcd_menu + - type: switch + text: Switch + switch: my_switch + on_text: Bright + off_text: Dark + immediate_edit: false + on_value: + then: + lambda: 'ESP_LOGI("lcd_menu", "switch value: %s", it->get_value_text().c_str());' + - type: custom + text: !lambda 'return "Custom";' + value_lambda: 'return "Val";' + on_next: + then: + lambda: 'ESP_LOGI("lcd_menu", "custom next: %s", it->get_text().c_str());' + on_prev: + then: + lambda: 'ESP_LOGI("lcd_menu", "custom prev: %s", it->get_text().c_str());' diff --git a/tests/components/lcd_menu/test.esp32-ard.yaml b/tests/components/lcd_menu/test.esp32-ard.yaml index 833ea2169a..9c2af456b5 100644 --- a/tests/components/lcd_menu/test.esp32-ard.yaml +++ b/tests/components/lcd_menu/test.esp32-ard.yaml @@ -1,118 +1,9 @@ -number: - - platform: template - id: test_number - min_value: 0 - step: 1 - max_value: 10 - optimistic: true +substitutions: + d0_pin: GPIO12 + d1_pin: GPIO13 + d2_pin: GPIO14 + d3_pin: GPIO15 + enable_pin: GPIO16 + rs_pin: GPIO5 -select: - - platform: template - id: test_select - options: - - one - - two - optimistic: true - -switch: - - platform: template - name: Template Switch - id: my_switch - optimistic: true - -display: - - platform: lcd_gpio - id: my_lcd_gpio - dimensions: 18x4 - data_pins: - - number: 12 - - number: 13 - - number: 14 - - number: 15 - enable_pin: 16 - rs_pin: 5 - lambda: |- - it.print("Hello World!"); - -lcd_menu: - id: test_lcd_menu - display_id: my_lcd_gpio - mark_back: 0x5e - mark_selected: 0x3e - mark_editing: 0x2a - mark_submenu: 0x7e - active: false - mode: rotary - on_enter: - then: - lambda: 'ESP_LOGI("lcd_menu", "root enter");' - on_leave: - then: - lambda: 'ESP_LOGI("lcd_menu", "root leave");' - items: - - type: back - text: Back - - type: label - - type: menu - text: Submenu 1 - items: - - type: back - text: Back - - type: menu - text: Submenu 21 - items: - - type: back - text: Back - - type: command - text: Show Main - on_value: - then: - - display_menu.show_main: test_lcd_menu - - type: select - text: Enum Item - immediate_edit: true - select: test_select - on_enter: - then: - lambda: 'ESP_LOGI("lcd_menu", "select enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_leave: - then: - lambda: 'ESP_LOGI("lcd_menu", "select leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_value: - then: - lambda: 'ESP_LOGI("lcd_menu", "select value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - - type: number - text: Number - number: test_number - on_enter: - then: - lambda: 'ESP_LOGI("lcd_menu", "number enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_leave: - then: - lambda: 'ESP_LOGI("lcd_menu", "number leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_value: - then: - lambda: 'ESP_LOGI("lcd_menu", "number value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - - type: command - text: Hide - on_value: - then: - - display_menu.hide: test_lcd_menu - - type: switch - text: Switch - switch: my_switch - on_text: Bright - off_text: Dark - immediate_edit: false - on_value: - then: - lambda: 'ESP_LOGI("lcd_menu", "switch value: %s", it->get_value_text().c_str());' - - type: custom - text: !lambda 'return "Custom";' - value_lambda: 'return "Val";' - on_next: - then: - lambda: 'ESP_LOGI("lcd_menu", "custom next: %s", it->get_text().c_str());' - on_prev: - then: - lambda: 'ESP_LOGI("lcd_menu", "custom prev: %s", it->get_text().c_str());' +<<: !include common.yaml diff --git a/tests/components/lcd_menu/test.esp32-c3-ard.yaml b/tests/components/lcd_menu/test.esp32-c3-ard.yaml index 39d2278d3d..b6b05f3ab4 100644 --- a/tests/components/lcd_menu/test.esp32-c3-ard.yaml +++ b/tests/components/lcd_menu/test.esp32-c3-ard.yaml @@ -1,118 +1,9 @@ -number: - - platform: template - id: test_number - min_value: 0 - step: 1 - max_value: 10 - optimistic: true +substitutions: + d0_pin: GPIO1 + d1_pin: GPIO2 + d2_pin: GPIO3 + d3_pin: GPIO4 + enable_pin: GPIO5 + rs_pin: GPIO6 -select: - - platform: template - id: test_select - options: - - one - - two - optimistic: true - -switch: - - platform: template - name: Template Switch - id: my_switch - optimistic: true - -display: - - platform: lcd_gpio - id: my_lcd_gpio - dimensions: 18x4 - data_pins: - - number: 1 - - number: 2 - - number: 3 - - number: 4 - enable_pin: 5 - rs_pin: 6 - lambda: |- - it.print("Hello World!"); - -lcd_menu: - id: test_lcd_menu - display_id: my_lcd_gpio - mark_back: 0x5e - mark_selected: 0x3e - mark_editing: 0x2a - mark_submenu: 0x7e - active: false - mode: rotary - on_enter: - then: - lambda: 'ESP_LOGI("lcd_menu", "root enter");' - on_leave: - then: - lambda: 'ESP_LOGI("lcd_menu", "root leave");' - items: - - type: back - text: Back - - type: label - - type: menu - text: Submenu 1 - items: - - type: back - text: Back - - type: menu - text: Submenu 21 - items: - - type: back - text: Back - - type: command - text: Show Main - on_value: - then: - - display_menu.show_main: test_lcd_menu - - type: select - text: Enum Item - immediate_edit: true - select: test_select - on_enter: - then: - lambda: 'ESP_LOGI("lcd_menu", "select enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_leave: - then: - lambda: 'ESP_LOGI("lcd_menu", "select leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_value: - then: - lambda: 'ESP_LOGI("lcd_menu", "select value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - - type: number - text: Number - number: test_number - on_enter: - then: - lambda: 'ESP_LOGI("lcd_menu", "number enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_leave: - then: - lambda: 'ESP_LOGI("lcd_menu", "number leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_value: - then: - lambda: 'ESP_LOGI("lcd_menu", "number value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - - type: command - text: Hide - on_value: - then: - - display_menu.hide: test_lcd_menu - - type: switch - text: Switch - switch: my_switch - on_text: Bright - off_text: Dark - immediate_edit: false - on_value: - then: - lambda: 'ESP_LOGI("lcd_menu", "switch value: %s", it->get_value_text().c_str());' - - type: custom - text: !lambda 'return "Custom";' - value_lambda: 'return "Val";' - on_next: - then: - lambda: 'ESP_LOGI("lcd_menu", "custom next: %s", it->get_text().c_str());' - on_prev: - then: - lambda: 'ESP_LOGI("lcd_menu", "custom prev: %s", it->get_text().c_str());' +<<: !include common.yaml diff --git a/tests/components/lcd_menu/test.esp32-c3-idf.yaml b/tests/components/lcd_menu/test.esp32-c3-idf.yaml index 39d2278d3d..b6b05f3ab4 100644 --- a/tests/components/lcd_menu/test.esp32-c3-idf.yaml +++ b/tests/components/lcd_menu/test.esp32-c3-idf.yaml @@ -1,118 +1,9 @@ -number: - - platform: template - id: test_number - min_value: 0 - step: 1 - max_value: 10 - optimistic: true +substitutions: + d0_pin: GPIO1 + d1_pin: GPIO2 + d2_pin: GPIO3 + d3_pin: GPIO4 + enable_pin: GPIO5 + rs_pin: GPIO6 -select: - - platform: template - id: test_select - options: - - one - - two - optimistic: true - -switch: - - platform: template - name: Template Switch - id: my_switch - optimistic: true - -display: - - platform: lcd_gpio - id: my_lcd_gpio - dimensions: 18x4 - data_pins: - - number: 1 - - number: 2 - - number: 3 - - number: 4 - enable_pin: 5 - rs_pin: 6 - lambda: |- - it.print("Hello World!"); - -lcd_menu: - id: test_lcd_menu - display_id: my_lcd_gpio - mark_back: 0x5e - mark_selected: 0x3e - mark_editing: 0x2a - mark_submenu: 0x7e - active: false - mode: rotary - on_enter: - then: - lambda: 'ESP_LOGI("lcd_menu", "root enter");' - on_leave: - then: - lambda: 'ESP_LOGI("lcd_menu", "root leave");' - items: - - type: back - text: Back - - type: label - - type: menu - text: Submenu 1 - items: - - type: back - text: Back - - type: menu - text: Submenu 21 - items: - - type: back - text: Back - - type: command - text: Show Main - on_value: - then: - - display_menu.show_main: test_lcd_menu - - type: select - text: Enum Item - immediate_edit: true - select: test_select - on_enter: - then: - lambda: 'ESP_LOGI("lcd_menu", "select enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_leave: - then: - lambda: 'ESP_LOGI("lcd_menu", "select leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_value: - then: - lambda: 'ESP_LOGI("lcd_menu", "select value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - - type: number - text: Number - number: test_number - on_enter: - then: - lambda: 'ESP_LOGI("lcd_menu", "number enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_leave: - then: - lambda: 'ESP_LOGI("lcd_menu", "number leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_value: - then: - lambda: 'ESP_LOGI("lcd_menu", "number value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - - type: command - text: Hide - on_value: - then: - - display_menu.hide: test_lcd_menu - - type: switch - text: Switch - switch: my_switch - on_text: Bright - off_text: Dark - immediate_edit: false - on_value: - then: - lambda: 'ESP_LOGI("lcd_menu", "switch value: %s", it->get_value_text().c_str());' - - type: custom - text: !lambda 'return "Custom";' - value_lambda: 'return "Val";' - on_next: - then: - lambda: 'ESP_LOGI("lcd_menu", "custom next: %s", it->get_text().c_str());' - on_prev: - then: - lambda: 'ESP_LOGI("lcd_menu", "custom prev: %s", it->get_text().c_str());' +<<: !include common.yaml diff --git a/tests/components/lcd_menu/test.esp32-idf.yaml b/tests/components/lcd_menu/test.esp32-idf.yaml index 833ea2169a..9c2af456b5 100644 --- a/tests/components/lcd_menu/test.esp32-idf.yaml +++ b/tests/components/lcd_menu/test.esp32-idf.yaml @@ -1,118 +1,9 @@ -number: - - platform: template - id: test_number - min_value: 0 - step: 1 - max_value: 10 - optimistic: true +substitutions: + d0_pin: GPIO12 + d1_pin: GPIO13 + d2_pin: GPIO14 + d3_pin: GPIO15 + enable_pin: GPIO16 + rs_pin: GPIO5 -select: - - platform: template - id: test_select - options: - - one - - two - optimistic: true - -switch: - - platform: template - name: Template Switch - id: my_switch - optimistic: true - -display: - - platform: lcd_gpio - id: my_lcd_gpio - dimensions: 18x4 - data_pins: - - number: 12 - - number: 13 - - number: 14 - - number: 15 - enable_pin: 16 - rs_pin: 5 - lambda: |- - it.print("Hello World!"); - -lcd_menu: - id: test_lcd_menu - display_id: my_lcd_gpio - mark_back: 0x5e - mark_selected: 0x3e - mark_editing: 0x2a - mark_submenu: 0x7e - active: false - mode: rotary - on_enter: - then: - lambda: 'ESP_LOGI("lcd_menu", "root enter");' - on_leave: - then: - lambda: 'ESP_LOGI("lcd_menu", "root leave");' - items: - - type: back - text: Back - - type: label - - type: menu - text: Submenu 1 - items: - - type: back - text: Back - - type: menu - text: Submenu 21 - items: - - type: back - text: Back - - type: command - text: Show Main - on_value: - then: - - display_menu.show_main: test_lcd_menu - - type: select - text: Enum Item - immediate_edit: true - select: test_select - on_enter: - then: - lambda: 'ESP_LOGI("lcd_menu", "select enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_leave: - then: - lambda: 'ESP_LOGI("lcd_menu", "select leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_value: - then: - lambda: 'ESP_LOGI("lcd_menu", "select value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - - type: number - text: Number - number: test_number - on_enter: - then: - lambda: 'ESP_LOGI("lcd_menu", "number enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_leave: - then: - lambda: 'ESP_LOGI("lcd_menu", "number leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_value: - then: - lambda: 'ESP_LOGI("lcd_menu", "number value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - - type: command - text: Hide - on_value: - then: - - display_menu.hide: test_lcd_menu - - type: switch - text: Switch - switch: my_switch - on_text: Bright - off_text: Dark - immediate_edit: false - on_value: - then: - lambda: 'ESP_LOGI("lcd_menu", "switch value: %s", it->get_value_text().c_str());' - - type: custom - text: !lambda 'return "Custom";' - value_lambda: 'return "Val";' - on_next: - then: - lambda: 'ESP_LOGI("lcd_menu", "custom next: %s", it->get_text().c_str());' - on_prev: - then: - lambda: 'ESP_LOGI("lcd_menu", "custom prev: %s", it->get_text().c_str());' +<<: !include common.yaml diff --git a/tests/components/lcd_menu/test.esp8266-ard.yaml b/tests/components/lcd_menu/test.esp8266-ard.yaml index 833ea2169a..9c2af456b5 100644 --- a/tests/components/lcd_menu/test.esp8266-ard.yaml +++ b/tests/components/lcd_menu/test.esp8266-ard.yaml @@ -1,118 +1,9 @@ -number: - - platform: template - id: test_number - min_value: 0 - step: 1 - max_value: 10 - optimistic: true +substitutions: + d0_pin: GPIO12 + d1_pin: GPIO13 + d2_pin: GPIO14 + d3_pin: GPIO15 + enable_pin: GPIO16 + rs_pin: GPIO5 -select: - - platform: template - id: test_select - options: - - one - - two - optimistic: true - -switch: - - platform: template - name: Template Switch - id: my_switch - optimistic: true - -display: - - platform: lcd_gpio - id: my_lcd_gpio - dimensions: 18x4 - data_pins: - - number: 12 - - number: 13 - - number: 14 - - number: 15 - enable_pin: 16 - rs_pin: 5 - lambda: |- - it.print("Hello World!"); - -lcd_menu: - id: test_lcd_menu - display_id: my_lcd_gpio - mark_back: 0x5e - mark_selected: 0x3e - mark_editing: 0x2a - mark_submenu: 0x7e - active: false - mode: rotary - on_enter: - then: - lambda: 'ESP_LOGI("lcd_menu", "root enter");' - on_leave: - then: - lambda: 'ESP_LOGI("lcd_menu", "root leave");' - items: - - type: back - text: Back - - type: label - - type: menu - text: Submenu 1 - items: - - type: back - text: Back - - type: menu - text: Submenu 21 - items: - - type: back - text: Back - - type: command - text: Show Main - on_value: - then: - - display_menu.show_main: test_lcd_menu - - type: select - text: Enum Item - immediate_edit: true - select: test_select - on_enter: - then: - lambda: 'ESP_LOGI("lcd_menu", "select enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_leave: - then: - lambda: 'ESP_LOGI("lcd_menu", "select leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_value: - then: - lambda: 'ESP_LOGI("lcd_menu", "select value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - - type: number - text: Number - number: test_number - on_enter: - then: - lambda: 'ESP_LOGI("lcd_menu", "number enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_leave: - then: - lambda: 'ESP_LOGI("lcd_menu", "number leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_value: - then: - lambda: 'ESP_LOGI("lcd_menu", "number value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - - type: command - text: Hide - on_value: - then: - - display_menu.hide: test_lcd_menu - - type: switch - text: Switch - switch: my_switch - on_text: Bright - off_text: Dark - immediate_edit: false - on_value: - then: - lambda: 'ESP_LOGI("lcd_menu", "switch value: %s", it->get_value_text().c_str());' - - type: custom - text: !lambda 'return "Custom";' - value_lambda: 'return "Val";' - on_next: - then: - lambda: 'ESP_LOGI("lcd_menu", "custom next: %s", it->get_text().c_str());' - on_prev: - then: - lambda: 'ESP_LOGI("lcd_menu", "custom prev: %s", it->get_text().c_str());' +<<: !include common.yaml diff --git a/tests/components/lcd_menu/test.rp2040-ard.yaml b/tests/components/lcd_menu/test.rp2040-ard.yaml index 39d2278d3d..b6b05f3ab4 100644 --- a/tests/components/lcd_menu/test.rp2040-ard.yaml +++ b/tests/components/lcd_menu/test.rp2040-ard.yaml @@ -1,118 +1,9 @@ -number: - - platform: template - id: test_number - min_value: 0 - step: 1 - max_value: 10 - optimistic: true +substitutions: + d0_pin: GPIO1 + d1_pin: GPIO2 + d2_pin: GPIO3 + d3_pin: GPIO4 + enable_pin: GPIO5 + rs_pin: GPIO6 -select: - - platform: template - id: test_select - options: - - one - - two - optimistic: true - -switch: - - platform: template - name: Template Switch - id: my_switch - optimistic: true - -display: - - platform: lcd_gpio - id: my_lcd_gpio - dimensions: 18x4 - data_pins: - - number: 1 - - number: 2 - - number: 3 - - number: 4 - enable_pin: 5 - rs_pin: 6 - lambda: |- - it.print("Hello World!"); - -lcd_menu: - id: test_lcd_menu - display_id: my_lcd_gpio - mark_back: 0x5e - mark_selected: 0x3e - mark_editing: 0x2a - mark_submenu: 0x7e - active: false - mode: rotary - on_enter: - then: - lambda: 'ESP_LOGI("lcd_menu", "root enter");' - on_leave: - then: - lambda: 'ESP_LOGI("lcd_menu", "root leave");' - items: - - type: back - text: Back - - type: label - - type: menu - text: Submenu 1 - items: - - type: back - text: Back - - type: menu - text: Submenu 21 - items: - - type: back - text: Back - - type: command - text: Show Main - on_value: - then: - - display_menu.show_main: test_lcd_menu - - type: select - text: Enum Item - immediate_edit: true - select: test_select - on_enter: - then: - lambda: 'ESP_LOGI("lcd_menu", "select enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_leave: - then: - lambda: 'ESP_LOGI("lcd_menu", "select leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_value: - then: - lambda: 'ESP_LOGI("lcd_menu", "select value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - - type: number - text: Number - number: test_number - on_enter: - then: - lambda: 'ESP_LOGI("lcd_menu", "number enter: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_leave: - then: - lambda: 'ESP_LOGI("lcd_menu", "number leave: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - on_value: - then: - lambda: 'ESP_LOGI("lcd_menu", "number value: %s, %s", it->get_text().c_str(), it->get_value_text().c_str());' - - type: command - text: Hide - on_value: - then: - - display_menu.hide: test_lcd_menu - - type: switch - text: Switch - switch: my_switch - on_text: Bright - off_text: Dark - immediate_edit: false - on_value: - then: - lambda: 'ESP_LOGI("lcd_menu", "switch value: %s", it->get_value_text().c_str());' - - type: custom - text: !lambda 'return "Custom";' - value_lambda: 'return "Val";' - on_next: - then: - lambda: 'ESP_LOGI("lcd_menu", "custom next: %s", it->get_text().c_str());' - on_prev: - then: - lambda: 'ESP_LOGI("lcd_menu", "custom prev: %s", it->get_text().c_str());' +<<: !include common.yaml diff --git a/tests/components/lcd_pcf8574/common.yaml b/tests/components/lcd_pcf8574/common.yaml new file mode 100644 index 0000000000..8b03cf5497 --- /dev/null +++ b/tests/components/lcd_pcf8574/common.yaml @@ -0,0 +1,22 @@ +i2c: + - id: i2c_lcd_pcf8574 + scl: ${scl_pin} + sda: ${sda_pin} + +display: + - platform: lcd_pcf8574 + dimensions: 18x4 + address: 0x3F + user_characters: + - position: 0 + data: + - 0b00000 + - 0b01010 + - 0b00000 + - 0b00100 + - 0b00100 + - 0b10001 + - 0b01110 + - 0b00000 + lambda: |- + it.print("Hello World!"); diff --git a/tests/components/lcd_pcf8574/test.esp32-ard.yaml b/tests/components/lcd_pcf8574/test.esp32-ard.yaml index 9d7d475f30..63c3bd6afd 100644 --- a/tests/components/lcd_pcf8574/test.esp32-ard.yaml +++ b/tests/components/lcd_pcf8574/test.esp32-ard.yaml @@ -1,22 +1,5 @@ -i2c: - - id: i2c_lcd_pcf8574 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -display: - - platform: lcd_pcf8574 - dimensions: 18x4 - address: 0x3F - user_characters: - - position: 0 - data: - - 0b00000 - - 0b01010 - - 0b00000 - - 0b00100 - - 0b00100 - - 0b10001 - - 0b01110 - - 0b00000 - lambda: |- - it.print("Hello World!"); +<<: !include common.yaml diff --git a/tests/components/lcd_pcf8574/test.esp32-c3-ard.yaml b/tests/components/lcd_pcf8574/test.esp32-c3-ard.yaml index 41eba26950..ee2c29ca4e 100644 --- a/tests/components/lcd_pcf8574/test.esp32-c3-ard.yaml +++ b/tests/components/lcd_pcf8574/test.esp32-c3-ard.yaml @@ -1,22 +1,5 @@ -i2c: - - id: i2c_lcd_pcf8574 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -display: - - platform: lcd_pcf8574 - dimensions: 18x4 - address: 0x3F - user_characters: - - position: 0 - data: - - 0b00000 - - 0b01010 - - 0b00000 - - 0b00100 - - 0b00100 - - 0b10001 - - 0b01110 - - 0b00000 - lambda: |- - it.print("Hello World!"); +<<: !include common.yaml diff --git a/tests/components/lcd_pcf8574/test.esp32-c3-idf.yaml b/tests/components/lcd_pcf8574/test.esp32-c3-idf.yaml index 41eba26950..ee2c29ca4e 100644 --- a/tests/components/lcd_pcf8574/test.esp32-c3-idf.yaml +++ b/tests/components/lcd_pcf8574/test.esp32-c3-idf.yaml @@ -1,22 +1,5 @@ -i2c: - - id: i2c_lcd_pcf8574 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -display: - - platform: lcd_pcf8574 - dimensions: 18x4 - address: 0x3F - user_characters: - - position: 0 - data: - - 0b00000 - - 0b01010 - - 0b00000 - - 0b00100 - - 0b00100 - - 0b10001 - - 0b01110 - - 0b00000 - lambda: |- - it.print("Hello World!"); +<<: !include common.yaml diff --git a/tests/components/lcd_pcf8574/test.esp32-idf.yaml b/tests/components/lcd_pcf8574/test.esp32-idf.yaml index 9d7d475f30..63c3bd6afd 100644 --- a/tests/components/lcd_pcf8574/test.esp32-idf.yaml +++ b/tests/components/lcd_pcf8574/test.esp32-idf.yaml @@ -1,22 +1,5 @@ -i2c: - - id: i2c_lcd_pcf8574 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -display: - - platform: lcd_pcf8574 - dimensions: 18x4 - address: 0x3F - user_characters: - - position: 0 - data: - - 0b00000 - - 0b01010 - - 0b00000 - - 0b00100 - - 0b00100 - - 0b10001 - - 0b01110 - - 0b00000 - lambda: |- - it.print("Hello World!"); +<<: !include common.yaml diff --git a/tests/components/lcd_pcf8574/test.esp8266-ard.yaml b/tests/components/lcd_pcf8574/test.esp8266-ard.yaml index 41eba26950..ee2c29ca4e 100644 --- a/tests/components/lcd_pcf8574/test.esp8266-ard.yaml +++ b/tests/components/lcd_pcf8574/test.esp8266-ard.yaml @@ -1,22 +1,5 @@ -i2c: - - id: i2c_lcd_pcf8574 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -display: - - platform: lcd_pcf8574 - dimensions: 18x4 - address: 0x3F - user_characters: - - position: 0 - data: - - 0b00000 - - 0b01010 - - 0b00000 - - 0b00100 - - 0b00100 - - 0b10001 - - 0b01110 - - 0b00000 - lambda: |- - it.print("Hello World!"); +<<: !include common.yaml diff --git a/tests/components/lcd_pcf8574/test.rp2040-ard.yaml b/tests/components/lcd_pcf8574/test.rp2040-ard.yaml index 41eba26950..ee2c29ca4e 100644 --- a/tests/components/lcd_pcf8574/test.rp2040-ard.yaml +++ b/tests/components/lcd_pcf8574/test.rp2040-ard.yaml @@ -1,22 +1,5 @@ -i2c: - - id: i2c_lcd_pcf8574 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -display: - - platform: lcd_pcf8574 - dimensions: 18x4 - address: 0x3F - user_characters: - - position: 0 - data: - - 0b00000 - - 0b01010 - - 0b00000 - - 0b00100 - - 0b00100 - - 0b10001 - - 0b01110 - - 0b00000 - lambda: |- - it.print("Hello World!"); +<<: !include common.yaml diff --git a/tests/components/ld2410/common.yaml b/tests/components/ld2410/common.yaml new file mode 100644 index 0000000000..e975fcf757 --- /dev/null +++ b/tests/components/ld2410/common.yaml @@ -0,0 +1,169 @@ +uart: + - id: uart_ld2410 + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} + baud_rate: 9600 + +ld2410: + id: my_ld2410 + +binary_sensor: + - platform: ld2410 + has_target: + name: presence + has_moving_target: + name: movement + has_still_target: + name: still + out_pin_presence_status: + name: out pin presence status + +button: + - platform: ld2410 + factory_reset: + name: factory reset + restart: + name: restart + query_params: + name: query params + +number: + - platform: ld2410 + light_threshold: + name: light threshold + timeout: + name: timeout + max_move_distance_gate: + name: max move distance gate + max_still_distance_gate: + name: max still distance gate + g0: + move_threshold: + name: g0 move threshold + still_threshold: + name: g0 still threshold + g1: + move_threshold: + name: g1 move threshold + still_threshold: + name: g1 still threshold + g2: + move_threshold: + name: g2 move threshold + still_threshold: + name: g2 still threshold + g3: + move_threshold: + name: g3 move threshold + still_threshold: + name: g3 still threshold + g4: + move_threshold: + name: g4 move threshold + still_threshold: + name: g4 still threshold + g5: + move_threshold: + name: g5 move threshold + still_threshold: + name: g5 still threshold + g6: + move_threshold: + name: g6 move threshold + still_threshold: + name: g6 still threshold + g7: + move_threshold: + name: g7 move threshold + still_threshold: + name: g7 still threshold + g8: + move_threshold: + name: g8 move threshold + still_threshold: + name: g8 still threshold + +select: + - platform: ld2410 + distance_resolution: + name: distance resolution + baud_rate: + name: baud rate + light_function: + name: light function + out_pin_level: + name: out ping level + +sensor: + - platform: ld2410 + light: + name: light + moving_distance: + name: Moving distance + still_distance: + name: Still Distance + moving_energy: + name: Move Energy + still_energy: + name: Still Energy + detection_distance: + name: Distance Detection + g0: + move_energy: + name: g0 move energy + still_energy: + name: g0 still energy + g1: + move_energy: + name: g1 move energy + still_energy: + name: g1 still energy + g2: + move_energy: + name: g2 move energy + still_energy: + name: g2 still energy + g3: + move_energy: + name: g3 move energy + still_energy: + name: g3 still energy + g4: + move_energy: + name: g4 move energy + still_energy: + name: g4 still energy + g5: + move_energy: + name: g5 move energy + still_energy: + name: g5 still energy + g6: + move_energy: + name: g6 move energy + still_energy: + name: g6 still energy + g7: + move_energy: + name: g7 move energy + still_energy: + name: g7 still energy + g8: + move_energy: + name: g8 move energy + still_energy: + name: g8 still energy + +switch: + - platform: ld2410 + engineering_mode: + name: control ld2410 engineering mode + bluetooth: + name: control ld2410 bluetooth + +text_sensor: + - platform: ld2410 + version: + name: presenece sensor version + mac_address: + name: presenece sensor mac address diff --git a/tests/components/ld2410/test.esp32-ard.yaml b/tests/components/ld2410/test.esp32-ard.yaml index 48ed179d93..f486544afa 100644 --- a/tests/components/ld2410/test.esp32-ard.yaml +++ b/tests/components/ld2410/test.esp32-ard.yaml @@ -1,169 +1,5 @@ -uart: - - id: uart_ld2410 - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO17 + rx_pin: GPIO16 -ld2410: - id: my_ld2410 - -binary_sensor: - - platform: ld2410 - has_target: - name: presence - has_moving_target: - name: movement - has_still_target: - name: still - out_pin_presence_status: - name: out pin presence status - -button: - - platform: ld2410 - factory_reset: - name: factory reset - restart: - name: restart - query_params: - name: query params - -number: - - platform: ld2410 - light_threshold: - name: light threshold - timeout: - name: timeout - max_move_distance_gate: - name: max move distance gate - max_still_distance_gate: - name: max still distance gate - g0: - move_threshold: - name: g0 move threshold - still_threshold: - name: g0 still threshold - g1: - move_threshold: - name: g1 move threshold - still_threshold: - name: g1 still threshold - g2: - move_threshold: - name: g2 move threshold - still_threshold: - name: g2 still threshold - g3: - move_threshold: - name: g3 move threshold - still_threshold: - name: g3 still threshold - g4: - move_threshold: - name: g4 move threshold - still_threshold: - name: g4 still threshold - g5: - move_threshold: - name: g5 move threshold - still_threshold: - name: g5 still threshold - g6: - move_threshold: - name: g6 move threshold - still_threshold: - name: g6 still threshold - g7: - move_threshold: - name: g7 move threshold - still_threshold: - name: g7 still threshold - g8: - move_threshold: - name: g8 move threshold - still_threshold: - name: g8 still threshold - -select: - - platform: ld2410 - distance_resolution: - name: distance resolution - baud_rate: - name: baud rate - light_function: - name: light function - out_pin_level: - name: out ping level - -sensor: - - platform: ld2410 - light: - name: light - moving_distance: - name: Moving distance - still_distance: - name: Still Distance - moving_energy: - name: Move Energy - still_energy: - name: Still Energy - detection_distance: - name: Distance Detection - g0: - move_energy: - name: g0 move energy - still_energy: - name: g0 still energy - g1: - move_energy: - name: g1 move energy - still_energy: - name: g1 still energy - g2: - move_energy: - name: g2 move energy - still_energy: - name: g2 still energy - g3: - move_energy: - name: g3 move energy - still_energy: - name: g3 still energy - g4: - move_energy: - name: g4 move energy - still_energy: - name: g4 still energy - g5: - move_energy: - name: g5 move energy - still_energy: - name: g5 still energy - g6: - move_energy: - name: g6 move energy - still_energy: - name: g6 still energy - g7: - move_energy: - name: g7 move energy - still_energy: - name: g7 still energy - g8: - move_energy: - name: g8 move energy - still_energy: - name: g8 still energy - -switch: - - platform: ld2410 - engineering_mode: - name: control ld2410 engineering mode - bluetooth: - name: control ld2410 bluetooth - -text_sensor: - - platform: ld2410 - version: - name: presenece sensor version - mac_address: - name: presenece sensor mac address +<<: !include common.yaml diff --git a/tests/components/ld2410/test.esp32-c3-ard.yaml b/tests/components/ld2410/test.esp32-c3-ard.yaml index afcaa81b3e..b516342f3b 100644 --- a/tests/components/ld2410/test.esp32-c3-ard.yaml +++ b/tests/components/ld2410/test.esp32-c3-ard.yaml @@ -1,169 +1,5 @@ -uart: - - id: uart_ld2410 - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -ld2410: - id: my_ld2410 - -binary_sensor: - - platform: ld2410 - has_target: - name: presence - has_moving_target: - name: movement - has_still_target: - name: still - out_pin_presence_status: - name: out pin presence status - -button: - - platform: ld2410 - factory_reset: - name: factory reset - restart: - name: restart - query_params: - name: query params - -number: - - platform: ld2410 - light_threshold: - name: light threshold - timeout: - name: timeout - max_move_distance_gate: - name: max move distance gate - max_still_distance_gate: - name: max still distance gate - g0: - move_threshold: - name: g0 move threshold - still_threshold: - name: g0 still threshold - g1: - move_threshold: - name: g1 move threshold - still_threshold: - name: g1 still threshold - g2: - move_threshold: - name: g2 move threshold - still_threshold: - name: g2 still threshold - g3: - move_threshold: - name: g3 move threshold - still_threshold: - name: g3 still threshold - g4: - move_threshold: - name: g4 move threshold - still_threshold: - name: g4 still threshold - g5: - move_threshold: - name: g5 move threshold - still_threshold: - name: g5 still threshold - g6: - move_threshold: - name: g6 move threshold - still_threshold: - name: g6 still threshold - g7: - move_threshold: - name: g7 move threshold - still_threshold: - name: g7 still threshold - g8: - move_threshold: - name: g8 move threshold - still_threshold: - name: g8 still threshold - -select: - - platform: ld2410 - distance_resolution: - name: distance resolution - baud_rate: - name: baud rate - light_function: - name: light function - out_pin_level: - name: out ping level - -sensor: - - platform: ld2410 - light: - name: light - moving_distance: - name: Moving distance - still_distance: - name: Still Distance - moving_energy: - name: Move Energy - still_energy: - name: Still Energy - detection_distance: - name: Distance Detection - g0: - move_energy: - name: g0 move energy - still_energy: - name: g0 still energy - g1: - move_energy: - name: g1 move energy - still_energy: - name: g1 still energy - g2: - move_energy: - name: g2 move energy - still_energy: - name: g2 still energy - g3: - move_energy: - name: g3 move energy - still_energy: - name: g3 still energy - g4: - move_energy: - name: g4 move energy - still_energy: - name: g4 still energy - g5: - move_energy: - name: g5 move energy - still_energy: - name: g5 still energy - g6: - move_energy: - name: g6 move energy - still_energy: - name: g6 still energy - g7: - move_energy: - name: g7 move energy - still_energy: - name: g7 still energy - g8: - move_energy: - name: g8 move energy - still_energy: - name: g8 still energy - -switch: - - platform: ld2410 - engineering_mode: - name: control ld2410 engineering mode - bluetooth: - name: control ld2410 bluetooth - -text_sensor: - - platform: ld2410 - version: - name: presenece sensor version - mac_address: - name: presenece sensor mac address +<<: !include common.yaml diff --git a/tests/components/ld2410/test.esp32-c3-idf.yaml b/tests/components/ld2410/test.esp32-c3-idf.yaml index afcaa81b3e..b516342f3b 100644 --- a/tests/components/ld2410/test.esp32-c3-idf.yaml +++ b/tests/components/ld2410/test.esp32-c3-idf.yaml @@ -1,169 +1,5 @@ -uart: - - id: uart_ld2410 - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -ld2410: - id: my_ld2410 - -binary_sensor: - - platform: ld2410 - has_target: - name: presence - has_moving_target: - name: movement - has_still_target: - name: still - out_pin_presence_status: - name: out pin presence status - -button: - - platform: ld2410 - factory_reset: - name: factory reset - restart: - name: restart - query_params: - name: query params - -number: - - platform: ld2410 - light_threshold: - name: light threshold - timeout: - name: timeout - max_move_distance_gate: - name: max move distance gate - max_still_distance_gate: - name: max still distance gate - g0: - move_threshold: - name: g0 move threshold - still_threshold: - name: g0 still threshold - g1: - move_threshold: - name: g1 move threshold - still_threshold: - name: g1 still threshold - g2: - move_threshold: - name: g2 move threshold - still_threshold: - name: g2 still threshold - g3: - move_threshold: - name: g3 move threshold - still_threshold: - name: g3 still threshold - g4: - move_threshold: - name: g4 move threshold - still_threshold: - name: g4 still threshold - g5: - move_threshold: - name: g5 move threshold - still_threshold: - name: g5 still threshold - g6: - move_threshold: - name: g6 move threshold - still_threshold: - name: g6 still threshold - g7: - move_threshold: - name: g7 move threshold - still_threshold: - name: g7 still threshold - g8: - move_threshold: - name: g8 move threshold - still_threshold: - name: g8 still threshold - -select: - - platform: ld2410 - distance_resolution: - name: distance resolution - baud_rate: - name: baud rate - light_function: - name: light function - out_pin_level: - name: out ping level - -sensor: - - platform: ld2410 - light: - name: light - moving_distance: - name: Moving distance - still_distance: - name: Still Distance - moving_energy: - name: Move Energy - still_energy: - name: Still Energy - detection_distance: - name: Distance Detection - g0: - move_energy: - name: g0 move energy - still_energy: - name: g0 still energy - g1: - move_energy: - name: g1 move energy - still_energy: - name: g1 still energy - g2: - move_energy: - name: g2 move energy - still_energy: - name: g2 still energy - g3: - move_energy: - name: g3 move energy - still_energy: - name: g3 still energy - g4: - move_energy: - name: g4 move energy - still_energy: - name: g4 still energy - g5: - move_energy: - name: g5 move energy - still_energy: - name: g5 still energy - g6: - move_energy: - name: g6 move energy - still_energy: - name: g6 still energy - g7: - move_energy: - name: g7 move energy - still_energy: - name: g7 still energy - g8: - move_energy: - name: g8 move energy - still_energy: - name: g8 still energy - -switch: - - platform: ld2410 - engineering_mode: - name: control ld2410 engineering mode - bluetooth: - name: control ld2410 bluetooth - -text_sensor: - - platform: ld2410 - version: - name: presenece sensor version - mac_address: - name: presenece sensor mac address +<<: !include common.yaml diff --git a/tests/components/ld2410/test.esp32-idf.yaml b/tests/components/ld2410/test.esp32-idf.yaml index 48ed179d93..f486544afa 100644 --- a/tests/components/ld2410/test.esp32-idf.yaml +++ b/tests/components/ld2410/test.esp32-idf.yaml @@ -1,169 +1,5 @@ -uart: - - id: uart_ld2410 - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO17 + rx_pin: GPIO16 -ld2410: - id: my_ld2410 - -binary_sensor: - - platform: ld2410 - has_target: - name: presence - has_moving_target: - name: movement - has_still_target: - name: still - out_pin_presence_status: - name: out pin presence status - -button: - - platform: ld2410 - factory_reset: - name: factory reset - restart: - name: restart - query_params: - name: query params - -number: - - platform: ld2410 - light_threshold: - name: light threshold - timeout: - name: timeout - max_move_distance_gate: - name: max move distance gate - max_still_distance_gate: - name: max still distance gate - g0: - move_threshold: - name: g0 move threshold - still_threshold: - name: g0 still threshold - g1: - move_threshold: - name: g1 move threshold - still_threshold: - name: g1 still threshold - g2: - move_threshold: - name: g2 move threshold - still_threshold: - name: g2 still threshold - g3: - move_threshold: - name: g3 move threshold - still_threshold: - name: g3 still threshold - g4: - move_threshold: - name: g4 move threshold - still_threshold: - name: g4 still threshold - g5: - move_threshold: - name: g5 move threshold - still_threshold: - name: g5 still threshold - g6: - move_threshold: - name: g6 move threshold - still_threshold: - name: g6 still threshold - g7: - move_threshold: - name: g7 move threshold - still_threshold: - name: g7 still threshold - g8: - move_threshold: - name: g8 move threshold - still_threshold: - name: g8 still threshold - -select: - - platform: ld2410 - distance_resolution: - name: distance resolution - baud_rate: - name: baud rate - light_function: - name: light function - out_pin_level: - name: out ping level - -sensor: - - platform: ld2410 - light: - name: light - moving_distance: - name: Moving distance - still_distance: - name: Still Distance - moving_energy: - name: Move Energy - still_energy: - name: Still Energy - detection_distance: - name: Distance Detection - g0: - move_energy: - name: g0 move energy - still_energy: - name: g0 still energy - g1: - move_energy: - name: g1 move energy - still_energy: - name: g1 still energy - g2: - move_energy: - name: g2 move energy - still_energy: - name: g2 still energy - g3: - move_energy: - name: g3 move energy - still_energy: - name: g3 still energy - g4: - move_energy: - name: g4 move energy - still_energy: - name: g4 still energy - g5: - move_energy: - name: g5 move energy - still_energy: - name: g5 still energy - g6: - move_energy: - name: g6 move energy - still_energy: - name: g6 still energy - g7: - move_energy: - name: g7 move energy - still_energy: - name: g7 still energy - g8: - move_energy: - name: g8 move energy - still_energy: - name: g8 still energy - -switch: - - platform: ld2410 - engineering_mode: - name: control ld2410 engineering mode - bluetooth: - name: control ld2410 bluetooth - -text_sensor: - - platform: ld2410 - version: - name: presenece sensor version - mac_address: - name: presenece sensor mac address +<<: !include common.yaml diff --git a/tests/components/ld2410/test.esp8266-ard.yaml b/tests/components/ld2410/test.esp8266-ard.yaml index afcaa81b3e..b516342f3b 100644 --- a/tests/components/ld2410/test.esp8266-ard.yaml +++ b/tests/components/ld2410/test.esp8266-ard.yaml @@ -1,169 +1,5 @@ -uart: - - id: uart_ld2410 - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -ld2410: - id: my_ld2410 - -binary_sensor: - - platform: ld2410 - has_target: - name: presence - has_moving_target: - name: movement - has_still_target: - name: still - out_pin_presence_status: - name: out pin presence status - -button: - - platform: ld2410 - factory_reset: - name: factory reset - restart: - name: restart - query_params: - name: query params - -number: - - platform: ld2410 - light_threshold: - name: light threshold - timeout: - name: timeout - max_move_distance_gate: - name: max move distance gate - max_still_distance_gate: - name: max still distance gate - g0: - move_threshold: - name: g0 move threshold - still_threshold: - name: g0 still threshold - g1: - move_threshold: - name: g1 move threshold - still_threshold: - name: g1 still threshold - g2: - move_threshold: - name: g2 move threshold - still_threshold: - name: g2 still threshold - g3: - move_threshold: - name: g3 move threshold - still_threshold: - name: g3 still threshold - g4: - move_threshold: - name: g4 move threshold - still_threshold: - name: g4 still threshold - g5: - move_threshold: - name: g5 move threshold - still_threshold: - name: g5 still threshold - g6: - move_threshold: - name: g6 move threshold - still_threshold: - name: g6 still threshold - g7: - move_threshold: - name: g7 move threshold - still_threshold: - name: g7 still threshold - g8: - move_threshold: - name: g8 move threshold - still_threshold: - name: g8 still threshold - -select: - - platform: ld2410 - distance_resolution: - name: distance resolution - baud_rate: - name: baud rate - light_function: - name: light function - out_pin_level: - name: out ping level - -sensor: - - platform: ld2410 - light: - name: light - moving_distance: - name: Moving distance - still_distance: - name: Still Distance - moving_energy: - name: Move Energy - still_energy: - name: Still Energy - detection_distance: - name: Distance Detection - g0: - move_energy: - name: g0 move energy - still_energy: - name: g0 still energy - g1: - move_energy: - name: g1 move energy - still_energy: - name: g1 still energy - g2: - move_energy: - name: g2 move energy - still_energy: - name: g2 still energy - g3: - move_energy: - name: g3 move energy - still_energy: - name: g3 still energy - g4: - move_energy: - name: g4 move energy - still_energy: - name: g4 still energy - g5: - move_energy: - name: g5 move energy - still_energy: - name: g5 still energy - g6: - move_energy: - name: g6 move energy - still_energy: - name: g6 still energy - g7: - move_energy: - name: g7 move energy - still_energy: - name: g7 still energy - g8: - move_energy: - name: g8 move energy - still_energy: - name: g8 still energy - -switch: - - platform: ld2410 - engineering_mode: - name: control ld2410 engineering mode - bluetooth: - name: control ld2410 bluetooth - -text_sensor: - - platform: ld2410 - version: - name: presenece sensor version - mac_address: - name: presenece sensor mac address +<<: !include common.yaml diff --git a/tests/components/ld2410/test.rp2040-ard.yaml b/tests/components/ld2410/test.rp2040-ard.yaml index afcaa81b3e..b516342f3b 100644 --- a/tests/components/ld2410/test.rp2040-ard.yaml +++ b/tests/components/ld2410/test.rp2040-ard.yaml @@ -1,169 +1,5 @@ -uart: - - id: uart_ld2410 - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -ld2410: - id: my_ld2410 - -binary_sensor: - - platform: ld2410 - has_target: - name: presence - has_moving_target: - name: movement - has_still_target: - name: still - out_pin_presence_status: - name: out pin presence status - -button: - - platform: ld2410 - factory_reset: - name: factory reset - restart: - name: restart - query_params: - name: query params - -number: - - platform: ld2410 - light_threshold: - name: light threshold - timeout: - name: timeout - max_move_distance_gate: - name: max move distance gate - max_still_distance_gate: - name: max still distance gate - g0: - move_threshold: - name: g0 move threshold - still_threshold: - name: g0 still threshold - g1: - move_threshold: - name: g1 move threshold - still_threshold: - name: g1 still threshold - g2: - move_threshold: - name: g2 move threshold - still_threshold: - name: g2 still threshold - g3: - move_threshold: - name: g3 move threshold - still_threshold: - name: g3 still threshold - g4: - move_threshold: - name: g4 move threshold - still_threshold: - name: g4 still threshold - g5: - move_threshold: - name: g5 move threshold - still_threshold: - name: g5 still threshold - g6: - move_threshold: - name: g6 move threshold - still_threshold: - name: g6 still threshold - g7: - move_threshold: - name: g7 move threshold - still_threshold: - name: g7 still threshold - g8: - move_threshold: - name: g8 move threshold - still_threshold: - name: g8 still threshold - -select: - - platform: ld2410 - distance_resolution: - name: distance resolution - baud_rate: - name: baud rate - light_function: - name: light function - out_pin_level: - name: out ping level - -sensor: - - platform: ld2410 - light: - name: light - moving_distance: - name: Moving distance - still_distance: - name: Still Distance - moving_energy: - name: Move Energy - still_energy: - name: Still Energy - detection_distance: - name: Distance Detection - g0: - move_energy: - name: g0 move energy - still_energy: - name: g0 still energy - g1: - move_energy: - name: g1 move energy - still_energy: - name: g1 still energy - g2: - move_energy: - name: g2 move energy - still_energy: - name: g2 still energy - g3: - move_energy: - name: g3 move energy - still_energy: - name: g3 still energy - g4: - move_energy: - name: g4 move energy - still_energy: - name: g4 still energy - g5: - move_energy: - name: g5 move energy - still_energy: - name: g5 still energy - g6: - move_energy: - name: g6 move energy - still_energy: - name: g6 still energy - g7: - move_energy: - name: g7 move energy - still_energy: - name: g7 still energy - g8: - move_energy: - name: g8 move energy - still_energy: - name: g8 still energy - -switch: - - platform: ld2410 - engineering_mode: - name: control ld2410 engineering mode - bluetooth: - name: control ld2410 bluetooth - -text_sensor: - - platform: ld2410 - version: - name: presenece sensor version - mac_address: - name: presenece sensor mac address +<<: !include common.yaml diff --git a/tests/components/ld2420/common.yaml b/tests/components/ld2420/common.yaml new file mode 100644 index 0000000000..76748aa8f0 --- /dev/null +++ b/tests/components/ld2420/common.yaml @@ -0,0 +1,132 @@ +uart: + - id: uart_ld2420 + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} + baud_rate: 9600 + +ld2420: + id: my_ld2420 + +binary_sensor: + - platform: ld2420 + has_target: + name: Presence + +button: + - platform: ld2420 + apply_config: + name: Apply Config + factory_reset: + name: Factory Reset + restart_module: + name: Restart Module + revert_config: + name: Undo Edits + +number: + - platform: ld2420 + presence_timeout: + name: Detection Presence Timeout + min_gate_distance: + name: Detection Gate Minimum + max_gate_distance: + name: Detection Gate Maximum + gate_move_sensitivity: + name: Move Calibration Sensitivity Factor + gate_still_sensitivity: + name: Still Calibration Sensitivity Factor + gate_0: + move_threshold: + name: Gate 0 Move Threshold + still_threshold: + name: Gate 0 Still Threshold + gate_1: + move_threshold: + name: Gate 1 Move Threshold + still_threshold: + name: Gate 1 Still Threshold + gate_2: + move_threshold: + name: Gate 2 Move Threshold + still_threshold: + name: Gate 2 Still Threshold + gate_3: + move_threshold: + name: Gate 3 Move Threshold + still_threshold: + name: Gate 3 Still Threshold + gate_4: + move_threshold: + name: Gate 4 Move Threshold + still_threshold: + name: Gate 4 Still Threshold + gate_5: + move_threshold: + name: Gate 5 Move Threshold + still_threshold: + name: Gate 5 Still Threshold + gate_6: + move_threshold: + name: Gate 6 Move Threshold + still_threshold: + name: Gate 6 Still Threshold + gate_7: + move_threshold: + name: Gate 7 Move Threshold + still_threshold: + name: Gate 7 Still Threshold + gate_8: + move_threshold: + name: Gate 8 Move Threshold + still_threshold: + name: Gate 8 Still Threshold + gate_9: + move_threshold: + name: Gate 9 Move Threshold + still_threshold: + name: Gate 9 Still Threshold + gate_10: + move_threshold: + name: Gate 10 Move Threshold + still_threshold: + name: Gate 10 Still Threshold + gate_11: + move_threshold: + name: Gate 11 Move Threshold + still_threshold: + name: Gate 11 Still Threshold + gate_12: + move_threshold: + name: Gate 12 Move Threshold + still_threshold: + name: Gate 12 Still Threshold + gate_13: + move_threshold: + name: Gate 13 Move Threshold + still_threshold: + name: Gate 13 Still Threshold + gate_14: + move_threshold: + name: Gate 14 Move Threshold + still_threshold: + name: Gate 14 Still Threshold + gate_15: + move_threshold: + name: Gate 15 Move Threshold + still_threshold: + name: Gate 15 Still Threshold + +select: + - platform: ld2420 + operating_mode: + name: Operating Mode + +sensor: + - platform: ld2420 + moving_distance: + name: "Moving distance (cm)" + +text_sensor: + - platform: ld2420 + fw_version: + name: LD2420 Firmware diff --git a/tests/components/ld2420/test.esp32-ard.yaml b/tests/components/ld2420/test.esp32-ard.yaml index 8c883664ec..f486544afa 100644 --- a/tests/components/ld2420/test.esp32-ard.yaml +++ b/tests/components/ld2420/test.esp32-ard.yaml @@ -1,132 +1,5 @@ -uart: - - id: uart_ld2420 - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO17 + rx_pin: GPIO16 -ld2420: - id: my_ld2420 - -binary_sensor: - - platform: ld2420 - has_target: - name: Presence - -button: - - platform: ld2420 - apply_config: - name: Apply Config - factory_reset: - name: Factory Reset - restart_module: - name: Restart Module - revert_config: - name: Undo Edits - -number: - - platform: ld2420 - presence_timeout: - name: Detection Presence Timeout - min_gate_distance: - name: Detection Gate Minimum - max_gate_distance: - name: Detection Gate Maximum - gate_move_sensitivity: - name: Move Calibration Sensitivity Factor - gate_still_sensitivity: - name: Still Calibration Sensitivity Factor - gate_0: - move_threshold: - name: Gate 0 Move Threshold - still_threshold: - name: Gate 0 Still Threshold - gate_1: - move_threshold: - name: Gate 1 Move Threshold - still_threshold: - name: Gate 1 Still Threshold - gate_2: - move_threshold: - name: Gate 2 Move Threshold - still_threshold: - name: Gate 2 Still Threshold - gate_3: - move_threshold: - name: Gate 3 Move Threshold - still_threshold: - name: Gate 3 Still Threshold - gate_4: - move_threshold: - name: Gate 4 Move Threshold - still_threshold: - name: Gate 4 Still Threshold - gate_5: - move_threshold: - name: Gate 5 Move Threshold - still_threshold: - name: Gate 5 Still Threshold - gate_6: - move_threshold: - name: Gate 6 Move Threshold - still_threshold: - name: Gate 6 Still Threshold - gate_7: - move_threshold: - name: Gate 7 Move Threshold - still_threshold: - name: Gate 7 Still Threshold - gate_8: - move_threshold: - name: Gate 8 Move Threshold - still_threshold: - name: Gate 8 Still Threshold - gate_9: - move_threshold: - name: Gate 9 Move Threshold - still_threshold: - name: Gate 9 Still Threshold - gate_10: - move_threshold: - name: Gate 10 Move Threshold - still_threshold: - name: Gate 10 Still Threshold - gate_11: - move_threshold: - name: Gate 11 Move Threshold - still_threshold: - name: Gate 11 Still Threshold - gate_12: - move_threshold: - name: Gate 12 Move Threshold - still_threshold: - name: Gate 12 Still Threshold - gate_13: - move_threshold: - name: Gate 13 Move Threshold - still_threshold: - name: Gate 13 Still Threshold - gate_14: - move_threshold: - name: Gate 14 Move Threshold - still_threshold: - name: Gate 14 Still Threshold - gate_15: - move_threshold: - name: Gate 15 Move Threshold - still_threshold: - name: Gate 15 Still Threshold - -select: - - platform: ld2420 - operating_mode: - name: Operating Mode - -sensor: - - platform: ld2420 - moving_distance: - name: "Moving distance (cm)" - -text_sensor: - - platform: ld2420 - fw_version: - name: LD2420 Firmware +<<: !include common.yaml diff --git a/tests/components/ld2420/test.esp32-c3-ard.yaml b/tests/components/ld2420/test.esp32-c3-ard.yaml index 5e0b9db1c2..b516342f3b 100644 --- a/tests/components/ld2420/test.esp32-c3-ard.yaml +++ b/tests/components/ld2420/test.esp32-c3-ard.yaml @@ -1,132 +1,5 @@ -uart: - - id: uart_ld2420 - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -ld2420: - id: my_ld2420 - -binary_sensor: - - platform: ld2420 - has_target: - name: Presence - -button: - - platform: ld2420 - apply_config: - name: Apply Config - factory_reset: - name: Factory Reset - restart_module: - name: Restart Module - revert_config: - name: Undo Edits - -number: - - platform: ld2420 - presence_timeout: - name: Detection Presence Timeout - min_gate_distance: - name: Detection Gate Minimum - max_gate_distance: - name: Detection Gate Maximum - gate_move_sensitivity: - name: Move Calibration Sensitivity Factor - gate_still_sensitivity: - name: Still Calibration Sensitivity Factor - gate_0: - move_threshold: - name: Gate 0 Move Threshold - still_threshold: - name: Gate 0 Still Threshold - gate_1: - move_threshold: - name: Gate 1 Move Threshold - still_threshold: - name: Gate 1 Still Threshold - gate_2: - move_threshold: - name: Gate 2 Move Threshold - still_threshold: - name: Gate 2 Still Threshold - gate_3: - move_threshold: - name: Gate 3 Move Threshold - still_threshold: - name: Gate 3 Still Threshold - gate_4: - move_threshold: - name: Gate 4 Move Threshold - still_threshold: - name: Gate 4 Still Threshold - gate_5: - move_threshold: - name: Gate 5 Move Threshold - still_threshold: - name: Gate 5 Still Threshold - gate_6: - move_threshold: - name: Gate 6 Move Threshold - still_threshold: - name: Gate 6 Still Threshold - gate_7: - move_threshold: - name: Gate 7 Move Threshold - still_threshold: - name: Gate 7 Still Threshold - gate_8: - move_threshold: - name: Gate 8 Move Threshold - still_threshold: - name: Gate 8 Still Threshold - gate_9: - move_threshold: - name: Gate 9 Move Threshold - still_threshold: - name: Gate 9 Still Threshold - gate_10: - move_threshold: - name: Gate 10 Move Threshold - still_threshold: - name: Gate 10 Still Threshold - gate_11: - move_threshold: - name: Gate 11 Move Threshold - still_threshold: - name: Gate 11 Still Threshold - gate_12: - move_threshold: - name: Gate 12 Move Threshold - still_threshold: - name: Gate 12 Still Threshold - gate_13: - move_threshold: - name: Gate 13 Move Threshold - still_threshold: - name: Gate 13 Still Threshold - gate_14: - move_threshold: - name: Gate 14 Move Threshold - still_threshold: - name: Gate 14 Still Threshold - gate_15: - move_threshold: - name: Gate 15 Move Threshold - still_threshold: - name: Gate 15 Still Threshold - -select: - - platform: ld2420 - operating_mode: - name: Operating Mode - -sensor: - - platform: ld2420 - moving_distance: - name: "Moving distance (cm)" - -text_sensor: - - platform: ld2420 - fw_version: - name: LD2420 Firmware +<<: !include common.yaml diff --git a/tests/components/ld2420/test.esp32-c3-idf.yaml b/tests/components/ld2420/test.esp32-c3-idf.yaml index 5e0b9db1c2..b516342f3b 100644 --- a/tests/components/ld2420/test.esp32-c3-idf.yaml +++ b/tests/components/ld2420/test.esp32-c3-idf.yaml @@ -1,132 +1,5 @@ -uart: - - id: uart_ld2420 - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -ld2420: - id: my_ld2420 - -binary_sensor: - - platform: ld2420 - has_target: - name: Presence - -button: - - platform: ld2420 - apply_config: - name: Apply Config - factory_reset: - name: Factory Reset - restart_module: - name: Restart Module - revert_config: - name: Undo Edits - -number: - - platform: ld2420 - presence_timeout: - name: Detection Presence Timeout - min_gate_distance: - name: Detection Gate Minimum - max_gate_distance: - name: Detection Gate Maximum - gate_move_sensitivity: - name: Move Calibration Sensitivity Factor - gate_still_sensitivity: - name: Still Calibration Sensitivity Factor - gate_0: - move_threshold: - name: Gate 0 Move Threshold - still_threshold: - name: Gate 0 Still Threshold - gate_1: - move_threshold: - name: Gate 1 Move Threshold - still_threshold: - name: Gate 1 Still Threshold - gate_2: - move_threshold: - name: Gate 2 Move Threshold - still_threshold: - name: Gate 2 Still Threshold - gate_3: - move_threshold: - name: Gate 3 Move Threshold - still_threshold: - name: Gate 3 Still Threshold - gate_4: - move_threshold: - name: Gate 4 Move Threshold - still_threshold: - name: Gate 4 Still Threshold - gate_5: - move_threshold: - name: Gate 5 Move Threshold - still_threshold: - name: Gate 5 Still Threshold - gate_6: - move_threshold: - name: Gate 6 Move Threshold - still_threshold: - name: Gate 6 Still Threshold - gate_7: - move_threshold: - name: Gate 7 Move Threshold - still_threshold: - name: Gate 7 Still Threshold - gate_8: - move_threshold: - name: Gate 8 Move Threshold - still_threshold: - name: Gate 8 Still Threshold - gate_9: - move_threshold: - name: Gate 9 Move Threshold - still_threshold: - name: Gate 9 Still Threshold - gate_10: - move_threshold: - name: Gate 10 Move Threshold - still_threshold: - name: Gate 10 Still Threshold - gate_11: - move_threshold: - name: Gate 11 Move Threshold - still_threshold: - name: Gate 11 Still Threshold - gate_12: - move_threshold: - name: Gate 12 Move Threshold - still_threshold: - name: Gate 12 Still Threshold - gate_13: - move_threshold: - name: Gate 13 Move Threshold - still_threshold: - name: Gate 13 Still Threshold - gate_14: - move_threshold: - name: Gate 14 Move Threshold - still_threshold: - name: Gate 14 Still Threshold - gate_15: - move_threshold: - name: Gate 15 Move Threshold - still_threshold: - name: Gate 15 Still Threshold - -select: - - platform: ld2420 - operating_mode: - name: Operating Mode - -sensor: - - platform: ld2420 - moving_distance: - name: "Moving distance (cm)" - -text_sensor: - - platform: ld2420 - fw_version: - name: LD2420 Firmware +<<: !include common.yaml diff --git a/tests/components/ld2420/test.esp32-idf.yaml b/tests/components/ld2420/test.esp32-idf.yaml index 8c883664ec..f486544afa 100644 --- a/tests/components/ld2420/test.esp32-idf.yaml +++ b/tests/components/ld2420/test.esp32-idf.yaml @@ -1,132 +1,5 @@ -uart: - - id: uart_ld2420 - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO17 + rx_pin: GPIO16 -ld2420: - id: my_ld2420 - -binary_sensor: - - platform: ld2420 - has_target: - name: Presence - -button: - - platform: ld2420 - apply_config: - name: Apply Config - factory_reset: - name: Factory Reset - restart_module: - name: Restart Module - revert_config: - name: Undo Edits - -number: - - platform: ld2420 - presence_timeout: - name: Detection Presence Timeout - min_gate_distance: - name: Detection Gate Minimum - max_gate_distance: - name: Detection Gate Maximum - gate_move_sensitivity: - name: Move Calibration Sensitivity Factor - gate_still_sensitivity: - name: Still Calibration Sensitivity Factor - gate_0: - move_threshold: - name: Gate 0 Move Threshold - still_threshold: - name: Gate 0 Still Threshold - gate_1: - move_threshold: - name: Gate 1 Move Threshold - still_threshold: - name: Gate 1 Still Threshold - gate_2: - move_threshold: - name: Gate 2 Move Threshold - still_threshold: - name: Gate 2 Still Threshold - gate_3: - move_threshold: - name: Gate 3 Move Threshold - still_threshold: - name: Gate 3 Still Threshold - gate_4: - move_threshold: - name: Gate 4 Move Threshold - still_threshold: - name: Gate 4 Still Threshold - gate_5: - move_threshold: - name: Gate 5 Move Threshold - still_threshold: - name: Gate 5 Still Threshold - gate_6: - move_threshold: - name: Gate 6 Move Threshold - still_threshold: - name: Gate 6 Still Threshold - gate_7: - move_threshold: - name: Gate 7 Move Threshold - still_threshold: - name: Gate 7 Still Threshold - gate_8: - move_threshold: - name: Gate 8 Move Threshold - still_threshold: - name: Gate 8 Still Threshold - gate_9: - move_threshold: - name: Gate 9 Move Threshold - still_threshold: - name: Gate 9 Still Threshold - gate_10: - move_threshold: - name: Gate 10 Move Threshold - still_threshold: - name: Gate 10 Still Threshold - gate_11: - move_threshold: - name: Gate 11 Move Threshold - still_threshold: - name: Gate 11 Still Threshold - gate_12: - move_threshold: - name: Gate 12 Move Threshold - still_threshold: - name: Gate 12 Still Threshold - gate_13: - move_threshold: - name: Gate 13 Move Threshold - still_threshold: - name: Gate 13 Still Threshold - gate_14: - move_threshold: - name: Gate 14 Move Threshold - still_threshold: - name: Gate 14 Still Threshold - gate_15: - move_threshold: - name: Gate 15 Move Threshold - still_threshold: - name: Gate 15 Still Threshold - -select: - - platform: ld2420 - operating_mode: - name: Operating Mode - -sensor: - - platform: ld2420 - moving_distance: - name: "Moving distance (cm)" - -text_sensor: - - platform: ld2420 - fw_version: - name: LD2420 Firmware +<<: !include common.yaml diff --git a/tests/components/ld2420/test.esp8266-ard.yaml b/tests/components/ld2420/test.esp8266-ard.yaml index 5e0b9db1c2..b516342f3b 100644 --- a/tests/components/ld2420/test.esp8266-ard.yaml +++ b/tests/components/ld2420/test.esp8266-ard.yaml @@ -1,132 +1,5 @@ -uart: - - id: uart_ld2420 - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -ld2420: - id: my_ld2420 - -binary_sensor: - - platform: ld2420 - has_target: - name: Presence - -button: - - platform: ld2420 - apply_config: - name: Apply Config - factory_reset: - name: Factory Reset - restart_module: - name: Restart Module - revert_config: - name: Undo Edits - -number: - - platform: ld2420 - presence_timeout: - name: Detection Presence Timeout - min_gate_distance: - name: Detection Gate Minimum - max_gate_distance: - name: Detection Gate Maximum - gate_move_sensitivity: - name: Move Calibration Sensitivity Factor - gate_still_sensitivity: - name: Still Calibration Sensitivity Factor - gate_0: - move_threshold: - name: Gate 0 Move Threshold - still_threshold: - name: Gate 0 Still Threshold - gate_1: - move_threshold: - name: Gate 1 Move Threshold - still_threshold: - name: Gate 1 Still Threshold - gate_2: - move_threshold: - name: Gate 2 Move Threshold - still_threshold: - name: Gate 2 Still Threshold - gate_3: - move_threshold: - name: Gate 3 Move Threshold - still_threshold: - name: Gate 3 Still Threshold - gate_4: - move_threshold: - name: Gate 4 Move Threshold - still_threshold: - name: Gate 4 Still Threshold - gate_5: - move_threshold: - name: Gate 5 Move Threshold - still_threshold: - name: Gate 5 Still Threshold - gate_6: - move_threshold: - name: Gate 6 Move Threshold - still_threshold: - name: Gate 6 Still Threshold - gate_7: - move_threshold: - name: Gate 7 Move Threshold - still_threshold: - name: Gate 7 Still Threshold - gate_8: - move_threshold: - name: Gate 8 Move Threshold - still_threshold: - name: Gate 8 Still Threshold - gate_9: - move_threshold: - name: Gate 9 Move Threshold - still_threshold: - name: Gate 9 Still Threshold - gate_10: - move_threshold: - name: Gate 10 Move Threshold - still_threshold: - name: Gate 10 Still Threshold - gate_11: - move_threshold: - name: Gate 11 Move Threshold - still_threshold: - name: Gate 11 Still Threshold - gate_12: - move_threshold: - name: Gate 12 Move Threshold - still_threshold: - name: Gate 12 Still Threshold - gate_13: - move_threshold: - name: Gate 13 Move Threshold - still_threshold: - name: Gate 13 Still Threshold - gate_14: - move_threshold: - name: Gate 14 Move Threshold - still_threshold: - name: Gate 14 Still Threshold - gate_15: - move_threshold: - name: Gate 15 Move Threshold - still_threshold: - name: Gate 15 Still Threshold - -select: - - platform: ld2420 - operating_mode: - name: Operating Mode - -sensor: - - platform: ld2420 - moving_distance: - name: "Moving distance (cm)" - -text_sensor: - - platform: ld2420 - fw_version: - name: LD2420 Firmware +<<: !include common.yaml diff --git a/tests/components/ld2420/test.rp2040-ard.yaml b/tests/components/ld2420/test.rp2040-ard.yaml index 5e0b9db1c2..b516342f3b 100644 --- a/tests/components/ld2420/test.rp2040-ard.yaml +++ b/tests/components/ld2420/test.rp2040-ard.yaml @@ -1,132 +1,5 @@ -uart: - - id: uart_ld2420 - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -ld2420: - id: my_ld2420 - -binary_sensor: - - platform: ld2420 - has_target: - name: Presence - -button: - - platform: ld2420 - apply_config: - name: Apply Config - factory_reset: - name: Factory Reset - restart_module: - name: Restart Module - revert_config: - name: Undo Edits - -number: - - platform: ld2420 - presence_timeout: - name: Detection Presence Timeout - min_gate_distance: - name: Detection Gate Minimum - max_gate_distance: - name: Detection Gate Maximum - gate_move_sensitivity: - name: Move Calibration Sensitivity Factor - gate_still_sensitivity: - name: Still Calibration Sensitivity Factor - gate_0: - move_threshold: - name: Gate 0 Move Threshold - still_threshold: - name: Gate 0 Still Threshold - gate_1: - move_threshold: - name: Gate 1 Move Threshold - still_threshold: - name: Gate 1 Still Threshold - gate_2: - move_threshold: - name: Gate 2 Move Threshold - still_threshold: - name: Gate 2 Still Threshold - gate_3: - move_threshold: - name: Gate 3 Move Threshold - still_threshold: - name: Gate 3 Still Threshold - gate_4: - move_threshold: - name: Gate 4 Move Threshold - still_threshold: - name: Gate 4 Still Threshold - gate_5: - move_threshold: - name: Gate 5 Move Threshold - still_threshold: - name: Gate 5 Still Threshold - gate_6: - move_threshold: - name: Gate 6 Move Threshold - still_threshold: - name: Gate 6 Still Threshold - gate_7: - move_threshold: - name: Gate 7 Move Threshold - still_threshold: - name: Gate 7 Still Threshold - gate_8: - move_threshold: - name: Gate 8 Move Threshold - still_threshold: - name: Gate 8 Still Threshold - gate_9: - move_threshold: - name: Gate 9 Move Threshold - still_threshold: - name: Gate 9 Still Threshold - gate_10: - move_threshold: - name: Gate 10 Move Threshold - still_threshold: - name: Gate 10 Still Threshold - gate_11: - move_threshold: - name: Gate 11 Move Threshold - still_threshold: - name: Gate 11 Still Threshold - gate_12: - move_threshold: - name: Gate 12 Move Threshold - still_threshold: - name: Gate 12 Still Threshold - gate_13: - move_threshold: - name: Gate 13 Move Threshold - still_threshold: - name: Gate 13 Still Threshold - gate_14: - move_threshold: - name: Gate 14 Move Threshold - still_threshold: - name: Gate 14 Still Threshold - gate_15: - move_threshold: - name: Gate 15 Move Threshold - still_threshold: - name: Gate 15 Still Threshold - -select: - - platform: ld2420 - operating_mode: - name: Operating Mode - -sensor: - - platform: ld2420 - moving_distance: - name: "Moving distance (cm)" - -text_sensor: - - platform: ld2420 - fw_version: - name: LD2420 Firmware +<<: !include common.yaml diff --git a/tests/components/lilygo_t5_47/common.yaml b/tests/components/lilygo_t5_47/common.yaml new file mode 100644 index 0000000000..f539c58d74 --- /dev/null +++ b/tests/components/lilygo_t5_47/common.yaml @@ -0,0 +1,24 @@ +i2c: + - id: i2c_lilygo_t5_47 + scl: ${scl_pin} + sda: ${sda_pin} + +display: + - platform: ssd1306_i2c + id: ssd1306_display + model: SSD1306_128X64 + reset_pin: ${reset_pin} + pages: + - id: page1 + lambda: |- + it.rectangle(0, 0, it.get_width(), it.get_height()); + +touchscreen: + - platform: lilygo_t5_47 + id: lilygo_touchscreen + interrupt_pin: ${interrupt_pin} + display: ssd1306_display + on_touch: + - logger.log: + format: Touch at (%d, %d) + args: [touch.x, touch.y] diff --git a/tests/components/lilygo_t5_47/test.esp32-ard.yaml b/tests/components/lilygo_t5_47/test.esp32-ard.yaml index 35eb3df022..342f0b6d8b 100644 --- a/tests/components/lilygo_t5_47/test.esp32-ard.yaml +++ b/tests/components/lilygo_t5_47/test.esp32-ard.yaml @@ -1,24 +1,7 @@ -i2c: - - id: i2c_lilygo_t5_47 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO13 + sda_pin: GPIO14 + interrupt_pin: GPIO15 + reset_pin: GPIO16 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 13 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -touchscreen: - - platform: lilygo_t5_47 - id: lilygo_touchscreen - interrupt_pin: 14 - display: ssd1306_display - on_touch: - - logger.log: - format: Touch at (%d, %d) - args: [touch.x, touch.y] +<<: !include common.yaml diff --git a/tests/components/lilygo_t5_47/test.esp32-c3-ard.yaml b/tests/components/lilygo_t5_47/test.esp32-c3-ard.yaml index 41e81103ac..061a98ce24 100644 --- a/tests/components/lilygo_t5_47/test.esp32-c3-ard.yaml +++ b/tests/components/lilygo_t5_47/test.esp32-c3-ard.yaml @@ -1,24 +1,7 @@ -i2c: - - id: i2c_lilygo_t5_47 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO0 + sda_pin: GPIO1 + interrupt_pin: GPIO2 + reset_pin: GPIO3 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 3 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -touchscreen: - - platform: lilygo_t5_47 - id: lilygo_touchscreen - interrupt_pin: 6 - display: ssd1306_display - on_touch: - - logger.log: - format: Touch at (%d, %d) - args: [touch.x, touch.y] +<<: !include common.yaml diff --git a/tests/components/lilygo_t5_47/test.esp32-c3-idf.yaml b/tests/components/lilygo_t5_47/test.esp32-c3-idf.yaml index 41e81103ac..061a98ce24 100644 --- a/tests/components/lilygo_t5_47/test.esp32-c3-idf.yaml +++ b/tests/components/lilygo_t5_47/test.esp32-c3-idf.yaml @@ -1,24 +1,7 @@ -i2c: - - id: i2c_lilygo_t5_47 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO0 + sda_pin: GPIO1 + interrupt_pin: GPIO2 + reset_pin: GPIO3 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 3 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -touchscreen: - - platform: lilygo_t5_47 - id: lilygo_touchscreen - interrupt_pin: 6 - display: ssd1306_display - on_touch: - - logger.log: - format: Touch at (%d, %d) - args: [touch.x, touch.y] +<<: !include common.yaml diff --git a/tests/components/lilygo_t5_47/test.esp32-idf.yaml b/tests/components/lilygo_t5_47/test.esp32-idf.yaml index 35eb3df022..342f0b6d8b 100644 --- a/tests/components/lilygo_t5_47/test.esp32-idf.yaml +++ b/tests/components/lilygo_t5_47/test.esp32-idf.yaml @@ -1,24 +1,7 @@ -i2c: - - id: i2c_lilygo_t5_47 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO13 + sda_pin: GPIO14 + interrupt_pin: GPIO15 + reset_pin: GPIO16 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 13 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -touchscreen: - - platform: lilygo_t5_47 - id: lilygo_touchscreen - interrupt_pin: 14 - display: ssd1306_display - on_touch: - - logger.log: - format: Touch at (%d, %d) - args: [touch.x, touch.y] +<<: !include common.yaml diff --git a/tests/components/lilygo_t5_47/test.esp8266-ard.yaml b/tests/components/lilygo_t5_47/test.esp8266-ard.yaml index 766c492b12..b446a75f13 100644 --- a/tests/components/lilygo_t5_47/test.esp8266-ard.yaml +++ b/tests/components/lilygo_t5_47/test.esp8266-ard.yaml @@ -1,24 +1,7 @@ -i2c: - - id: i2c_lilygo_t5_47 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 + interrupt_pin: GPIO12 + reset_pin: GPIO16 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 3 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -touchscreen: - - platform: lilygo_t5_47 - id: lilygo_touchscreen - interrupt_pin: 12 - display: ssd1306_display - on_touch: - - logger.log: - format: Touch at (%d, %d) - args: [touch.x, touch.y] +<<: !include common.yaml diff --git a/tests/components/lilygo_t5_47/test.rp2040-ard.yaml b/tests/components/lilygo_t5_47/test.rp2040-ard.yaml index 41e81103ac..061a98ce24 100644 --- a/tests/components/lilygo_t5_47/test.rp2040-ard.yaml +++ b/tests/components/lilygo_t5_47/test.rp2040-ard.yaml @@ -1,24 +1,7 @@ -i2c: - - id: i2c_lilygo_t5_47 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO0 + sda_pin: GPIO1 + interrupt_pin: GPIO2 + reset_pin: GPIO3 -display: - - platform: ssd1306_i2c - id: ssd1306_display - model: SSD1306_128X64 - reset_pin: 3 - pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height()); - -touchscreen: - - platform: lilygo_t5_47 - id: lilygo_touchscreen - interrupt_pin: 6 - display: ssd1306_display - on_touch: - - logger.log: - format: Touch at (%d, %d) - args: [touch.x, touch.y] +<<: !include common.yaml diff --git a/tests/components/ltr390/common.yaml b/tests/components/ltr390/common.yaml new file mode 100644 index 0000000000..2eebe9d1c3 --- /dev/null +++ b/tests/components/ltr390/common.yaml @@ -0,0 +1,38 @@ +i2c: + - id: i2c_ltr390 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: ltr390 + uv: + name: LTR390 UV + uv_index: + name: LTR390 UVI + light: + name: LTR390 Light + ambient_light: + name: LTR390 ALS + gain: X3 + resolution: 18 + window_correction_factor: 1.0 + address: 0x53 + update_interval: 60s + - platform: ltr390 + uv: + name: LTR390 UV + uv_index: + name: LTR390 UVI + light: + name: LTR390 Light + ambient_light: + name: LTR390 ALS + gain: + ambient_light: X9 + uv: X3 + resolution: + ambient_light: 18 + uv: 13 + window_correction_factor: 1.0 + address: 0x53 + update_interval: 60s diff --git a/tests/components/ltr390/test.esp32-ard.yaml b/tests/components/ltr390/test.esp32-ard.yaml index bdfe349b77..63c3bd6afd 100644 --- a/tests/components/ltr390/test.esp32-ard.yaml +++ b/tests/components/ltr390/test.esp32-ard.yaml @@ -1,38 +1,5 @@ -i2c: - - id: i2c_ltr390 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: ltr390 - uv: - name: LTR390 UV - uv_index: - name: LTR390 UVI - light: - name: LTR390 Light - ambient_light: - name: LTR390 ALS - gain: X3 - resolution: 18 - window_correction_factor: 1.0 - address: 0x53 - update_interval: 60s - - platform: ltr390 - uv: - name: LTR390 UV - uv_index: - name: LTR390 UVI - light: - name: LTR390 Light - ambient_light: - name: LTR390 ALS - gain: - ambient_light: X9 - uv: X3 - resolution: - ambient_light: 18 - uv: 13 - window_correction_factor: 1.0 - address: 0x53 - update_interval: 60s +<<: !include common.yaml diff --git a/tests/components/ltr390/test.esp32-c3-ard.yaml b/tests/components/ltr390/test.esp32-c3-ard.yaml index fee0f37ce1..ee2c29ca4e 100644 --- a/tests/components/ltr390/test.esp32-c3-ard.yaml +++ b/tests/components/ltr390/test.esp32-c3-ard.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_ltr390 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ltr390 - uv: - name: LTR390 UV - uv_index: - name: LTR390 UVI - light: - name: LTR390 Light - ambient_light: - name: LTR390 ALS - gain: X3 - resolution: 18 - window_correction_factor: 1.0 - address: 0x53 - update_interval: 60s +<<: !include common.yaml diff --git a/tests/components/ltr390/test.esp32-c3-idf.yaml b/tests/components/ltr390/test.esp32-c3-idf.yaml index fee0f37ce1..ee2c29ca4e 100644 --- a/tests/components/ltr390/test.esp32-c3-idf.yaml +++ b/tests/components/ltr390/test.esp32-c3-idf.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_ltr390 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ltr390 - uv: - name: LTR390 UV - uv_index: - name: LTR390 UVI - light: - name: LTR390 Light - ambient_light: - name: LTR390 ALS - gain: X3 - resolution: 18 - window_correction_factor: 1.0 - address: 0x53 - update_interval: 60s +<<: !include common.yaml diff --git a/tests/components/ltr390/test.esp32-idf.yaml b/tests/components/ltr390/test.esp32-idf.yaml index 9786c7dac3..63c3bd6afd 100644 --- a/tests/components/ltr390/test.esp32-idf.yaml +++ b/tests/components/ltr390/test.esp32-idf.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_ltr390 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: ltr390 - uv: - name: LTR390 UV - uv_index: - name: LTR390 UVI - light: - name: LTR390 Light - ambient_light: - name: LTR390 ALS - gain: X3 - resolution: 18 - window_correction_factor: 1.0 - address: 0x53 - update_interval: 60s +<<: !include common.yaml diff --git a/tests/components/ltr390/test.esp8266-ard.yaml b/tests/components/ltr390/test.esp8266-ard.yaml index 149f46f9c8..ee2c29ca4e 100644 --- a/tests/components/ltr390/test.esp8266-ard.yaml +++ b/tests/components/ltr390/test.esp8266-ard.yaml @@ -1,22 +1,5 @@ -i2c: - - id: i2c_ltr390 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ltr390 - uv: - name: LTR390 UV - uv_index: - name: LTR390 UVI - light: - name: LTR390 Light - ambient_light: - name: LTR390 ALS - gain: - ambient_light: X9 - uv: X3 - resolution: 18 - window_correction_factor: 1.0 - address: 0x53 - update_interval: 60s +<<: !include common.yaml diff --git a/tests/components/ltr390/test.rp2040-ard.yaml b/tests/components/ltr390/test.rp2040-ard.yaml index fee0f37ce1..ee2c29ca4e 100644 --- a/tests/components/ltr390/test.rp2040-ard.yaml +++ b/tests/components/ltr390/test.rp2040-ard.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_ltr390 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: ltr390 - uv: - name: LTR390 UV - uv_index: - name: LTR390 UVI - light: - name: LTR390 Light - ambient_light: - name: LTR390 ALS - gain: X3 - resolution: 18 - window_correction_factor: 1.0 - address: 0x53 - update_interval: 60s +<<: !include common.yaml diff --git a/tests/components/lvgl/lvgl-package.yaml b/tests/components/lvgl/lvgl-package.yaml index c51a3d03e7..c527f51b1e 100644 --- a/tests/components/lvgl/lvgl-package.yaml +++ b/tests/components/lvgl/lvgl-package.yaml @@ -133,6 +133,18 @@ lvgl: pages: - id: page1 + on_swipe_top: + logger.log: "swiped up" + on_swipe_bottom: + logger.log: "swiped down" + on_swipe_up: + logger.log: "swiped up" + on_swipe_down: + logger.log: "swiped down" + on_swipe_left: + logger.log: "swiped left" + on_swipe_right: + logger.log: "swiped right" bg_image_src: cat_image on_load: - logger.log: page loaded diff --git a/tests/components/max31855/common.yaml b/tests/components/max31855/common.yaml new file mode 100644 index 0000000000..7136c597d5 --- /dev/null +++ b/tests/components/max31855/common.yaml @@ -0,0 +1,13 @@ +spi: + - id: spi_max31855 + clk_pin: ${clk_pin} + mosi_pin: ${mosi_pin} + miso_pin: ${miso_pin} + +sensor: + - platform: max31855 + name: MAX31855 Temperature + cs_pin: ${cs_pin} + update_interval: 15s + reference_temperature: + name: MAX31855 Internal Temperature diff --git a/tests/components/max31855/test.esp32-ard.yaml b/tests/components/max31855/test.esp32-ard.yaml index 25fee986d2..54e027a614 100644 --- a/tests/components/max31855/test.esp32-ard.yaml +++ b/tests/components/max31855/test.esp32-ard.yaml @@ -1,13 +1,7 @@ -spi: - - id: spi_max31855 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -sensor: - - platform: max31855 - name: MAX31855 Temperature - cs_pin: 12 - update_interval: 15s - reference_temperature: - name: MAX31855 Internal Temperature +<<: !include common.yaml diff --git a/tests/components/max31855/test.esp32-c3-ard.yaml b/tests/components/max31855/test.esp32-c3-ard.yaml index e7c8f3f824..2415ba5dc6 100644 --- a/tests/components/max31855/test.esp32-c3-ard.yaml +++ b/tests/components/max31855/test.esp32-c3-ard.yaml @@ -1,13 +1,7 @@ -spi: - - id: spi_max31855 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -sensor: - - platform: max31855 - name: MAX31855 Temperature - cs_pin: 8 - update_interval: 15s - reference_temperature: - name: MAX31855 Internal Temperature +<<: !include common.yaml diff --git a/tests/components/max31855/test.esp32-c3-idf.yaml b/tests/components/max31855/test.esp32-c3-idf.yaml index e7c8f3f824..2415ba5dc6 100644 --- a/tests/components/max31855/test.esp32-c3-idf.yaml +++ b/tests/components/max31855/test.esp32-c3-idf.yaml @@ -1,13 +1,7 @@ -spi: - - id: spi_max31855 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -sensor: - - platform: max31855 - name: MAX31855 Temperature - cs_pin: 8 - update_interval: 15s - reference_temperature: - name: MAX31855 Internal Temperature +<<: !include common.yaml diff --git a/tests/components/max31855/test.esp32-idf.yaml b/tests/components/max31855/test.esp32-idf.yaml index 25fee986d2..54e027a614 100644 --- a/tests/components/max31855/test.esp32-idf.yaml +++ b/tests/components/max31855/test.esp32-idf.yaml @@ -1,13 +1,7 @@ -spi: - - id: spi_max31855 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -sensor: - - platform: max31855 - name: MAX31855 Temperature - cs_pin: 12 - update_interval: 15s - reference_temperature: - name: MAX31855 Internal Temperature +<<: !include common.yaml diff --git a/tests/components/max31855/test.esp8266-ard.yaml b/tests/components/max31855/test.esp8266-ard.yaml index 7e02d41fce..dbd158d030 100644 --- a/tests/components/max31855/test.esp8266-ard.yaml +++ b/tests/components/max31855/test.esp8266-ard.yaml @@ -1,13 +1,7 @@ -spi: - - id: spi_max31855 - clk_pin: 14 - mosi_pin: 13 - miso_pin: 12 +substitutions: + clk_pin: GPIO14 + mosi_pin: GPIO13 + miso_pin: GPIO12 + cs_pin: GPIO15 -sensor: - - platform: max31855 - name: MAX31855 Temperature - cs_pin: 15 - update_interval: 15s - reference_temperature: - name: MAX31855 Internal Temperature +<<: !include common.yaml diff --git a/tests/components/max31855/test.rp2040-ard.yaml b/tests/components/max31855/test.rp2040-ard.yaml index 379d4d33d6..f6c3f1eeca 100644 --- a/tests/components/max31855/test.rp2040-ard.yaml +++ b/tests/components/max31855/test.rp2040-ard.yaml @@ -1,13 +1,7 @@ -spi: - - id: spi_max31855 - clk_pin: 2 - mosi_pin: 3 - miso_pin: 4 +substitutions: + clk_pin: GPIO2 + mosi_pin: GPIO3 + miso_pin: GPIO4 + cs_pin: GPIO5 -sensor: - - platform: max31855 - name: MAX31855 Temperature - cs_pin: 6 - update_interval: 15s - reference_temperature: - name: MAX31855 Internal Temperature +<<: !include common.yaml diff --git a/tests/components/max31856/common.yaml b/tests/components/max31856/common.yaml new file mode 100644 index 0000000000..4f7c3ad408 --- /dev/null +++ b/tests/components/max31856/common.yaml @@ -0,0 +1,13 @@ +spi: + - id: spi_max31856 + clk_pin: ${clk_pin} + mosi_pin: ${mosi_pin} + miso_pin: ${miso_pin} + +sensor: + - platform: max31856 + name: MAX31856 Temperature + cs_pin: ${cs_pin} + update_interval: 15s + mains_filter: 50Hz + thermocouple_type: N diff --git a/tests/components/max31856/test.esp32-ard.yaml b/tests/components/max31856/test.esp32-ard.yaml index 9a4da6b2a2..54e027a614 100644 --- a/tests/components/max31856/test.esp32-ard.yaml +++ b/tests/components/max31856/test.esp32-ard.yaml @@ -1,13 +1,7 @@ -spi: - - id: spi_max31856 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -sensor: - - platform: max31856 - name: MAX31856 Temperature - cs_pin: 12 - update_interval: 15s - mains_filter: 50Hz - thermocouple_type: N +<<: !include common.yaml diff --git a/tests/components/max31856/test.esp32-c3-ard.yaml b/tests/components/max31856/test.esp32-c3-ard.yaml index 71bbfffb7b..2415ba5dc6 100644 --- a/tests/components/max31856/test.esp32-c3-ard.yaml +++ b/tests/components/max31856/test.esp32-c3-ard.yaml @@ -1,14 +1,7 @@ -spi: - - id: spi_max31856 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 - -sensor: - - platform: max31856 - name: MAX31856 Temperature - cs_pin: 8 - update_interval: 15s - mains_filter: 50Hz - thermocouple_type: N +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 +<<: !include common.yaml diff --git a/tests/components/max31856/test.esp32-c3-idf.yaml b/tests/components/max31856/test.esp32-c3-idf.yaml index 71bbfffb7b..2415ba5dc6 100644 --- a/tests/components/max31856/test.esp32-c3-idf.yaml +++ b/tests/components/max31856/test.esp32-c3-idf.yaml @@ -1,14 +1,7 @@ -spi: - - id: spi_max31856 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 - -sensor: - - platform: max31856 - name: MAX31856 Temperature - cs_pin: 8 - update_interval: 15s - mains_filter: 50Hz - thermocouple_type: N +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 +<<: !include common.yaml diff --git a/tests/components/max31856/test.esp32-idf.yaml b/tests/components/max31856/test.esp32-idf.yaml index 9a4da6b2a2..54e027a614 100644 --- a/tests/components/max31856/test.esp32-idf.yaml +++ b/tests/components/max31856/test.esp32-idf.yaml @@ -1,13 +1,7 @@ -spi: - - id: spi_max31856 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -sensor: - - platform: max31856 - name: MAX31856 Temperature - cs_pin: 12 - update_interval: 15s - mains_filter: 50Hz - thermocouple_type: N +<<: !include common.yaml diff --git a/tests/components/max31856/test.esp8266-ard.yaml b/tests/components/max31856/test.esp8266-ard.yaml index b9c42542fd..dbd158d030 100644 --- a/tests/components/max31856/test.esp8266-ard.yaml +++ b/tests/components/max31856/test.esp8266-ard.yaml @@ -1,14 +1,7 @@ -spi: - - id: spi_max31856 - clk_pin: 14 - mosi_pin: 13 - miso_pin: 12 - -sensor: - - platform: max31856 - name: MAX31856 Temperature - cs_pin: 15 - update_interval: 15s - mains_filter: 50Hz - thermocouple_type: N +substitutions: + clk_pin: GPIO14 + mosi_pin: GPIO13 + miso_pin: GPIO12 + cs_pin: GPIO15 +<<: !include common.yaml diff --git a/tests/components/max31856/test.rp2040-ard.yaml b/tests/components/max31856/test.rp2040-ard.yaml index 8607eb18cf..f6c3f1eeca 100644 --- a/tests/components/max31856/test.rp2040-ard.yaml +++ b/tests/components/max31856/test.rp2040-ard.yaml @@ -1,14 +1,7 @@ -spi: - - id: spi_max31856 - clk_pin: 2 - mosi_pin: 3 - miso_pin: 4 - -sensor: - - platform: max31856 - name: MAX31856 Temperature - cs_pin: 6 - update_interval: 15s - mains_filter: 50Hz - thermocouple_type: N +substitutions: + clk_pin: GPIO2 + mosi_pin: GPIO3 + miso_pin: GPIO4 + cs_pin: GPIO5 +<<: !include common.yaml diff --git a/tests/components/max31865/common.yaml b/tests/components/max31865/common.yaml new file mode 100644 index 0000000000..5bb7bda5aa --- /dev/null +++ b/tests/components/max31865/common.yaml @@ -0,0 +1,13 @@ +spi: + - id: spi_max31865 + clk_pin: ${clk_pin} + mosi_pin: ${mosi_pin} + miso_pin: ${miso_pin} + +sensor: + - platform: max31865 + name: MAX31865 Temperature + cs_pin: ${cs_pin} + update_interval: 15s + reference_resistance: 430 Ω + rtd_nominal_resistance: 100 Ω diff --git a/tests/components/max31865/test.esp32-ard.yaml b/tests/components/max31865/test.esp32-ard.yaml index 8326a578ee..54e027a614 100644 --- a/tests/components/max31865/test.esp32-ard.yaml +++ b/tests/components/max31865/test.esp32-ard.yaml @@ -1,13 +1,7 @@ -spi: - - id: spi_max31865 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -sensor: - - platform: max31865 - name: MAX31865 Temperature - cs_pin: 12 - update_interval: 15s - reference_resistance: 430 Ω - rtd_nominal_resistance: 100 Ω +<<: !include common.yaml diff --git a/tests/components/max31865/test.esp32-c3-ard.yaml b/tests/components/max31865/test.esp32-c3-ard.yaml index 45de22331e..2415ba5dc6 100644 --- a/tests/components/max31865/test.esp32-c3-ard.yaml +++ b/tests/components/max31865/test.esp32-c3-ard.yaml @@ -1,13 +1,7 @@ -spi: - - id: spi_max31865 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -sensor: - - platform: max31865 - name: MAX31865 Temperature - cs_pin: 8 - update_interval: 15s - reference_resistance: 430 Ω - rtd_nominal_resistance: 100 Ω +<<: !include common.yaml diff --git a/tests/components/max31865/test.esp32-c3-idf.yaml b/tests/components/max31865/test.esp32-c3-idf.yaml index 45de22331e..2415ba5dc6 100644 --- a/tests/components/max31865/test.esp32-c3-idf.yaml +++ b/tests/components/max31865/test.esp32-c3-idf.yaml @@ -1,13 +1,7 @@ -spi: - - id: spi_max31865 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -sensor: - - platform: max31865 - name: MAX31865 Temperature - cs_pin: 8 - update_interval: 15s - reference_resistance: 430 Ω - rtd_nominal_resistance: 100 Ω +<<: !include common.yaml diff --git a/tests/components/max31865/test.esp32-idf.yaml b/tests/components/max31865/test.esp32-idf.yaml index 8326a578ee..54e027a614 100644 --- a/tests/components/max31865/test.esp32-idf.yaml +++ b/tests/components/max31865/test.esp32-idf.yaml @@ -1,13 +1,7 @@ -spi: - - id: spi_max31865 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -sensor: - - platform: max31865 - name: MAX31865 Temperature - cs_pin: 12 - update_interval: 15s - reference_resistance: 430 Ω - rtd_nominal_resistance: 100 Ω +<<: !include common.yaml diff --git a/tests/components/max31865/test.esp8266-ard.yaml b/tests/components/max31865/test.esp8266-ard.yaml index 4828019acc..dbd158d030 100644 --- a/tests/components/max31865/test.esp8266-ard.yaml +++ b/tests/components/max31865/test.esp8266-ard.yaml @@ -1,13 +1,7 @@ -spi: - - id: spi_max31865 - clk_pin: 14 - mosi_pin: 13 - miso_pin: 12 +substitutions: + clk_pin: GPIO14 + mosi_pin: GPIO13 + miso_pin: GPIO12 + cs_pin: GPIO15 -sensor: - - platform: max31865 - name: MAX31865 Temperature - cs_pin: 15 - update_interval: 15s - reference_resistance: 430 Ω - rtd_nominal_resistance: 100 Ω +<<: !include common.yaml diff --git a/tests/components/max31865/test.rp2040-ard.yaml b/tests/components/max31865/test.rp2040-ard.yaml index 5af64b41ad..f6c3f1eeca 100644 --- a/tests/components/max31865/test.rp2040-ard.yaml +++ b/tests/components/max31865/test.rp2040-ard.yaml @@ -1,13 +1,7 @@ -spi: - - id: spi_max31865 - clk_pin: 2 - mosi_pin: 3 - miso_pin: 4 +substitutions: + clk_pin: GPIO2 + mosi_pin: GPIO3 + miso_pin: GPIO4 + cs_pin: GPIO5 -sensor: - - platform: max31865 - name: MAX31865 Temperature - cs_pin: 6 - update_interval: 15s - reference_resistance: 430 Ω - rtd_nominal_resistance: 100 Ω +<<: !include common.yaml diff --git a/tests/components/max44009/common.yaml b/tests/components/max44009/common.yaml new file mode 100644 index 0000000000..ef51740895 --- /dev/null +++ b/tests/components/max44009/common.yaml @@ -0,0 +1,12 @@ +i2c: + - id: i2c_max44009 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: max44009 + name: MAX44009 Brightness + internal: true + mode: low_power + address: 0x4A + update_interval: 30s diff --git a/tests/components/max44009/test.esp32-ard.yaml b/tests/components/max44009/test.esp32-ard.yaml index 56eecebc4a..63c3bd6afd 100644 --- a/tests/components/max44009/test.esp32-ard.yaml +++ b/tests/components/max44009/test.esp32-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_max44009 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: max44009 - name: MAX44009 Brightness - internal: true - mode: low_power - address: 0x4A - update_interval: 30s +<<: !include common.yaml diff --git a/tests/components/max44009/test.esp32-c3-ard.yaml b/tests/components/max44009/test.esp32-c3-ard.yaml index 593d4bd48c..ee2c29ca4e 100644 --- a/tests/components/max44009/test.esp32-c3-ard.yaml +++ b/tests/components/max44009/test.esp32-c3-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_max44009 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: max44009 - name: MAX44009 Brightness - internal: true - mode: low_power - address: 0x4A - update_interval: 30s +<<: !include common.yaml diff --git a/tests/components/max44009/test.esp32-c3-idf.yaml b/tests/components/max44009/test.esp32-c3-idf.yaml index 593d4bd48c..ee2c29ca4e 100644 --- a/tests/components/max44009/test.esp32-c3-idf.yaml +++ b/tests/components/max44009/test.esp32-c3-idf.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_max44009 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: max44009 - name: MAX44009 Brightness - internal: true - mode: low_power - address: 0x4A - update_interval: 30s +<<: !include common.yaml diff --git a/tests/components/max44009/test.esp32-idf.yaml b/tests/components/max44009/test.esp32-idf.yaml index 56eecebc4a..63c3bd6afd 100644 --- a/tests/components/max44009/test.esp32-idf.yaml +++ b/tests/components/max44009/test.esp32-idf.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_max44009 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: max44009 - name: MAX44009 Brightness - internal: true - mode: low_power - address: 0x4A - update_interval: 30s +<<: !include common.yaml diff --git a/tests/components/max44009/test.esp8266-ard.yaml b/tests/components/max44009/test.esp8266-ard.yaml index 593d4bd48c..ee2c29ca4e 100644 --- a/tests/components/max44009/test.esp8266-ard.yaml +++ b/tests/components/max44009/test.esp8266-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_max44009 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: max44009 - name: MAX44009 Brightness - internal: true - mode: low_power - address: 0x4A - update_interval: 30s +<<: !include common.yaml diff --git a/tests/components/max44009/test.rp2040-ard.yaml b/tests/components/max44009/test.rp2040-ard.yaml index 593d4bd48c..ee2c29ca4e 100644 --- a/tests/components/max44009/test.rp2040-ard.yaml +++ b/tests/components/max44009/test.rp2040-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_max44009 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: max44009 - name: MAX44009 Brightness - internal: true - mode: low_power - address: 0x4A - update_interval: 30s +<<: !include common.yaml diff --git a/tests/components/max6675/common.yaml b/tests/components/max6675/common.yaml new file mode 100644 index 0000000000..5b4e04b317 --- /dev/null +++ b/tests/components/max6675/common.yaml @@ -0,0 +1,11 @@ +spi: + - id: spi_max6675 + clk_pin: ${clk_pin} + mosi_pin: ${mosi_pin} + miso_pin: ${miso_pin} + +sensor: + - platform: max6675 + name: Temperature + cs_pin: ${cs_pin} + update_interval: 15s diff --git a/tests/components/max6675/test.esp32-ard.yaml b/tests/components/max6675/test.esp32-ard.yaml index 9771bf9d5f..54e027a614 100644 --- a/tests/components/max6675/test.esp32-ard.yaml +++ b/tests/components/max6675/test.esp32-ard.yaml @@ -1,11 +1,7 @@ -spi: - - id: spi_max6675 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -sensor: - - platform: max6675 - name: Temperature - cs_pin: 12 - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/max6675/test.esp32-c3-ard.yaml b/tests/components/max6675/test.esp32-c3-ard.yaml index 2f05102ca1..2415ba5dc6 100644 --- a/tests/components/max6675/test.esp32-c3-ard.yaml +++ b/tests/components/max6675/test.esp32-c3-ard.yaml @@ -1,11 +1,7 @@ -spi: - - id: spi_max6675 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -sensor: - - platform: max6675 - name: Temperature - cs_pin: 8 - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/max6675/test.esp32-c3-idf.yaml b/tests/components/max6675/test.esp32-c3-idf.yaml index 2f05102ca1..2415ba5dc6 100644 --- a/tests/components/max6675/test.esp32-c3-idf.yaml +++ b/tests/components/max6675/test.esp32-c3-idf.yaml @@ -1,11 +1,7 @@ -spi: - - id: spi_max6675 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -sensor: - - platform: max6675 - name: Temperature - cs_pin: 8 - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/max6675/test.esp32-idf.yaml b/tests/components/max6675/test.esp32-idf.yaml index 9771bf9d5f..54e027a614 100644 --- a/tests/components/max6675/test.esp32-idf.yaml +++ b/tests/components/max6675/test.esp32-idf.yaml @@ -1,11 +1,7 @@ -spi: - - id: spi_max6675 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -sensor: - - platform: max6675 - name: Temperature - cs_pin: 12 - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/max6675/test.esp8266-ard.yaml b/tests/components/max6675/test.esp8266-ard.yaml index f67e9e04a8..dbd158d030 100644 --- a/tests/components/max6675/test.esp8266-ard.yaml +++ b/tests/components/max6675/test.esp8266-ard.yaml @@ -1,11 +1,7 @@ -spi: - - id: spi_max6675 - clk_pin: 14 - mosi_pin: 13 - miso_pin: 12 +substitutions: + clk_pin: GPIO14 + mosi_pin: GPIO13 + miso_pin: GPIO12 + cs_pin: GPIO15 -sensor: - - platform: max6675 - name: Temperature - cs_pin: 15 - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/max6675/test.rp2040-ard.yaml b/tests/components/max6675/test.rp2040-ard.yaml index 89c0932f94..f6c3f1eeca 100644 --- a/tests/components/max6675/test.rp2040-ard.yaml +++ b/tests/components/max6675/test.rp2040-ard.yaml @@ -1,11 +1,7 @@ -spi: - - id: spi_max6675 - clk_pin: 2 - mosi_pin: 3 - miso_pin: 4 +substitutions: + clk_pin: GPIO2 + mosi_pin: GPIO3 + miso_pin: GPIO4 + cs_pin: GPIO5 -sensor: - - platform: max6675 - name: Temperature - cs_pin: 6 - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/max6956/common.yaml b/tests/components/max6956/common.yaml new file mode 100644 index 0000000000..e44e3464f8 --- /dev/null +++ b/tests/components/max6956/common.yaml @@ -0,0 +1,19 @@ +i2c: + - id: i2c_max6956 + scl: ${scl_pin} + sda: ${sda_pin} + +max6956: + - id: max6956_1 + address: 0x40 + +binary_sensor: + - platform: gpio + name: Max Input Pin + pin: + max6956: max6956_1 + number: 4 + mode: + input: true + pullup: true + inverted: false diff --git a/tests/components/max6956/test.esp32-ard.yaml b/tests/components/max6956/test.esp32-ard.yaml index abd1404634..63c3bd6afd 100644 --- a/tests/components/max6956/test.esp32-ard.yaml +++ b/tests/components/max6956/test.esp32-ard.yaml @@ -1,19 +1,5 @@ -i2c: - - id: i2c_max6956 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -max6956: - - id: max6956_1 - address: 0x40 - -binary_sensor: - - platform: gpio - name: Max Input Pin 4 - pin: - max6956: max6956_1 - number: 4 - mode: - input: true - pullup: true - inverted: false +<<: !include common.yaml diff --git a/tests/components/max6956/test.esp32-c3-ard.yaml b/tests/components/max6956/test.esp32-c3-ard.yaml index 690941784c..ee2c29ca4e 100644 --- a/tests/components/max6956/test.esp32-c3-ard.yaml +++ b/tests/components/max6956/test.esp32-c3-ard.yaml @@ -1,19 +1,5 @@ -i2c: - - id: i2c_max6956 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -max6956: - - id: max6956_1 - address: 0x40 - -binary_sensor: - - platform: gpio - name: Max Input Pin 4 - pin: - max6956: max6956_1 - number: 4 - mode: - input: true - pullup: true - inverted: false +<<: !include common.yaml diff --git a/tests/components/max6956/test.esp32-c3-idf.yaml b/tests/components/max6956/test.esp32-c3-idf.yaml index 690941784c..ee2c29ca4e 100644 --- a/tests/components/max6956/test.esp32-c3-idf.yaml +++ b/tests/components/max6956/test.esp32-c3-idf.yaml @@ -1,19 +1,5 @@ -i2c: - - id: i2c_max6956 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -max6956: - - id: max6956_1 - address: 0x40 - -binary_sensor: - - platform: gpio - name: Max Input Pin 4 - pin: - max6956: max6956_1 - number: 4 - mode: - input: true - pullup: true - inverted: false +<<: !include common.yaml diff --git a/tests/components/max6956/test.esp32-idf.yaml b/tests/components/max6956/test.esp32-idf.yaml index abd1404634..63c3bd6afd 100644 --- a/tests/components/max6956/test.esp32-idf.yaml +++ b/tests/components/max6956/test.esp32-idf.yaml @@ -1,19 +1,5 @@ -i2c: - - id: i2c_max6956 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -max6956: - - id: max6956_1 - address: 0x40 - -binary_sensor: - - platform: gpio - name: Max Input Pin 4 - pin: - max6956: max6956_1 - number: 4 - mode: - input: true - pullup: true - inverted: false +<<: !include common.yaml diff --git a/tests/components/max6956/test.esp8266-ard.yaml b/tests/components/max6956/test.esp8266-ard.yaml index 690941784c..ee2c29ca4e 100644 --- a/tests/components/max6956/test.esp8266-ard.yaml +++ b/tests/components/max6956/test.esp8266-ard.yaml @@ -1,19 +1,5 @@ -i2c: - - id: i2c_max6956 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -max6956: - - id: max6956_1 - address: 0x40 - -binary_sensor: - - platform: gpio - name: Max Input Pin 4 - pin: - max6956: max6956_1 - number: 4 - mode: - input: true - pullup: true - inverted: false +<<: !include common.yaml diff --git a/tests/components/max6956/test.rp2040-ard.yaml b/tests/components/max6956/test.rp2040-ard.yaml index 690941784c..ee2c29ca4e 100644 --- a/tests/components/max6956/test.rp2040-ard.yaml +++ b/tests/components/max6956/test.rp2040-ard.yaml @@ -1,19 +1,5 @@ -i2c: - - id: i2c_max6956 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -max6956: - - id: max6956_1 - address: 0x40 - -binary_sensor: - - platform: gpio - name: Max Input Pin 4 - pin: - max6956: max6956_1 - number: 4 - mode: - input: true - pullup: true - inverted: false +<<: !include common.yaml diff --git a/tests/components/max7219/common.yaml b/tests/components/max7219/common.yaml new file mode 100644 index 0000000000..0060db191e --- /dev/null +++ b/tests/components/max7219/common.yaml @@ -0,0 +1,12 @@ +spi: + - id: spi_max6675 + clk_pin: ${clk_pin} + mosi_pin: ${mosi_pin} + miso_pin: ${miso_pin} + +display: + - platform: max7219 + cs_pin: ${cs_pin} + num_chips: 1 + lambda: |- + it.print("01234567"); diff --git a/tests/components/max7219/test.esp32-ard.yaml b/tests/components/max7219/test.esp32-ard.yaml index 2985345a48..54e027a614 100644 --- a/tests/components/max7219/test.esp32-ard.yaml +++ b/tests/components/max7219/test.esp32-ard.yaml @@ -1,12 +1,7 @@ -spi: - - id: spi_max6675 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -display: - - platform: max7219 - cs_pin: 12 - num_chips: 1 - lambda: |- - it.print("01234567"); +<<: !include common.yaml diff --git a/tests/components/max7219/test.esp32-c3-ard.yaml b/tests/components/max7219/test.esp32-c3-ard.yaml index fa1ac15f33..2415ba5dc6 100644 --- a/tests/components/max7219/test.esp32-c3-ard.yaml +++ b/tests/components/max7219/test.esp32-c3-ard.yaml @@ -1,12 +1,7 @@ -spi: - - id: spi_max7219 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -display: - - platform: max7219 - cs_pin: 8 - num_chips: 1 - lambda: |- - it.print("01234567"); +<<: !include common.yaml diff --git a/tests/components/max7219/test.esp32-c3-idf.yaml b/tests/components/max7219/test.esp32-c3-idf.yaml index fa1ac15f33..2415ba5dc6 100644 --- a/tests/components/max7219/test.esp32-c3-idf.yaml +++ b/tests/components/max7219/test.esp32-c3-idf.yaml @@ -1,12 +1,7 @@ -spi: - - id: spi_max7219 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -display: - - platform: max7219 - cs_pin: 8 - num_chips: 1 - lambda: |- - it.print("01234567"); +<<: !include common.yaml diff --git a/tests/components/max7219/test.esp32-idf.yaml b/tests/components/max7219/test.esp32-idf.yaml index 2985345a48..54e027a614 100644 --- a/tests/components/max7219/test.esp32-idf.yaml +++ b/tests/components/max7219/test.esp32-idf.yaml @@ -1,12 +1,7 @@ -spi: - - id: spi_max6675 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -display: - - platform: max7219 - cs_pin: 12 - num_chips: 1 - lambda: |- - it.print("01234567"); +<<: !include common.yaml diff --git a/tests/components/max7219/test.esp8266-ard.yaml b/tests/components/max7219/test.esp8266-ard.yaml index a8c280daff..dbd158d030 100644 --- a/tests/components/max7219/test.esp8266-ard.yaml +++ b/tests/components/max7219/test.esp8266-ard.yaml @@ -1,12 +1,7 @@ -spi: - - id: spi_max6675 - clk_pin: 14 - mosi_pin: 13 - miso_pin: 12 +substitutions: + clk_pin: GPIO14 + mosi_pin: GPIO13 + miso_pin: GPIO12 + cs_pin: GPIO15 -display: - - platform: max7219 - cs_pin: 15 - num_chips: 1 - lambda: |- - it.print("01234567"); +<<: !include common.yaml diff --git a/tests/components/max7219/test.rp2040-ard.yaml b/tests/components/max7219/test.rp2040-ard.yaml index 37b2220649..f6c3f1eeca 100644 --- a/tests/components/max7219/test.rp2040-ard.yaml +++ b/tests/components/max7219/test.rp2040-ard.yaml @@ -1,12 +1,7 @@ -spi: - - id: spi_max6675 - clk_pin: 2 - mosi_pin: 3 - miso_pin: 4 +substitutions: + clk_pin: GPIO2 + mosi_pin: GPIO3 + miso_pin: GPIO4 + cs_pin: GPIO5 -display: - - platform: max7219 - cs_pin: 6 - num_chips: 1 - lambda: |- - it.print("01234567"); +<<: !include common.yaml diff --git a/tests/components/max7219digit/common.yaml b/tests/components/max7219digit/common.yaml new file mode 100644 index 0000000000..a5a3bd57fb --- /dev/null +++ b/tests/components/max7219digit/common.yaml @@ -0,0 +1,16 @@ +spi: + - id: spi_max7219digit + clk_pin: ${clk_pin} + mosi_pin: ${mosi_pin} + miso_pin: ${miso_pin} + +display: + - platform: max7219digit + cs_pin: ${cs_pin} + num_chips: 4 + rotate_chip: 0 + intensity: 10 + scroll_mode: STOP + id: my_matrix + lambda: |- + it.printdigit("hello"); diff --git a/tests/components/max7219digit/test.esp32-ard.yaml b/tests/components/max7219digit/test.esp32-ard.yaml index 7f3aed964a..54e027a614 100644 --- a/tests/components/max7219digit/test.esp32-ard.yaml +++ b/tests/components/max7219digit/test.esp32-ard.yaml @@ -1,16 +1,7 @@ -spi: - - id: spi_max7219digit - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -display: - - platform: max7219digit - cs_pin: 12 - num_chips: 4 - rotate_chip: 0 - intensity: 10 - scroll_mode: STOP - id: my_matrix - lambda: |- - it.printdigit("hello"); +<<: !include common.yaml diff --git a/tests/components/max7219digit/test.esp32-c3-ard.yaml b/tests/components/max7219digit/test.esp32-c3-ard.yaml index 0c04784380..2415ba5dc6 100644 --- a/tests/components/max7219digit/test.esp32-c3-ard.yaml +++ b/tests/components/max7219digit/test.esp32-c3-ard.yaml @@ -1,16 +1,7 @@ -spi: - - id: spi_max7219digit - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -display: - - platform: max7219digit - cs_pin: 8 - num_chips: 4 - rotate_chip: 0 - intensity: 10 - scroll_mode: STOP - id: my_matrix - lambda: |- - it.printdigit("hello"); +<<: !include common.yaml diff --git a/tests/components/max7219digit/test.esp32-c3-idf.yaml b/tests/components/max7219digit/test.esp32-c3-idf.yaml index 0c04784380..2415ba5dc6 100644 --- a/tests/components/max7219digit/test.esp32-c3-idf.yaml +++ b/tests/components/max7219digit/test.esp32-c3-idf.yaml @@ -1,16 +1,7 @@ -spi: - - id: spi_max7219digit - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -display: - - platform: max7219digit - cs_pin: 8 - num_chips: 4 - rotate_chip: 0 - intensity: 10 - scroll_mode: STOP - id: my_matrix - lambda: |- - it.printdigit("hello"); +<<: !include common.yaml diff --git a/tests/components/max7219digit/test.esp32-idf.yaml b/tests/components/max7219digit/test.esp32-idf.yaml index 7f3aed964a..54e027a614 100644 --- a/tests/components/max7219digit/test.esp32-idf.yaml +++ b/tests/components/max7219digit/test.esp32-idf.yaml @@ -1,16 +1,7 @@ -spi: - - id: spi_max7219digit - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -display: - - platform: max7219digit - cs_pin: 12 - num_chips: 4 - rotate_chip: 0 - intensity: 10 - scroll_mode: STOP - id: my_matrix - lambda: |- - it.printdigit("hello"); +<<: !include common.yaml diff --git a/tests/components/max7219digit/test.esp8266-ard.yaml b/tests/components/max7219digit/test.esp8266-ard.yaml index 52587e8b0e..dbd158d030 100644 --- a/tests/components/max7219digit/test.esp8266-ard.yaml +++ b/tests/components/max7219digit/test.esp8266-ard.yaml @@ -1,16 +1,7 @@ -spi: - - id: spi_max7219digit - clk_pin: 14 - mosi_pin: 13 - miso_pin: 12 +substitutions: + clk_pin: GPIO14 + mosi_pin: GPIO13 + miso_pin: GPIO12 + cs_pin: GPIO15 -display: - - platform: max7219digit - cs_pin: 15 - num_chips: 4 - rotate_chip: 0 - intensity: 10 - scroll_mode: STOP - id: my_matrix - lambda: |- - it.printdigit("hello"); +<<: !include common.yaml diff --git a/tests/components/max7219digit/test.rp2040-ard.yaml b/tests/components/max7219digit/test.rp2040-ard.yaml index f986483ec2..f6c3f1eeca 100644 --- a/tests/components/max7219digit/test.rp2040-ard.yaml +++ b/tests/components/max7219digit/test.rp2040-ard.yaml @@ -1,16 +1,7 @@ -spi: - - id: spi_max7219digit - clk_pin: 2 - mosi_pin: 3 - miso_pin: 4 +substitutions: + clk_pin: GPIO2 + mosi_pin: GPIO3 + miso_pin: GPIO4 + cs_pin: GPIO5 -display: - - platform: max7219digit - cs_pin: 6 - num_chips: 4 - rotate_chip: 0 - intensity: 10 - scroll_mode: STOP - id: my_matrix - lambda: |- - it.printdigit("hello"); +<<: !include common.yaml diff --git a/tests/components/max9611/common.yaml b/tests/components/max9611/common.yaml new file mode 100644 index 0000000000..c3c00fdf85 --- /dev/null +++ b/tests/components/max9611/common.yaml @@ -0,0 +1,18 @@ +i2c: + - id: i2c_max9611 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: max9611 + shunt_resistance: 0.2 ohm + gain: 1X + voltage: + name: Max9611 Voltage + current: + name: Max9611 Current + power: + name: Max9611 Watts + temperature: + name: Max9611 Temperature + update_interval: 1s diff --git a/tests/components/max9611/test.esp32-ard.yaml b/tests/components/max9611/test.esp32-ard.yaml index 5c480cc815..63c3bd6afd 100644 --- a/tests/components/max9611/test.esp32-ard.yaml +++ b/tests/components/max9611/test.esp32-ard.yaml @@ -1,18 +1,5 @@ -i2c: - - id: i2c_max9611 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: max9611 - shunt_resistance: 0.2 ohm - gain: 1X - voltage: - name: Max9611 Voltage - current: - name: Max9611 Current - power: - name: Max9611 Watts - temperature: - name: Max9611 Temp - update_interval: 1s +<<: !include common.yaml diff --git a/tests/components/max9611/test.esp32-c3-ard.yaml b/tests/components/max9611/test.esp32-c3-ard.yaml index 00f8330280..ee2c29ca4e 100644 --- a/tests/components/max9611/test.esp32-c3-ard.yaml +++ b/tests/components/max9611/test.esp32-c3-ard.yaml @@ -1,18 +1,5 @@ -i2c: - - id: i2c_max9611 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: max9611 - shunt_resistance: 0.2 ohm - gain: 1X - voltage: - name: Max9611 Voltage - current: - name: Max9611 Current - power: - name: Max9611 Watts - temperature: - name: Max9611 Temp - update_interval: 1s +<<: !include common.yaml diff --git a/tests/components/max9611/test.esp32-c3-idf.yaml b/tests/components/max9611/test.esp32-c3-idf.yaml index 00f8330280..ee2c29ca4e 100644 --- a/tests/components/max9611/test.esp32-c3-idf.yaml +++ b/tests/components/max9611/test.esp32-c3-idf.yaml @@ -1,18 +1,5 @@ -i2c: - - id: i2c_max9611 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: max9611 - shunt_resistance: 0.2 ohm - gain: 1X - voltage: - name: Max9611 Voltage - current: - name: Max9611 Current - power: - name: Max9611 Watts - temperature: - name: Max9611 Temp - update_interval: 1s +<<: !include common.yaml diff --git a/tests/components/max9611/test.esp32-idf.yaml b/tests/components/max9611/test.esp32-idf.yaml index 5c480cc815..63c3bd6afd 100644 --- a/tests/components/max9611/test.esp32-idf.yaml +++ b/tests/components/max9611/test.esp32-idf.yaml @@ -1,18 +1,5 @@ -i2c: - - id: i2c_max9611 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: max9611 - shunt_resistance: 0.2 ohm - gain: 1X - voltage: - name: Max9611 Voltage - current: - name: Max9611 Current - power: - name: Max9611 Watts - temperature: - name: Max9611 Temp - update_interval: 1s +<<: !include common.yaml diff --git a/tests/components/max9611/test.esp8266-ard.yaml b/tests/components/max9611/test.esp8266-ard.yaml index 00f8330280..ee2c29ca4e 100644 --- a/tests/components/max9611/test.esp8266-ard.yaml +++ b/tests/components/max9611/test.esp8266-ard.yaml @@ -1,18 +1,5 @@ -i2c: - - id: i2c_max9611 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: max9611 - shunt_resistance: 0.2 ohm - gain: 1X - voltage: - name: Max9611 Voltage - current: - name: Max9611 Current - power: - name: Max9611 Watts - temperature: - name: Max9611 Temp - update_interval: 1s +<<: !include common.yaml diff --git a/tests/components/max9611/test.rp2040-ard.yaml b/tests/components/max9611/test.rp2040-ard.yaml index 00f8330280..ee2c29ca4e 100644 --- a/tests/components/max9611/test.rp2040-ard.yaml +++ b/tests/components/max9611/test.rp2040-ard.yaml @@ -1,18 +1,5 @@ -i2c: - - id: i2c_max9611 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: max9611 - shunt_resistance: 0.2 ohm - gain: 1X - voltage: - name: Max9611 Voltage - current: - name: Max9611 Current - power: - name: Max9611 Watts - temperature: - name: Max9611 Temp - update_interval: 1s +<<: !include common.yaml diff --git a/tests/components/mcp23008/common.yaml b/tests/components/mcp23008/common.yaml new file mode 100644 index 0000000000..1954766d25 --- /dev/null +++ b/tests/components/mcp23008/common.yaml @@ -0,0 +1,23 @@ +i2c: + - id: i2c_mcp23008 + scl: ${scl_pin} + sda: ${sda_pin} + +mcp23008: + id: mcp23008_hub + +binary_sensor: + - platform: gpio + id: mcp23008_binary_sensor + pin: + mcp23xxx: mcp23008_hub + number: 0 + mode: INPUT + +switch: + - platform: gpio + id: mcp23008_switch + pin: + mcp23xxx: mcp23008_hub + number: 1 + mode: OUTPUT diff --git a/tests/components/mcp23008/test.esp32-ard.yaml b/tests/components/mcp23008/test.esp32-ard.yaml index cbf03f371c..63c3bd6afd 100644 --- a/tests/components/mcp23008/test.esp32-ard.yaml +++ b/tests/components/mcp23008/test.esp32-ard.yaml @@ -1,23 +1,5 @@ -i2c: - - id: i2c_mcp23008 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -mcp23008: - id: mcp23008_hub - -binary_sensor: - - platform: gpio - id: mcp23008_binary_sensor - pin: - mcp23xxx: mcp23008_hub - number: 0 - mode: INPUT - -switch: - - platform: gpio - id: mcp23008_switch - pin: - mcp23xxx: mcp23008_hub - number: 1 - mode: OUTPUT +<<: !include common.yaml diff --git a/tests/components/mcp23008/test.esp32-c3-ard.yaml b/tests/components/mcp23008/test.esp32-c3-ard.yaml index eabd5a7311..ee2c29ca4e 100644 --- a/tests/components/mcp23008/test.esp32-c3-ard.yaml +++ b/tests/components/mcp23008/test.esp32-c3-ard.yaml @@ -1,23 +1,5 @@ -i2c: - - id: i2c_mcp23008 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -mcp23008: - id: mcp23008_hub - -binary_sensor: - - platform: gpio - id: mcp23008_binary_sensor - pin: - mcp23xxx: mcp23008_hub - number: 0 - mode: INPUT - -switch: - - platform: gpio - id: mcp23008_switch - pin: - mcp23xxx: mcp23008_hub - number: 1 - mode: OUTPUT +<<: !include common.yaml diff --git a/tests/components/mcp23008/test.esp32-c3-idf.yaml b/tests/components/mcp23008/test.esp32-c3-idf.yaml index eabd5a7311..ee2c29ca4e 100644 --- a/tests/components/mcp23008/test.esp32-c3-idf.yaml +++ b/tests/components/mcp23008/test.esp32-c3-idf.yaml @@ -1,23 +1,5 @@ -i2c: - - id: i2c_mcp23008 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -mcp23008: - id: mcp23008_hub - -binary_sensor: - - platform: gpio - id: mcp23008_binary_sensor - pin: - mcp23xxx: mcp23008_hub - number: 0 - mode: INPUT - -switch: - - platform: gpio - id: mcp23008_switch - pin: - mcp23xxx: mcp23008_hub - number: 1 - mode: OUTPUT +<<: !include common.yaml diff --git a/tests/components/mcp23008/test.esp32-idf.yaml b/tests/components/mcp23008/test.esp32-idf.yaml index cbf03f371c..63c3bd6afd 100644 --- a/tests/components/mcp23008/test.esp32-idf.yaml +++ b/tests/components/mcp23008/test.esp32-idf.yaml @@ -1,23 +1,5 @@ -i2c: - - id: i2c_mcp23008 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -mcp23008: - id: mcp23008_hub - -binary_sensor: - - platform: gpio - id: mcp23008_binary_sensor - pin: - mcp23xxx: mcp23008_hub - number: 0 - mode: INPUT - -switch: - - platform: gpio - id: mcp23008_switch - pin: - mcp23xxx: mcp23008_hub - number: 1 - mode: OUTPUT +<<: !include common.yaml diff --git a/tests/components/mcp23008/test.esp8266-ard.yaml b/tests/components/mcp23008/test.esp8266-ard.yaml index eabd5a7311..ee2c29ca4e 100644 --- a/tests/components/mcp23008/test.esp8266-ard.yaml +++ b/tests/components/mcp23008/test.esp8266-ard.yaml @@ -1,23 +1,5 @@ -i2c: - - id: i2c_mcp23008 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -mcp23008: - id: mcp23008_hub - -binary_sensor: - - platform: gpio - id: mcp23008_binary_sensor - pin: - mcp23xxx: mcp23008_hub - number: 0 - mode: INPUT - -switch: - - platform: gpio - id: mcp23008_switch - pin: - mcp23xxx: mcp23008_hub - number: 1 - mode: OUTPUT +<<: !include common.yaml diff --git a/tests/components/mcp23008/test.rp2040-ard.yaml b/tests/components/mcp23008/test.rp2040-ard.yaml index eabd5a7311..ee2c29ca4e 100644 --- a/tests/components/mcp23008/test.rp2040-ard.yaml +++ b/tests/components/mcp23008/test.rp2040-ard.yaml @@ -1,23 +1,5 @@ -i2c: - - id: i2c_mcp23008 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -mcp23008: - id: mcp23008_hub - -binary_sensor: - - platform: gpio - id: mcp23008_binary_sensor - pin: - mcp23xxx: mcp23008_hub - number: 0 - mode: INPUT - -switch: - - platform: gpio - id: mcp23008_switch - pin: - mcp23xxx: mcp23008_hub - number: 1 - mode: OUTPUT +<<: !include common.yaml diff --git a/tests/components/mcp23016/common.yaml b/tests/components/mcp23016/common.yaml new file mode 100644 index 0000000000..109cb34b21 --- /dev/null +++ b/tests/components/mcp23016/common.yaml @@ -0,0 +1,23 @@ +i2c: + - id: i2c_mcp23016 + scl: ${scl_pin} + sda: ${sda_pin} + +mcp23016: + id: mcp23016_hub + +binary_sensor: + - platform: gpio + id: mcp23016_binary_sensor + pin: + mcp23016: mcp23016_hub + number: 0 + mode: INPUT + +switch: + - platform: gpio + id: mcp23016_switch + pin: + mcp23016: mcp23016_hub + number: 1 + mode: OUTPUT diff --git a/tests/components/mcp23016/test.esp32-ard.yaml b/tests/components/mcp23016/test.esp32-ard.yaml index 48574a9b01..63c3bd6afd 100644 --- a/tests/components/mcp23016/test.esp32-ard.yaml +++ b/tests/components/mcp23016/test.esp32-ard.yaml @@ -1,23 +1,5 @@ -i2c: - - id: i2c_mcp23016 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -mcp23016: - id: mcp23016_hub - -binary_sensor: - - platform: gpio - id: mcp23016_binary_sensor - pin: - mcp23016: mcp23016_hub - number: 0 - mode: INPUT - -switch: - - platform: gpio - id: mcp23016_switch - pin: - mcp23016: mcp23016_hub - number: 1 - mode: OUTPUT +<<: !include common.yaml diff --git a/tests/components/mcp23016/test.esp32-c3-ard.yaml b/tests/components/mcp23016/test.esp32-c3-ard.yaml index 2211931e3d..ee2c29ca4e 100644 --- a/tests/components/mcp23016/test.esp32-c3-ard.yaml +++ b/tests/components/mcp23016/test.esp32-c3-ard.yaml @@ -1,23 +1,5 @@ -i2c: - - id: i2c_mcp23016 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -mcp23016: - id: mcp23016_hub - -binary_sensor: - - platform: gpio - id: mcp23016_binary_sensor - pin: - mcp23016: mcp23016_hub - number: 0 - mode: INPUT - -switch: - - platform: gpio - id: mcp23016_switch - pin: - mcp23016: mcp23016_hub - number: 1 - mode: OUTPUT +<<: !include common.yaml diff --git a/tests/components/mcp23016/test.esp32-c3-idf.yaml b/tests/components/mcp23016/test.esp32-c3-idf.yaml index 2211931e3d..ee2c29ca4e 100644 --- a/tests/components/mcp23016/test.esp32-c3-idf.yaml +++ b/tests/components/mcp23016/test.esp32-c3-idf.yaml @@ -1,23 +1,5 @@ -i2c: - - id: i2c_mcp23016 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -mcp23016: - id: mcp23016_hub - -binary_sensor: - - platform: gpio - id: mcp23016_binary_sensor - pin: - mcp23016: mcp23016_hub - number: 0 - mode: INPUT - -switch: - - platform: gpio - id: mcp23016_switch - pin: - mcp23016: mcp23016_hub - number: 1 - mode: OUTPUT +<<: !include common.yaml diff --git a/tests/components/mcp23016/test.esp32-idf.yaml b/tests/components/mcp23016/test.esp32-idf.yaml index 48574a9b01..63c3bd6afd 100644 --- a/tests/components/mcp23016/test.esp32-idf.yaml +++ b/tests/components/mcp23016/test.esp32-idf.yaml @@ -1,23 +1,5 @@ -i2c: - - id: i2c_mcp23016 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -mcp23016: - id: mcp23016_hub - -binary_sensor: - - platform: gpio - id: mcp23016_binary_sensor - pin: - mcp23016: mcp23016_hub - number: 0 - mode: INPUT - -switch: - - platform: gpio - id: mcp23016_switch - pin: - mcp23016: mcp23016_hub - number: 1 - mode: OUTPUT +<<: !include common.yaml diff --git a/tests/components/mcp23016/test.esp8266-ard.yaml b/tests/components/mcp23016/test.esp8266-ard.yaml index 2211931e3d..ee2c29ca4e 100644 --- a/tests/components/mcp23016/test.esp8266-ard.yaml +++ b/tests/components/mcp23016/test.esp8266-ard.yaml @@ -1,23 +1,5 @@ -i2c: - - id: i2c_mcp23016 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -mcp23016: - id: mcp23016_hub - -binary_sensor: - - platform: gpio - id: mcp23016_binary_sensor - pin: - mcp23016: mcp23016_hub - number: 0 - mode: INPUT - -switch: - - platform: gpio - id: mcp23016_switch - pin: - mcp23016: mcp23016_hub - number: 1 - mode: OUTPUT +<<: !include common.yaml diff --git a/tests/components/mcp23016/test.rp2040-ard.yaml b/tests/components/mcp23016/test.rp2040-ard.yaml index 2211931e3d..ee2c29ca4e 100644 --- a/tests/components/mcp23016/test.rp2040-ard.yaml +++ b/tests/components/mcp23016/test.rp2040-ard.yaml @@ -1,23 +1,5 @@ -i2c: - - id: i2c_mcp23016 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -mcp23016: - id: mcp23016_hub - -binary_sensor: - - platform: gpio - id: mcp23016_binary_sensor - pin: - mcp23016: mcp23016_hub - number: 0 - mode: INPUT - -switch: - - platform: gpio - id: mcp23016_switch - pin: - mcp23016: mcp23016_hub - number: 1 - mode: OUTPUT +<<: !include common.yaml diff --git a/tests/components/mcp23017/common.yaml b/tests/components/mcp23017/common.yaml new file mode 100644 index 0000000000..74949bba76 --- /dev/null +++ b/tests/components/mcp23017/common.yaml @@ -0,0 +1,23 @@ +i2c: + - id: i2c_mcp23017 + scl: ${scl_pin} + sda: ${sda_pin} + +mcp23017: + id: mcp23017_hub + +binary_sensor: + - platform: gpio + id: mcp23017_binary_sensor + pin: + mcp23xxx: mcp23017_hub + number: 0 + mode: INPUT + +switch: + - platform: gpio + id: mcp23017_switch + pin: + mcp23xxx: mcp23017_hub + number: 1 + mode: OUTPUT diff --git a/tests/components/mcp23017/test.esp32-ard.yaml b/tests/components/mcp23017/test.esp32-ard.yaml index 9b7c45eb8a..63c3bd6afd 100644 --- a/tests/components/mcp23017/test.esp32-ard.yaml +++ b/tests/components/mcp23017/test.esp32-ard.yaml @@ -1,23 +1,5 @@ -i2c: - - id: i2c_mcp23017 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -mcp23017: - id: mcp23017_hub - -binary_sensor: - - platform: gpio - id: mcp23017_binary_sensor - pin: - mcp23xxx: mcp23017_hub - number: 0 - mode: INPUT - -switch: - - platform: gpio - id: mcp23017_switch - pin: - mcp23xxx: mcp23017_hub - number: 1 - mode: OUTPUT +<<: !include common.yaml diff --git a/tests/components/mcp23017/test.esp32-c3-ard.yaml b/tests/components/mcp23017/test.esp32-c3-ard.yaml index 863b2b8f0b..ee2c29ca4e 100644 --- a/tests/components/mcp23017/test.esp32-c3-ard.yaml +++ b/tests/components/mcp23017/test.esp32-c3-ard.yaml @@ -1,23 +1,5 @@ -i2c: - - id: i2c_mcp23017 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -mcp23017: - id: mcp23017_hub - -binary_sensor: - - platform: gpio - id: mcp23017_binary_sensor - pin: - mcp23xxx: mcp23017_hub - number: 0 - mode: INPUT - -switch: - - platform: gpio - id: mcp23017_switch - pin: - mcp23xxx: mcp23017_hub - number: 1 - mode: OUTPUT +<<: !include common.yaml diff --git a/tests/components/mcp23017/test.esp32-c3-idf.yaml b/tests/components/mcp23017/test.esp32-c3-idf.yaml index 863b2b8f0b..ee2c29ca4e 100644 --- a/tests/components/mcp23017/test.esp32-c3-idf.yaml +++ b/tests/components/mcp23017/test.esp32-c3-idf.yaml @@ -1,23 +1,5 @@ -i2c: - - id: i2c_mcp23017 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -mcp23017: - id: mcp23017_hub - -binary_sensor: - - platform: gpio - id: mcp23017_binary_sensor - pin: - mcp23xxx: mcp23017_hub - number: 0 - mode: INPUT - -switch: - - platform: gpio - id: mcp23017_switch - pin: - mcp23xxx: mcp23017_hub - number: 1 - mode: OUTPUT +<<: !include common.yaml diff --git a/tests/components/mcp23017/test.esp32-idf.yaml b/tests/components/mcp23017/test.esp32-idf.yaml index 9b7c45eb8a..63c3bd6afd 100644 --- a/tests/components/mcp23017/test.esp32-idf.yaml +++ b/tests/components/mcp23017/test.esp32-idf.yaml @@ -1,23 +1,5 @@ -i2c: - - id: i2c_mcp23017 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -mcp23017: - id: mcp23017_hub - -binary_sensor: - - platform: gpio - id: mcp23017_binary_sensor - pin: - mcp23xxx: mcp23017_hub - number: 0 - mode: INPUT - -switch: - - platform: gpio - id: mcp23017_switch - pin: - mcp23xxx: mcp23017_hub - number: 1 - mode: OUTPUT +<<: !include common.yaml diff --git a/tests/components/mcp23017/test.esp8266-ard.yaml b/tests/components/mcp23017/test.esp8266-ard.yaml index 863b2b8f0b..ee2c29ca4e 100644 --- a/tests/components/mcp23017/test.esp8266-ard.yaml +++ b/tests/components/mcp23017/test.esp8266-ard.yaml @@ -1,23 +1,5 @@ -i2c: - - id: i2c_mcp23017 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -mcp23017: - id: mcp23017_hub - -binary_sensor: - - platform: gpio - id: mcp23017_binary_sensor - pin: - mcp23xxx: mcp23017_hub - number: 0 - mode: INPUT - -switch: - - platform: gpio - id: mcp23017_switch - pin: - mcp23xxx: mcp23017_hub - number: 1 - mode: OUTPUT +<<: !include common.yaml diff --git a/tests/components/mcp23017/test.rp2040-ard.yaml b/tests/components/mcp23017/test.rp2040-ard.yaml index 863b2b8f0b..ee2c29ca4e 100644 --- a/tests/components/mcp23017/test.rp2040-ard.yaml +++ b/tests/components/mcp23017/test.rp2040-ard.yaml @@ -1,23 +1,5 @@ -i2c: - - id: i2c_mcp23017 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -mcp23017: - id: mcp23017_hub - -binary_sensor: - - platform: gpio - id: mcp23017_binary_sensor - pin: - mcp23xxx: mcp23017_hub - number: 0 - mode: INPUT - -switch: - - platform: gpio - id: mcp23017_switch - pin: - mcp23xxx: mcp23017_hub - number: 1 - mode: OUTPUT +<<: !include common.yaml diff --git a/tests/components/mcp23s08/common.yaml b/tests/components/mcp23s08/common.yaml new file mode 100644 index 0000000000..b89088fe15 --- /dev/null +++ b/tests/components/mcp23s08/common.yaml @@ -0,0 +1,10 @@ +spi: + - id: spi_mcp23s08 + clk_pin: ${clk_pin} + mosi_pin: ${mosi_pin} + miso_pin: ${miso_pin} + +mcp23s08: + - id: mcp23s08_hub + cs_pin: ${cs_pin} + deviceaddress: 0 diff --git a/tests/components/mcp23s08/test.esp32-ard.yaml b/tests/components/mcp23s08/test.esp32-ard.yaml index 0b26035c3e..54e027a614 100644 --- a/tests/components/mcp23s08/test.esp32-ard.yaml +++ b/tests/components/mcp23s08/test.esp32-ard.yaml @@ -1,10 +1,7 @@ -spi: - - id: spi_mcp23s08 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -mcp23s08: - - id: mcp23s08_hub - cs_pin: 12 - deviceaddress: 0 +<<: !include common.yaml diff --git a/tests/components/mcp23s08/test.esp32-c3-ard.yaml b/tests/components/mcp23s08/test.esp32-c3-ard.yaml index f1af8a71a9..2415ba5dc6 100644 --- a/tests/components/mcp23s08/test.esp32-c3-ard.yaml +++ b/tests/components/mcp23s08/test.esp32-c3-ard.yaml @@ -1,10 +1,7 @@ -spi: - - id: spi_mcp23s08 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -mcp23s08: - - id: mcp23s08_hub - cs_pin: 8 - deviceaddress: 0 +<<: !include common.yaml diff --git a/tests/components/mcp23s08/test.esp32-c3-idf.yaml b/tests/components/mcp23s08/test.esp32-c3-idf.yaml index f1af8a71a9..2415ba5dc6 100644 --- a/tests/components/mcp23s08/test.esp32-c3-idf.yaml +++ b/tests/components/mcp23s08/test.esp32-c3-idf.yaml @@ -1,10 +1,7 @@ -spi: - - id: spi_mcp23s08 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -mcp23s08: - - id: mcp23s08_hub - cs_pin: 8 - deviceaddress: 0 +<<: !include common.yaml diff --git a/tests/components/mcp23s08/test.esp32-idf.yaml b/tests/components/mcp23s08/test.esp32-idf.yaml index 0b26035c3e..54e027a614 100644 --- a/tests/components/mcp23s08/test.esp32-idf.yaml +++ b/tests/components/mcp23s08/test.esp32-idf.yaml @@ -1,10 +1,7 @@ -spi: - - id: spi_mcp23s08 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -mcp23s08: - - id: mcp23s08_hub - cs_pin: 12 - deviceaddress: 0 +<<: !include common.yaml diff --git a/tests/components/mcp23s08/test.esp8266-ard.yaml b/tests/components/mcp23s08/test.esp8266-ard.yaml index eff856aca9..dbd158d030 100644 --- a/tests/components/mcp23s08/test.esp8266-ard.yaml +++ b/tests/components/mcp23s08/test.esp8266-ard.yaml @@ -1,10 +1,7 @@ -spi: - - id: spi_mcp23s08 - clk_pin: 14 - mosi_pin: 13 - miso_pin: 12 +substitutions: + clk_pin: GPIO14 + mosi_pin: GPIO13 + miso_pin: GPIO12 + cs_pin: GPIO15 -mcp23s08: - - id: mcp23s08_hub - cs_pin: 15 - deviceaddress: 0 +<<: !include common.yaml diff --git a/tests/components/mcp23s08/test.rp2040-ard.yaml b/tests/components/mcp23s08/test.rp2040-ard.yaml index 1b23d2d3b5..f6c3f1eeca 100644 --- a/tests/components/mcp23s08/test.rp2040-ard.yaml +++ b/tests/components/mcp23s08/test.rp2040-ard.yaml @@ -1,10 +1,7 @@ -spi: - - id: spi_mcp23s08 - clk_pin: 2 - mosi_pin: 3 - miso_pin: 4 +substitutions: + clk_pin: GPIO2 + mosi_pin: GPIO3 + miso_pin: GPIO4 + cs_pin: GPIO5 -mcp23s08: - - id: mcp23s08_hub - cs_pin: 6 - deviceaddress: 0 +<<: !include common.yaml diff --git a/tests/components/mcp23s17/common.yaml b/tests/components/mcp23s17/common.yaml new file mode 100644 index 0000000000..3fb27ef625 --- /dev/null +++ b/tests/components/mcp23s17/common.yaml @@ -0,0 +1,10 @@ +spi: + - id: spi_mcp23s17 + clk_pin: ${clk_pin} + mosi_pin: ${mosi_pin} + miso_pin: ${miso_pin} + +mcp23s17: + - id: mcp23s17_hub + cs_pin: ${cs_pin} + deviceaddress: 0 diff --git a/tests/components/mcp23s17/test.esp32-ard.yaml b/tests/components/mcp23s17/test.esp32-ard.yaml index 9a42c12e85..54e027a614 100644 --- a/tests/components/mcp23s17/test.esp32-ard.yaml +++ b/tests/components/mcp23s17/test.esp32-ard.yaml @@ -1,10 +1,7 @@ -spi: - - id: spi_mcp23s17 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -mcp23s17: - - id: mcp23s17_hub - cs_pin: 12 - deviceaddress: 0 +<<: !include common.yaml diff --git a/tests/components/mcp23s17/test.esp32-c3-ard.yaml b/tests/components/mcp23s17/test.esp32-c3-ard.yaml index d83f66d3b1..2415ba5dc6 100644 --- a/tests/components/mcp23s17/test.esp32-c3-ard.yaml +++ b/tests/components/mcp23s17/test.esp32-c3-ard.yaml @@ -1,10 +1,7 @@ -spi: - - id: spi_mcp23s17 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -mcp23s17: - - id: mcp23s17_hub - cs_pin: 8 - deviceaddress: 0 +<<: !include common.yaml diff --git a/tests/components/mcp23s17/test.esp32-c3-idf.yaml b/tests/components/mcp23s17/test.esp32-c3-idf.yaml index d83f66d3b1..2415ba5dc6 100644 --- a/tests/components/mcp23s17/test.esp32-c3-idf.yaml +++ b/tests/components/mcp23s17/test.esp32-c3-idf.yaml @@ -1,10 +1,7 @@ -spi: - - id: spi_mcp23s17 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -mcp23s17: - - id: mcp23s17_hub - cs_pin: 8 - deviceaddress: 0 +<<: !include common.yaml diff --git a/tests/components/mcp23s17/test.esp32-idf.yaml b/tests/components/mcp23s17/test.esp32-idf.yaml index 9a42c12e85..54e027a614 100644 --- a/tests/components/mcp23s17/test.esp32-idf.yaml +++ b/tests/components/mcp23s17/test.esp32-idf.yaml @@ -1,10 +1,7 @@ -spi: - - id: spi_mcp23s17 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -mcp23s17: - - id: mcp23s17_hub - cs_pin: 12 - deviceaddress: 0 +<<: !include common.yaml diff --git a/tests/components/mcp23s17/test.esp8266-ard.yaml b/tests/components/mcp23s17/test.esp8266-ard.yaml index 36dac63f6f..dbd158d030 100644 --- a/tests/components/mcp23s17/test.esp8266-ard.yaml +++ b/tests/components/mcp23s17/test.esp8266-ard.yaml @@ -1,10 +1,7 @@ -spi: - - id: spi_mcp23s17 - clk_pin: 14 - mosi_pin: 13 - miso_pin: 12 +substitutions: + clk_pin: GPIO14 + mosi_pin: GPIO13 + miso_pin: GPIO12 + cs_pin: GPIO15 -mcp23s17: - - id: mcp23s17_hub - cs_pin: 15 - deviceaddress: 0 +<<: !include common.yaml diff --git a/tests/components/mcp23s17/test.rp2040-ard.yaml b/tests/components/mcp23s17/test.rp2040-ard.yaml index 2730f6a9d6..f6c3f1eeca 100644 --- a/tests/components/mcp23s17/test.rp2040-ard.yaml +++ b/tests/components/mcp23s17/test.rp2040-ard.yaml @@ -1,10 +1,7 @@ -spi: - - id: spi_mcp23s17 - clk_pin: 2 - mosi_pin: 3 - miso_pin: 4 +substitutions: + clk_pin: GPIO2 + mosi_pin: GPIO3 + miso_pin: GPIO4 + cs_pin: GPIO5 -mcp23s17: - - id: mcp23s17_hub - cs_pin: 6 - deviceaddress: 0 +<<: !include common.yaml diff --git a/tests/components/mcp2515/common.yaml b/tests/components/mcp2515/common.yaml new file mode 100644 index 0000000000..96a72a3ec3 --- /dev/null +++ b/tests/components/mcp2515/common.yaml @@ -0,0 +1,44 @@ +spi: + - id: spi_mcp2515 + clk_pin: ${clk_pin} + mosi_pin: ${mosi_pin} + miso_pin: ${miso_pin} + +canbus: + - platform: mcp2515 + id: mcp2515_can + cs_pin: ${cs_pin} + can_id: 4 + bit_rate: 50kbps + on_frame: + - can_id: 500 + then: + - lambda: |- + std::string b(x.begin(), x.end()); + ESP_LOGD("can_id 500", "%s", b.c_str()); + - can_id: 23 + then: + - if: + condition: + lambda: "return x[0] == 0x11;" + then: + logger.log: "x[0] == 0x11" + - can_id: 0b00000000000000000000001000000 + can_id_mask: 0b11111000000000011111111000000 + use_extended_id: true + then: + - lambda: |- + auto pdo_id = can_id >> 14; + switch (pdo_id) + { + case 117: + ESP_LOGD("canbus", "exhaust_fan_duty"); + break; + case 118: + ESP_LOGD("canbus", "supply_fan_duty"); + break; + case 119: + ESP_LOGD("canbus", "supply_fan_flow"); + break; + // to be continued... + } diff --git a/tests/components/mcp2515/test.esp32-ard.yaml b/tests/components/mcp2515/test.esp32-ard.yaml index 07fae36cc3..54e027a614 100644 --- a/tests/components/mcp2515/test.esp32-ard.yaml +++ b/tests/components/mcp2515/test.esp32-ard.yaml @@ -1,44 +1,7 @@ -spi: - - id: spi_mcp2515 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -canbus: - - platform: mcp2515 - id: mcp2515_can - cs_pin: 12 - can_id: 4 - bit_rate: 50kbps - on_frame: - - can_id: 500 - then: - - lambda: |- - std::string b(x.begin(), x.end()); - ESP_LOGD("can_id 500", "%s", b.c_str()); - - can_id: 23 - then: - - if: - condition: - lambda: "return x[0] == 0x11;" - then: - logger.log: "x[0] == 0x11" - - can_id: 0b00000000000000000000001000000 - can_id_mask: 0b11111000000000011111111000000 - use_extended_id: true - then: - - lambda: |- - auto pdo_id = can_id >> 14; - switch (pdo_id) - { - case 117: - ESP_LOGD("canbus", "exhaust_fan_duty"); - break; - case 118: - ESP_LOGD("canbus", "supply_fan_duty"); - break; - case 119: - ESP_LOGD("canbus", "supply_fan_flow"); - break; - // to be continued... - } +<<: !include common.yaml diff --git a/tests/components/mcp2515/test.esp32-c3-ard.yaml b/tests/components/mcp2515/test.esp32-c3-ard.yaml index 3ceeea268f..2415ba5dc6 100644 --- a/tests/components/mcp2515/test.esp32-c3-ard.yaml +++ b/tests/components/mcp2515/test.esp32-c3-ard.yaml @@ -1,44 +1,7 @@ -spi: - - id: spi_mcp2515 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -canbus: - - platform: mcp2515 - id: mcp2515_can - cs_pin: 8 - can_id: 4 - bit_rate: 50kbps - on_frame: - - can_id: 500 - then: - - lambda: |- - std::string b(x.begin(), x.end()); - ESP_LOGD("can_id 500", "%s", b.c_str()); - - can_id: 23 - then: - - if: - condition: - lambda: "return x[0] == 0x11;" - then: - logger.log: "x[0] == 0x11" - - can_id: 0b00000000000000000000001000000 - can_id_mask: 0b11111000000000011111111000000 - use_extended_id: true - then: - - lambda: |- - auto pdo_id = can_id >> 14; - switch (pdo_id) - { - case 117: - ESP_LOGD("canbus", "exhaust_fan_duty"); - break; - case 118: - ESP_LOGD("canbus", "supply_fan_duty"); - break; - case 119: - ESP_LOGD("canbus", "supply_fan_flow"); - break; - // to be continued... - } +<<: !include common.yaml diff --git a/tests/components/mcp2515/test.esp32-c3-idf.yaml b/tests/components/mcp2515/test.esp32-c3-idf.yaml index 3ceeea268f..2415ba5dc6 100644 --- a/tests/components/mcp2515/test.esp32-c3-idf.yaml +++ b/tests/components/mcp2515/test.esp32-c3-idf.yaml @@ -1,44 +1,7 @@ -spi: - - id: spi_mcp2515 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -canbus: - - platform: mcp2515 - id: mcp2515_can - cs_pin: 8 - can_id: 4 - bit_rate: 50kbps - on_frame: - - can_id: 500 - then: - - lambda: |- - std::string b(x.begin(), x.end()); - ESP_LOGD("can_id 500", "%s", b.c_str()); - - can_id: 23 - then: - - if: - condition: - lambda: "return x[0] == 0x11;" - then: - logger.log: "x[0] == 0x11" - - can_id: 0b00000000000000000000001000000 - can_id_mask: 0b11111000000000011111111000000 - use_extended_id: true - then: - - lambda: |- - auto pdo_id = can_id >> 14; - switch (pdo_id) - { - case 117: - ESP_LOGD("canbus", "exhaust_fan_duty"); - break; - case 118: - ESP_LOGD("canbus", "supply_fan_duty"); - break; - case 119: - ESP_LOGD("canbus", "supply_fan_flow"); - break; - // to be continued... - } +<<: !include common.yaml diff --git a/tests/components/mcp2515/test.esp32-idf.yaml b/tests/components/mcp2515/test.esp32-idf.yaml index 07fae36cc3..54e027a614 100644 --- a/tests/components/mcp2515/test.esp32-idf.yaml +++ b/tests/components/mcp2515/test.esp32-idf.yaml @@ -1,44 +1,7 @@ -spi: - - id: spi_mcp2515 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -canbus: - - platform: mcp2515 - id: mcp2515_can - cs_pin: 12 - can_id: 4 - bit_rate: 50kbps - on_frame: - - can_id: 500 - then: - - lambda: |- - std::string b(x.begin(), x.end()); - ESP_LOGD("can_id 500", "%s", b.c_str()); - - can_id: 23 - then: - - if: - condition: - lambda: "return x[0] == 0x11;" - then: - logger.log: "x[0] == 0x11" - - can_id: 0b00000000000000000000001000000 - can_id_mask: 0b11111000000000011111111000000 - use_extended_id: true - then: - - lambda: |- - auto pdo_id = can_id >> 14; - switch (pdo_id) - { - case 117: - ESP_LOGD("canbus", "exhaust_fan_duty"); - break; - case 118: - ESP_LOGD("canbus", "supply_fan_duty"); - break; - case 119: - ESP_LOGD("canbus", "supply_fan_flow"); - break; - // to be continued... - } +<<: !include common.yaml diff --git a/tests/components/mcp2515/test.esp8266-ard.yaml b/tests/components/mcp2515/test.esp8266-ard.yaml index 1096a0e809..dbd158d030 100644 --- a/tests/components/mcp2515/test.esp8266-ard.yaml +++ b/tests/components/mcp2515/test.esp8266-ard.yaml @@ -1,44 +1,7 @@ -spi: - - id: spi_mcp2515 - clk_pin: 14 - mosi_pin: 13 - miso_pin: 12 +substitutions: + clk_pin: GPIO14 + mosi_pin: GPIO13 + miso_pin: GPIO12 + cs_pin: GPIO15 -canbus: - - platform: mcp2515 - id: mcp2515_can - cs_pin: 15 - can_id: 4 - bit_rate: 50kbps - on_frame: - - can_id: 500 - then: - - lambda: |- - std::string b(x.begin(), x.end()); - ESP_LOGD("can_id 500", "%s", b.c_str()); - - can_id: 23 - then: - - if: - condition: - lambda: "return x[0] == 0x11;" - then: - logger.log: "x[0] == 0x11" - - can_id: 0b00000000000000000000001000000 - can_id_mask: 0b11111000000000011111111000000 - use_extended_id: true - then: - - lambda: |- - auto pdo_id = can_id >> 14; - switch (pdo_id) - { - case 117: - ESP_LOGD("canbus", "exhaust_fan_duty"); - break; - case 118: - ESP_LOGD("canbus", "supply_fan_duty"); - break; - case 119: - ESP_LOGD("canbus", "supply_fan_flow"); - break; - // to be continued... - } +<<: !include common.yaml diff --git a/tests/components/mcp2515/test.rp2040-ard.yaml b/tests/components/mcp2515/test.rp2040-ard.yaml index 678c817d3d..f6c3f1eeca 100644 --- a/tests/components/mcp2515/test.rp2040-ard.yaml +++ b/tests/components/mcp2515/test.rp2040-ard.yaml @@ -1,44 +1,7 @@ -spi: - - id: spi_mcp2515 - clk_pin: 2 - mosi_pin: 3 - miso_pin: 4 +substitutions: + clk_pin: GPIO2 + mosi_pin: GPIO3 + miso_pin: GPIO4 + cs_pin: GPIO5 -canbus: - - platform: mcp2515 - id: mcp2515_can - cs_pin: 6 - can_id: 4 - bit_rate: 50kbps - on_frame: - - can_id: 500 - then: - - lambda: |- - std::string b(x.begin(), x.end()); - ESP_LOGD("can_id 500", "%s", b.c_str()); - - can_id: 23 - then: - - if: - condition: - lambda: "return x[0] == 0x11;" - then: - logger.log: "x[0] == 0x11" - - can_id: 0b00000000000000000000001000000 - can_id_mask: 0b11111000000000011111111000000 - use_extended_id: true - then: - - lambda: |- - auto pdo_id = can_id >> 14; - switch (pdo_id) - { - case 117: - ESP_LOGD("canbus", "exhaust_fan_duty"); - break; - case 118: - ESP_LOGD("canbus", "supply_fan_duty"); - break; - case 119: - ESP_LOGD("canbus", "supply_fan_flow"); - break; - // to be continued... - } +<<: !include common.yaml diff --git a/tests/components/mcp3008/common.yaml b/tests/components/mcp3008/common.yaml new file mode 100644 index 0000000000..646d3a20e9 --- /dev/null +++ b/tests/components/mcp3008/common.yaml @@ -0,0 +1,17 @@ +spi: + - id: spi_mcp3008 + clk_pin: ${clk_pin} + mosi_pin: ${mosi_pin} + miso_pin: ${miso_pin} + +mcp3008: + - id: mcp3008_hub + cs_pin: ${cs_pin} + +sensor: + - platform: mcp3008 + id: mcp3008_sensor + mcp3008_id: mcp3008_hub + number: 0 + reference_voltage: 3.19 + update_interval: 5s diff --git a/tests/components/mcp3008/test.esp32-ard.yaml b/tests/components/mcp3008/test.esp32-ard.yaml index a66fbeb7a1..54e027a614 100644 --- a/tests/components/mcp3008/test.esp32-ard.yaml +++ b/tests/components/mcp3008/test.esp32-ard.yaml @@ -1,17 +1,7 @@ -spi: - - id: spi_mcp3008 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -mcp3008: - - id: mcp3008_hub - cs_pin: 12 - -sensor: - - platform: mcp3008 - id: mcp3008_sensor - mcp3008_id: mcp3008_hub - number: 0 - reference_voltage: 3.19 - update_interval: 5s +<<: !include common.yaml diff --git a/tests/components/mcp3008/test.esp32-c3-ard.yaml b/tests/components/mcp3008/test.esp32-c3-ard.yaml index 9e66372e4f..2415ba5dc6 100644 --- a/tests/components/mcp3008/test.esp32-c3-ard.yaml +++ b/tests/components/mcp3008/test.esp32-c3-ard.yaml @@ -1,17 +1,7 @@ -spi: - - id: spi_mcp3008 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -mcp3008: - - id: mcp3008_hub - cs_pin: 8 - -sensor: - - platform: mcp3008 - id: mcp3008_sensor - mcp3008_id: mcp3008_hub - number: 0 - reference_voltage: 3.19 - update_interval: 5s +<<: !include common.yaml diff --git a/tests/components/mcp3008/test.esp32-c3-idf.yaml b/tests/components/mcp3008/test.esp32-c3-idf.yaml index 9e66372e4f..2415ba5dc6 100644 --- a/tests/components/mcp3008/test.esp32-c3-idf.yaml +++ b/tests/components/mcp3008/test.esp32-c3-idf.yaml @@ -1,17 +1,7 @@ -spi: - - id: spi_mcp3008 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -mcp3008: - - id: mcp3008_hub - cs_pin: 8 - -sensor: - - platform: mcp3008 - id: mcp3008_sensor - mcp3008_id: mcp3008_hub - number: 0 - reference_voltage: 3.19 - update_interval: 5s +<<: !include common.yaml diff --git a/tests/components/mcp3008/test.esp32-idf.yaml b/tests/components/mcp3008/test.esp32-idf.yaml index a66fbeb7a1..54e027a614 100644 --- a/tests/components/mcp3008/test.esp32-idf.yaml +++ b/tests/components/mcp3008/test.esp32-idf.yaml @@ -1,17 +1,7 @@ -spi: - - id: spi_mcp3008 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -mcp3008: - - id: mcp3008_hub - cs_pin: 12 - -sensor: - - platform: mcp3008 - id: mcp3008_sensor - mcp3008_id: mcp3008_hub - number: 0 - reference_voltage: 3.19 - update_interval: 5s +<<: !include common.yaml diff --git a/tests/components/mcp3008/test.esp8266-ard.yaml b/tests/components/mcp3008/test.esp8266-ard.yaml index eaccca0765..dbd158d030 100644 --- a/tests/components/mcp3008/test.esp8266-ard.yaml +++ b/tests/components/mcp3008/test.esp8266-ard.yaml @@ -1,17 +1,7 @@ -spi: - - id: spi_mcp3008 - clk_pin: 14 - mosi_pin: 13 - miso_pin: 12 +substitutions: + clk_pin: GPIO14 + mosi_pin: GPIO13 + miso_pin: GPIO12 + cs_pin: GPIO15 -mcp3008: - - id: mcp3008_hub - cs_pin: 15 - -sensor: - - platform: mcp3008 - id: mcp3008_sensor - mcp3008_id: mcp3008_hub - number: 0 - reference_voltage: 3.19 - update_interval: 5s +<<: !include common.yaml diff --git a/tests/components/mcp3008/test.rp2040-ard.yaml b/tests/components/mcp3008/test.rp2040-ard.yaml index 8ab9630553..f6c3f1eeca 100644 --- a/tests/components/mcp3008/test.rp2040-ard.yaml +++ b/tests/components/mcp3008/test.rp2040-ard.yaml @@ -1,17 +1,7 @@ -spi: - - id: spi_mcp3008 - clk_pin: 2 - mosi_pin: 3 - miso_pin: 4 +substitutions: + clk_pin: GPIO2 + mosi_pin: GPIO3 + miso_pin: GPIO4 + cs_pin: GPIO5 -mcp3008: - - id: mcp3008_hub - cs_pin: 6 - -sensor: - - platform: mcp3008 - id: mcp3008_sensor - mcp3008_id: mcp3008_hub - number: 0 - reference_voltage: 3.19 - update_interval: 5s +<<: !include common.yaml diff --git a/tests/components/mcp3204/common.yaml b/tests/components/mcp3204/common.yaml new file mode 100644 index 0000000000..f102500c81 --- /dev/null +++ b/tests/components/mcp3204/common.yaml @@ -0,0 +1,16 @@ +spi: + - id: spi_mcp3204 + clk_pin: ${clk_pin} + mosi_pin: ${mosi_pin} + miso_pin: ${miso_pin} + +mcp3204: + - id: mcp3204_hub + cs_pin: ${cs_pin} + +sensor: + - platform: mcp3204 + id: mcp3204_sensor + mcp3204_id: mcp3204_hub + number: 0 + update_interval: 5s diff --git a/tests/components/mcp3204/test.esp32-ard.yaml b/tests/components/mcp3204/test.esp32-ard.yaml index c340797c8e..54e027a614 100644 --- a/tests/components/mcp3204/test.esp32-ard.yaml +++ b/tests/components/mcp3204/test.esp32-ard.yaml @@ -1,16 +1,7 @@ -spi: - - id: spi_mcp3204 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -mcp3204: - - id: mcp3204_hub - cs_pin: 12 - -sensor: - - platform: mcp3204 - id: mcp3204_sensor - mcp3204_id: mcp3204_hub - number: 0 - update_interval: 5s +<<: !include common.yaml diff --git a/tests/components/mcp3204/test.esp32-c3-ard.yaml b/tests/components/mcp3204/test.esp32-c3-ard.yaml index 5bf5ba81e1..2415ba5dc6 100644 --- a/tests/components/mcp3204/test.esp32-c3-ard.yaml +++ b/tests/components/mcp3204/test.esp32-c3-ard.yaml @@ -1,16 +1,7 @@ -spi: - - id: spi_mcp3204 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -mcp3204: - - id: mcp3204_hub - cs_pin: 8 - -sensor: - - platform: mcp3204 - id: mcp3204_sensor - mcp3204_id: mcp3204_hub - number: 0 - update_interval: 5s +<<: !include common.yaml diff --git a/tests/components/mcp3204/test.esp32-c3-idf.yaml b/tests/components/mcp3204/test.esp32-c3-idf.yaml index 5bf5ba81e1..2415ba5dc6 100644 --- a/tests/components/mcp3204/test.esp32-c3-idf.yaml +++ b/tests/components/mcp3204/test.esp32-c3-idf.yaml @@ -1,16 +1,7 @@ -spi: - - id: spi_mcp3204 - clk_pin: 6 - mosi_pin: 7 - miso_pin: 5 +substitutions: + clk_pin: GPIO6 + mosi_pin: GPIO7 + miso_pin: GPIO5 + cs_pin: GPIO8 -mcp3204: - - id: mcp3204_hub - cs_pin: 8 - -sensor: - - platform: mcp3204 - id: mcp3204_sensor - mcp3204_id: mcp3204_hub - number: 0 - update_interval: 5s +<<: !include common.yaml diff --git a/tests/components/mcp3204/test.esp32-idf.yaml b/tests/components/mcp3204/test.esp32-idf.yaml index c340797c8e..54e027a614 100644 --- a/tests/components/mcp3204/test.esp32-idf.yaml +++ b/tests/components/mcp3204/test.esp32-idf.yaml @@ -1,16 +1,7 @@ -spi: - - id: spi_mcp3204 - clk_pin: 16 - mosi_pin: 17 - miso_pin: 15 +substitutions: + clk_pin: GPIO16 + mosi_pin: GPIO17 + miso_pin: GPIO15 + cs_pin: GPIO5 -mcp3204: - - id: mcp3204_hub - cs_pin: 12 - -sensor: - - platform: mcp3204 - id: mcp3204_sensor - mcp3204_id: mcp3204_hub - number: 0 - update_interval: 5s +<<: !include common.yaml diff --git a/tests/components/mcp3204/test.esp8266-ard.yaml b/tests/components/mcp3204/test.esp8266-ard.yaml index d208e3e06c..dbd158d030 100644 --- a/tests/components/mcp3204/test.esp8266-ard.yaml +++ b/tests/components/mcp3204/test.esp8266-ard.yaml @@ -1,16 +1,7 @@ -spi: - - id: spi_mcp3204 - clk_pin: 14 - mosi_pin: 13 - miso_pin: 12 +substitutions: + clk_pin: GPIO14 + mosi_pin: GPIO13 + miso_pin: GPIO12 + cs_pin: GPIO15 -mcp3204: - - id: mcp3204_hub - cs_pin: 15 - -sensor: - - platform: mcp3204 - id: mcp3204_sensor - mcp3204_id: mcp3204_hub - number: 0 - update_interval: 5s +<<: !include common.yaml diff --git a/tests/components/mcp3204/test.rp2040-ard.yaml b/tests/components/mcp3204/test.rp2040-ard.yaml index 63f30e3621..f6c3f1eeca 100644 --- a/tests/components/mcp3204/test.rp2040-ard.yaml +++ b/tests/components/mcp3204/test.rp2040-ard.yaml @@ -1,16 +1,7 @@ -spi: - - id: spi_mcp3204 - clk_pin: 2 - mosi_pin: 3 - miso_pin: 4 +substitutions: + clk_pin: GPIO2 + mosi_pin: GPIO3 + miso_pin: GPIO4 + cs_pin: GPIO5 -mcp3204: - - id: mcp3204_hub - cs_pin: 6 - -sensor: - - platform: mcp3204 - id: mcp3204_sensor - mcp3204_id: mcp3204_hub - number: 0 - update_interval: 5s +<<: !include common.yaml diff --git a/tests/components/mcp4725/common.yaml b/tests/components/mcp4725/common.yaml new file mode 100644 index 0000000000..0ccc649f2e --- /dev/null +++ b/tests/components/mcp4725/common.yaml @@ -0,0 +1,8 @@ +i2c: + - id: i2c_mcp4725 + scl: ${scl_pin} + sda: ${sda_pin} + +output: + - platform: mcp4725 + id: mcp4725_dac_output diff --git a/tests/components/mcp4725/test.esp32-ard.yaml b/tests/components/mcp4725/test.esp32-ard.yaml index a523ad95e1..63c3bd6afd 100644 --- a/tests/components/mcp4725/test.esp32-ard.yaml +++ b/tests/components/mcp4725/test.esp32-ard.yaml @@ -1,8 +1,5 @@ -i2c: - - id: i2c_mcp4725 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -output: - - platform: mcp4725 - id: mcp4725_dac_output +<<: !include common.yaml diff --git a/tests/components/mcp4725/test.esp32-c3-ard.yaml b/tests/components/mcp4725/test.esp32-c3-ard.yaml index 5fc799203d..ee2c29ca4e 100644 --- a/tests/components/mcp4725/test.esp32-c3-ard.yaml +++ b/tests/components/mcp4725/test.esp32-c3-ard.yaml @@ -1,8 +1,5 @@ -i2c: - - id: i2c_mcp4725 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -output: - - platform: mcp4725 - id: mcp4725_dac_output +<<: !include common.yaml diff --git a/tests/components/mcp4725/test.esp32-c3-idf.yaml b/tests/components/mcp4725/test.esp32-c3-idf.yaml index 5fc799203d..ee2c29ca4e 100644 --- a/tests/components/mcp4725/test.esp32-c3-idf.yaml +++ b/tests/components/mcp4725/test.esp32-c3-idf.yaml @@ -1,8 +1,5 @@ -i2c: - - id: i2c_mcp4725 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -output: - - platform: mcp4725 - id: mcp4725_dac_output +<<: !include common.yaml diff --git a/tests/components/mcp4725/test.esp32-idf.yaml b/tests/components/mcp4725/test.esp32-idf.yaml index a523ad95e1..63c3bd6afd 100644 --- a/tests/components/mcp4725/test.esp32-idf.yaml +++ b/tests/components/mcp4725/test.esp32-idf.yaml @@ -1,8 +1,5 @@ -i2c: - - id: i2c_mcp4725 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -output: - - platform: mcp4725 - id: mcp4725_dac_output +<<: !include common.yaml diff --git a/tests/components/mcp4725/test.esp8266-ard.yaml b/tests/components/mcp4725/test.esp8266-ard.yaml index 5fc799203d..ee2c29ca4e 100644 --- a/tests/components/mcp4725/test.esp8266-ard.yaml +++ b/tests/components/mcp4725/test.esp8266-ard.yaml @@ -1,8 +1,5 @@ -i2c: - - id: i2c_mcp4725 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -output: - - platform: mcp4725 - id: mcp4725_dac_output +<<: !include common.yaml diff --git a/tests/components/mcp4725/test.rp2040-ard.yaml b/tests/components/mcp4725/test.rp2040-ard.yaml index 5fc799203d..ee2c29ca4e 100644 --- a/tests/components/mcp4725/test.rp2040-ard.yaml +++ b/tests/components/mcp4725/test.rp2040-ard.yaml @@ -1,8 +1,5 @@ -i2c: - - id: i2c_mcp4725 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -output: - - platform: mcp4725 - id: mcp4725_dac_output +<<: !include common.yaml diff --git a/tests/components/mcp4728/common.yaml b/tests/components/mcp4728/common.yaml new file mode 100644 index 0000000000..b42818e4e6 --- /dev/null +++ b/tests/components/mcp4728/common.yaml @@ -0,0 +1,31 @@ +i2c: + - id: i2c_mcp4728 + scl: ${scl_pin} + sda: ${sda_pin} + +mcp4728: + - id: mcp4728_dac + +output: + - platform: mcp4728 + id: mcp4728_dac_output_a + channel: A + vref: vdd + power_down: normal + - platform: mcp4728 + id: mcp4728_dac_output_b + channel: B + vref: internal + gain: X1 + power_down: gnd_1k + - platform: mcp4728 + id: mcp4728_dac_output_c + channel: C + vref: vdd + power_down: gnd_100k + - platform: mcp4728 + id: mcp4728_dac_output_d + channel: D + vref: internal + gain: X2 + power_down: gnd_500k diff --git a/tests/components/mcp4728/test.esp32-ard.yaml b/tests/components/mcp4728/test.esp32-ard.yaml index b29a6ee53c..63c3bd6afd 100644 --- a/tests/components/mcp4728/test.esp32-ard.yaml +++ b/tests/components/mcp4728/test.esp32-ard.yaml @@ -1,31 +1,5 @@ -i2c: - - id: i2c_mcp4728 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -mcp4728: - - id: mcp4728_dac - -output: - - platform: mcp4728 - id: mcp4728_dac_output_a - channel: A - vref: vdd - power_down: normal - - platform: mcp4728 - id: mcp4728_dac_output_b - channel: B - vref: internal - gain: X1 - power_down: gnd_1k - - platform: mcp4728 - id: mcp4728_dac_output_c - channel: C - vref: vdd - power_down: gnd_100k - - platform: mcp4728 - id: mcp4728_dac_output_d - channel: D - vref: internal - gain: X2 - power_down: gnd_500k +<<: !include common.yaml diff --git a/tests/components/mcp4728/test.esp32-c3-ard.yaml b/tests/components/mcp4728/test.esp32-c3-ard.yaml index 2f24dd0b8c..ee2c29ca4e 100644 --- a/tests/components/mcp4728/test.esp32-c3-ard.yaml +++ b/tests/components/mcp4728/test.esp32-c3-ard.yaml @@ -1,31 +1,5 @@ -i2c: - - id: i2c_mcp4728 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -mcp4728: - - id: mcp4728_dac - -output: - - platform: mcp4728 - id: mcp4728_dac_output_a - channel: A - vref: vdd - power_down: normal - - platform: mcp4728 - id: mcp4728_dac_output_b - channel: B - vref: internal - gain: X1 - power_down: gnd_1k - - platform: mcp4728 - id: mcp4728_dac_output_c - channel: C - vref: vdd - power_down: gnd_100k - - platform: mcp4728 - id: mcp4728_dac_output_d - channel: D - vref: internal - gain: X2 - power_down: gnd_500k +<<: !include common.yaml diff --git a/tests/components/mcp4728/test.esp32-c3-idf.yaml b/tests/components/mcp4728/test.esp32-c3-idf.yaml index 2f24dd0b8c..ee2c29ca4e 100644 --- a/tests/components/mcp4728/test.esp32-c3-idf.yaml +++ b/tests/components/mcp4728/test.esp32-c3-idf.yaml @@ -1,31 +1,5 @@ -i2c: - - id: i2c_mcp4728 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -mcp4728: - - id: mcp4728_dac - -output: - - platform: mcp4728 - id: mcp4728_dac_output_a - channel: A - vref: vdd - power_down: normal - - platform: mcp4728 - id: mcp4728_dac_output_b - channel: B - vref: internal - gain: X1 - power_down: gnd_1k - - platform: mcp4728 - id: mcp4728_dac_output_c - channel: C - vref: vdd - power_down: gnd_100k - - platform: mcp4728 - id: mcp4728_dac_output_d - channel: D - vref: internal - gain: X2 - power_down: gnd_500k +<<: !include common.yaml diff --git a/tests/components/mcp4728/test.esp32-idf.yaml b/tests/components/mcp4728/test.esp32-idf.yaml index b29a6ee53c..63c3bd6afd 100644 --- a/tests/components/mcp4728/test.esp32-idf.yaml +++ b/tests/components/mcp4728/test.esp32-idf.yaml @@ -1,31 +1,5 @@ -i2c: - - id: i2c_mcp4728 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -mcp4728: - - id: mcp4728_dac - -output: - - platform: mcp4728 - id: mcp4728_dac_output_a - channel: A - vref: vdd - power_down: normal - - platform: mcp4728 - id: mcp4728_dac_output_b - channel: B - vref: internal - gain: X1 - power_down: gnd_1k - - platform: mcp4728 - id: mcp4728_dac_output_c - channel: C - vref: vdd - power_down: gnd_100k - - platform: mcp4728 - id: mcp4728_dac_output_d - channel: D - vref: internal - gain: X2 - power_down: gnd_500k +<<: !include common.yaml diff --git a/tests/components/mcp4728/test.esp8266-ard.yaml b/tests/components/mcp4728/test.esp8266-ard.yaml index 2f24dd0b8c..ee2c29ca4e 100644 --- a/tests/components/mcp4728/test.esp8266-ard.yaml +++ b/tests/components/mcp4728/test.esp8266-ard.yaml @@ -1,31 +1,5 @@ -i2c: - - id: i2c_mcp4728 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -mcp4728: - - id: mcp4728_dac - -output: - - platform: mcp4728 - id: mcp4728_dac_output_a - channel: A - vref: vdd - power_down: normal - - platform: mcp4728 - id: mcp4728_dac_output_b - channel: B - vref: internal - gain: X1 - power_down: gnd_1k - - platform: mcp4728 - id: mcp4728_dac_output_c - channel: C - vref: vdd - power_down: gnd_100k - - platform: mcp4728 - id: mcp4728_dac_output_d - channel: D - vref: internal - gain: X2 - power_down: gnd_500k +<<: !include common.yaml diff --git a/tests/components/mcp4728/test.rp2040-ard.yaml b/tests/components/mcp4728/test.rp2040-ard.yaml index 2f24dd0b8c..ee2c29ca4e 100644 --- a/tests/components/mcp4728/test.rp2040-ard.yaml +++ b/tests/components/mcp4728/test.rp2040-ard.yaml @@ -1,31 +1,5 @@ -i2c: - - id: i2c_mcp4728 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -mcp4728: - - id: mcp4728_dac - -output: - - platform: mcp4728 - id: mcp4728_dac_output_a - channel: A - vref: vdd - power_down: normal - - platform: mcp4728 - id: mcp4728_dac_output_b - channel: B - vref: internal - gain: X1 - power_down: gnd_1k - - platform: mcp4728 - id: mcp4728_dac_output_c - channel: C - vref: vdd - power_down: gnd_100k - - platform: mcp4728 - id: mcp4728_dac_output_d - channel: D - vref: internal - gain: X2 - power_down: gnd_500k +<<: !include common.yaml diff --git a/tests/components/mcp47a1/common.yaml b/tests/components/mcp47a1/common.yaml new file mode 100644 index 0000000000..59e28d37b3 --- /dev/null +++ b/tests/components/mcp47a1/common.yaml @@ -0,0 +1,8 @@ +i2c: + - id: i2c_mcp47a1 + scl: ${scl_pin} + sda: ${sda_pin} + +output: + - platform: mcp47a1 + id: output_mcp47a1 diff --git a/tests/components/mcp47a1/test.esp32-ard.yaml b/tests/components/mcp47a1/test.esp32-ard.yaml index 9e2133de66..63c3bd6afd 100644 --- a/tests/components/mcp47a1/test.esp32-ard.yaml +++ b/tests/components/mcp47a1/test.esp32-ard.yaml @@ -1,8 +1,5 @@ -i2c: - - id: i2c_mcp47a1 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -output: - - platform: mcp47a1 - id: output_mcp47a1 +<<: !include common.yaml diff --git a/tests/components/mcp47a1/test.esp32-c3-ard.yaml b/tests/components/mcp47a1/test.esp32-c3-ard.yaml index 68273e00eb..ee2c29ca4e 100644 --- a/tests/components/mcp47a1/test.esp32-c3-ard.yaml +++ b/tests/components/mcp47a1/test.esp32-c3-ard.yaml @@ -1,8 +1,5 @@ -i2c: - - id: i2c_mcp47a1 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -output: - - platform: mcp47a1 - id: output_mcp47a1 +<<: !include common.yaml diff --git a/tests/components/mcp47a1/test.esp32-c3-idf.yaml b/tests/components/mcp47a1/test.esp32-c3-idf.yaml index 68273e00eb..ee2c29ca4e 100644 --- a/tests/components/mcp47a1/test.esp32-c3-idf.yaml +++ b/tests/components/mcp47a1/test.esp32-c3-idf.yaml @@ -1,8 +1,5 @@ -i2c: - - id: i2c_mcp47a1 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -output: - - platform: mcp47a1 - id: output_mcp47a1 +<<: !include common.yaml diff --git a/tests/components/mcp47a1/test.esp32-idf.yaml b/tests/components/mcp47a1/test.esp32-idf.yaml index 9e2133de66..63c3bd6afd 100644 --- a/tests/components/mcp47a1/test.esp32-idf.yaml +++ b/tests/components/mcp47a1/test.esp32-idf.yaml @@ -1,8 +1,5 @@ -i2c: - - id: i2c_mcp47a1 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -output: - - platform: mcp47a1 - id: output_mcp47a1 +<<: !include common.yaml diff --git a/tests/components/mcp47a1/test.esp8266-ard.yaml b/tests/components/mcp47a1/test.esp8266-ard.yaml index 68273e00eb..ee2c29ca4e 100644 --- a/tests/components/mcp47a1/test.esp8266-ard.yaml +++ b/tests/components/mcp47a1/test.esp8266-ard.yaml @@ -1,8 +1,5 @@ -i2c: - - id: i2c_mcp47a1 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -output: - - platform: mcp47a1 - id: output_mcp47a1 +<<: !include common.yaml diff --git a/tests/components/mcp47a1/test.rp2040-ard.yaml b/tests/components/mcp47a1/test.rp2040-ard.yaml index 68273e00eb..ee2c29ca4e 100644 --- a/tests/components/mcp47a1/test.rp2040-ard.yaml +++ b/tests/components/mcp47a1/test.rp2040-ard.yaml @@ -1,8 +1,5 @@ -i2c: - - id: i2c_mcp47a1 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -output: - - platform: mcp47a1 - id: output_mcp47a1 +<<: !include common.yaml diff --git a/tests/components/mcp9600/common.yaml b/tests/components/mcp9600/common.yaml new file mode 100644 index 0000000000..e3c9df79e4 --- /dev/null +++ b/tests/components/mcp9600/common.yaml @@ -0,0 +1,12 @@ +i2c: + - id: i2c_mcp9600 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: mcp9600 + thermocouple_type: K + hot_junction: + name: Thermocouple Temperature + cold_junction: + name: Ambient Temperature diff --git a/tests/components/mcp9600/test.esp32-ard.yaml b/tests/components/mcp9600/test.esp32-ard.yaml index 0c94f099ae..63c3bd6afd 100644 --- a/tests/components/mcp9600/test.esp32-ard.yaml +++ b/tests/components/mcp9600/test.esp32-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_mcp9600 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: mcp9600 - thermocouple_type: K - hot_junction: - name: Thermocouple Temperature - cold_junction: - name: Ambient Temperature +<<: !include common.yaml diff --git a/tests/components/mcp9600/test.esp32-c3-ard.yaml b/tests/components/mcp9600/test.esp32-c3-ard.yaml index b07f4589ce..ee2c29ca4e 100644 --- a/tests/components/mcp9600/test.esp32-c3-ard.yaml +++ b/tests/components/mcp9600/test.esp32-c3-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_mcp9600 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mcp9600 - thermocouple_type: K - hot_junction: - name: Thermocouple Temperature - cold_junction: - name: Ambient Temperature +<<: !include common.yaml diff --git a/tests/components/mcp9600/test.esp32-c3-idf.yaml b/tests/components/mcp9600/test.esp32-c3-idf.yaml index b07f4589ce..ee2c29ca4e 100644 --- a/tests/components/mcp9600/test.esp32-c3-idf.yaml +++ b/tests/components/mcp9600/test.esp32-c3-idf.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_mcp9600 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mcp9600 - thermocouple_type: K - hot_junction: - name: Thermocouple Temperature - cold_junction: - name: Ambient Temperature +<<: !include common.yaml diff --git a/tests/components/mcp9600/test.esp32-idf.yaml b/tests/components/mcp9600/test.esp32-idf.yaml index 0c94f099ae..63c3bd6afd 100644 --- a/tests/components/mcp9600/test.esp32-idf.yaml +++ b/tests/components/mcp9600/test.esp32-idf.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_mcp9600 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: mcp9600 - thermocouple_type: K - hot_junction: - name: Thermocouple Temperature - cold_junction: - name: Ambient Temperature +<<: !include common.yaml diff --git a/tests/components/mcp9600/test.esp8266-ard.yaml b/tests/components/mcp9600/test.esp8266-ard.yaml index b07f4589ce..ee2c29ca4e 100644 --- a/tests/components/mcp9600/test.esp8266-ard.yaml +++ b/tests/components/mcp9600/test.esp8266-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_mcp9600 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mcp9600 - thermocouple_type: K - hot_junction: - name: Thermocouple Temperature - cold_junction: - name: Ambient Temperature +<<: !include common.yaml diff --git a/tests/components/mcp9600/test.rp2040-ard.yaml b/tests/components/mcp9600/test.rp2040-ard.yaml index b07f4589ce..ee2c29ca4e 100644 --- a/tests/components/mcp9600/test.rp2040-ard.yaml +++ b/tests/components/mcp9600/test.rp2040-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_mcp9600 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mcp9600 - thermocouple_type: K - hot_junction: - name: Thermocouple Temperature - cold_junction: - name: Ambient Temperature +<<: !include common.yaml diff --git a/tests/components/mcp9808/common.yaml b/tests/components/mcp9808/common.yaml new file mode 100644 index 0000000000..ccfd5d13ce --- /dev/null +++ b/tests/components/mcp9808/common.yaml @@ -0,0 +1,8 @@ +i2c: + - id: i2c_mcp9808 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: mcp9808 + name: MCP9808 Temperature diff --git a/tests/components/mcp9808/test.esp32-ard.yaml b/tests/components/mcp9808/test.esp32-ard.yaml index 1e5affdac0..63c3bd6afd 100644 --- a/tests/components/mcp9808/test.esp32-ard.yaml +++ b/tests/components/mcp9808/test.esp32-ard.yaml @@ -1,8 +1,5 @@ -i2c: - - id: i2c_mcp9808 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: mcp9808 - name: MCP9808 Temperature +<<: !include common.yaml diff --git a/tests/components/mcp9808/test.esp32-c3-ard.yaml b/tests/components/mcp9808/test.esp32-c3-ard.yaml index 86b4d7f181..ee2c29ca4e 100644 --- a/tests/components/mcp9808/test.esp32-c3-ard.yaml +++ b/tests/components/mcp9808/test.esp32-c3-ard.yaml @@ -1,8 +1,5 @@ -i2c: - - id: i2c_mcp9808 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mcp9808 - name: MCP9808 Temperature +<<: !include common.yaml diff --git a/tests/components/mcp9808/test.esp32-c3-idf.yaml b/tests/components/mcp9808/test.esp32-c3-idf.yaml index 86b4d7f181..ee2c29ca4e 100644 --- a/tests/components/mcp9808/test.esp32-c3-idf.yaml +++ b/tests/components/mcp9808/test.esp32-c3-idf.yaml @@ -1,8 +1,5 @@ -i2c: - - id: i2c_mcp9808 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mcp9808 - name: MCP9808 Temperature +<<: !include common.yaml diff --git a/tests/components/mcp9808/test.esp32-idf.yaml b/tests/components/mcp9808/test.esp32-idf.yaml index 1e5affdac0..63c3bd6afd 100644 --- a/tests/components/mcp9808/test.esp32-idf.yaml +++ b/tests/components/mcp9808/test.esp32-idf.yaml @@ -1,8 +1,5 @@ -i2c: - - id: i2c_mcp9808 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: mcp9808 - name: MCP9808 Temperature +<<: !include common.yaml diff --git a/tests/components/mcp9808/test.esp8266-ard.yaml b/tests/components/mcp9808/test.esp8266-ard.yaml index 86b4d7f181..ee2c29ca4e 100644 --- a/tests/components/mcp9808/test.esp8266-ard.yaml +++ b/tests/components/mcp9808/test.esp8266-ard.yaml @@ -1,8 +1,5 @@ -i2c: - - id: i2c_mcp9808 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mcp9808 - name: MCP9808 Temperature +<<: !include common.yaml diff --git a/tests/components/mcp9808/test.rp2040-ard.yaml b/tests/components/mcp9808/test.rp2040-ard.yaml index 86b4d7f181..ee2c29ca4e 100644 --- a/tests/components/mcp9808/test.rp2040-ard.yaml +++ b/tests/components/mcp9808/test.rp2040-ard.yaml @@ -1,8 +1,5 @@ -i2c: - - id: i2c_mcp9808 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mcp9808 - name: MCP9808 Temperature +<<: !include common.yaml diff --git a/tests/components/mhz19/common.yaml b/tests/components/mhz19/common.yaml new file mode 100644 index 0000000000..8b7e732068 --- /dev/null +++ b/tests/components/mhz19/common.yaml @@ -0,0 +1,14 @@ +uart: + - id: uart_mhz19 + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} + baud_rate: 9600 + +sensor: + - platform: mhz19 + co2: + name: MH-Z19 CO2 Value + temperature: + name: MH-Z19 Temperature + automatic_baseline_calibration: false + update_interval: 15s diff --git a/tests/components/mhz19/test.esp32-ard.yaml b/tests/components/mhz19/test.esp32-ard.yaml index 0e30713b54..f486544afa 100644 --- a/tests/components/mhz19/test.esp32-ard.yaml +++ b/tests/components/mhz19/test.esp32-ard.yaml @@ -1,14 +1,5 @@ -uart: - - id: uart_mhz19 - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO17 + rx_pin: GPIO16 -sensor: - - platform: mhz19 - co2: - name: MH-Z19 CO2 Value - temperature: - name: MH-Z19 Temperature - automatic_baseline_calibration: false - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/mhz19/test.esp32-c3-ard.yaml b/tests/components/mhz19/test.esp32-c3-ard.yaml index 1edfa49c23..b516342f3b 100644 --- a/tests/components/mhz19/test.esp32-c3-ard.yaml +++ b/tests/components/mhz19/test.esp32-c3-ard.yaml @@ -1,14 +1,5 @@ -uart: - - id: uart_mhz19 - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -sensor: - - platform: mhz19 - co2: - name: MH-Z19 CO2 Value - temperature: - name: MH-Z19 Temperature - automatic_baseline_calibration: false - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/mhz19/test.esp32-c3-idf.yaml b/tests/components/mhz19/test.esp32-c3-idf.yaml index 1edfa49c23..b516342f3b 100644 --- a/tests/components/mhz19/test.esp32-c3-idf.yaml +++ b/tests/components/mhz19/test.esp32-c3-idf.yaml @@ -1,14 +1,5 @@ -uart: - - id: uart_mhz19 - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -sensor: - - platform: mhz19 - co2: - name: MH-Z19 CO2 Value - temperature: - name: MH-Z19 Temperature - automatic_baseline_calibration: false - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/mhz19/test.esp32-idf.yaml b/tests/components/mhz19/test.esp32-idf.yaml index 0e30713b54..f486544afa 100644 --- a/tests/components/mhz19/test.esp32-idf.yaml +++ b/tests/components/mhz19/test.esp32-idf.yaml @@ -1,14 +1,5 @@ -uart: - - id: uart_mhz19 - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO17 + rx_pin: GPIO16 -sensor: - - platform: mhz19 - co2: - name: MH-Z19 CO2 Value - temperature: - name: MH-Z19 Temperature - automatic_baseline_calibration: false - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/mhz19/test.esp8266-ard.yaml b/tests/components/mhz19/test.esp8266-ard.yaml index 1edfa49c23..b516342f3b 100644 --- a/tests/components/mhz19/test.esp8266-ard.yaml +++ b/tests/components/mhz19/test.esp8266-ard.yaml @@ -1,14 +1,5 @@ -uart: - - id: uart_mhz19 - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -sensor: - - platform: mhz19 - co2: - name: MH-Z19 CO2 Value - temperature: - name: MH-Z19 Temperature - automatic_baseline_calibration: false - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/mhz19/test.rp2040-ard.yaml b/tests/components/mhz19/test.rp2040-ard.yaml index 1edfa49c23..b516342f3b 100644 --- a/tests/components/mhz19/test.rp2040-ard.yaml +++ b/tests/components/mhz19/test.rp2040-ard.yaml @@ -1,14 +1,5 @@ -uart: - - id: uart_mhz19 - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 -sensor: - - platform: mhz19 - co2: - name: MH-Z19 CO2 Value - temperature: - name: MH-Z19 Temperature - automatic_baseline_calibration: false - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/micronova/common.yaml b/tests/components/micronova/common.yaml new file mode 100644 index 0000000000..661c9330c6 --- /dev/null +++ b/tests/components/micronova/common.yaml @@ -0,0 +1,49 @@ +uart: + - id: uart_micronova + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} + baud_rate: 9600 + +micronova: + enable_rx_pin: ${enable_rx_pin} + +button: + - platform: micronova + custom_button: + name: Custom Micronova Button + memory_location: 0xA0 + memory_address: 0x7D + memory_data: 0x0F + +number: + - platform: micronova + thermostat_temperature: + name: Micronova Thermostaat + step: 1 + power_level: + name: Micronova Power level + +sensor: + - platform: micronova + room_temperature: + name: Room Temperature + fumes_temperature: + name: Fumes Temperature + water_temperature: + name: Water temperature + water_pressure: + name: Water pressure + stove_power: + name: Stove Power + fan_speed: + fan_rpm_offset: 240 + name: Fan RPM + memory_address_sensor: + memory_location: 0x20 + memory_address: 0x7d + name: Adres sensor + +switch: + - platform: micronova + stove: + name: Stove on/off diff --git a/tests/components/micronova/test.esp32-ard.yaml b/tests/components/micronova/test.esp32-ard.yaml index 9156f7d6a9..35d041e047 100644 --- a/tests/components/micronova/test.esp32-ard.yaml +++ b/tests/components/micronova/test.esp32-ard.yaml @@ -1,49 +1,6 @@ -uart: - - id: uart_micronova - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 + enable_rx_pin: GPIO13 -micronova: - enable_rx_pin: 18 - -button: - - platform: micronova - custom_button: - name: Custom Micronova Button - memory_location: 0xA0 - memory_address: 0x7D - memory_data: 0x0F - -number: - - platform: micronova - thermostat_temperature: - name: Micronova Thermostaat - step: 1 - power_level: - name: Micronova Power level - -sensor: - - platform: micronova - room_temperature: - name: Room Temperature - fumes_temperature: - name: Fumes Temperature - water_temperature: - name: Water temperature - water_pressure: - name: Water pressure - stove_power: - name: Stove Power - fan_speed: - fan_rpm_offset: 240 - name: Fan RPM - memory_address_sensor: - memory_location: 0x20 - memory_address: 0x7d - name: Adres sensor - -switch: - - platform: micronova - stove: - name: Stove on/off +<<: !include common.yaml diff --git a/tests/components/micronova/test.esp32-c3-ard.yaml b/tests/components/micronova/test.esp32-c3-ard.yaml index ec9699909e..993071999f 100644 --- a/tests/components/micronova/test.esp32-c3-ard.yaml +++ b/tests/components/micronova/test.esp32-c3-ard.yaml @@ -1,49 +1,6 @@ -uart: - - id: uart_micronova - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + enable_rx_pin: GPIO3 -micronova: - enable_rx_pin: 6 - -button: - - platform: micronova - custom_button: - name: Custom Micronova Button - memory_location: 0xA0 - memory_address: 0x7D - memory_data: 0x0F - -number: - - platform: micronova - thermostat_temperature: - name: Micronova Thermostaat - step: 1 - power_level: - name: Micronova Power level - -sensor: - - platform: micronova - room_temperature: - name: Room Temperature - fumes_temperature: - name: Fumes Temperature - water_temperature: - name: Water temperature - water_pressure: - name: Water pressure - stove_power: - name: Stove Power - fan_speed: - fan_rpm_offset: 240 - name: Fan RPM - memory_address_sensor: - memory_location: 0x20 - memory_address: 0x7d - name: Adres sensor - -switch: - - platform: micronova - stove: - name: Stove on/off +<<: !include common.yaml diff --git a/tests/components/micronova/test.esp32-c3-idf.yaml b/tests/components/micronova/test.esp32-c3-idf.yaml index ec9699909e..993071999f 100644 --- a/tests/components/micronova/test.esp32-c3-idf.yaml +++ b/tests/components/micronova/test.esp32-c3-idf.yaml @@ -1,49 +1,6 @@ -uart: - - id: uart_micronova - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + enable_rx_pin: GPIO3 -micronova: - enable_rx_pin: 6 - -button: - - platform: micronova - custom_button: - name: Custom Micronova Button - memory_location: 0xA0 - memory_address: 0x7D - memory_data: 0x0F - -number: - - platform: micronova - thermostat_temperature: - name: Micronova Thermostaat - step: 1 - power_level: - name: Micronova Power level - -sensor: - - platform: micronova - room_temperature: - name: Room Temperature - fumes_temperature: - name: Fumes Temperature - water_temperature: - name: Water temperature - water_pressure: - name: Water pressure - stove_power: - name: Stove Power - fan_speed: - fan_rpm_offset: 240 - name: Fan RPM - memory_address_sensor: - memory_location: 0x20 - memory_address: 0x7d - name: Adres sensor - -switch: - - platform: micronova - stove: - name: Stove on/off +<<: !include common.yaml diff --git a/tests/components/micronova/test.esp32-idf.yaml b/tests/components/micronova/test.esp32-idf.yaml index 9156f7d6a9..35d041e047 100644 --- a/tests/components/micronova/test.esp32-idf.yaml +++ b/tests/components/micronova/test.esp32-idf.yaml @@ -1,49 +1,6 @@ -uart: - - id: uart_micronova - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 + enable_rx_pin: GPIO13 -micronova: - enable_rx_pin: 18 - -button: - - platform: micronova - custom_button: - name: Custom Micronova Button - memory_location: 0xA0 - memory_address: 0x7D - memory_data: 0x0F - -number: - - platform: micronova - thermostat_temperature: - name: Micronova Thermostaat - step: 1 - power_level: - name: Micronova Power level - -sensor: - - platform: micronova - room_temperature: - name: Room Temperature - fumes_temperature: - name: Fumes Temperature - water_temperature: - name: Water temperature - water_pressure: - name: Water pressure - stove_power: - name: Stove Power - fan_speed: - fan_rpm_offset: 240 - name: Fan RPM - memory_address_sensor: - memory_location: 0x20 - memory_address: 0x7d - name: Adres sensor - -switch: - - platform: micronova - stove: - name: Stove on/off +<<: !include common.yaml diff --git a/tests/components/micronova/test.esp8266-ard.yaml b/tests/components/micronova/test.esp8266-ard.yaml index d10ab7ad7a..048fb82d72 100644 --- a/tests/components/micronova/test.esp8266-ard.yaml +++ b/tests/components/micronova/test.esp8266-ard.yaml @@ -1,49 +1,6 @@ -uart: - - id: uart_micronova - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + enable_rx_pin: GPIO13 -micronova: - enable_rx_pin: 16 - -button: - - platform: micronova - custom_button: - name: Custom Micronova Button - memory_location: 0xA0 - memory_address: 0x7D - memory_data: 0x0F - -number: - - platform: micronova - thermostat_temperature: - name: Micronova Thermostaat - step: 1 - power_level: - name: Micronova Power level - -sensor: - - platform: micronova - room_temperature: - name: Room Temperature - fumes_temperature: - name: Fumes Temperature - water_temperature: - name: Water temperature - water_pressure: - name: Water pressure - stove_power: - name: Stove Power - fan_speed: - fan_rpm_offset: 240 - name: Fan RPM - memory_address_sensor: - memory_location: 0x20 - memory_address: 0x7d - name: Adres sensor - -switch: - - platform: micronova - stove: - name: Stove on/off +<<: !include common.yaml diff --git a/tests/components/micronova/test.rp2040-ard.yaml b/tests/components/micronova/test.rp2040-ard.yaml index ec9699909e..993071999f 100644 --- a/tests/components/micronova/test.rp2040-ard.yaml +++ b/tests/components/micronova/test.rp2040-ard.yaml @@ -1,49 +1,6 @@ -uart: - - id: uart_micronova - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + enable_rx_pin: GPIO3 -micronova: - enable_rx_pin: 6 - -button: - - platform: micronova - custom_button: - name: Custom Micronova Button - memory_location: 0xA0 - memory_address: 0x7D - memory_data: 0x0F - -number: - - platform: micronova - thermostat_temperature: - name: Micronova Thermostaat - step: 1 - power_level: - name: Micronova Power level - -sensor: - - platform: micronova - room_temperature: - name: Room Temperature - fumes_temperature: - name: Fumes Temperature - water_temperature: - name: Water temperature - water_pressure: - name: Water pressure - stove_power: - name: Stove Power - fan_speed: - fan_rpm_offset: 240 - name: Fan RPM - memory_address_sensor: - memory_location: 0x20 - memory_address: 0x7d - name: Adres sensor - -switch: - - platform: micronova - stove: - name: Stove on/off +<<: !include common.yaml diff --git a/tests/components/microphone/common.yaml b/tests/components/microphone/common.yaml new file mode 100644 index 0000000000..ea79266281 --- /dev/null +++ b/tests/components/microphone/common.yaml @@ -0,0 +1,11 @@ +i2s_audio: + i2s_bclk_pin: ${i2s_bclk_pin} + i2s_lrclk_pin: ${i2s_lrclk_pin} + i2s_mclk_pin: ${i2s_mclk_pin} + +microphone: + - platform: i2s_audio + id: mic_id_external + i2s_din_pin: ${i2s_din_pin} + adc_type: external + pdm: false diff --git a/tests/components/microphone/test.esp32-ard.yaml b/tests/components/microphone/test.esp32-ard.yaml index 166eedb54d..392df582cc 100644 --- a/tests/components/microphone/test.esp32-ard.yaml +++ b/tests/components/microphone/test.esp32-ard.yaml @@ -1,15 +1,13 @@ -i2s_audio: - i2s_lrclk_pin: 13 - i2s_bclk_pin: 14 - i2s_mclk_pin: 15 +substitutions: + i2s_bclk_pin: GPIO15 + i2s_lrclk_pin: GPIO16 + i2s_mclk_pin: GPIO17 + i2s_din_pin: GPIO33 + +<<: !include common.yaml microphone: - platform: i2s_audio id: mic_id_adc adc_pin: 32 adc_type: internal - - platform: i2s_audio - id: mic_id_external - i2s_din_pin: 33 - adc_type: external - pdm: false diff --git a/tests/components/microphone/test.esp32-c3-ard.yaml b/tests/components/microphone/test.esp32-c3-ard.yaml index 706a38f910..c28dc553f5 100644 --- a/tests/components/microphone/test.esp32-c3-ard.yaml +++ b/tests/components/microphone/test.esp32-c3-ard.yaml @@ -1,11 +1,7 @@ -i2s_audio: - i2s_lrclk_pin: 6 - i2s_bclk_pin: 7 - i2s_mclk_pin: 8 +substitutions: + i2s_bclk_pin: GPIO6 + i2s_lrclk_pin: GPIO7 + i2s_mclk_pin: GPIO8 + i2s_din_pin: GPIO3 -microphone: - - platform: i2s_audio - id: mic_id_external - i2s_din_pin: 3 - adc_type: external - pdm: false +<<: !include common.yaml diff --git a/tests/components/microphone/test.esp32-c3-idf.yaml b/tests/components/microphone/test.esp32-c3-idf.yaml index 706a38f910..c28dc553f5 100644 --- a/tests/components/microphone/test.esp32-c3-idf.yaml +++ b/tests/components/microphone/test.esp32-c3-idf.yaml @@ -1,11 +1,7 @@ -i2s_audio: - i2s_lrclk_pin: 6 - i2s_bclk_pin: 7 - i2s_mclk_pin: 8 +substitutions: + i2s_bclk_pin: GPIO6 + i2s_lrclk_pin: GPIO7 + i2s_mclk_pin: GPIO8 + i2s_din_pin: GPIO3 -microphone: - - platform: i2s_audio - id: mic_id_external - i2s_din_pin: 3 - adc_type: external - pdm: false +<<: !include common.yaml diff --git a/tests/components/microphone/test.esp32-idf.yaml b/tests/components/microphone/test.esp32-idf.yaml index 166eedb54d..392df582cc 100644 --- a/tests/components/microphone/test.esp32-idf.yaml +++ b/tests/components/microphone/test.esp32-idf.yaml @@ -1,15 +1,13 @@ -i2s_audio: - i2s_lrclk_pin: 13 - i2s_bclk_pin: 14 - i2s_mclk_pin: 15 +substitutions: + i2s_bclk_pin: GPIO15 + i2s_lrclk_pin: GPIO16 + i2s_mclk_pin: GPIO17 + i2s_din_pin: GPIO33 + +<<: !include common.yaml microphone: - platform: i2s_audio id: mic_id_adc adc_pin: 32 adc_type: internal - - platform: i2s_audio - id: mic_id_external - i2s_din_pin: 33 - adc_type: external - pdm: false diff --git a/tests/components/mics_4514/common.yaml b/tests/components/mics_4514/common.yaml new file mode 100644 index 0000000000..0bc3f3e654 --- /dev/null +++ b/tests/components/mics_4514/common.yaml @@ -0,0 +1,20 @@ +i2c: + - id: i2c_mics_4514 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: mics_4514 + update_interval: 60s + nitrogen_dioxide: + name: MICS-4514 NO2 + carbon_monoxide: + name: MICS-4514 CO + methane: + name: MICS-4514 CH4 + hydrogen: + name: MICS-4514 H2 + ethanol: + name: MICS-4514 C2H5OH + ammonia: + name: MICS-4514 NH3 diff --git a/tests/components/mics_4514/test.esp32-ard.yaml b/tests/components/mics_4514/test.esp32-ard.yaml index 234839c91c..63c3bd6afd 100644 --- a/tests/components/mics_4514/test.esp32-ard.yaml +++ b/tests/components/mics_4514/test.esp32-ard.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_mics_4514 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: mics_4514 - update_interval: 60s - nitrogen_dioxide: - name: MICS-4514 NO2 - carbon_monoxide: - name: MICS-4514 CO - methane: - name: MICS-4514 CH4 - hydrogen: - name: MICS-4514 H2 - ethanol: - name: MICS-4514 C2H5OH - ammonia: - name: MICS-4514 NH3 +<<: !include common.yaml diff --git a/tests/components/mics_4514/test.esp32-c3-ard.yaml b/tests/components/mics_4514/test.esp32-c3-ard.yaml index 72369bec01..ee2c29ca4e 100644 --- a/tests/components/mics_4514/test.esp32-c3-ard.yaml +++ b/tests/components/mics_4514/test.esp32-c3-ard.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_mics_4514 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mics_4514 - update_interval: 60s - nitrogen_dioxide: - name: MICS-4514 NO2 - carbon_monoxide: - name: MICS-4514 CO - methane: - name: MICS-4514 CH4 - hydrogen: - name: MICS-4514 H2 - ethanol: - name: MICS-4514 C2H5OH - ammonia: - name: MICS-4514 NH3 +<<: !include common.yaml diff --git a/tests/components/mics_4514/test.esp32-c3-idf.yaml b/tests/components/mics_4514/test.esp32-c3-idf.yaml index 72369bec01..ee2c29ca4e 100644 --- a/tests/components/mics_4514/test.esp32-c3-idf.yaml +++ b/tests/components/mics_4514/test.esp32-c3-idf.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_mics_4514 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mics_4514 - update_interval: 60s - nitrogen_dioxide: - name: MICS-4514 NO2 - carbon_monoxide: - name: MICS-4514 CO - methane: - name: MICS-4514 CH4 - hydrogen: - name: MICS-4514 H2 - ethanol: - name: MICS-4514 C2H5OH - ammonia: - name: MICS-4514 NH3 +<<: !include common.yaml diff --git a/tests/components/mics_4514/test.esp32-idf.yaml b/tests/components/mics_4514/test.esp32-idf.yaml index 234839c91c..63c3bd6afd 100644 --- a/tests/components/mics_4514/test.esp32-idf.yaml +++ b/tests/components/mics_4514/test.esp32-idf.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_mics_4514 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: mics_4514 - update_interval: 60s - nitrogen_dioxide: - name: MICS-4514 NO2 - carbon_monoxide: - name: MICS-4514 CO - methane: - name: MICS-4514 CH4 - hydrogen: - name: MICS-4514 H2 - ethanol: - name: MICS-4514 C2H5OH - ammonia: - name: MICS-4514 NH3 +<<: !include common.yaml diff --git a/tests/components/mics_4514/test.esp8266-ard.yaml b/tests/components/mics_4514/test.esp8266-ard.yaml index 72369bec01..ee2c29ca4e 100644 --- a/tests/components/mics_4514/test.esp8266-ard.yaml +++ b/tests/components/mics_4514/test.esp8266-ard.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_mics_4514 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mics_4514 - update_interval: 60s - nitrogen_dioxide: - name: MICS-4514 NO2 - carbon_monoxide: - name: MICS-4514 CO - methane: - name: MICS-4514 CH4 - hydrogen: - name: MICS-4514 H2 - ethanol: - name: MICS-4514 C2H5OH - ammonia: - name: MICS-4514 NH3 +<<: !include common.yaml diff --git a/tests/components/mics_4514/test.rp2040-ard.yaml b/tests/components/mics_4514/test.rp2040-ard.yaml index 72369bec01..ee2c29ca4e 100644 --- a/tests/components/mics_4514/test.rp2040-ard.yaml +++ b/tests/components/mics_4514/test.rp2040-ard.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_mics_4514 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mics_4514 - update_interval: 60s - nitrogen_dioxide: - name: MICS-4514 NO2 - carbon_monoxide: - name: MICS-4514 CO - methane: - name: MICS-4514 CH4 - hydrogen: - name: MICS-4514 H2 - ethanol: - name: MICS-4514 C2H5OH - ammonia: - name: MICS-4514 NH3 +<<: !include common.yaml diff --git a/tests/components/midea/common.yaml b/tests/components/midea/common.yaml new file mode 100644 index 0000000000..07385e29a1 --- /dev/null +++ b/tests/components/midea/common.yaml @@ -0,0 +1,59 @@ +wifi: + ssid: MySSID + password: password1 + +remote_transmitter: + pin: ${pin} + carrier_duty_percent: 50% + +uart: + - id: uart_midea + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} + baud_rate: 9600 + +climate: + - platform: midea + id: midea_unit + name: Midea Climate + on_control: + - logger.log: Control message received! + - lambda: |- + x.set_mode(CLIMATE_MODE_FAN_ONLY); + on_state: + - logger.log: State changed! + transmitter_id: + period: 1s + num_attempts: 5 + timeout: 2s + beeper: false + autoconf: true + visual: + min_temperature: 17 °C + max_temperature: 30 °C + temperature_step: 0.5 °C + supported_modes: + - FAN_ONLY + - HEAT_COOL + - COOL + - HEAT + - DRY + custom_fan_modes: + - SILENT + - TURBO + supported_presets: + - ECO + - BOOST + - SLEEP + custom_presets: + - FREEZE_PROTECTION + supported_swing_modes: + - VERTICAL + - HORIZONTAL + - BOTH + outdoor_temperature: + name: Temp + power_usage: + name: Power + humidity_setpoint: + name: Humidity diff --git a/tests/components/midea/test.esp32-ard.yaml b/tests/components/midea/test.esp32-ard.yaml index 5c638b9613..7f55d6a52d 100644 --- a/tests/components/midea/test.esp32-ard.yaml +++ b/tests/components/midea/test.esp32-ard.yaml @@ -1,59 +1,6 @@ -wifi: - ssid: MySSID - password: password1 +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 + pin: GPIO2 -remote_transmitter: - pin: 18 - carrier_duty_percent: 50% - -uart: - - id: uart_midea - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 - -climate: - - platform: midea - id: midea_unit - name: Midea Climate - on_control: - - logger.log: Control message received! - - lambda: |- - x.set_mode(CLIMATE_MODE_FAN_ONLY); - on_state: - - logger.log: State changed! - transmitter_id: - period: 1s - num_attempts: 5 - timeout: 2s - beeper: false - autoconf: true - visual: - min_temperature: 17 °C - max_temperature: 30 °C - temperature_step: 0.5 °C - supported_modes: - - FAN_ONLY - - HEAT_COOL - - COOL - - HEAT - - DRY - custom_fan_modes: - - SILENT - - TURBO - supported_presets: - - ECO - - BOOST - - SLEEP - custom_presets: - - FREEZE_PROTECTION - supported_swing_modes: - - VERTICAL - - HORIZONTAL - - BOTH - outdoor_temperature: - name: Temp - power_usage: - name: Power - humidity_setpoint: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/midea/test.esp32-c3-ard.yaml b/tests/components/midea/test.esp32-c3-ard.yaml index bcb8635eaf..a879df3ca4 100644 --- a/tests/components/midea/test.esp32-c3-ard.yaml +++ b/tests/components/midea/test.esp32-c3-ard.yaml @@ -1,59 +1,6 @@ -wifi: - ssid: MySSID - password: password1 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + pin: GPIO2 -remote_transmitter: - pin: 2 - carrier_duty_percent: 50% - -uart: - - id: uart_midea - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 - -climate: - - platform: midea - id: midea_unit - name: Midea Climate - on_control: - - logger.log: Control message received! - - lambda: |- - x.set_mode(CLIMATE_MODE_FAN_ONLY); - on_state: - - logger.log: State changed! - transmitter_id: - period: 1s - num_attempts: 5 - timeout: 2s - beeper: false - autoconf: true - visual: - min_temperature: 17 °C - max_temperature: 30 °C - temperature_step: 0.5 °C - supported_modes: - - FAN_ONLY - - HEAT_COOL - - COOL - - HEAT - - DRY - custom_fan_modes: - - SILENT - - TURBO - supported_presets: - - ECO - - BOOST - - SLEEP - custom_presets: - - FREEZE_PROTECTION - supported_swing_modes: - - VERTICAL - - HORIZONTAL - - BOTH - outdoor_temperature: - name: Temp - power_usage: - name: Power - humidity_setpoint: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/midea/test.esp8266-ard.yaml b/tests/components/midea/test.esp8266-ard.yaml index b0ed7eb472..4f50bd7e5e 100644 --- a/tests/components/midea/test.esp8266-ard.yaml +++ b/tests/components/midea/test.esp8266-ard.yaml @@ -1,59 +1,6 @@ -wifi: - ssid: MySSID - password: password1 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + pin: GPIO15 -remote_transmitter: - pin: 12 - carrier_duty_percent: 50% - -uart: - - id: uart_midea - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 - -climate: - - platform: midea - id: midea_unit - name: Midea Climate - on_control: - - logger.log: Control message received! - - lambda: |- - x.set_mode(CLIMATE_MODE_FAN_ONLY); - on_state: - - logger.log: State changed! - transmitter_id: - period: 1s - num_attempts: 5 - timeout: 2s - beeper: false - autoconf: true - visual: - min_temperature: 17 °C - max_temperature: 30 °C - temperature_step: 0.5 °C - supported_modes: - - FAN_ONLY - - HEAT_COOL - - COOL - - HEAT - - DRY - custom_fan_modes: - - SILENT - - TURBO - supported_presets: - - ECO - - BOOST - - SLEEP - custom_presets: - - FREEZE_PROTECTION - supported_swing_modes: - - VERTICAL - - HORIZONTAL - - BOTH - outdoor_temperature: - name: Temp - power_usage: - name: Power - humidity_setpoint: - name: Humidity +<<: !include common.yaml diff --git a/tests/components/mixer/common.yaml b/tests/components/mixer/common.yaml new file mode 100644 index 0000000000..e171b9499c --- /dev/null +++ b/tests/components/mixer/common.yaml @@ -0,0 +1,23 @@ +esphome: + on_boot: + then: + - mixer_speaker.apply_ducking: + id: source_speaker_1_id + decibel_reduction: 10 + duration: 1s + +i2s_audio: + i2s_lrclk_pin: ${lrclk_pin} + i2s_bclk_pin: ${bclk_pin} + i2s_mclk_pin: ${mclk_pin} + +speaker: + - platform: i2s_audio + id: speaker_id + dac_type: external + i2s_dout_pin: ${dout_pin} + - platform: mixer + output_speaker: speaker_id + source_speakers: + - id: source_speaker_1_id + - id: source_speaker_2_id diff --git a/tests/components/mixer/test.esp32-ard.yaml b/tests/components/mixer/test.esp32-ard.yaml new file mode 100644 index 0000000000..96d2d37458 --- /dev/null +++ b/tests/components/mixer/test.esp32-ard.yaml @@ -0,0 +1,7 @@ +substitutions: + lrclk_pin: GPIO16 + bclk_pin: GPIO17 + mclk_pin: GPIO15 + dout_pin: GPIO14 + +<<: !include common.yaml diff --git a/tests/components/mixer/test.esp32-c3-ard.yaml b/tests/components/mixer/test.esp32-c3-ard.yaml new file mode 100644 index 0000000000..f1721f0862 --- /dev/null +++ b/tests/components/mixer/test.esp32-c3-ard.yaml @@ -0,0 +1,7 @@ +substitutions: + lrclk_pin: GPIO4 + bclk_pin: GPIO5 + mclk_pin: GPIO6 + dout_pin: GPIO7 + +<<: !include common.yaml diff --git a/tests/components/mixer/test.esp32-c3-idf.yaml b/tests/components/mixer/test.esp32-c3-idf.yaml new file mode 100644 index 0000000000..f1721f0862 --- /dev/null +++ b/tests/components/mixer/test.esp32-c3-idf.yaml @@ -0,0 +1,7 @@ +substitutions: + lrclk_pin: GPIO4 + bclk_pin: GPIO5 + mclk_pin: GPIO6 + dout_pin: GPIO7 + +<<: !include common.yaml diff --git a/tests/components/mixer/test.esp32-idf.yaml b/tests/components/mixer/test.esp32-idf.yaml new file mode 100644 index 0000000000..96d2d37458 --- /dev/null +++ b/tests/components/mixer/test.esp32-idf.yaml @@ -0,0 +1,7 @@ +substitutions: + lrclk_pin: GPIO16 + bclk_pin: GPIO17 + mclk_pin: GPIO15 + dout_pin: GPIO14 + +<<: !include common.yaml diff --git a/tests/components/mixer/test.esp32-s3-ard.yaml b/tests/components/mixer/test.esp32-s3-ard.yaml new file mode 100644 index 0000000000..f1721f0862 --- /dev/null +++ b/tests/components/mixer/test.esp32-s3-ard.yaml @@ -0,0 +1,7 @@ +substitutions: + lrclk_pin: GPIO4 + bclk_pin: GPIO5 + mclk_pin: GPIO6 + dout_pin: GPIO7 + +<<: !include common.yaml diff --git a/tests/components/mixer/test.esp32-s3-idf.yaml b/tests/components/mixer/test.esp32-s3-idf.yaml new file mode 100644 index 0000000000..f1721f0862 --- /dev/null +++ b/tests/components/mixer/test.esp32-s3-idf.yaml @@ -0,0 +1,7 @@ +substitutions: + lrclk_pin: GPIO4 + bclk_pin: GPIO5 + mclk_pin: GPIO6 + dout_pin: GPIO7 + +<<: !include common.yaml diff --git a/tests/components/mlx90393/common.yaml b/tests/components/mlx90393/common.yaml new file mode 100644 index 0000000000..a7ab0867cc --- /dev/null +++ b/tests/components/mlx90393/common.yaml @@ -0,0 +1,20 @@ +i2c: + - id: i2c_mlx90393 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: mlx90393 + oversampling: 1 + filter: 0 + gain: 3X + x_axis: + name: mlxxaxis + y_axis: + name: mlxyaxis + z_axis: + name: mlxzaxis + resolution: 17BIT + temperature: + name: mlxtemp + oversampling: 2 diff --git a/tests/components/mlx90393/test.esp32-ard.yaml b/tests/components/mlx90393/test.esp32-ard.yaml index 089fd136f4..63c3bd6afd 100644 --- a/tests/components/mlx90393/test.esp32-ard.yaml +++ b/tests/components/mlx90393/test.esp32-ard.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_mlx90393 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: mlx90393 - oversampling: 1 - filter: 0 - gain: 3X - x_axis: - name: mlxxaxis - y_axis: - name: mlxyaxis - z_axis: - name: mlxzaxis - resolution: 17BIT - temperature: - name: mlxtemp - oversampling: 2 +<<: !include common.yaml diff --git a/tests/components/mlx90393/test.esp32-c3-ard.yaml b/tests/components/mlx90393/test.esp32-c3-ard.yaml index 549eea8032..ee2c29ca4e 100644 --- a/tests/components/mlx90393/test.esp32-c3-ard.yaml +++ b/tests/components/mlx90393/test.esp32-c3-ard.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_mlx90393 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mlx90393 - oversampling: 1 - filter: 0 - gain: 3X - x_axis: - name: mlxxaxis - y_axis: - name: mlxyaxis - z_axis: - name: mlxzaxis - resolution: 17BIT - temperature: - name: mlxtemp - oversampling: 2 +<<: !include common.yaml diff --git a/tests/components/mlx90393/test.esp32-c3-idf.yaml b/tests/components/mlx90393/test.esp32-c3-idf.yaml index 549eea8032..ee2c29ca4e 100644 --- a/tests/components/mlx90393/test.esp32-c3-idf.yaml +++ b/tests/components/mlx90393/test.esp32-c3-idf.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_mlx90393 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mlx90393 - oversampling: 1 - filter: 0 - gain: 3X - x_axis: - name: mlxxaxis - y_axis: - name: mlxyaxis - z_axis: - name: mlxzaxis - resolution: 17BIT - temperature: - name: mlxtemp - oversampling: 2 +<<: !include common.yaml diff --git a/tests/components/mlx90393/test.esp32-idf.yaml b/tests/components/mlx90393/test.esp32-idf.yaml index 089fd136f4..63c3bd6afd 100644 --- a/tests/components/mlx90393/test.esp32-idf.yaml +++ b/tests/components/mlx90393/test.esp32-idf.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_mlx90393 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: mlx90393 - oversampling: 1 - filter: 0 - gain: 3X - x_axis: - name: mlxxaxis - y_axis: - name: mlxyaxis - z_axis: - name: mlxzaxis - resolution: 17BIT - temperature: - name: mlxtemp - oversampling: 2 +<<: !include common.yaml diff --git a/tests/components/mlx90393/test.esp8266-ard.yaml b/tests/components/mlx90393/test.esp8266-ard.yaml index 549eea8032..ee2c29ca4e 100644 --- a/tests/components/mlx90393/test.esp8266-ard.yaml +++ b/tests/components/mlx90393/test.esp8266-ard.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_mlx90393 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mlx90393 - oversampling: 1 - filter: 0 - gain: 3X - x_axis: - name: mlxxaxis - y_axis: - name: mlxyaxis - z_axis: - name: mlxzaxis - resolution: 17BIT - temperature: - name: mlxtemp - oversampling: 2 +<<: !include common.yaml diff --git a/tests/components/mlx90393/test.rp2040-ard.yaml b/tests/components/mlx90393/test.rp2040-ard.yaml index 549eea8032..ee2c29ca4e 100644 --- a/tests/components/mlx90393/test.rp2040-ard.yaml +++ b/tests/components/mlx90393/test.rp2040-ard.yaml @@ -1,20 +1,5 @@ -i2c: - - id: i2c_mlx90393 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mlx90393 - oversampling: 1 - filter: 0 - gain: 3X - x_axis: - name: mlxxaxis - y_axis: - name: mlxyaxis - z_axis: - name: mlxzaxis - resolution: 17BIT - temperature: - name: mlxtemp - oversampling: 2 +<<: !include common.yaml diff --git a/tests/components/mlx90614/common.yaml b/tests/components/mlx90614/common.yaml new file mode 100644 index 0000000000..03279e6e14 --- /dev/null +++ b/tests/components/mlx90614/common.yaml @@ -0,0 +1,12 @@ +i2c: + - id: i2c_mlx90614 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: mlx90614 + ambient: + name: Ambient + object: + name: Object + emissivity: 1.0 diff --git a/tests/components/mlx90614/test.esp32-ard.yaml b/tests/components/mlx90614/test.esp32-ard.yaml index 8c1ee68f42..63c3bd6afd 100644 --- a/tests/components/mlx90614/test.esp32-ard.yaml +++ b/tests/components/mlx90614/test.esp32-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_mlx90614 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: mlx90614 - ambient: - name: Ambient - object: - name: Object - emissivity: 1.0 +<<: !include common.yaml diff --git a/tests/components/mlx90614/test.esp32-c3-ard.yaml b/tests/components/mlx90614/test.esp32-c3-ard.yaml index a863e0ee2e..ee2c29ca4e 100644 --- a/tests/components/mlx90614/test.esp32-c3-ard.yaml +++ b/tests/components/mlx90614/test.esp32-c3-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_mlx90614 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mlx90614 - ambient: - name: Ambient - object: - name: Object - emissivity: 1.0 +<<: !include common.yaml diff --git a/tests/components/mlx90614/test.esp32-c3-idf.yaml b/tests/components/mlx90614/test.esp32-c3-idf.yaml index a863e0ee2e..ee2c29ca4e 100644 --- a/tests/components/mlx90614/test.esp32-c3-idf.yaml +++ b/tests/components/mlx90614/test.esp32-c3-idf.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_mlx90614 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mlx90614 - ambient: - name: Ambient - object: - name: Object - emissivity: 1.0 +<<: !include common.yaml diff --git a/tests/components/mlx90614/test.esp32-idf.yaml b/tests/components/mlx90614/test.esp32-idf.yaml index 8c1ee68f42..63c3bd6afd 100644 --- a/tests/components/mlx90614/test.esp32-idf.yaml +++ b/tests/components/mlx90614/test.esp32-idf.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_mlx90614 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: mlx90614 - ambient: - name: Ambient - object: - name: Object - emissivity: 1.0 +<<: !include common.yaml diff --git a/tests/components/mlx90614/test.esp8266-ard.yaml b/tests/components/mlx90614/test.esp8266-ard.yaml index a863e0ee2e..ee2c29ca4e 100644 --- a/tests/components/mlx90614/test.esp8266-ard.yaml +++ b/tests/components/mlx90614/test.esp8266-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_mlx90614 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mlx90614 - ambient: - name: Ambient - object: - name: Object - emissivity: 1.0 +<<: !include common.yaml diff --git a/tests/components/mlx90614/test.rp2040-ard.yaml b/tests/components/mlx90614/test.rp2040-ard.yaml index a863e0ee2e..ee2c29ca4e 100644 --- a/tests/components/mlx90614/test.rp2040-ard.yaml +++ b/tests/components/mlx90614/test.rp2040-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_mlx90614 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mlx90614 - ambient: - name: Ambient - object: - name: Object - emissivity: 1.0 +<<: !include common.yaml diff --git a/tests/components/mmc5603/common.yaml b/tests/components/mmc5603/common.yaml new file mode 100644 index 0000000000..83235f596e --- /dev/null +++ b/tests/components/mmc5603/common.yaml @@ -0,0 +1,14 @@ +i2c: + - id: i2c_mmc5603 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: mmc5603 + address: 0x30 + field_strength_x: + name: HMC5883L Field Strength X + field_strength_y: + name: HMC5883L Field Strength Y + field_strength_z: + name: HMC5883L Field Strength Z diff --git a/tests/components/mmc5603/test.esp32-ard.yaml b/tests/components/mmc5603/test.esp32-ard.yaml index fbb83cd9f8..63c3bd6afd 100644 --- a/tests/components/mmc5603/test.esp32-ard.yaml +++ b/tests/components/mmc5603/test.esp32-ard.yaml @@ -1,14 +1,5 @@ -i2c: - - id: i2c_mmc5603 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: mmc5603 - address: 0x30 - field_strength_x: - name: HMC5883L Field Strength X - field_strength_y: - name: HMC5883L Field Strength Y - field_strength_z: - name: HMC5883L Field Strength Z +<<: !include common.yaml diff --git a/tests/components/mmc5603/test.esp32-c3-ard.yaml b/tests/components/mmc5603/test.esp32-c3-ard.yaml index 834591bb39..ee2c29ca4e 100644 --- a/tests/components/mmc5603/test.esp32-c3-ard.yaml +++ b/tests/components/mmc5603/test.esp32-c3-ard.yaml @@ -1,14 +1,5 @@ -i2c: - - id: i2c_mmc5603 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mmc5603 - address: 0x30 - field_strength_x: - name: HMC5883L Field Strength X - field_strength_y: - name: HMC5883L Field Strength Y - field_strength_z: - name: HMC5883L Field Strength Z +<<: !include common.yaml diff --git a/tests/components/mmc5603/test.esp32-c3-idf.yaml b/tests/components/mmc5603/test.esp32-c3-idf.yaml index 834591bb39..ee2c29ca4e 100644 --- a/tests/components/mmc5603/test.esp32-c3-idf.yaml +++ b/tests/components/mmc5603/test.esp32-c3-idf.yaml @@ -1,14 +1,5 @@ -i2c: - - id: i2c_mmc5603 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mmc5603 - address: 0x30 - field_strength_x: - name: HMC5883L Field Strength X - field_strength_y: - name: HMC5883L Field Strength Y - field_strength_z: - name: HMC5883L Field Strength Z +<<: !include common.yaml diff --git a/tests/components/mmc5603/test.esp32-idf.yaml b/tests/components/mmc5603/test.esp32-idf.yaml index fbb83cd9f8..63c3bd6afd 100644 --- a/tests/components/mmc5603/test.esp32-idf.yaml +++ b/tests/components/mmc5603/test.esp32-idf.yaml @@ -1,14 +1,5 @@ -i2c: - - id: i2c_mmc5603 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: mmc5603 - address: 0x30 - field_strength_x: - name: HMC5883L Field Strength X - field_strength_y: - name: HMC5883L Field Strength Y - field_strength_z: - name: HMC5883L Field Strength Z +<<: !include common.yaml diff --git a/tests/components/mmc5603/test.esp8266-ard.yaml b/tests/components/mmc5603/test.esp8266-ard.yaml index 834591bb39..ee2c29ca4e 100644 --- a/tests/components/mmc5603/test.esp8266-ard.yaml +++ b/tests/components/mmc5603/test.esp8266-ard.yaml @@ -1,14 +1,5 @@ -i2c: - - id: i2c_mmc5603 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mmc5603 - address: 0x30 - field_strength_x: - name: HMC5883L Field Strength X - field_strength_y: - name: HMC5883L Field Strength Y - field_strength_z: - name: HMC5883L Field Strength Z +<<: !include common.yaml diff --git a/tests/components/mmc5603/test.rp2040-ard.yaml b/tests/components/mmc5603/test.rp2040-ard.yaml index 834591bb39..ee2c29ca4e 100644 --- a/tests/components/mmc5603/test.rp2040-ard.yaml +++ b/tests/components/mmc5603/test.rp2040-ard.yaml @@ -1,14 +1,5 @@ -i2c: - - id: i2c_mmc5603 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mmc5603 - address: 0x30 - field_strength_x: - name: HMC5883L Field Strength X - field_strength_y: - name: HMC5883L Field Strength Y - field_strength_z: - name: HMC5883L Field Strength Z +<<: !include common.yaml diff --git a/tests/components/mmc5983/common.yaml b/tests/components/mmc5983/common.yaml new file mode 100644 index 0000000000..949ff527e7 --- /dev/null +++ b/tests/components/mmc5983/common.yaml @@ -0,0 +1,16 @@ +i2c: + - id: i2c_mmc5983 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: mmc5983 + field_strength_x: + name: "Magnet X" + id: magnet_x + field_strength_y: + name: "Magnet Y" + id: magnet_y + field_strength_z: + name: "Magnet Z" + id: magnet_z diff --git a/tests/components/mmc5983/test.esp32-ard.yaml b/tests/components/mmc5983/test.esp32-ard.yaml index 6104be9b83..63c3bd6afd 100644 --- a/tests/components/mmc5983/test.esp32-ard.yaml +++ b/tests/components/mmc5983/test.esp32-ard.yaml @@ -1,16 +1,5 @@ -i2c: - - id: i2c_mmc5983 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: mmc5983 - field_strength_x: - name: "Magnet X" - id: magnet_x - field_strength_y: - name: "Magnet Y" - id: magnet_y - field_strength_z: - name: "Magnet Z" - id: magnet_z +<<: !include common.yaml diff --git a/tests/components/mmc5983/test.esp32-c3-ard.yaml b/tests/components/mmc5983/test.esp32-c3-ard.yaml index 68d821e9a5..ee2c29ca4e 100644 --- a/tests/components/mmc5983/test.esp32-c3-ard.yaml +++ b/tests/components/mmc5983/test.esp32-c3-ard.yaml @@ -1,16 +1,5 @@ -i2c: - - id: i2c_mmc5983 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mmc5983 - field_strength_x: - name: "Magnet X" - id: magnet_x - field_strength_y: - name: "Magnet Y" - id: magnet_y - field_strength_z: - name: "Magnet Z" - id: magnet_z +<<: !include common.yaml diff --git a/tests/components/mmc5983/test.esp32-c3-idf.yaml b/tests/components/mmc5983/test.esp32-c3-idf.yaml index 68d821e9a5..ee2c29ca4e 100644 --- a/tests/components/mmc5983/test.esp32-c3-idf.yaml +++ b/tests/components/mmc5983/test.esp32-c3-idf.yaml @@ -1,16 +1,5 @@ -i2c: - - id: i2c_mmc5983 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mmc5983 - field_strength_x: - name: "Magnet X" - id: magnet_x - field_strength_y: - name: "Magnet Y" - id: magnet_y - field_strength_z: - name: "Magnet Z" - id: magnet_z +<<: !include common.yaml diff --git a/tests/components/mmc5983/test.esp32-idf.yaml b/tests/components/mmc5983/test.esp32-idf.yaml index 6104be9b83..63c3bd6afd 100644 --- a/tests/components/mmc5983/test.esp32-idf.yaml +++ b/tests/components/mmc5983/test.esp32-idf.yaml @@ -1,16 +1,5 @@ -i2c: - - id: i2c_mmc5983 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: mmc5983 - field_strength_x: - name: "Magnet X" - id: magnet_x - field_strength_y: - name: "Magnet Y" - id: magnet_y - field_strength_z: - name: "Magnet Z" - id: magnet_z +<<: !include common.yaml diff --git a/tests/components/mmc5983/test.esp8266-ard.yaml b/tests/components/mmc5983/test.esp8266-ard.yaml index 68d821e9a5..ee2c29ca4e 100644 --- a/tests/components/mmc5983/test.esp8266-ard.yaml +++ b/tests/components/mmc5983/test.esp8266-ard.yaml @@ -1,16 +1,5 @@ -i2c: - - id: i2c_mmc5983 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mmc5983 - field_strength_x: - name: "Magnet X" - id: magnet_x - field_strength_y: - name: "Magnet Y" - id: magnet_y - field_strength_z: - name: "Magnet Z" - id: magnet_z +<<: !include common.yaml diff --git a/tests/components/mmc5983/test.rp2040-ard.yaml b/tests/components/mmc5983/test.rp2040-ard.yaml index 68d821e9a5..ee2c29ca4e 100644 --- a/tests/components/mmc5983/test.rp2040-ard.yaml +++ b/tests/components/mmc5983/test.rp2040-ard.yaml @@ -1,16 +1,5 @@ -i2c: - - id: i2c_mmc5983 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mmc5983 - field_strength_x: - name: "Magnet X" - id: magnet_x - field_strength_y: - name: "Magnet Y" - id: magnet_y - field_strength_z: - name: "Magnet Z" - id: magnet_z +<<: !include common.yaml diff --git a/tests/components/modbus/common.yaml b/tests/components/modbus/common.yaml new file mode 100644 index 0000000000..3ec9518585 --- /dev/null +++ b/tests/components/modbus/common.yaml @@ -0,0 +1,9 @@ +uart: + - id: uart_modbus + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} + baud_rate: 9600 + +modbus: + id: mod_bus1 + flow_control_pin: ${flow_control_pin} diff --git a/tests/components/modbus/test.esp32-ard.yaml b/tests/components/modbus/test.esp32-ard.yaml index 20cf238b1b..bd767a8ece 100644 --- a/tests/components/modbus/test.esp32-ard.yaml +++ b/tests/components/modbus/test.esp32-ard.yaml @@ -1,9 +1,6 @@ -uart: - - id: uart_modbus - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 + flow_control_pin: GPIO13 -modbus: - id: mod_bus1 - flow_control_pin: 15 +<<: !include common.yaml diff --git a/tests/components/modbus/test.esp32-c3-ard.yaml b/tests/components/modbus/test.esp32-c3-ard.yaml index d22b507be0..452031a5aa 100644 --- a/tests/components/modbus/test.esp32-c3-ard.yaml +++ b/tests/components/modbus/test.esp32-c3-ard.yaml @@ -1,9 +1,6 @@ -uart: - - id: uart_modbus - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + flow_control_pin: GPIO3 -modbus: - id: mod_bus1 - flow_control_pin: 6 +<<: !include common.yaml diff --git a/tests/components/modbus/test.esp32-c3-idf.yaml b/tests/components/modbus/test.esp32-c3-idf.yaml index d22b507be0..452031a5aa 100644 --- a/tests/components/modbus/test.esp32-c3-idf.yaml +++ b/tests/components/modbus/test.esp32-c3-idf.yaml @@ -1,9 +1,6 @@ -uart: - - id: uart_modbus - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + flow_control_pin: GPIO3 -modbus: - id: mod_bus1 - flow_control_pin: 6 +<<: !include common.yaml diff --git a/tests/components/modbus/test.esp32-idf.yaml b/tests/components/modbus/test.esp32-idf.yaml index 20cf238b1b..bd767a8ece 100644 --- a/tests/components/modbus/test.esp32-idf.yaml +++ b/tests/components/modbus/test.esp32-idf.yaml @@ -1,9 +1,6 @@ -uart: - - id: uart_modbus - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 +substitutions: + tx_pin: GPIO12 + rx_pin: GPIO14 + flow_control_pin: GPIO13 -modbus: - id: mod_bus1 - flow_control_pin: 15 +<<: !include common.yaml diff --git a/tests/components/modbus/test.esp8266-ard.yaml b/tests/components/modbus/test.esp8266-ard.yaml index 560c044766..29c98d0957 100644 --- a/tests/components/modbus/test.esp8266-ard.yaml +++ b/tests/components/modbus/test.esp8266-ard.yaml @@ -1,9 +1,6 @@ -uart: - - id: uart_modbus - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + flow_control_pin: GPIO13 -modbus: - id: mod_bus1 - flow_control_pin: 12 +<<: !include common.yaml diff --git a/tests/components/modbus/test.rp2040-ard.yaml b/tests/components/modbus/test.rp2040-ard.yaml index d22b507be0..452031a5aa 100644 --- a/tests/components/modbus/test.rp2040-ard.yaml +++ b/tests/components/modbus/test.rp2040-ard.yaml @@ -1,9 +1,6 @@ -uart: - - id: uart_modbus - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + flow_control_pin: GPIO3 -modbus: - id: mod_bus1 - flow_control_pin: 6 +<<: !include common.yaml diff --git a/tests/components/modbus_controller/common.yaml b/tests/components/modbus_controller/common.yaml new file mode 100644 index 0000000000..93d8391ff5 --- /dev/null +++ b/tests/components/modbus_controller/common.yaml @@ -0,0 +1,35 @@ +uart: + - id: uart_modbus_client + tx_pin: ${client_tx_pin} + rx_pin: ${client_rx_pin} + baud_rate: 9600 + - id: uart_modbus_server + tx_pin: ${server_tx_pin} + rx_pin: ${server_rx_pin} + baud_rate: 9600 + +modbus: + - id: mod_bus1 + uart_id: uart_modbus_client + flow_control_pin: ${flow_control_pin} + - id: mod_bus2 + uart_id: uart_modbus_server + role: server + +modbus_controller: + - id: modbus_controller1 + address: 0x2 + modbus_id: mod_bus1 + allow_duplicate_commands: false + on_online: + then: + logger.log: "Module Online" + - id: modbus_controller2 + address: 0x2 + modbus_id: mod_bus2 + server_registers: + - address: 0x0000 + value_type: S_DWORD_R + read_lambda: |- + return 42.3; + max_cmd_retries: 0 diff --git a/tests/components/modbus_controller/test.esp32-ard.yaml b/tests/components/modbus_controller/test.esp32-ard.yaml index f5c5c10125..548b8c0666 100644 --- a/tests/components/modbus_controller/test.esp32-ard.yaml +++ b/tests/components/modbus_controller/test.esp32-ard.yaml @@ -1,35 +1,8 @@ -uart: - - id: uart_modbus_client - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 - - id: uart_modbus_server - tx_pin: 1 - rx_pin: 3 - baud_rate: 9600 +substitutions: + client_tx_pin: GPIO12 + client_rx_pin: GPIO14 + server_tx_pin: GPIO16 + server_rx_pin: GPIO17 + flow_control_pin: GPIO13 -modbus: - - id: mod_bus1 - uart_id: uart_modbus_client - flow_control_pin: 15 - - id: mod_bus2 - uart_id: uart_modbus_server - role: server - -modbus_controller: - - id: modbus_controller1 - address: 0x2 - modbus_id: mod_bus1 - allow_duplicate_commands: false - on_online: - then: - logger.log: "Module Online" - - id: modbus_controller2 - address: 0x2 - modbus_id: mod_bus2 - server_registers: - - address: 0x0000 - value_type: S_DWORD_R - read_lambda: |- - return 42.3; - max_cmd_retries: 0 +<<: !include common.yaml diff --git a/tests/components/modbus_controller/test.esp32-c3-ard.yaml b/tests/components/modbus_controller/test.esp32-c3-ard.yaml index 476e65ecb0..f5b770ff58 100644 --- a/tests/components/modbus_controller/test.esp32-c3-ard.yaml +++ b/tests/components/modbus_controller/test.esp32-c3-ard.yaml @@ -1,14 +1,8 @@ -uart: - - id: uart_modbus - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + client_tx_pin: GPIO4 + client_rx_pin: GPIO5 + server_tx_pin: GPIO6 + server_rx_pin: GPIO7 + flow_control_pin: GPIO3 -modbus: - id: mod_bus1 - flow_control_pin: 6 - -modbus_controller: - - id: modbus_controller1 - address: 0x2 - modbus_id: mod_bus1 +<<: !include common.yaml diff --git a/tests/components/modbus_controller/test.esp32-c3-idf.yaml b/tests/components/modbus_controller/test.esp32-c3-idf.yaml index 476e65ecb0..f5b770ff58 100644 --- a/tests/components/modbus_controller/test.esp32-c3-idf.yaml +++ b/tests/components/modbus_controller/test.esp32-c3-idf.yaml @@ -1,14 +1,8 @@ -uart: - - id: uart_modbus - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + client_tx_pin: GPIO4 + client_rx_pin: GPIO5 + server_tx_pin: GPIO6 + server_rx_pin: GPIO7 + flow_control_pin: GPIO3 -modbus: - id: mod_bus1 - flow_control_pin: 6 - -modbus_controller: - - id: modbus_controller1 - address: 0x2 - modbus_id: mod_bus1 +<<: !include common.yaml diff --git a/tests/components/modbus_controller/test.esp32-idf.yaml b/tests/components/modbus_controller/test.esp32-idf.yaml index 0e1849dd88..548b8c0666 100644 --- a/tests/components/modbus_controller/test.esp32-idf.yaml +++ b/tests/components/modbus_controller/test.esp32-idf.yaml @@ -1,19 +1,8 @@ -uart: - - id: uart_modbus - tx_pin: 17 - rx_pin: 16 - baud_rate: 9600 +substitutions: + client_tx_pin: GPIO12 + client_rx_pin: GPIO14 + server_tx_pin: GPIO16 + server_rx_pin: GPIO17 + flow_control_pin: GPIO13 -modbus: - id: mod_bus1 - flow_control_pin: 15 - -modbus_controller: - - id: modbus_controller1 - address: 0x2 - modbus_id: mod_bus1 - allow_duplicate_commands: true - on_offline: - then: - logger.log: "Module Offline" - max_cmd_retries: 10 +<<: !include common.yaml diff --git a/tests/components/modbus_controller/test.esp8266-ard.yaml b/tests/components/modbus_controller/test.esp8266-ard.yaml index 67cac65d1b..c68a57cbde 100644 --- a/tests/components/modbus_controller/test.esp8266-ard.yaml +++ b/tests/components/modbus_controller/test.esp8266-ard.yaml @@ -1,14 +1,8 @@ -uart: - - id: uart_modbus - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + client_tx_pin: GPIO1 + client_rx_pin: GPIO3 + server_tx_pin: GPIO4 + server_rx_pin: GPIO5 + flow_control_pin: GPIO13 -modbus: - id: mod_bus1 - flow_control_pin: 12 - -modbus_controller: - - id: modbus_controller1 - address: 0x2 - modbus_id: mod_bus1 +<<: !include common.yaml diff --git a/tests/components/modbus_controller/test.rp2040-ard.yaml b/tests/components/modbus_controller/test.rp2040-ard.yaml index 476e65ecb0..80528bc12b 100644 --- a/tests/components/modbus_controller/test.rp2040-ard.yaml +++ b/tests/components/modbus_controller/test.rp2040-ard.yaml @@ -1,14 +1,8 @@ -uart: - - id: uart_modbus - tx_pin: 4 - rx_pin: 5 - baud_rate: 9600 +substitutions: + client_tx_pin: GPIO2 + client_rx_pin: GPIO3 + server_tx_pin: GPIO4 + server_rx_pin: GPIO5 + flow_control_pin: GPIO6 -modbus: - id: mod_bus1 - flow_control_pin: 6 - -modbus_controller: - - id: modbus_controller1 - address: 0x2 - modbus_id: mod_bus1 +<<: !include common.yaml diff --git a/tests/components/monochromatic/common.yaml b/tests/components/monochromatic/common.yaml new file mode 100644 index 0000000000..9915e086eb --- /dev/null +++ b/tests/components/monochromatic/common.yaml @@ -0,0 +1,40 @@ +output: + - platform: ${light_platform} + id: light_output_1 + pin: ${pin} + +light: + - platform: monochromatic + name: Monochromatic Light + id: monochromatic_light + output: light_output_1 + gamma_correct: 2.8 + default_transition_length: 2s + effects: + - strobe: + - flicker: + - flicker: + name: My Flicker + alpha: 98% + intensity: 1.5% + - lambda: + name: My Custom Effect + update_interval: 1s + lambda: |- + static int state = 0; + state += 1; + if (state == 4) + state = 0; + - pulse: + transition_length: 10s + update_interval: 20s + min_brightness: 10% + max_brightness: 90% + - pulse: + name: pulse2 + transition_length: + on_length: 10s + off_length: 5s + update_interval: 15s + min_brightness: 10% + max_brightness: 90% diff --git a/tests/components/monochromatic/test.esp32-ard.yaml b/tests/components/monochromatic/test.esp32-ard.yaml index 9524efcb2d..feabf013fd 100644 --- a/tests/components/monochromatic/test.esp32-ard.yaml +++ b/tests/components/monochromatic/test.esp32-ard.yaml @@ -1,40 +1,5 @@ -output: - - platform: ledc - id: light_output_1 - pin: 4 +substitutions: + light_platform: ledc + pin: GPIO2 -light: - - platform: monochromatic - name: Monochromatic Light - id: monochromatic_light - output: light_output_1 - gamma_correct: 2.8 - default_transition_length: 2s - effects: - - strobe: - - flicker: - - flicker: - name: My Flicker - alpha: 98% - intensity: 1.5% - - lambda: - name: My Custom Effect - update_interval: 1s - lambda: |- - static int state = 0; - state += 1; - if (state == 4) - state = 0; - - pulse: - transition_length: 10s - update_interval: 20s - min_brightness: 10% - max_brightness: 90% - - pulse: - name: pulse2 - transition_length: - on_length: 10s - off_length: 5s - update_interval: 15s - min_brightness: 10% - max_brightness: 90% +<<: !include common.yaml diff --git a/tests/components/monochromatic/test.esp32-c3-ard.yaml b/tests/components/monochromatic/test.esp32-c3-ard.yaml index 9524efcb2d..feabf013fd 100644 --- a/tests/components/monochromatic/test.esp32-c3-ard.yaml +++ b/tests/components/monochromatic/test.esp32-c3-ard.yaml @@ -1,40 +1,5 @@ -output: - - platform: ledc - id: light_output_1 - pin: 4 +substitutions: + light_platform: ledc + pin: GPIO2 -light: - - platform: monochromatic - name: Monochromatic Light - id: monochromatic_light - output: light_output_1 - gamma_correct: 2.8 - default_transition_length: 2s - effects: - - strobe: - - flicker: - - flicker: - name: My Flicker - alpha: 98% - intensity: 1.5% - - lambda: - name: My Custom Effect - update_interval: 1s - lambda: |- - static int state = 0; - state += 1; - if (state == 4) - state = 0; - - pulse: - transition_length: 10s - update_interval: 20s - min_brightness: 10% - max_brightness: 90% - - pulse: - name: pulse2 - transition_length: - on_length: 10s - off_length: 5s - update_interval: 15s - min_brightness: 10% - max_brightness: 90% +<<: !include common.yaml diff --git a/tests/components/monochromatic/test.esp32-c3-idf.yaml b/tests/components/monochromatic/test.esp32-c3-idf.yaml index 9524efcb2d..feabf013fd 100644 --- a/tests/components/monochromatic/test.esp32-c3-idf.yaml +++ b/tests/components/monochromatic/test.esp32-c3-idf.yaml @@ -1,40 +1,5 @@ -output: - - platform: ledc - id: light_output_1 - pin: 4 +substitutions: + light_platform: ledc + pin: GPIO2 -light: - - platform: monochromatic - name: Monochromatic Light - id: monochromatic_light - output: light_output_1 - gamma_correct: 2.8 - default_transition_length: 2s - effects: - - strobe: - - flicker: - - flicker: - name: My Flicker - alpha: 98% - intensity: 1.5% - - lambda: - name: My Custom Effect - update_interval: 1s - lambda: |- - static int state = 0; - state += 1; - if (state == 4) - state = 0; - - pulse: - transition_length: 10s - update_interval: 20s - min_brightness: 10% - max_brightness: 90% - - pulse: - name: pulse2 - transition_length: - on_length: 10s - off_length: 5s - update_interval: 15s - min_brightness: 10% - max_brightness: 90% +<<: !include common.yaml diff --git a/tests/components/monochromatic/test.esp32-idf.yaml b/tests/components/monochromatic/test.esp32-idf.yaml index 9524efcb2d..feabf013fd 100644 --- a/tests/components/monochromatic/test.esp32-idf.yaml +++ b/tests/components/monochromatic/test.esp32-idf.yaml @@ -1,40 +1,5 @@ -output: - - platform: ledc - id: light_output_1 - pin: 4 +substitutions: + light_platform: ledc + pin: GPIO2 -light: - - platform: monochromatic - name: Monochromatic Light - id: monochromatic_light - output: light_output_1 - gamma_correct: 2.8 - default_transition_length: 2s - effects: - - strobe: - - flicker: - - flicker: - name: My Flicker - alpha: 98% - intensity: 1.5% - - lambda: - name: My Custom Effect - update_interval: 1s - lambda: |- - static int state = 0; - state += 1; - if (state == 4) - state = 0; - - pulse: - transition_length: 10s - update_interval: 20s - min_brightness: 10% - max_brightness: 90% - - pulse: - name: pulse2 - transition_length: - on_length: 10s - off_length: 5s - update_interval: 15s - min_brightness: 10% - max_brightness: 90% +<<: !include common.yaml diff --git a/tests/components/monochromatic/test.esp8266-ard.yaml b/tests/components/monochromatic/test.esp8266-ard.yaml index 94d849581d..65bfb329f1 100644 --- a/tests/components/monochromatic/test.esp8266-ard.yaml +++ b/tests/components/monochromatic/test.esp8266-ard.yaml @@ -1,40 +1,5 @@ -output: - - platform: esp8266_pwm - id: light_output_1 - pin: 4 +substitutions: + light_platform: esp8266_pwm + pin: GPIO5 -light: - - platform: monochromatic - name: Monochromatic Light - id: monochromatic_light - output: light_output_1 - gamma_correct: 2.8 - default_transition_length: 2s - effects: - - strobe: - - flicker: - - flicker: - name: My Flicker - alpha: 98% - intensity: 1.5% - - lambda: - name: My Custom Effect - update_interval: 1s - lambda: |- - static int state = 0; - state += 1; - if (state == 4) - state = 0; - - pulse: - transition_length: 10s - update_interval: 20s - min_brightness: 10% - max_brightness: 90% - - pulse: - name: pulse2 - transition_length: - on_length: 10s - off_length: 5s - update_interval: 15s - min_brightness: 10% - max_brightness: 90% +<<: !include common.yaml diff --git a/tests/components/monochromatic/test.rp2040-ard.yaml b/tests/components/monochromatic/test.rp2040-ard.yaml index 093577e256..d329597d46 100644 --- a/tests/components/monochromatic/test.rp2040-ard.yaml +++ b/tests/components/monochromatic/test.rp2040-ard.yaml @@ -1,40 +1,5 @@ -output: - - platform: rp2040_pwm - id: light_output_1 - pin: 4 +substitutions: + light_platform: rp2040_pwm + pin: GPIO2 -light: - - platform: monochromatic - name: Monochromatic Light - id: monochromatic_light - output: light_output_1 - gamma_correct: 2.8 - default_transition_length: 2s - effects: - - strobe: - - flicker: - - flicker: - name: My Flicker - alpha: 98% - intensity: 1.5% - - lambda: - name: My Custom Effect - update_interval: 1s - lambda: |- - static int state = 0; - state += 1; - if (state == 4) - state = 0; - - pulse: - transition_length: 10s - update_interval: 20s - min_brightness: 10% - max_brightness: 90% - - pulse: - name: pulse2 - transition_length: - on_length: 10s - off_length: 5s - update_interval: 15s - min_brightness: 10% - max_brightness: 90% +<<: !include common.yaml diff --git a/tests/components/mpl3115a2/common.yaml b/tests/components/mpl3115a2/common.yaml new file mode 100644 index 0000000000..f2f65885b3 --- /dev/null +++ b/tests/components/mpl3115a2/common.yaml @@ -0,0 +1,12 @@ +i2c: + - id: i2c_mpl3115a2 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: mpl3115a2 + temperature: + name: MPL3115A2 Temperature + pressure: + name: MPL3115A2 Pressure + update_interval: 10s diff --git a/tests/components/mpl3115a2/test.esp32-ard.yaml b/tests/components/mpl3115a2/test.esp32-ard.yaml index 5e9d6d190d..63c3bd6afd 100644 --- a/tests/components/mpl3115a2/test.esp32-ard.yaml +++ b/tests/components/mpl3115a2/test.esp32-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_mpl3115a2 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: mpl3115a2 - temperature: - name: MPL3115A2 Temperature - pressure: - name: MPL3115A2 Pressure - update_interval: 10s +<<: !include common.yaml diff --git a/tests/components/mpl3115a2/test.esp32-c3-ard.yaml b/tests/components/mpl3115a2/test.esp32-c3-ard.yaml index 9cbe08d920..ee2c29ca4e 100644 --- a/tests/components/mpl3115a2/test.esp32-c3-ard.yaml +++ b/tests/components/mpl3115a2/test.esp32-c3-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_mpl3115a2 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mpl3115a2 - temperature: - name: MPL3115A2 Temperature - pressure: - name: MPL3115A2 Pressure - update_interval: 10s +<<: !include common.yaml diff --git a/tests/components/mpl3115a2/test.esp32-c3-idf.yaml b/tests/components/mpl3115a2/test.esp32-c3-idf.yaml index 9cbe08d920..ee2c29ca4e 100644 --- a/tests/components/mpl3115a2/test.esp32-c3-idf.yaml +++ b/tests/components/mpl3115a2/test.esp32-c3-idf.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_mpl3115a2 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mpl3115a2 - temperature: - name: MPL3115A2 Temperature - pressure: - name: MPL3115A2 Pressure - update_interval: 10s +<<: !include common.yaml diff --git a/tests/components/mpl3115a2/test.esp32-idf.yaml b/tests/components/mpl3115a2/test.esp32-idf.yaml index 5e9d6d190d..63c3bd6afd 100644 --- a/tests/components/mpl3115a2/test.esp32-idf.yaml +++ b/tests/components/mpl3115a2/test.esp32-idf.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_mpl3115a2 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: mpl3115a2 - temperature: - name: MPL3115A2 Temperature - pressure: - name: MPL3115A2 Pressure - update_interval: 10s +<<: !include common.yaml diff --git a/tests/components/mpl3115a2/test.esp8266-ard.yaml b/tests/components/mpl3115a2/test.esp8266-ard.yaml index 9cbe08d920..ee2c29ca4e 100644 --- a/tests/components/mpl3115a2/test.esp8266-ard.yaml +++ b/tests/components/mpl3115a2/test.esp8266-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_mpl3115a2 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mpl3115a2 - temperature: - name: MPL3115A2 Temperature - pressure: - name: MPL3115A2 Pressure - update_interval: 10s +<<: !include common.yaml diff --git a/tests/components/mpl3115a2/test.rp2040-ard.yaml b/tests/components/mpl3115a2/test.rp2040-ard.yaml index 9cbe08d920..ee2c29ca4e 100644 --- a/tests/components/mpl3115a2/test.rp2040-ard.yaml +++ b/tests/components/mpl3115a2/test.rp2040-ard.yaml @@ -1,12 +1,5 @@ -i2c: - - id: i2c_mpl3115a2 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mpl3115a2 - temperature: - name: MPL3115A2 Temperature - pressure: - name: MPL3115A2 Pressure - update_interval: 10s +<<: !include common.yaml diff --git a/tests/components/mpu6050/common.yaml b/tests/components/mpu6050/common.yaml new file mode 100644 index 0000000000..e9d4995534 --- /dev/null +++ b/tests/components/mpu6050/common.yaml @@ -0,0 +1,22 @@ +i2c: + - id: i2c_mpu6050 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: mpu6050 + address: 0x68 + accel_x: + name: MPU6050 Accel X + accel_y: + name: MPU6050 Accel Y + accel_z: + name: MPU6050 Accel z + gyro_x: + name: MPU6050 Gyro X + gyro_y: + name: MPU6050 Gyro Y + gyro_z: + name: MPU6050 Gyro z + temperature: + name: MPU6050 Temperature diff --git a/tests/components/mpu6050/test.esp32-ard.yaml b/tests/components/mpu6050/test.esp32-ard.yaml index 45bca55dea..63c3bd6afd 100644 --- a/tests/components/mpu6050/test.esp32-ard.yaml +++ b/tests/components/mpu6050/test.esp32-ard.yaml @@ -1,22 +1,5 @@ -i2c: - - id: i2c_mpu6050 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: mpu6050 - address: 0x68 - accel_x: - name: MPU6050 Accel X - accel_y: - name: MPU6050 Accel Y - accel_z: - name: MPU6050 Accel z - gyro_x: - name: MPU6050 Gyro X - gyro_y: - name: MPU6050 Gyro Y - gyro_z: - name: MPU6050 Gyro z - temperature: - name: MPU6050 Temperature +<<: !include common.yaml diff --git a/tests/components/mpu6050/test.esp32-c3-ard.yaml b/tests/components/mpu6050/test.esp32-c3-ard.yaml index 39c8506d2b..ee2c29ca4e 100644 --- a/tests/components/mpu6050/test.esp32-c3-ard.yaml +++ b/tests/components/mpu6050/test.esp32-c3-ard.yaml @@ -1,22 +1,5 @@ -i2c: - - id: i2c_mpu6050 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mpu6050 - address: 0x68 - accel_x: - name: MPU6050 Accel X - accel_y: - name: MPU6050 Accel Y - accel_z: - name: MPU6050 Accel z - gyro_x: - name: MPU6050 Gyro X - gyro_y: - name: MPU6050 Gyro Y - gyro_z: - name: MPU6050 Gyro z - temperature: - name: MPU6050 Temperature +<<: !include common.yaml diff --git a/tests/components/mpu6050/test.esp32-c3-idf.yaml b/tests/components/mpu6050/test.esp32-c3-idf.yaml index 39c8506d2b..ee2c29ca4e 100644 --- a/tests/components/mpu6050/test.esp32-c3-idf.yaml +++ b/tests/components/mpu6050/test.esp32-c3-idf.yaml @@ -1,22 +1,5 @@ -i2c: - - id: i2c_mpu6050 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mpu6050 - address: 0x68 - accel_x: - name: MPU6050 Accel X - accel_y: - name: MPU6050 Accel Y - accel_z: - name: MPU6050 Accel z - gyro_x: - name: MPU6050 Gyro X - gyro_y: - name: MPU6050 Gyro Y - gyro_z: - name: MPU6050 Gyro z - temperature: - name: MPU6050 Temperature +<<: !include common.yaml diff --git a/tests/components/mpu6050/test.esp32-idf.yaml b/tests/components/mpu6050/test.esp32-idf.yaml index 45bca55dea..63c3bd6afd 100644 --- a/tests/components/mpu6050/test.esp32-idf.yaml +++ b/tests/components/mpu6050/test.esp32-idf.yaml @@ -1,22 +1,5 @@ -i2c: - - id: i2c_mpu6050 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: mpu6050 - address: 0x68 - accel_x: - name: MPU6050 Accel X - accel_y: - name: MPU6050 Accel Y - accel_z: - name: MPU6050 Accel z - gyro_x: - name: MPU6050 Gyro X - gyro_y: - name: MPU6050 Gyro Y - gyro_z: - name: MPU6050 Gyro z - temperature: - name: MPU6050 Temperature +<<: !include common.yaml diff --git a/tests/components/mpu6050/test.esp8266-ard.yaml b/tests/components/mpu6050/test.esp8266-ard.yaml index 39c8506d2b..ee2c29ca4e 100644 --- a/tests/components/mpu6050/test.esp8266-ard.yaml +++ b/tests/components/mpu6050/test.esp8266-ard.yaml @@ -1,22 +1,5 @@ -i2c: - - id: i2c_mpu6050 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mpu6050 - address: 0x68 - accel_x: - name: MPU6050 Accel X - accel_y: - name: MPU6050 Accel Y - accel_z: - name: MPU6050 Accel z - gyro_x: - name: MPU6050 Gyro X - gyro_y: - name: MPU6050 Gyro Y - gyro_z: - name: MPU6050 Gyro z - temperature: - name: MPU6050 Temperature +<<: !include common.yaml diff --git a/tests/components/mpu6050/test.rp2040-ard.yaml b/tests/components/mpu6050/test.rp2040-ard.yaml index 39c8506d2b..ee2c29ca4e 100644 --- a/tests/components/mpu6050/test.rp2040-ard.yaml +++ b/tests/components/mpu6050/test.rp2040-ard.yaml @@ -1,22 +1,5 @@ -i2c: - - id: i2c_mpu6050 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mpu6050 - address: 0x68 - accel_x: - name: MPU6050 Accel X - accel_y: - name: MPU6050 Accel Y - accel_z: - name: MPU6050 Accel z - gyro_x: - name: MPU6050 Gyro X - gyro_y: - name: MPU6050 Gyro Y - gyro_z: - name: MPU6050 Gyro z - temperature: - name: MPU6050 Temperature +<<: !include common.yaml diff --git a/tests/components/mpu6886/common.yaml b/tests/components/mpu6886/common.yaml new file mode 100644 index 0000000000..9c3e283cc3 --- /dev/null +++ b/tests/components/mpu6886/common.yaml @@ -0,0 +1,22 @@ +i2c: + - id: i2c_mpu6886 + scl: ${scl_pin} + sda: ${sda_pin} + +sensor: + - platform: mpu6886 + address: 0x68 + accel_x: + name: MPU6886 Accel X + accel_y: + name: MPU6886 Accel Y + accel_z: + name: MPU6886 Accel z + gyro_x: + name: MPU6886 Gyro X + gyro_y: + name: MPU6886 Gyro Y + gyro_z: + name: MPU6886 Gyro z + temperature: + name: MPU6886 Temperature diff --git a/tests/components/mpu6886/test.esp32-ard.yaml b/tests/components/mpu6886/test.esp32-ard.yaml index 84e4d56739..63c3bd6afd 100644 --- a/tests/components/mpu6886/test.esp32-ard.yaml +++ b/tests/components/mpu6886/test.esp32-ard.yaml @@ -1,22 +1,5 @@ -i2c: - - id: i2c_mpu6886 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: mpu6886 - address: 0x68 - accel_x: - name: MPU6886 Accel X - accel_y: - name: MPU6886 Accel Y - accel_z: - name: MPU6886 Accel z - gyro_x: - name: MPU6886 Gyro X - gyro_y: - name: MPU6886 Gyro Y - gyro_z: - name: MPU6886 Gyro z - temperature: - name: MPU6886 Temperature +<<: !include common.yaml diff --git a/tests/components/mpu6886/test.esp32-c3-ard.yaml b/tests/components/mpu6886/test.esp32-c3-ard.yaml index fad51a80b4..ee2c29ca4e 100644 --- a/tests/components/mpu6886/test.esp32-c3-ard.yaml +++ b/tests/components/mpu6886/test.esp32-c3-ard.yaml @@ -1,22 +1,5 @@ -i2c: - - id: i2c_mpu6886 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mpu6886 - address: 0x68 - accel_x: - name: MPU6886 Accel X - accel_y: - name: MPU6886 Accel Y - accel_z: - name: MPU6886 Accel z - gyro_x: - name: MPU6886 Gyro X - gyro_y: - name: MPU6886 Gyro Y - gyro_z: - name: MPU6886 Gyro z - temperature: - name: MPU6886 Temperature +<<: !include common.yaml diff --git a/tests/components/mpu6886/test.esp32-c3-idf.yaml b/tests/components/mpu6886/test.esp32-c3-idf.yaml index fad51a80b4..ee2c29ca4e 100644 --- a/tests/components/mpu6886/test.esp32-c3-idf.yaml +++ b/tests/components/mpu6886/test.esp32-c3-idf.yaml @@ -1,22 +1,5 @@ -i2c: - - id: i2c_mpu6886 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mpu6886 - address: 0x68 - accel_x: - name: MPU6886 Accel X - accel_y: - name: MPU6886 Accel Y - accel_z: - name: MPU6886 Accel z - gyro_x: - name: MPU6886 Gyro X - gyro_y: - name: MPU6886 Gyro Y - gyro_z: - name: MPU6886 Gyro z - temperature: - name: MPU6886 Temperature +<<: !include common.yaml diff --git a/tests/components/mpu6886/test.esp32-idf.yaml b/tests/components/mpu6886/test.esp32-idf.yaml index 84e4d56739..63c3bd6afd 100644 --- a/tests/components/mpu6886/test.esp32-idf.yaml +++ b/tests/components/mpu6886/test.esp32-idf.yaml @@ -1,22 +1,5 @@ -i2c: - - id: i2c_mpu6886 - scl: 16 - sda: 17 +substitutions: + scl_pin: GPIO16 + sda_pin: GPIO17 -sensor: - - platform: mpu6886 - address: 0x68 - accel_x: - name: MPU6886 Accel X - accel_y: - name: MPU6886 Accel Y - accel_z: - name: MPU6886 Accel z - gyro_x: - name: MPU6886 Gyro X - gyro_y: - name: MPU6886 Gyro Y - gyro_z: - name: MPU6886 Gyro z - temperature: - name: MPU6886 Temperature +<<: !include common.yaml diff --git a/tests/components/mpu6886/test.esp8266-ard.yaml b/tests/components/mpu6886/test.esp8266-ard.yaml index fad51a80b4..ee2c29ca4e 100644 --- a/tests/components/mpu6886/test.esp8266-ard.yaml +++ b/tests/components/mpu6886/test.esp8266-ard.yaml @@ -1,22 +1,5 @@ -i2c: - - id: i2c_mpu6886 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mpu6886 - address: 0x68 - accel_x: - name: MPU6886 Accel X - accel_y: - name: MPU6886 Accel Y - accel_z: - name: MPU6886 Accel z - gyro_x: - name: MPU6886 Gyro X - gyro_y: - name: MPU6886 Gyro Y - gyro_z: - name: MPU6886 Gyro z - temperature: - name: MPU6886 Temperature +<<: !include common.yaml diff --git a/tests/components/mpu6886/test.rp2040-ard.yaml b/tests/components/mpu6886/test.rp2040-ard.yaml index fad51a80b4..ee2c29ca4e 100644 --- a/tests/components/mpu6886/test.rp2040-ard.yaml +++ b/tests/components/mpu6886/test.rp2040-ard.yaml @@ -1,22 +1,5 @@ -i2c: - - id: i2c_mpu6886 - scl: 5 - sda: 4 +substitutions: + scl_pin: GPIO5 + sda_pin: GPIO4 -sensor: - - platform: mpu6886 - address: 0x68 - accel_x: - name: MPU6886 Accel X - accel_y: - name: MPU6886 Accel Y - accel_z: - name: MPU6886 Accel z - gyro_x: - name: MPU6886 Gyro X - gyro_y: - name: MPU6886 Gyro Y - gyro_z: - name: MPU6886 Gyro z - temperature: - name: MPU6886 Temperature +<<: !include common.yaml diff --git a/tests/components/mqtt_subscribe/common-ard.yaml b/tests/components/mqtt_subscribe/common-ard.yaml new file mode 100644 index 0000000000..13ed311b17 --- /dev/null +++ b/tests/components/mqtt_subscribe/common-ard.yaml @@ -0,0 +1,36 @@ +wifi: + ssid: MySSID + password: password1 + +mqtt: + broker: test.mosquitto.org + port: 1883 + discovery: true + discovery_prefix: homeassistant + log_topic: + on_message: + topic: testing/sensor/testing_sensor/state + qos: 0 + then: + - logger.log: Mqtt Test + +sensor: + - platform: mqtt_subscribe + name: MQTT Subscribe Sensor + topic: mqtt/topic + id: the_sensor + qos: 2 + on_value: + - mqtt.publish_json: + topic: the/topic + payload: |- + root["key"] = id(the_sensor).state; + root["greeting"] = "Hello World"; + +text_sensor: + - platform: mqtt_subscribe + name: MQTT Subscribe Text + topic: "the/topic" + qos: 2 + on_value: + - logger.log: "Text sensor got value" diff --git a/tests/components/mqtt_subscribe/common-idf.yaml b/tests/components/mqtt_subscribe/common-idf.yaml new file mode 100644 index 0000000000..070672f15c --- /dev/null +++ b/tests/components/mqtt_subscribe/common-idf.yaml @@ -0,0 +1,37 @@ +wifi: + ssid: MySSID + password: password1 + +mqtt: + broker: test.mosquitto.org + port: 1883 + discovery: true + discovery_prefix: homeassistant + idf_send_async: false + log_topic: + on_message: + topic: testing/sensor/testing_sensor/state + qos: 0 + then: + - logger.log: Mqtt Test + +sensor: + - platform: mqtt_subscribe + name: MQTT Subscribe Sensor + topic: mqtt/topic + id: the_sensor + qos: 2 + on_value: + - mqtt.publish_json: + topic: the/topic + payload: |- + root["key"] = id(the_sensor).state; + root["greeting"] = "Hello World"; + +text_sensor: + - platform: mqtt_subscribe + name: MQTT Subscribe Text + topic: "the/topic" + qos: 2 + on_value: + - logger.log: "Text sensor got value" diff --git a/tests/components/mqtt_subscribe/test.esp32-ard.yaml b/tests/components/mqtt_subscribe/test.esp32-ard.yaml index 13ed311b17..28589ee06c 100644 --- a/tests/components/mqtt_subscribe/test.esp32-ard.yaml +++ b/tests/components/mqtt_subscribe/test.esp32-ard.yaml @@ -1,36 +1 @@ -wifi: - ssid: MySSID - password: password1 - -mqtt: - broker: test.mosquitto.org - port: 1883 - discovery: true - discovery_prefix: homeassistant - log_topic: - on_message: - topic: testing/sensor/testing_sensor/state - qos: 0 - then: - - logger.log: Mqtt Test - -sensor: - - platform: mqtt_subscribe - name: MQTT Subscribe Sensor - topic: mqtt/topic - id: the_sensor - qos: 2 - on_value: - - mqtt.publish_json: - topic: the/topic - payload: |- - root["key"] = id(the_sensor).state; - root["greeting"] = "Hello World"; - -text_sensor: - - platform: mqtt_subscribe - name: MQTT Subscribe Text - topic: "the/topic" - qos: 2 - on_value: - - logger.log: "Text sensor got value" +<<: !include common-ard.yaml diff --git a/tests/components/mqtt_subscribe/test.esp32-c3-ard.yaml b/tests/components/mqtt_subscribe/test.esp32-c3-ard.yaml index 13ed311b17..28589ee06c 100644 --- a/tests/components/mqtt_subscribe/test.esp32-c3-ard.yaml +++ b/tests/components/mqtt_subscribe/test.esp32-c3-ard.yaml @@ -1,36 +1 @@ -wifi: - ssid: MySSID - password: password1 - -mqtt: - broker: test.mosquitto.org - port: 1883 - discovery: true - discovery_prefix: homeassistant - log_topic: - on_message: - topic: testing/sensor/testing_sensor/state - qos: 0 - then: - - logger.log: Mqtt Test - -sensor: - - platform: mqtt_subscribe - name: MQTT Subscribe Sensor - topic: mqtt/topic - id: the_sensor - qos: 2 - on_value: - - mqtt.publish_json: - topic: the/topic - payload: |- - root["key"] = id(the_sensor).state; - root["greeting"] = "Hello World"; - -text_sensor: - - platform: mqtt_subscribe - name: MQTT Subscribe Text - topic: "the/topic" - qos: 2 - on_value: - - logger.log: "Text sensor got value" +<<: !include common-ard.yaml diff --git a/tests/components/mqtt_subscribe/test.esp32-c3-idf.yaml b/tests/components/mqtt_subscribe/test.esp32-c3-idf.yaml index 070672f15c..2cb6d82536 100644 --- a/tests/components/mqtt_subscribe/test.esp32-c3-idf.yaml +++ b/tests/components/mqtt_subscribe/test.esp32-c3-idf.yaml @@ -1,37 +1 @@ -wifi: - ssid: MySSID - password: password1 - -mqtt: - broker: test.mosquitto.org - port: 1883 - discovery: true - discovery_prefix: homeassistant - idf_send_async: false - log_topic: - on_message: - topic: testing/sensor/testing_sensor/state - qos: 0 - then: - - logger.log: Mqtt Test - -sensor: - - platform: mqtt_subscribe - name: MQTT Subscribe Sensor - topic: mqtt/topic - id: the_sensor - qos: 2 - on_value: - - mqtt.publish_json: - topic: the/topic - payload: |- - root["key"] = id(the_sensor).state; - root["greeting"] = "Hello World"; - -text_sensor: - - platform: mqtt_subscribe - name: MQTT Subscribe Text - topic: "the/topic" - qos: 2 - on_value: - - logger.log: "Text sensor got value" +<<: !include common-idf.yaml diff --git a/tests/components/mqtt_subscribe/test.esp32-idf.yaml b/tests/components/mqtt_subscribe/test.esp32-idf.yaml index 070672f15c..2cb6d82536 100644 --- a/tests/components/mqtt_subscribe/test.esp32-idf.yaml +++ b/tests/components/mqtt_subscribe/test.esp32-idf.yaml @@ -1,37 +1 @@ -wifi: - ssid: MySSID - password: password1 - -mqtt: - broker: test.mosquitto.org - port: 1883 - discovery: true - discovery_prefix: homeassistant - idf_send_async: false - log_topic: - on_message: - topic: testing/sensor/testing_sensor/state - qos: 0 - then: - - logger.log: Mqtt Test - -sensor: - - platform: mqtt_subscribe - name: MQTT Subscribe Sensor - topic: mqtt/topic - id: the_sensor - qos: 2 - on_value: - - mqtt.publish_json: - topic: the/topic - payload: |- - root["key"] = id(the_sensor).state; - root["greeting"] = "Hello World"; - -text_sensor: - - platform: mqtt_subscribe - name: MQTT Subscribe Text - topic: "the/topic" - qos: 2 - on_value: - - logger.log: "Text sensor got value" +<<: !include common-idf.yaml diff --git a/tests/components/mqtt_subscribe/test.esp8266-ard.yaml b/tests/components/mqtt_subscribe/test.esp8266-ard.yaml index 13ed311b17..28589ee06c 100644 --- a/tests/components/mqtt_subscribe/test.esp8266-ard.yaml +++ b/tests/components/mqtt_subscribe/test.esp8266-ard.yaml @@ -1,36 +1 @@ -wifi: - ssid: MySSID - password: password1 - -mqtt: - broker: test.mosquitto.org - port: 1883 - discovery: true - discovery_prefix: homeassistant - log_topic: - on_message: - topic: testing/sensor/testing_sensor/state - qos: 0 - then: - - logger.log: Mqtt Test - -sensor: - - platform: mqtt_subscribe - name: MQTT Subscribe Sensor - topic: mqtt/topic - id: the_sensor - qos: 2 - on_value: - - mqtt.publish_json: - topic: the/topic - payload: |- - root["key"] = id(the_sensor).state; - root["greeting"] = "Hello World"; - -text_sensor: - - platform: mqtt_subscribe - name: MQTT Subscribe Text - topic: "the/topic" - qos: 2 - on_value: - - logger.log: "Text sensor got value" +<<: !include common-ard.yaml diff --git a/tests/components/ms5611/common.yaml b/tests/components/ms5611/common.yaml new file mode 100644 index 0000000000..d0417faa86 --- /dev/null +++ b/tests/components/ms5611/common.yaml @@ -0,0 +1,13 @@ +i2c: + - id: i2c_ms5611 + scl: ${i2c_scl} + sda: ${i2c_sda} + +sensor: + - platform: ms5611 + temperature: + name: Outside Temperature + pressure: + name: Outside Pressure + address: 0x77 + update_interval: 15s diff --git a/tests/components/ms5611/test.esp32-ard.yaml b/tests/components/ms5611/test.esp32-ard.yaml index b090eeaa93..1037d5d35b 100644 --- a/tests/components/ms5611/test.esp32-ard.yaml +++ b/tests/components/ms5611/test.esp32-ard.yaml @@ -1,13 +1,5 @@ -i2c: - - id: i2c_ms5611 - scl: 16 - sda: 17 +substitutions: + i2c_scl: GPIO16 + i2c_sda: GPIO17 -sensor: - - platform: ms5611 - temperature: - name: Outside Temperature - pressure: - name: Outside Pressure - address: 0x77 - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ms5611/test.esp32-c3-ard.yaml b/tests/components/ms5611/test.esp32-c3-ard.yaml index 8f18501eef..d7ae0d5161 100644 --- a/tests/components/ms5611/test.esp32-c3-ard.yaml +++ b/tests/components/ms5611/test.esp32-c3-ard.yaml @@ -1,13 +1,5 @@ -i2c: - - id: i2c_ms5611 - scl: 5 - sda: 4 +substitutions: + i2c_scl: GPIO5 + i2c_sda: GPIO4 -sensor: - - platform: ms5611 - temperature: - name: Outside Temperature - pressure: - name: Outside Pressure - address: 0x77 - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ms5611/test.esp32-c3-idf.yaml b/tests/components/ms5611/test.esp32-c3-idf.yaml index 8f18501eef..d7ae0d5161 100644 --- a/tests/components/ms5611/test.esp32-c3-idf.yaml +++ b/tests/components/ms5611/test.esp32-c3-idf.yaml @@ -1,13 +1,5 @@ -i2c: - - id: i2c_ms5611 - scl: 5 - sda: 4 +substitutions: + i2c_scl: GPIO5 + i2c_sda: GPIO4 -sensor: - - platform: ms5611 - temperature: - name: Outside Temperature - pressure: - name: Outside Pressure - address: 0x77 - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ms5611/test.esp32-idf.yaml b/tests/components/ms5611/test.esp32-idf.yaml index b090eeaa93..1037d5d35b 100644 --- a/tests/components/ms5611/test.esp32-idf.yaml +++ b/tests/components/ms5611/test.esp32-idf.yaml @@ -1,13 +1,5 @@ -i2c: - - id: i2c_ms5611 - scl: 16 - sda: 17 +substitutions: + i2c_scl: GPIO16 + i2c_sda: GPIO17 -sensor: - - platform: ms5611 - temperature: - name: Outside Temperature - pressure: - name: Outside Pressure - address: 0x77 - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ms5611/test.esp8266-ard.yaml b/tests/components/ms5611/test.esp8266-ard.yaml index 8f18501eef..d7ae0d5161 100644 --- a/tests/components/ms5611/test.esp8266-ard.yaml +++ b/tests/components/ms5611/test.esp8266-ard.yaml @@ -1,13 +1,5 @@ -i2c: - - id: i2c_ms5611 - scl: 5 - sda: 4 +substitutions: + i2c_scl: GPIO5 + i2c_sda: GPIO4 -sensor: - - platform: ms5611 - temperature: - name: Outside Temperature - pressure: - name: Outside Pressure - address: 0x77 - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/ms5611/test.rp2040-ard.yaml b/tests/components/ms5611/test.rp2040-ard.yaml index 8f18501eef..d7ae0d5161 100644 --- a/tests/components/ms5611/test.rp2040-ard.yaml +++ b/tests/components/ms5611/test.rp2040-ard.yaml @@ -1,13 +1,5 @@ -i2c: - - id: i2c_ms5611 - scl: 5 - sda: 4 +substitutions: + i2c_scl: GPIO5 + i2c_sda: GPIO4 -sensor: - - platform: ms5611 - temperature: - name: Outside Temperature - pressure: - name: Outside Pressure - address: 0x77 - update_interval: 15s +<<: !include common.yaml diff --git a/tests/components/resampler/common.yaml b/tests/components/resampler/common.yaml new file mode 100644 index 0000000000..8ff09ed256 --- /dev/null +++ b/tests/components/resampler/common.yaml @@ -0,0 +1,13 @@ +i2s_audio: + i2s_lrclk_pin: ${lrclk_pin} + i2s_bclk_pin: ${bclk_pin} + i2s_mclk_pin: ${mclk_pin} + +speaker: + - platform: i2s_audio + id: speaker_id + dac_type: external + i2s_dout_pin: ${dout_pin} + - platform: resampler + id: resampler_speaker_id + output_speaker: speaker_id diff --git a/tests/components/resampler/test.esp32-ard.yaml b/tests/components/resampler/test.esp32-ard.yaml new file mode 100644 index 0000000000..96d2d37458 --- /dev/null +++ b/tests/components/resampler/test.esp32-ard.yaml @@ -0,0 +1,7 @@ +substitutions: + lrclk_pin: GPIO16 + bclk_pin: GPIO17 + mclk_pin: GPIO15 + dout_pin: GPIO14 + +<<: !include common.yaml diff --git a/tests/components/resampler/test.esp32-c3-ard.yaml b/tests/components/resampler/test.esp32-c3-ard.yaml new file mode 100644 index 0000000000..f1721f0862 --- /dev/null +++ b/tests/components/resampler/test.esp32-c3-ard.yaml @@ -0,0 +1,7 @@ +substitutions: + lrclk_pin: GPIO4 + bclk_pin: GPIO5 + mclk_pin: GPIO6 + dout_pin: GPIO7 + +<<: !include common.yaml diff --git a/tests/components/resampler/test.esp32-c3-idf.yaml b/tests/components/resampler/test.esp32-c3-idf.yaml new file mode 100644 index 0000000000..f1721f0862 --- /dev/null +++ b/tests/components/resampler/test.esp32-c3-idf.yaml @@ -0,0 +1,7 @@ +substitutions: + lrclk_pin: GPIO4 + bclk_pin: GPIO5 + mclk_pin: GPIO6 + dout_pin: GPIO7 + +<<: !include common.yaml diff --git a/tests/components/resampler/test.esp32-idf.yaml b/tests/components/resampler/test.esp32-idf.yaml new file mode 100644 index 0000000000..96d2d37458 --- /dev/null +++ b/tests/components/resampler/test.esp32-idf.yaml @@ -0,0 +1,7 @@ +substitutions: + lrclk_pin: GPIO16 + bclk_pin: GPIO17 + mclk_pin: GPIO15 + dout_pin: GPIO14 + +<<: !include common.yaml diff --git a/tests/components/resampler/test.esp32-s3-ard.yaml b/tests/components/resampler/test.esp32-s3-ard.yaml new file mode 100644 index 0000000000..f1721f0862 --- /dev/null +++ b/tests/components/resampler/test.esp32-s3-ard.yaml @@ -0,0 +1,7 @@ +substitutions: + lrclk_pin: GPIO4 + bclk_pin: GPIO5 + mclk_pin: GPIO6 + dout_pin: GPIO7 + +<<: !include common.yaml diff --git a/tests/components/resampler/test.esp32-s3-idf.yaml b/tests/components/resampler/test.esp32-s3-idf.yaml new file mode 100644 index 0000000000..f1721f0862 --- /dev/null +++ b/tests/components/resampler/test.esp32-s3-idf.yaml @@ -0,0 +1,7 @@ +substitutions: + lrclk_pin: GPIO4 + bclk_pin: GPIO5 + mclk_pin: GPIO6 + dout_pin: GPIO7 + +<<: !include common.yaml