1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-02 08:01:50 +00:00

Compare commits

...

10 Commits

Author SHA1 Message Date
Jesse Hills
dfb98b523f [sdl] Allow the display to act as a KeyProvider 2024-06-24 16:37:54 +12:00
Samuel Sieb
17204baac0 allow template parameters (#6972) 2024-06-24 10:22:08 +12:00
Manuel Kasper
1e05bcaa61 [qspi_amoled] Fix clear/fill with rotation (#6960) 2024-06-23 01:10:22 +10:00
esphomebot
18690d51f5 Synchronise Device Classes from Home Assistant (#6966) 2024-06-22 13:27:47 +00:00
Samuel Sieb
2aacf14e96 Onewire (#6967)
* retry scan

* setup pin and log retries

* fix retries

* remove retries

---------

Co-authored-by: Samuel Sieb <samuel@sieb.net>
2024-06-22 11:57:27 +00:00
dependabot[bot]
9c5507ab46 Bump docker/build-push-action from 6.0.1 to 6.1.0 in /.github/actions/build-image (#6962)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-22 12:50:21 +02:00
Kevin P. Fleming
0a9703bff9 ESP-IDF 4.x expects seconds for esp_task_wdt_init(), not milliseconds. (#6964) 2024-06-21 21:28:11 +00:00
Kevin P. Fleming
67bd5db6d6 Fix infinite loop in http_request for ESP-IDF. (#6963) 2024-06-22 09:18:43 +12:00
Manuel Kasper
6c11f0bd51 [qspi_amoled] Fix display remaining blank after update() before setup completion (#6958) 2024-06-22 00:46:06 +10:00
Jesse Hills
e7556271e7 [update] Set entity_category to config & Publish state to logs (#6954) 2024-06-21 02:59:52 +00:00
15 changed files with 60 additions and 13 deletions

View File

@@ -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

View File

@@ -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();
}

View File

@@ -90,7 +90,7 @@ std::shared_ptr<HttpContainer> HttpRequestIDF::start(std::string url, std::strin
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;

View File

@@ -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

View File

@@ -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,

View File

@@ -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) {

View File

@@ -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_();

View File

@@ -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):

View File

@@ -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"

View File

@@ -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;

View File

@@ -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;

View File

@@ -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,

View File

@@ -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,
}
)
)

View File

@@ -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();
}

View File

@@ -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"