Merge branch 'dev' into optolink

This commit is contained in:
j0ta29 2024-03-28 09:18:33 +01:00 committed by GitHub
commit 493281cff2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 81 additions and 17 deletions

View file

@ -1,6 +1,5 @@
name: API Proto CI name: API Proto CI
# yamllint disable-line rule:truthy
on: on:
pull_request: pull_request:
paths: paths:

View file

@ -2,7 +2,7 @@
name: CI for docker images name: CI for docker images
# Only run when docker paths change # Only run when docker paths change
# yamllint disable-line rule:truthy
on: on:
push: push:
branches: [dev, beta, release] branches: [dev, beta, release]

View file

@ -1,7 +1,6 @@
--- ---
name: CI name: CI
# yamllint disable-line rule:truthy
on: on:
push: push:
branches: [dev, beta, release] branches: [dev, beta, release]

View file

@ -1,7 +1,6 @@
--- ---
name: Lock name: Lock
# yamllint disable-line rule:truthy
on: on:
schedule: schedule:
- cron: "30 0 * * *" - cron: "30 0 * * *"

View file

@ -1,6 +1,5 @@
name: Needs Docs name: Needs Docs
# yamllint disable-line rule:truthy
on: on:
pull_request: pull_request:
types: [labeled, unlabeled] types: [labeled, unlabeled]

View file

@ -1,7 +1,6 @@
--- ---
name: Publish Release name: Publish Release
# yamllint disable-line rule:truthy
on: on:
workflow_dispatch: workflow_dispatch:
release: release:

View file

@ -1,7 +1,6 @@
--- ---
name: Stale name: Stale
# yamllint disable-line rule:truthy
on: on:
schedule: schedule:
- cron: "30 0 * * *" - cron: "30 0 * * *"

View file

@ -1,7 +1,6 @@
--- ---
name: Synchronise Device Classes from Home Assistant name: Synchronise Device Classes from Home Assistant
# yamllint disable-line rule:truthy
on: on:
workflow_dispatch: workflow_dispatch:
schedule: schedule:

View file

@ -1,7 +1,6 @@
--- ---
name: YAML lint name: YAML lint
# yamllint disable-line rule:truthy
on: on:
push: push:
branches: [dev, beta, release] branches: [dev, beta, release]

View file

@ -16,3 +16,4 @@ rules:
indent-sequences: true indent-sequences: true
check-multi-line-strings: false check-multi-line-strings: false
line-length: disable line-length: disable
truthy: disable

View file

@ -317,6 +317,7 @@ esphome/components/sfa30/* @ghsensdev
esphome/components/sgp40/* @SenexCrenshaw esphome/components/sgp40/* @SenexCrenshaw
esphome/components/sgp4x/* @SenexCrenshaw @martgras esphome/components/sgp4x/* @SenexCrenshaw @martgras
esphome/components/shelly_dimmer/* @edge90 @rnauber esphome/components/shelly_dimmer/* @edge90 @rnauber
esphome/components/sht3xd/* @mrtoy-me
esphome/components/sht4x/* @sjtrny esphome/components/sht4x/* @sjtrny
esphome/components/shutdown/* @esphome/core @jsuanet esphome/components/shutdown/* @esphome/core @jsuanet
esphome/components/sigma_delta_output/* @Cat-Ion esphome/components/sigma_delta_output/* @Cat-Ion

View file

@ -51,5 +51,17 @@ void QrCode::draw(display::Display *buff, uint16_t x_offset, uint16_t y_offset,
} }
} }
} }
uint8_t QrCode::get_size() {
if (this->needs_update_) {
this->generate_qr_code();
this->needs_update_ = false;
}
uint8_t size = qrcodegen_getSize(this->qr_);
return size;
}
} // namespace qr_code } // namespace qr_code
} // namespace esphome } // namespace esphome

View file

@ -24,6 +24,8 @@ class QrCode : public Component {
void generate_qr_code(); void generate_qr_code();
uint8_t get_size();
protected: protected:
std::string value_; std::string value_;
qrcodegen_Ecc ecc_; qrcodegen_Ecc ecc_;

View file

@ -14,6 +14,8 @@ from esphome.const import (
CONF_HEATER_ENABLED = "heater_enabled" CONF_HEATER_ENABLED = "heater_enabled"
CODEOWNERS = ["@mrtoy-me"]
DEPENDENCIES = ["i2c"] DEPENDENCIES = ["i2c"]
AUTO_LOAD = ["sensirion_common"] AUTO_LOAD = ["sensirion_common"]
@ -26,13 +28,13 @@ CONFIG_SCHEMA = (
cv.Schema( cv.Schema(
{ {
cv.GenerateID(): cv.declare_id(SHT3XDComponent), cv.GenerateID(): cv.declare_id(SHT3XDComponent),
cv.Required(CONF_TEMPERATURE): sensor.sensor_schema( cv.Optional(CONF_TEMPERATURE): sensor.sensor_schema(
unit_of_measurement=UNIT_CELSIUS, unit_of_measurement=UNIT_CELSIUS,
accuracy_decimals=1, accuracy_decimals=1,
device_class=DEVICE_CLASS_TEMPERATURE, device_class=DEVICE_CLASS_TEMPERATURE,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_MEASUREMENT,
), ),
cv.Required(CONF_HUMIDITY): sensor.sensor_schema( cv.Optional(CONF_HUMIDITY): sensor.sensor_schema(
unit_of_measurement=UNIT_PERCENT, unit_of_measurement=UNIT_PERCENT,
accuracy_decimals=1, accuracy_decimals=1,
device_class=DEVICE_CLASS_HUMIDITY, device_class=DEVICE_CLASS_HUMIDITY,

View file

@ -6,7 +6,11 @@ namespace sht3xd {
static const char *const TAG = "sht3xd"; static const char *const TAG = "sht3xd";
static const uint16_t SHT3XD_COMMAND_READ_SERIAL_NUMBER = 0x3780; // use read serial number register with clock stretching disabled as per other SHT3XD_COMMAND registers
// which provides support for SHT85 sensor
// SHT85 does not support clock stretching and uses same registers as SHT3xd with clock stretching disabled
static const uint16_t SHT3XD_COMMAND_READ_SERIAL_NUMBER = 0x3682;
static const uint16_t SHT3XD_COMMAND_READ_STATUS = 0xF32D; static const uint16_t SHT3XD_COMMAND_READ_STATUS = 0xF32D;
static const uint16_t SHT3XD_COMMAND_CLEAR_STATUS = 0x3041; static const uint16_t SHT3XD_COMMAND_CLEAR_STATUS = 0x3041;
static const uint16_t SHT3XD_COMMAND_HEATER_ENABLE = 0x306D; static const uint16_t SHT3XD_COMMAND_HEATER_ENABLE = 0x306D;
@ -22,25 +26,32 @@ void SHT3XDComponent::setup() {
this->mark_failed(); this->mark_failed();
return; return;
} }
this->serial_number_ = (uint32_t(raw_serial_number[0]) << 16) | uint32_t(raw_serial_number[1]);
if (!this->write_command(heater_enabled_ ? SHT3XD_COMMAND_HEATER_ENABLE : SHT3XD_COMMAND_HEATER_DISABLE)) { if (!this->write_command(heater_enabled_ ? SHT3XD_COMMAND_HEATER_ENABLE : SHT3XD_COMMAND_HEATER_DISABLE)) {
this->mark_failed(); this->mark_failed();
return; return;
} }
uint32_t serial_number = (uint32_t(raw_serial_number[0]) << 16) | uint32_t(raw_serial_number[1]);
ESP_LOGV(TAG, " Serial Number: 0x%08" PRIX32, serial_number);
} }
void SHT3XDComponent::dump_config() { void SHT3XDComponent::dump_config() {
ESP_LOGCONFIG(TAG, "SHT3xD:"); ESP_LOGCONFIG(TAG, "SHT3xD:");
LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with SHT3xD failed!"); ESP_LOGE(TAG, " Communication with SHT3xD failed!");
return;
} }
ESP_LOGD(TAG, " Serial Number: 0x%08" PRIX32, this->serial_number_);
ESP_LOGD(TAG, " Heater Enabled: %s", this->heater_enabled_ ? "true" : "false");
LOG_I2C_DEVICE(this);
LOG_UPDATE_INTERVAL(this); LOG_UPDATE_INTERVAL(this);
LOG_SENSOR(" ", "Temperature", this->temperature_sensor_); LOG_SENSOR(" ", "Temperature", this->temperature_sensor_);
LOG_SENSOR(" ", "Humidity", this->humidity_sensor_); LOG_SENSOR(" ", "Humidity", this->humidity_sensor_);
} }
float SHT3XDComponent::get_setup_priority() const { return setup_priority::DATA; } float SHT3XDComponent::get_setup_priority() const { return setup_priority::DATA; }
void SHT3XDComponent::update() { void SHT3XDComponent::update() {
if (this->status_has_warning()) { if (this->status_has_warning()) {
ESP_LOGD(TAG, "Retrying to reconnect the sensor."); ESP_LOGD(TAG, "Retrying to reconnect the sensor.");

View file

@ -25,6 +25,7 @@ class SHT3XDComponent : public PollingComponent, public sensirion_common::Sensir
sensor::Sensor *temperature_sensor_{nullptr}; sensor::Sensor *temperature_sensor_{nullptr};
sensor::Sensor *humidity_sensor_{nullptr}; sensor::Sensor *humidity_sensor_{nullptr};
bool heater_enabled_{true}; bool heater_enabled_{true};
uint32_t serial_number_{0};
}; };
} // namespace sht3xd } // namespace sht3xd

View file

@ -8,6 +8,6 @@ button:
id: light_off_ceiling_sofa id: light_off_ceiling_sofa
on_press: on_press:
lightwaverf.send_raw: lightwaverf.send_raw:
code: [0x04, 0x00, 0x00, 0x00, 0x0f, 0x03, 0x0d, 0x09, 0x08, 0x08] code: [0x04, 0x00, 0x00, 0x00, 0x0f, 0x03, 0x0d, 0x09, 0x08, 0x08]
name: "Sofa" name: "Sofa"
repeat: 1 repeat: 1

View file

@ -11,6 +11,13 @@ display:
cs_pin: 8 cs_pin: 8
dc_pin: 9 dc_pin: 9
reset_pin: 10 reset_pin: 10
lambda: |-
// Draw a QR code in the center of the screen
auto scale = 2;
auto size = id(homepage_qr).get_size() * scale;
auto x = (it.get_width() / 2) - (size / 2);
auto y = (it.get_height() / 2) - (size / 2);
it.qr_code(x, y, id(homepage_qr), Color(255,255,255), scale);
qr_code: qr_code:
- id: homepage_qr - id: homepage_qr

View file

@ -11,6 +11,13 @@ display:
cs_pin: 8 cs_pin: 8
dc_pin: 9 dc_pin: 9
reset_pin: 10 reset_pin: 10
lambda: |-
// Draw a QR code in the center of the screen
auto scale = 2;
auto size = id(homepage_qr).get_size() * scale;
auto x = (it.get_width() / 2) - (size / 2);
auto y = (it.get_height() / 2) - (size / 2);
it.qr_code(x, y, id(homepage_qr), Color(255,255,255), scale);
qr_code: qr_code:
- id: homepage_qr - id: homepage_qr

View file

@ -11,6 +11,13 @@ display:
cs_pin: 12 cs_pin: 12
dc_pin: 13 dc_pin: 13
reset_pin: 21 reset_pin: 21
lambda: |-
// Draw a QR code in the center of the screen
auto scale = 2;
auto size = id(homepage_qr).get_size() * scale;
auto x = (it.get_width() / 2) - (size / 2);
auto y = (it.get_height() / 2) - (size / 2);
it.qr_code(x, y, id(homepage_qr), Color(255,255,255), scale);
qr_code: qr_code:
- id: homepage_qr - id: homepage_qr

View file

@ -11,6 +11,13 @@ display:
cs_pin: 12 cs_pin: 12
dc_pin: 13 dc_pin: 13
reset_pin: 21 reset_pin: 21
lambda: |-
// Draw a QR code in the center of the screen
auto scale = 2;
auto size = id(homepage_qr).get_size() * scale;
auto x = (it.get_width() / 2) - (size / 2);
auto y = (it.get_height() / 2) - (size / 2);
it.qr_code(x, y, id(homepage_qr), Color(255,255,255), scale);
qr_code: qr_code:
- id: homepage_qr - id: homepage_qr

View file

@ -11,6 +11,13 @@ display:
cs_pin: 5 cs_pin: 5
dc_pin: 15 dc_pin: 15
reset_pin: 16 reset_pin: 16
lambda: |-
// Draw a QR code in the center of the screen
auto scale = 2;
auto size = id(homepage_qr).get_size() * scale;
auto x = (it.get_width() / 2) - (size / 2);
auto y = (it.get_height() / 2) - (size / 2);
it.qr_code(x, y, id(homepage_qr), Color(255,255,255), scale);
qr_code: qr_code:
- id: homepage_qr - id: homepage_qr

View file

@ -11,6 +11,13 @@ display:
cs_pin: 20 cs_pin: 20
dc_pin: 21 dc_pin: 21
reset_pin: 22 reset_pin: 22
lambda: |-
// Draw a QR code in the center of the screen
auto scale = 2;
auto size = id(homepage_qr).get_size() * scale;
auto x = (it.get_width() / 2) - (size / 2);
auto y = (it.get_height() / 2) - (size / 2);
it.qr_code(x, y, id(homepage_qr), Color(255,255,255), scale);
qr_code: qr_code:
- id: homepage_qr - id: homepage_qr