mirror of
				https://github.com/esphome/esphome.git
				synced 2025-11-04 00:51:49 +00:00 
			
		
		
		
	Compare commits
	
		
			10 Commits
		
	
	
		
			jesserockz
			...
			jesserockz
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					dfb98b523f | ||
| 
						 | 
					17204baac0 | ||
| 
						 | 
					1e05bcaa61 | ||
| 
						 | 
					18690d51f5 | ||
| 
						 | 
					2aacf14e96 | ||
| 
						 | 
					9c5507ab46 | ||
| 
						 | 
					0a9703bff9 | ||
| 
						 | 
					67bd5db6d6 | ||
| 
						 | 
					6c11f0bd51 | ||
| 
						 | 
					e7556271e7 | 
							
								
								
									
										4
									
								
								.github/actions/build-image/action.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/actions/build-image/action.yaml
									
									
									
									
										vendored
									
									
								
							@@ -46,7 +46,7 @@ runs:
 | 
			
		||||
 | 
			
		||||
    - name: Build and push to ghcr by digest
 | 
			
		||||
      id: build-ghcr
 | 
			
		||||
      uses: docker/build-push-action@v6.0.1
 | 
			
		||||
      uses: docker/build-push-action@v6.1.0
 | 
			
		||||
      with:
 | 
			
		||||
        context: .
 | 
			
		||||
        file: ./docker/Dockerfile
 | 
			
		||||
@@ -69,7 +69,7 @@ runs:
 | 
			
		||||
 | 
			
		||||
    - name: Build and push to dockerhub by digest
 | 
			
		||||
      id: build-dockerhub
 | 
			
		||||
      uses: docker/build-push-action@v6.0.1
 | 
			
		||||
      uses: docker/build-push-action@v6.1.0
 | 
			
		||||
      with:
 | 
			
		||||
        context: .
 | 
			
		||||
        file: ./docker/Dockerfile
 | 
			
		||||
 
 | 
			
		||||
@@ -9,6 +9,10 @@ static const char *const TAG = "gpio.one_wire";
 | 
			
		||||
 | 
			
		||||
void GPIOOneWireBus::setup() {
 | 
			
		||||
  ESP_LOGCONFIG(TAG, "Setting up 1-wire bus...");
 | 
			
		||||
  this->t_pin_->setup();
 | 
			
		||||
  // clear bus with 480µs high, otherwise initial reset in search might fail
 | 
			
		||||
  this->t_pin_->pin_mode(gpio::FLAG_INPUT | gpio::FLAG_PULLUP);
 | 
			
		||||
  delayMicroseconds(480);
 | 
			
		||||
  this->search();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -86,13 +86,11 @@ std::shared_ptr<HttpContainer> HttpRequestIDF::start(std::string url, std::strin
 | 
			
		||||
    return nullptr;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ESP_LOGV(TAG, "HTTP Request started: %s", url.c_str());
 | 
			
		||||
 | 
			
		||||
  if (body_len > 0) {
 | 
			
		||||
    int write_left = body_len;
 | 
			
		||||
    int write_index = 0;
 | 
			
		||||
    const char *buf = body.c_str();
 | 
			
		||||
    while (body_len > 0) {
 | 
			
		||||
    while (write_left > 0) {
 | 
			
		||||
      int written = esp_http_client_write(client, buf + write_index, write_left);
 | 
			
		||||
      if (written < 0) {
 | 
			
		||||
        err = ESP_FAIL;
 | 
			
		||||
@@ -110,26 +108,10 @@ std::shared_ptr<HttpContainer> HttpRequestIDF::start(std::string url, std::strin
 | 
			
		||||
    return nullptr;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ESP_LOGV(TAG, "HTTP Request body written: %d", body_len);
 | 
			
		||||
 | 
			
		||||
  container->content_length = esp_http_client_fetch_headers(client);
 | 
			
		||||
  if (esp_http_client_is_chunked_response(client)) {
 | 
			
		||||
    ESP_LOGV(TAG, "HTTP Response is chunked");
 | 
			
		||||
    int length = 0;
 | 
			
		||||
    err = esp_http_client_get_chunk_length(client, &length);
 | 
			
		||||
    if (err != ESP_OK) {
 | 
			
		||||
      this->status_momentary_error("failed", 1000);
 | 
			
		||||
      ESP_LOGE(TAG, "Failed to get chunk length: %s", esp_err_to_name(err));
 | 
			
		||||
      esp_http_client_cleanup(client);
 | 
			
		||||
      return nullptr;
 | 
			
		||||
    }
 | 
			
		||||
    container->content_length = length;
 | 
			
		||||
  }
 | 
			
		||||
  const auto status_code = esp_http_client_get_status_code(client);
 | 
			
		||||
  container->status_code = status_code;
 | 
			
		||||
 | 
			
		||||
  ESP_LOGD(TAG, "Status %d", status_code);
 | 
			
		||||
 | 
			
		||||
  if (status_code < 200 || status_code >= 300) {
 | 
			
		||||
    ESP_LOGE(TAG, "HTTP Request failed; URL: %s; Code: %d", url.c_str(), status_code);
 | 
			
		||||
    this->status_momentary_error("failed", 1000);
 | 
			
		||||
@@ -165,8 +147,6 @@ void HttpContainerIDF::end() {
 | 
			
		||||
 | 
			
		||||
  esp_http_client_close(this->client_);
 | 
			
		||||
  esp_http_client_cleanup(this->client_);
 | 
			
		||||
 | 
			
		||||
  ESP_LOGV(TAG, "HTTP Request ended: %d", this->status_code);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}  // namespace http_request
 | 
			
		||||
 
 | 
			
		||||
@@ -46,7 +46,7 @@ void WatchdogManager::set_timeout_(uint32_t timeout_ms) {
 | 
			
		||||
  };
 | 
			
		||||
  esp_task_wdt_reconfigure(&wdt_config);
 | 
			
		||||
#else
 | 
			
		||||
  esp_task_wdt_init(timeout_ms, true);
 | 
			
		||||
  esp_task_wdt_init(timeout_ms / 1000, true);
 | 
			
		||||
#endif  // ESP_IDF_VERSION_MAJOR
 | 
			
		||||
#endif  // USE_ESP32
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -26,6 +26,7 @@ from esphome.const import (
 | 
			
		||||
    DEVICE_CLASS_BATTERY,
 | 
			
		||||
    DEVICE_CLASS_CARBON_DIOXIDE,
 | 
			
		||||
    DEVICE_CLASS_CARBON_MONOXIDE,
 | 
			
		||||
    DEVICE_CLASS_CONDUCTIVITY,
 | 
			
		||||
    DEVICE_CLASS_CURRENT,
 | 
			
		||||
    DEVICE_CLASS_DATA_RATE,
 | 
			
		||||
    DEVICE_CLASS_DATA_SIZE,
 | 
			
		||||
@@ -82,6 +83,7 @@ DEVICE_CLASSES = [
 | 
			
		||||
    DEVICE_CLASS_BATTERY,
 | 
			
		||||
    DEVICE_CLASS_CARBON_DIOXIDE,
 | 
			
		||||
    DEVICE_CLASS_CARBON_MONOXIDE,
 | 
			
		||||
    DEVICE_CLASS_CONDUCTIVITY,
 | 
			
		||||
    DEVICE_CLASS_CURRENT,
 | 
			
		||||
    DEVICE_CLASS_DATA_RATE,
 | 
			
		||||
    DEVICE_CLASS_DATA_SIZE,
 | 
			
		||||
 
 | 
			
		||||
@@ -25,6 +25,9 @@ void QspiAmoLed::setup() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void QspiAmoLed::update() {
 | 
			
		||||
  if (!this->setup_complete_) {
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  this->do_update_();
 | 
			
		||||
  // Start addresses and widths/heights must be divisible by 2 (CASET/RASET restriction in datasheet)
 | 
			
		||||
  if (this->x_low_ % 2 == 1) {
 | 
			
		||||
 
 | 
			
		||||
@@ -65,13 +65,10 @@ class QspiAmoLed : public display::DisplayBuffer,
 | 
			
		||||
 | 
			
		||||
  void set_reset_pin(GPIOPin *reset_pin) { this->reset_pin_ = reset_pin; }
 | 
			
		||||
  void set_enable_pin(GPIOPin *enable_pin) { this->enable_pin_ = enable_pin; }
 | 
			
		||||
  void set_width(uint16_t width) { this->width_ = width; }
 | 
			
		||||
  void set_dimensions(uint16_t width, uint16_t height) {
 | 
			
		||||
    this->width_ = width;
 | 
			
		||||
    this->height_ = height;
 | 
			
		||||
  }
 | 
			
		||||
  int get_width() override { return this->width_; }
 | 
			
		||||
  int get_height() override { return this->height_; }
 | 
			
		||||
  void set_invert_colors(bool invert_colors) {
 | 
			
		||||
    this->invert_colors_ = invert_colors;
 | 
			
		||||
    this->reset_params_();
 | 
			
		||||
 
 | 
			
		||||
@@ -88,7 +88,7 @@ def validate_parameter_name(value):
 | 
			
		||||
    raise cv.Invalid(f"Script's parameter name cannot be {CONF_ID}")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ALLOWED_PARAM_TYPE_CHARSET = set("abcdefghijklmnopqrstuvwxyz0123456789_:*&[]")
 | 
			
		||||
ALLOWED_PARAM_TYPE_CHARSET = set("abcdefghijklmnopqrstuvwxyz0123456789_:*&[]<>")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def validate_parameter_type(value):
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@ import subprocess
 | 
			
		||||
 | 
			
		||||
import esphome.codegen as cg
 | 
			
		||||
import esphome.config_validation as cv
 | 
			
		||||
from esphome.components import display
 | 
			
		||||
from esphome.components import display, key_provider
 | 
			
		||||
from esphome.const import (
 | 
			
		||||
    CONF_ID,
 | 
			
		||||
    CONF_DIMENSIONS,
 | 
			
		||||
@@ -12,8 +12,10 @@ from esphome.const import (
 | 
			
		||||
    PLATFORM_HOST,
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
AUTO_LOAD = ["key_provider"]
 | 
			
		||||
 | 
			
		||||
sdl_ns = cg.esphome_ns.namespace("sdl")
 | 
			
		||||
Sdl = sdl_ns.class_("Sdl", display.Display, cg.Component)
 | 
			
		||||
Sdl = sdl_ns.class_("Sdl", display.Display, key_provider.KeyProvider)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
CONF_SDL_OPTIONS = "sdl_options"
 | 
			
		||||
 
 | 
			
		||||
@@ -84,6 +84,10 @@ void Sdl::loop() {
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
      case SDL_KEYUP:
 | 
			
		||||
        this->send_key_(e.key.keysym.sym);
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
      default:
 | 
			
		||||
        ESP_LOGV(TAG, "Event %d", e.type);
 | 
			
		||||
        break;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,11 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#ifdef USE_HOST
 | 
			
		||||
#include "esphome/components/display/display.h"
 | 
			
		||||
#include "esphome/components/key_provider/key_provider.h"
 | 
			
		||||
#include "esphome/core/application.h"
 | 
			
		||||
#include "esphome/core/component.h"
 | 
			
		||||
#include "esphome/core/log.h"
 | 
			
		||||
#include "esphome/core/application.h"
 | 
			
		||||
#include "esphome/components/display/display.h"
 | 
			
		||||
#define SDL_MAIN_HANDLED
 | 
			
		||||
#include "SDL.h"
 | 
			
		||||
 | 
			
		||||
@@ -13,7 +14,7 @@ namespace sdl {
 | 
			
		||||
 | 
			
		||||
constexpr static const char *const TAG = "sdl";
 | 
			
		||||
 | 
			
		||||
class Sdl : public display::Display {
 | 
			
		||||
class Sdl : public display::Display, public key_provider::KeyProvider {
 | 
			
		||||
 public:
 | 
			
		||||
  display::DisplayType get_display_type() override { return display::DISPLAY_TYPE_COLOR; }
 | 
			
		||||
  void update() override;
 | 
			
		||||
 
 | 
			
		||||
@@ -43,6 +43,7 @@ from esphome.const import (
 | 
			
		||||
    DEVICE_CLASS_BATTERY,
 | 
			
		||||
    DEVICE_CLASS_CARBON_DIOXIDE,
 | 
			
		||||
    DEVICE_CLASS_CARBON_MONOXIDE,
 | 
			
		||||
    DEVICE_CLASS_CONDUCTIVITY,
 | 
			
		||||
    DEVICE_CLASS_CURRENT,
 | 
			
		||||
    DEVICE_CLASS_DATA_RATE,
 | 
			
		||||
    DEVICE_CLASS_DATA_SIZE,
 | 
			
		||||
@@ -103,6 +104,7 @@ DEVICE_CLASSES = [
 | 
			
		||||
    DEVICE_CLASS_BATTERY,
 | 
			
		||||
    DEVICE_CLASS_CARBON_DIOXIDE,
 | 
			
		||||
    DEVICE_CLASS_CARBON_MONOXIDE,
 | 
			
		||||
    DEVICE_CLASS_CONDUCTIVITY,
 | 
			
		||||
    DEVICE_CLASS_CURRENT,
 | 
			
		||||
    DEVICE_CLASS_DATA_RATE,
 | 
			
		||||
    DEVICE_CLASS_DATA_SIZE,
 | 
			
		||||
 
 | 
			
		||||
@@ -4,11 +4,13 @@ import esphome.config_validation as cv
 | 
			
		||||
import esphome.codegen as cg
 | 
			
		||||
from esphome.const import (
 | 
			
		||||
    CONF_DEVICE_CLASS,
 | 
			
		||||
    CONF_ENTITY_CATEGORY,
 | 
			
		||||
    CONF_ID,
 | 
			
		||||
    CONF_MQTT_ID,
 | 
			
		||||
    CONF_WEB_SERVER_ID,
 | 
			
		||||
    DEVICE_CLASS_EMPTY,
 | 
			
		||||
    DEVICE_CLASS_FIRMWARE,
 | 
			
		||||
    ENTITY_CATEGORY_CONFIG,
 | 
			
		||||
)
 | 
			
		||||
from esphome.core import CORE, coroutine_with_priority
 | 
			
		||||
from esphome.cpp_helpers import setup_entity
 | 
			
		||||
@@ -41,6 +43,9 @@ UPDATE_SCHEMA = (
 | 
			
		||||
            cv.Optional(CONF_ON_UPDATE_AVAILABLE): automation.validate_automation(
 | 
			
		||||
                single=True
 | 
			
		||||
            ),
 | 
			
		||||
            cv.Optional(
 | 
			
		||||
                CONF_ENTITY_CATEGORY, default=ENTITY_CATEGORY_CONFIG
 | 
			
		||||
            ): cv.entity_category,
 | 
			
		||||
        }
 | 
			
		||||
    )
 | 
			
		||||
)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,35 @@
 | 
			
		||||
#include "update_entity.h"
 | 
			
		||||
 | 
			
		||||
#include "esphome/core/log.h"
 | 
			
		||||
 | 
			
		||||
namespace esphome {
 | 
			
		||||
namespace update {
 | 
			
		||||
 | 
			
		||||
static const char *const TAG = "update";
 | 
			
		||||
 | 
			
		||||
void UpdateEntity::publish_state() {
 | 
			
		||||
  ESP_LOGD(TAG, "'%s' - Publishing:", this->name_.c_str());
 | 
			
		||||
  ESP_LOGD(TAG, "  Current Version: %s", this->update_info_.current_version.c_str());
 | 
			
		||||
 | 
			
		||||
  if (!this->update_info_.md5.empty()) {
 | 
			
		||||
    ESP_LOGD(TAG, "  Latest Version: %s", this->update_info_.latest_version.c_str());
 | 
			
		||||
  }
 | 
			
		||||
  if (!this->update_info_.firmware_url.empty()) {
 | 
			
		||||
    ESP_LOGD(TAG, "  Firmware URL: %s", this->update_info_.firmware_url.c_str());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ESP_LOGD(TAG, "  Title: %s", this->update_info_.title.c_str());
 | 
			
		||||
  if (!this->update_info_.summary.empty()) {
 | 
			
		||||
    ESP_LOGD(TAG, "  Summary: %s", this->update_info_.summary.c_str());
 | 
			
		||||
  }
 | 
			
		||||
  if (!this->update_info_.release_url.empty()) {
 | 
			
		||||
    ESP_LOGD(TAG, "  Release URL: %s", this->update_info_.release_url.c_str());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (this->update_info_.has_progress) {
 | 
			
		||||
    ESP_LOGD(TAG, "  Progress: %.0f%%", this->update_info_.progress);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  this->has_state_ = true;
 | 
			
		||||
  this->state_callback_.call();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1070,6 +1070,7 @@ DEVICE_CLASS_BUTTON = "button"
 | 
			
		||||
DEVICE_CLASS_CARBON_DIOXIDE = "carbon_dioxide"
 | 
			
		||||
DEVICE_CLASS_CARBON_MONOXIDE = "carbon_monoxide"
 | 
			
		||||
DEVICE_CLASS_COLD = "cold"
 | 
			
		||||
DEVICE_CLASS_CONDUCTIVITY = "conductivity"
 | 
			
		||||
DEVICE_CLASS_CONNECTIVITY = "connectivity"
 | 
			
		||||
DEVICE_CLASS_CURRENT = "current"
 | 
			
		||||
DEVICE_CLASS_CURTAIN = "curtain"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user