Compare commits

..

108 Commits

Author SHA1 Message Date
Jesse Hills
dd8dc1ef1d Merge pull request #4609 from esphome/bump-2023.3.1
2023.3.1
2023-03-22 12:40:28 +13:00
Jesse Hills
bc427de16a Bump version to 2023.3.1 2023-03-22 12:03:34 +13:00
Jesse Hills
db5988bbe1 rp2040: Use fake Mutex lock (#4602) 2023-03-22 12:03:34 +13:00
Nathaniel Wesley Filardo
a3875af4b4 climate: brown paper bag fix for on_configure (#4573)
I forgot this hunk in https://github.com/esphome/esphome/pull/4511 .
I'm sorry for the noise.
2023-03-22 12:03:34 +13:00
Jesse Hills
e6737479f7 Merge pull request #4568 from esphome/bump-2023.3.0
2023.3.0
2023-03-16 10:40:18 +13:00
Jesse Hills
7f75832bf1 Bump version to 2023.3.0 2023-03-16 09:38:19 +13:00
Jesse Hills
33339e3bd8 Merge branch 'beta' into bump-2023.3.0 2023-03-16 09:38:19 +13:00
Jesse Hills
c298c1166f Merge pull request #4567 from esphome/bump-2023.3.0b6
2023.3.0b6
2023-03-16 09:34:00 +13:00
Jesse Hills
c3d9eef01f Bump version to 2023.3.0b6 2023-03-16 08:57:54 +13:00
NP v/d Spek
5ffdc66864 fixing shrink and extend functions of the displaybuffer's Rect class (#4565)
* fixing rectangle's `shrink` and `extend`

* fixed the rect::shrink and rect::inside methods
and added rect:equal() method

* fixed internal clang issue again. When would is
this going to be fixed :(

* fixed internal clang issue again. When would is
this going to be fixed :(

* remove trailing space
2023-03-16 08:57:54 +13:00
Jesse Hills
9922c1503a Merge pull request #4564 from esphome/bump-2023.3.0b5
2023.3.0b5
2023-03-15 23:46:14 +13:00
Jesse Hills
fce99d4b17 Bump version to 2023.3.0b5 2023-03-15 21:20:08 +13:00
Jesse Hills
11567085d8 Mark esp32_touch supported only on standard esp32 variant (#4562)
* Mark esp32_touch supported only on standard esp32 variant

* Add back default
2023-03-15 21:20:08 +13:00
Keith Burzinski
83f8e84247 Remove switch actions during config; bump setup priority (#4563) 2023-03-15 21:20:08 +13:00
Jesse Hills
11eb5cb0fa Merge pull request #4559 from esphome/bump-2023.3.0b4
2023.3.0b4
2023-03-14 16:17:51 +13:00
Jesse Hills
9a7af97b2d Bump version to 2023.3.0b4 2023-03-14 14:11:55 +13:00
Stroe Andrei Catalin
5e11469f50 Added response for Tuya RSSI command (#4549)
* Added wifi rssi util
Added tuya mcu response to wifi rssi command

* Cleanup

* PR Comments

* PR Comments
2023-03-14 14:11:55 +13:00
DAVe3283
0c7a3d1fff Revert "Remove state class from uptime sensor (#4345)" (#4557)
This reverts commit 36c2e770bf.
Addresses esphome/issues#4193.
2023-03-14 14:11:55 +13:00
Eduardo Roldan
8a705bf4b0 pipsolar component. Correct the sscanf format for QPIG command parsing to set pv_input_voltage as float (not int) (#4165) 2023-03-14 14:11:55 +13:00
Jesse Hills
6a89180deb Merge pull request #4553 from esphome/bump-2023.3.0b3
2023.3.0b3
2023-03-13 15:31:04 +13:00
Jesse Hills
65d2b806cc Bump version to 2023.3.0b3 2023-03-13 13:32:21 +13:00
Jesse Hills
c149a3033c Map gpio pins for touch on esp32-s2/s3 (#4552)
* Map gpio pins for touch on esp32-s2/s3

* fix value
2023-03-13 13:32:21 +13:00
NP v/d Spek
4b7c233f1a On the ILI9xxx display's enable the psram on esp32 and allow big screen (#4551)
* enable the psram on esp32 and allow big screen

* update CODEOWNERS

* small update

* update CODEOWNERS again.

* Removed the M5STACK because it is a ESP32 device.

* i removed the wrong model

* update the error message.
2023-03-13 13:32:21 +13:00
Jesse Hills
6e8e9c2aa9 Allow AUTO_LOAD to be a function (#4550) 2023-03-13 13:32:21 +13:00
Dorian Zedler
b6f628ee40 Feat: add support for hex color in color component (#4493)
* Feat: add support for hex color in color component

* Chore: move hex color validator to color component

* Chore: add test

* Chore: fix formatting

* Chore: make linter happy

* Chore: make linter happy

* Fix: parse correct offsets

Co-authored-by: Oxan van Leeuwen <oxan@oxanvanleeuwen.nl>

* Chore: use cv.Invalid

* Fix: remove # because it indicates a comment in yaml

* Fix: only allow hex if no other color value is set

* Fix: tests

* Fix: mutual exclusion of raw and hex colors

* Chore: format file

* Update __init__.py

---------

Co-authored-by: Oxan van Leeuwen <oxan@oxanvanleeuwen.nl>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2023-03-13 13:32:21 +13:00
Martin Murray
bf79a700b7 Add carbon dioxide device class to scd30 sensor schema. (#4547) 2023-03-13 13:32:21 +13:00
jakehdk
cdeb6e750f Add support for new clones of mpu6050 responding with 0x70 address (#4546)
Co-authored-by: jakehdk <Jake@Jakobs-MacBook-Pro.local>
2023-03-13 13:32:21 +13:00
Jesse Hills
c037e95861 Merge pull request #4478 from esphome/bump-2023.2.4
2023.2.4
2023-02-23 14:17:01 +13:00
Jesse Hills
2e1b35959f Bump version to 2023.2.4 2023-02-23 13:42:02 +13:00
Jesse Hills
7f46d9e0f9 Fix multiple remote_receivers with triggers (#4477) 2023-02-23 13:42:01 +13:00
Samuel Sieb
069b5f81a0 fix parity (#4476)
Co-authored-by: Samuel Sieb <samuel@sieb.net>
2023-02-23 13:42:01 +13:00
konsulten
3a36d0b13f BL0939 state_class set for energy sensors (#4463)
BL0939 was missing TOTAL_INCREASING for energy (kWh) thus it did not show as statistics in home assistant
2023-02-23 13:42:01 +13:00
Jesse Hills
f0760e99b7 Merge pull request #4466 from esphome/bump-2023.2.3
2023.2.3
2023-02-20 08:54:32 +13:00
Jesse Hills
18fecf8c09 Bump version to 2023.2.3 2023-02-20 08:16:47 +13:00
Jesse Hills
414cf1b333 Update Manifest to rmeove unused dashboard files and include .c ethernet drivers (#4459) 2023-02-20 08:16:46 +13:00
jmichiel
d10f891f51 fix preset discovery config (#4451)
Co-authored-by: Michiel, Jeroen <jeroen.michiel@teledyneflir.com>
2023-02-20 08:16:46 +13:00
Jesse Hills
b5927322e6 Merge pull request #4458 from esphome/bump-2023.2.2
2023.2.2
2023-02-17 19:38:01 +13:00
Jesse Hills
1cf4107e1c Bump version to 2023.2.2 2023-02-17 19:11:15 +13:00
Jesse Hills
c12408326c Fix adoption of variants and pico-w (#4455) 2023-02-17 19:11:14 +13:00
Jesse Hills
4434e59e5a Merge pull request #4445 from esphome/bump-2023.2.1
2023.2.1
2023-02-16 15:44:32 +13:00
Jesse Hills
45180d98f6 Bump version to 2023.2.1 2023-02-16 14:06:42 +13:00
Jesse Hills
44494ad18e Add ESPHome version to generated platformio.ini (#4443)
* Add ESPHome version to generated platformio.ini

* Move description to platformio section
2023-02-16 14:06:42 +13:00
Jesse Hills
1447536906 Merge pull request #4441 from esphome/bump-2023.2.0
2023.2.0
2023-02-15 22:33:31 +13:00
Jesse Hills
27ec517084 Remove dup line 2023-02-15 21:39:17 +13:00
Jesse Hills
ce1f034bac Bump version to 2023.2.0 2023-02-15 19:29:02 +13:00
Jesse Hills
f1f96f16e9 Merge branch 'beta' into bump-2023.2.0 2023-02-15 19:29:02 +13:00
Jesse Hills
4af4649e23 Merge pull request #4355 from esphome/bump-2022.12.8
2022.12.8
2023-01-27 10:04:29 +13:00
Jesse Hills
8bcddef39d Bump version to 2022.12.8 2023-01-27 09:44:41 +13:00
Franck Nijhof
4ac96ccea2 Add Home Assistant integration discovery (#4328) 2023-01-27 09:44:41 +13:00
Franck Nijhof
3c5de77ae9 Refactor NGINX configuration of Home Assistant Add-on (#4312) 2023-01-27 09:44:41 +13:00
Franck Nijhof
a2925b1d37 Migrate old-style S6 scripts to s6-rc.d (#4311) 2023-01-27 09:44:41 +13:00
Franck Nijhof
73748e9e20 Upgrades add-on base image to 6.2.0 (#4310) 2023-01-27 09:44:40 +13:00
Jesse Hills
75c9823899 Merge pull request #4350 from esphome/bump-2022.12.7
2022.12.7
2023-01-26 15:50:03 +13:00
Jesse Hills
c8c0bd3351 Bump version to 2022.12.7 2023-01-26 15:00:18 +13:00
melyux
e1cdeb7c8f Add a soft reset in setup() for bmp280 (#4329)
fixes https://github.com/esphome/issues/issues/3383
2023-01-26 15:00:17 +13:00
Alex
7f97f42552 Fix BME280 initialization before wifi setup (#4190)
fixes https://github.com/esphome/issues/issues/3530
2023-01-26 15:00:17 +13:00
Stephan Martin
aa7f3569ec rename esp32 CAN to TWAI, so it compiles again (#4334)
fixes https://github.com/esphome/issues/issues/4023
2023-01-26 15:00:17 +13:00
Denis Bodor (aka Lefinnois)
2d0a08442e fix stepper jump back with small steps (#4339) 2023-01-26 15:00:17 +13:00
Joakim Sørensen
d2380756b2 Add "content" to deploy-ha-addon-repo dispatch (#4349) 2023-01-26 15:00:17 +13:00
Jesse Hills
925e3cb6c9 Fix missing s 2023-01-23 20:34:31 +00:00
Jesse Hills
6757acba56 Merge pull request #4342 from esphome/bump-2022.12.6
2022.12.6
2023-01-24 08:58:45 +13:00
Jesse Hills
5cc91cdd95 Bump version to 2022.12.6 2023-01-24 08:30:42 +13:00
Jesse Hills
2b41886819 Move from docker manifest command to buildx with platforms (#4320) 2023-01-24 08:30:42 +13:00
Jesse Hills
72c6efd6a0 Merge pull request #4335 from esphome/bump-2022.12.5
2022.12.5
2023-01-23 09:27:18 +13:00
Jesse Hills
a1f1804112 Bump version to 2022.12.5 2023-01-23 09:06:20 +13:00
Jesse Hills
a8b1ceb4e9 Bump nano version in lint docker image (#4218) 2023-01-23 09:06:20 +13:00
Jesse Hills
4fb0f7f8c6 Merge pull request #4323 from esphome/bump-2022.12.4
2022.12.4
2023-01-21 16:17:57 +13:00
Jesse Hills
958cadeca8 Bump version to 2022.12.4 2023-01-20 18:33:09 +13:00
J. Nick Koston
00f2655f1a Always send the MTU request for BLE v3 cached connections (#4322)
closes https://github.com/esphome/esphome/pull/4321
fixes https://github.com/esphome/issues/issues/4041
fixes https://github.com/esphome/issues/issues/3951
2023-01-20 18:33:09 +13:00
Jesse Hills
074f5029eb Fix gpio pin mode for ISR pins (#4216) 2023-01-20 18:33:09 +13:00
Jesse Hills
1691976587 Merge pull request #4214 from esphome/bump-2022.12.3
2022.12.3
2022-12-20 23:34:01 +13:00
Jesse Hills
60e6b4d21e Bump version to 2022.12.3 2022-12-20 23:15:39 +13:00
Jesse Hills
5750591df2 Fix ESP32 GPIO when using INPUT PULLUP mode (#4213) 2022-12-20 23:15:39 +13:00
Jesse Hills
a75da54455 Merge pull request #4212 from esphome/bump-2022.12.2
2022.12.2
2022-12-20 11:06:34 +13:00
Jesse Hills
de7f6c3f5f Bump version to 2022.12.2 2022-12-20 10:49:36 +13:00
J. Nick Koston
4245480656 Handle zero padding anywhere in the combined adv data (#4208)
fixes https://github.com/esphome/issues/issues/3913
2022-12-20 10:49:35 +13:00
Jesse Hills
1824c8131e Fix import_full_config for adoption configs (#4197)
* Fix git raw url

* Fix setting full config query param

* Force dashboard import urls to have a branch or tag reference for full import
2022-12-20 10:49:35 +13:00
Jesse Hills
4e9606d2e0 Merge pull request #4196 from esphome/bump-2022.12.1
2022.12.1
2022-12-16 14:05:24 +13:00
Jesse Hills
78500fa933 Bump version to 2022.12.1 2022-12-16 13:36:11 +13:00
Jesse Hills
9c69b98a49 Fix i2s_audio media_player compiling for esp32-s2 (#4195) 2022-12-16 13:36:10 +13:00
Jesse Hills
e6d8ef98d3 Mark ESP32-S2 as not having Bluetooth (#4194) 2022-12-16 13:36:10 +13:00
Stefan Agner
3f1af1690b Support non-multiarch toolchains on 32-bit ARM (#4191)
fixes https://github.com/esphome/issues/issues/3904
2022-12-16 13:36:10 +13:00
Jesse Hills
84374b6b1e Merge pull request #4186 from esphome/bump-2022.12.0
2022.12.0
2022-12-14 17:06:24 +13:00
Jesse Hills
391316c9b5 Bump version to 2022.12.0 2022-12-14 16:37:39 +13:00
Jesse Hills
705c62ebd7 Merge branch 'beta' into bump-2022.12.0 2022-12-14 16:37:39 +13:00
Jesse Hills
7209dd8bae Merge pull request #4152 from esphome/bump-2022.11.5
2022.11.5
2022-12-06 13:12:57 +13:00
Jesse Hills
ab736c89bb Bump version to 2022.11.5 2022-12-06 12:52:48 +13:00
Jesse Hills
6911639617 Fix board pin alias lookup (#4147) 2022-12-06 12:52:48 +13:00
Jesse Hills
b9720d0715 Merge pull request #4130 from esphome/bump-2022.11.4
2022.11.4
2022-12-01 15:38:52 +13:00
Jesse Hills
47b3267ed4 Bump version to 2022.11.4 2022-12-01 13:47:50 +13:00
Jesse Hills
e16ba2adb5 Fix queuing scripts not compiling (#4077) 2022-12-01 13:47:50 +13:00
Nicolas Graziano
0a19b1e32c Dashboard, after login use relative url. (#4103) 2022-12-01 13:47:49 +13:00
Jesse Hills
bae9a950c0 current-based cover fix copy paste mistake (#4124) 2022-12-01 13:47:49 +13:00
Jesse Hills
72b2943332 Merge pull request #4083 from esphome/bump-2022.11.3
2022.11.3
2022-11-25 07:23:08 +13:00
Jesse Hills
4ec0ef7548 Bump version to 2022.11.3 2022-11-24 17:01:52 +13:00
Jesse Hills
25bc6761f6 Don't convert climate temperature step (#4082) 2022-11-24 17:01:52 +13:00
Brian Kaufman
81b6562c25 Fix units for refresh: never (#4048) 2022-11-24 17:01:52 +13:00
Samuel Sieb
ae74189fc2 fix missing library (#4051) 2022-11-24 17:01:51 +13:00
Jesse Hills
9e516efe10 Merge pull request #4074 from esphome/bump-2022.11.2
2022.11.2
2022-11-23 16:06:34 +13:00
Jesse Hills
366e29439e Bump version to 2022.11.2 2022-11-23 13:04:21 +13:00
J. Nick Koston
1c9c700d7f Avoid creating a new espbt::ESPBTUUID each loop when registering for notify (#4069) 2022-11-23 13:04:21 +13:00
J. Nick Koston
b2e6b9d31f Avoid 128bit uuid loop for 16/32 bit uuids (#4068) 2022-11-23 13:04:21 +13:00
Jesse Hills
7623f63846 rp2040_pwm frequency is per pair of pins (#4061) 2022-11-23 13:04:21 +13:00
Jesse Hills
2bfaf9dce3 Update web_server index (#4060) 2022-11-23 13:04:20 +13:00
Jesse Hills
5c2c1560bb Fix rp2040 pwm to use pico-sdk, not mbed (#4059) 2022-11-23 13:04:20 +13:00
Jesse Hills
f7096ab78e Merge pull request #4041 from esphome/bump-2022.11.1
2022.11.1
2022-11-17 15:40:51 +13:00
Jesse Hills
98f8feb625 Bump version to 2022.11.1 2022-11-17 13:52:15 +13:00
Jesse Hills
9944ca414e Support ADC on RP2040 (#4040) 2022-11-17 13:52:15 +13:00
22 changed files with 221 additions and 85 deletions

View File

@@ -324,6 +324,10 @@ async def setup_climate_core_(var, config):
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
await automation.build_automation(trigger, [], conf)
for conf in config.get(CONF_ON_CONTROL, []):
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
await automation.build_automation(trigger, [], conf)
async def register_climate(var, config):
if not CORE.has_id(config[CONF_ID]):

View File

@@ -10,23 +10,42 @@ CONF_RED_INT = "red_int"
CONF_GREEN_INT = "green_int"
CONF_BLUE_INT = "blue_int"
CONF_WHITE_INT = "white_int"
CONFIG_SCHEMA = cv.Schema(
{
cv.Required(CONF_ID): cv.declare_id(ColorStruct),
cv.Exclusive(CONF_RED, "red"): cv.percentage,
cv.Exclusive(CONF_RED_INT, "red"): cv.uint8_t,
cv.Exclusive(CONF_GREEN, "green"): cv.percentage,
cv.Exclusive(CONF_GREEN_INT, "green"): cv.uint8_t,
cv.Exclusive(CONF_BLUE, "blue"): cv.percentage,
cv.Exclusive(CONF_BLUE_INT, "blue"): cv.uint8_t,
cv.Exclusive(CONF_WHITE, "white"): cv.percentage,
cv.Exclusive(CONF_WHITE_INT, "white"): cv.uint8_t,
}
).extend(cv.COMPONENT_SCHEMA)
CONF_HEX = "hex"
async def to_code(config):
def hex_color(value):
if len(value) != 6:
raise cv.Invalid("Color must have six digits")
try:
return (int(value[0:2], 16), int(value[2:4], 16), int(value[4:6], 16))
except ValueError as exc:
raise cv.Invalid("Color must be hexadecimal") from exc
CONFIG_SCHEMA = cv.Any(
cv.Schema(
{
cv.Required(CONF_ID): cv.declare_id(ColorStruct),
cv.Exclusive(CONF_RED, "red"): cv.percentage,
cv.Exclusive(CONF_RED_INT, "red"): cv.uint8_t,
cv.Exclusive(CONF_GREEN, "green"): cv.percentage,
cv.Exclusive(CONF_GREEN_INT, "green"): cv.uint8_t,
cv.Exclusive(CONF_BLUE, "blue"): cv.percentage,
cv.Exclusive(CONF_BLUE_INT, "blue"): cv.uint8_t,
cv.Exclusive(CONF_WHITE, "white"): cv.percentage,
cv.Exclusive(CONF_WHITE_INT, "white"): cv.uint8_t,
}
).extend(cv.COMPONENT_SCHEMA),
cv.Schema(
{
cv.Required(CONF_ID): cv.declare_id(ColorStruct),
cv.Required(CONF_HEX): hex_color,
}
).extend(cv.COMPONENT_SCHEMA),
)
def from_rgbw(config):
r = 0
if CONF_RED in config:
r = int(config[CONF_RED] * 255)
@@ -51,6 +70,16 @@ async def to_code(config):
elif CONF_WHITE_INT in config:
w = config[CONF_WHITE_INT]
return (r, g, b, w)
async def to_code(config):
if CONF_HEX in config:
r, g, b = config[CONF_HEX]
w = 0
else:
r, g, b, w = from_rgbw(config)
cg.new_variable(
config[CONF_ID],
cg.StructInitializer(ColorStruct, ("r", r), ("g", g), ("b", b), ("w", w)),

View File

@@ -32,9 +32,11 @@ void Rect::extend(Rect rect) {
this->h = rect.h;
} else {
if (this->x > rect.x) {
this->w = this->w + (this->x - rect.x);
this->x = rect.x;
}
if (this->y > rect.y) {
this->h = this->h + (this->y - rect.y);
this->y = rect.y;
}
if (this->x2() < rect.x2()) {
@@ -49,29 +51,35 @@ void Rect::shrink(Rect rect) {
if (!this->inside(rect)) {
(*this) = Rect();
} else {
if (this->x < rect.x) {
this->x = rect.x;
}
if (this->y < rect.y) {
this->y = rect.y;
}
if (this->x2() > rect.x2()) {
this->w = rect.x2() - this->x;
}
if (this->x < rect.x) {
this->w = this->w + (this->x - rect.x);
this->x = rect.x;
}
if (this->y2() > rect.y2()) {
this->h = rect.y2() - this->y;
}
if (this->y < rect.y) {
this->h = this->h + (this->y - rect.y);
this->y = rect.y;
}
}
}
bool Rect::inside(int16_t x, int16_t y, bool absolute) { // NOLINT
bool Rect::equal(Rect rect) {
return (rect.x == this->x) && (rect.w == this->w) && (rect.y == this->y) && (rect.h == this->h);
}
bool Rect::inside(int16_t test_x, int16_t test_y, bool absolute) { // NOLINT
if (!this->is_set()) {
return true;
}
if (absolute) {
return ((x >= 0) && (x <= this->w) && (y >= 0) && (y <= this->h));
return ((test_x >= this->x) && (test_x <= this->x2()) && (test_y >= this->y) && (test_y <= this->y2()));
} else {
return ((x >= this->x) && (x <= this->x2()) && (y >= this->y) && (y <= this->y2()));
return ((test_x >= 0) && (test_x <= this->w) && (test_y >= 0) && (test_y <= this->h));
}
}
@@ -80,15 +88,16 @@ bool Rect::inside(Rect rect, bool absolute) {
return true;
}
if (absolute) {
return ((rect.x <= this->w) && (rect.w >= 0) && (rect.y <= this->h) && (rect.h >= 0));
} else {
return ((rect.x <= this->x2()) && (rect.x2() >= this->x) && (rect.y <= this->y2()) && (rect.y2() >= this->y));
} else {
return ((rect.x <= this->w) && (rect.w >= 0) && (rect.y <= this->h) && (rect.h >= 0));
}
}
void Rect::info(const std::string &prefix) {
if (this->is_set()) {
ESP_LOGI(TAG, "%s [%3d,%3d,%3d,%3d]", prefix.c_str(), this->x, this->y, this->w, this->h);
ESP_LOGI(TAG, "%s [%3d,%3d,%3d,%3d] (%3d,%3d)", prefix.c_str(), this->x, this->y, this->w, this->h, this->x2(),
this->y2());
} else
ESP_LOGI(TAG, "%s ** IS NOT SET **", prefix.c_str());
}

View File

@@ -120,8 +120,9 @@ class Rect {
void extend(Rect rect);
void shrink(Rect rect);
bool inside(Rect rect, bool absolute = false);
bool inside(int16_t x, int16_t y, bool absolute = false);
bool inside(Rect rect, bool absolute = true);
bool inside(int16_t test_x, int16_t test_y, bool absolute = true);
bool equal(Rect rect);
void info(const std::string &prefix = "rect info:");
};

View File

@@ -12,6 +12,8 @@ CONF_BLE_ID = "ble_id"
NO_BLUTOOTH_VARIANTS = [const.VARIANT_ESP32S2]
NO_BLUTOOTH_VARIANTS = [const.VARIANT_ESP32S2]
esp32_ble_ns = cg.esphome_ns.namespace("esp32_ble")
ESP32BLE = esp32_ble_ns.class_("ESP32BLE", cg.Component)

View File

@@ -11,6 +11,7 @@ from esphome.const import (
CONF_VOLTAGE_ATTENUATION,
)
from esphome.core import TimePeriod
from esphome.components import esp32
AUTO_LOAD = ["binary_sensor"]
DEPENDENCIES = ["esp32"]
@@ -50,30 +51,37 @@ VOLTAGE_ATTENUATION = {
"0V": cg.global_ns.TOUCH_HVOLT_ATTEN_0V,
}
CONFIG_SCHEMA = cv.Schema(
{
cv.GenerateID(): cv.declare_id(ESP32TouchComponent),
cv.Optional(CONF_SETUP_MODE, default=False): cv.boolean,
cv.Optional(
CONF_IIR_FILTER, default="0ms"
): cv.positive_time_period_milliseconds,
cv.Optional(CONF_SLEEP_DURATION, default="27306us"): cv.All(
cv.positive_time_period, cv.Range(max=TimePeriod(microseconds=436906))
),
cv.Optional(CONF_MEASUREMENT_DURATION, default="8192us"): cv.All(
cv.positive_time_period, cv.Range(max=TimePeriod(microseconds=8192))
),
cv.Optional(CONF_LOW_VOLTAGE_REFERENCE, default="0.5V"): validate_voltage(
LOW_VOLTAGE_REFERENCE
),
cv.Optional(CONF_HIGH_VOLTAGE_REFERENCE, default="2.7V"): validate_voltage(
HIGH_VOLTAGE_REFERENCE
),
cv.Optional(CONF_VOLTAGE_ATTENUATION, default="0V"): validate_voltage(
VOLTAGE_ATTENUATION
),
}
).extend(cv.COMPONENT_SCHEMA)
CONFIG_SCHEMA = cv.All(
cv.Schema(
{
cv.GenerateID(): cv.declare_id(ESP32TouchComponent),
cv.Optional(CONF_SETUP_MODE, default=False): cv.boolean,
cv.Optional(
CONF_IIR_FILTER, default="0ms"
): cv.positive_time_period_milliseconds,
cv.Optional(CONF_SLEEP_DURATION, default="27306us"): cv.All(
cv.positive_time_period, cv.Range(max=TimePeriod(microseconds=436906))
),
cv.Optional(CONF_MEASUREMENT_DURATION, default="8192us"): cv.All(
cv.positive_time_period, cv.Range(max=TimePeriod(microseconds=8192))
),
cv.Optional(CONF_LOW_VOLTAGE_REFERENCE, default="0.5V"): validate_voltage(
LOW_VOLTAGE_REFERENCE
),
cv.Optional(CONF_HIGH_VOLTAGE_REFERENCE, default="2.7V"): validate_voltage(
HIGH_VOLTAGE_REFERENCE
),
cv.Optional(CONF_VOLTAGE_ATTENUATION, default="0V"): validate_voltage(
VOLTAGE_ATTENUATION
),
}
).extend(cv.COMPONENT_SCHEMA),
esp32.only_on_variant(
supported=[
esp32.const.VARIANT_ESP32,
]
),
)
async def to_code(config):

View File

@@ -1,5 +1,6 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.core import CORE
from esphome.components import binary_sensor
from esphome.const import (
CONF_PIN,
@@ -7,6 +8,13 @@ from esphome.const import (
CONF_ID,
)
from esphome.components.esp32 import gpio
from esphome.components.esp32.const import (
KEY_ESP32,
KEY_VARIANT,
VARIANT_ESP32,
VARIANT_ESP32S2,
VARIANT_ESP32S3,
)
from . import esp32_touch_ns, ESP32TouchComponent
DEPENDENCIES = ["esp32_touch", "esp32"]
@@ -15,24 +23,63 @@ CONF_ESP32_TOUCH_ID = "esp32_touch_id"
CONF_WAKEUP_THRESHOLD = "wakeup_threshold"
TOUCH_PADS = {
4: cg.global_ns.TOUCH_PAD_NUM0,
0: cg.global_ns.TOUCH_PAD_NUM1,
2: cg.global_ns.TOUCH_PAD_NUM2,
15: cg.global_ns.TOUCH_PAD_NUM3,
13: cg.global_ns.TOUCH_PAD_NUM4,
12: cg.global_ns.TOUCH_PAD_NUM5,
14: cg.global_ns.TOUCH_PAD_NUM6,
27: cg.global_ns.TOUCH_PAD_NUM7,
33: cg.global_ns.TOUCH_PAD_NUM8,
32: cg.global_ns.TOUCH_PAD_NUM9,
VARIANT_ESP32: {
4: cg.global_ns.TOUCH_PAD_NUM0,
0: cg.global_ns.TOUCH_PAD_NUM1,
2: cg.global_ns.TOUCH_PAD_NUM2,
15: cg.global_ns.TOUCH_PAD_NUM3,
13: cg.global_ns.TOUCH_PAD_NUM4,
12: cg.global_ns.TOUCH_PAD_NUM5,
14: cg.global_ns.TOUCH_PAD_NUM6,
27: cg.global_ns.TOUCH_PAD_NUM7,
33: cg.global_ns.TOUCH_PAD_NUM8,
32: cg.global_ns.TOUCH_PAD_NUM9,
},
VARIANT_ESP32S2: {
1: cg.global_ns.TOUCH_PAD_NUM1,
2: cg.global_ns.TOUCH_PAD_NUM2,
3: cg.global_ns.TOUCH_PAD_NUM3,
4: cg.global_ns.TOUCH_PAD_NUM4,
5: cg.global_ns.TOUCH_PAD_NUM5,
6: cg.global_ns.TOUCH_PAD_NUM6,
7: cg.global_ns.TOUCH_PAD_NUM7,
8: cg.global_ns.TOUCH_PAD_NUM8,
9: cg.global_ns.TOUCH_PAD_NUM9,
10: cg.global_ns.TOUCH_PAD_NUM10,
11: cg.global_ns.TOUCH_PAD_NUM11,
12: cg.global_ns.TOUCH_PAD_NUM12,
13: cg.global_ns.TOUCH_PAD_NUM13,
14: cg.global_ns.TOUCH_PAD_NUM14,
},
VARIANT_ESP32S3: {
1: cg.global_ns.TOUCH_PAD_NUM1,
2: cg.global_ns.TOUCH_PAD_NUM2,
3: cg.global_ns.TOUCH_PAD_NUM3,
4: cg.global_ns.TOUCH_PAD_NUM4,
5: cg.global_ns.TOUCH_PAD_NUM5,
6: cg.global_ns.TOUCH_PAD_NUM6,
7: cg.global_ns.TOUCH_PAD_NUM7,
8: cg.global_ns.TOUCH_PAD_NUM8,
9: cg.global_ns.TOUCH_PAD_NUM9,
10: cg.global_ns.TOUCH_PAD_NUM10,
11: cg.global_ns.TOUCH_PAD_NUM11,
12: cg.global_ns.TOUCH_PAD_NUM12,
13: cg.global_ns.TOUCH_PAD_NUM13,
14: cg.global_ns.TOUCH_PAD_NUM14,
},
}
def validate_touch_pad(value):
value = gpio.validate_gpio_pin(value)
if value not in TOUCH_PADS:
variant = CORE.data[KEY_ESP32][KEY_VARIANT]
if variant not in TOUCH_PADS:
raise cv.Invalid(f"ESP32 variant {variant} does not support touch pads.")
pads = TOUCH_PADS[variant]
if value not in pads:
raise cv.Invalid(f"Pin {value} does not support touch pads.")
return value
return cv.enum(pads)(value)
ESP32TouchBinarySensor = esp32_touch_ns.class_(
@@ -53,7 +100,7 @@ async def to_code(config):
hub = await cg.get_variable(config[CONF_ESP32_TOUCH_ID])
var = cg.new_Pvariable(
config[CONF_ID],
TOUCH_PADS[config[CONF_PIN]],
config[CONF_PIN],
config[CONF_THRESHOLD],
config[CONF_WAKEUP_THRESHOLD],
)

View File

@@ -16,7 +16,13 @@ from esphome.const import (
)
DEPENDENCIES = ["spi"]
AUTO_LOAD = ["psram"]
def AUTO_LOAD():
if CORE.is_esp32:
return ["psram"]
return []
CODEOWNERS = ["@nielsnl68"]
@@ -60,6 +66,16 @@ def _validate(config):
raise cv.Invalid(
"Providing color palette images requires palette mode to be 'IMAGE_ADAPTIVE'"
)
if CORE.is_esp8266 and config.get(CONF_MODEL) not in [
"M5STACK",
"TFT_2.4",
"TFT_2.4R",
"ILI9341",
"ILI9342",
]:
raise cv.Invalid(
"Provided model can't run on ESP8266. Use an ESP32 with PSRAM onboard"
)
return config

View File

@@ -23,7 +23,8 @@ const float GRAVITY_EARTH = 9.80665f;
void MPU6050Component::setup() {
ESP_LOGCONFIG(TAG, "Setting up MPU6050...");
uint8_t who_am_i;
if (!this->read_byte(MPU6050_REGISTER_WHO_AM_I, &who_am_i) || (who_am_i != 0x68 && who_am_i != 0x98)) {
if (!this->read_byte(MPU6050_REGISTER_WHO_AM_I, &who_am_i) ||
(who_am_i != 0x68 && who_am_i != 0x70 && who_am_i != 0x98)) {
this->mark_failed();
return;
}

View File

@@ -448,7 +448,7 @@ void Pipsolar::loop() {
ESP_LOGD(TAG, "Decode QPIGS");
sscanf( // NOLINT
tmp, // NOLINT
"(%f %f %f %f %d %d %d %d %f %d %d %d %d %f %f %d %1d%1d%1d%1d%1d%1d%1d%1d %d %d %d %1d%1d%1d", // NOLINT
"(%f %f %f %f %d %d %d %d %f %d %d %d %f %f %f %d %1d%1d%1d%1d%1d%1d%1d%1d %d %d %d %1d%1d%1d", // NOLINT
&value_grid_voltage_, &value_grid_frequency_, &value_ac_output_voltage_, // NOLINT
&value_ac_output_frequency_, // NOLINT
&value_ac_output_apparent_power_, &value_ac_output_active_power_, &value_output_load_percent_, // NOLINT

View File

@@ -65,7 +65,7 @@ class Pipsolar : public uart::UARTDevice, public PollingComponent {
PIPSOLAR_SENSOR(battery_charging_current, QPIGS, int)
PIPSOLAR_SENSOR(battery_capacity_percent, QPIGS, int)
PIPSOLAR_SENSOR(inverter_heat_sink_temperature, QPIGS, int)
PIPSOLAR_SENSOR(pv_input_current_for_battery, QPIGS, int)
PIPSOLAR_SENSOR(pv_input_current_for_battery, QPIGS, float)
PIPSOLAR_SENSOR(pv_input_voltage, QPIGS, float)
PIPSOLAR_SENSOR(battery_voltage_scc, QPIGS, float)
PIPSOLAR_SENSOR(battery_discharge_current, QPIGS, int)

View File

@@ -10,6 +10,7 @@ from esphome.const import (
CONF_CO2,
CONF_UPDATE_INTERVAL,
CONF_VALUE,
DEVICE_CLASS_CARBON_DIOXIDE,
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_TEMPERATURE,
STATE_CLASS_MEASUREMENT,
@@ -46,6 +47,7 @@ CONFIG_SCHEMA = (
unit_of_measurement=UNIT_PARTS_PER_MILLION,
icon=ICON_MOLECULE_CO2,
accuracy_decimals=0,
device_class=DEVICE_CLASS_CARBON_DIOXIDE,
state_class=STATE_CLASS_MEASUREMENT,
),
cv.Optional(CONF_TEMPERATURE): sensor.sensor_schema(

View File

@@ -477,7 +477,6 @@ void Sprinkler::configure_valve_switch(size_t valve_number, switch_::Switch *val
if (this->is_a_valid_valve(valve_number)) {
this->valve_[valve_number].valve_switch.set_on_switch(valve_switch);
this->valve_[valve_number].run_duration = run_duration;
valve_switch->turn_off();
}
}
@@ -489,8 +488,6 @@ void Sprinkler::configure_valve_switch_pulsed(size_t valve_number, switch_::Swit
this->valve_[valve_number].valve_switch.set_on_switch(valve_switch_on);
this->valve_[valve_number].valve_switch.set_pulse_duration(pulse_duration);
this->valve_[valve_number].run_duration = run_duration;
valve_switch_off->turn_off();
valve_switch_on->turn_off();
}
}
@@ -505,7 +502,6 @@ void Sprinkler::configure_valve_pump_switch(size_t valve_number, switch_::Switch
this->pump_.resize(this->pump_.size() + 1);
this->pump_.back().set_on_switch(pump_switch);
this->valve_[valve_number].pump_switch_index = this->pump_.size() - 1; // save the index to the new pump
pump_switch->turn_off();
}
}
@@ -524,8 +520,6 @@ void Sprinkler::configure_valve_pump_switch_pulsed(size_t valve_number, switch_:
this->pump_.back().set_on_switch(pump_switch_on);
this->pump_.back().set_pulse_duration(pulse_duration);
this->valve_[valve_number].pump_switch_index = this->pump_.size() - 1; // save the index to the new pump
pump_switch_off->turn_off();
pump_switch_on->turn_off();
}
}

View File

@@ -103,7 +103,7 @@ class SprinklerControllerNumber : public number::Number, public Component {
public:
void setup() override;
void dump_config() override;
float get_setup_priority() const override { return setup_priority::HARDWARE; }
float get_setup_priority() const override { return setup_priority::PROCESSOR; }
Trigger<float> *get_set_trigger() const { return set_trigger_; }
void set_initial_value(float initial_value) { initial_value_ = initial_value; }

View File

@@ -5,6 +5,10 @@
#include "esphome/core/util.h"
#include "esphome/core/gpio.h"
#ifdef USE_WIFI
#include "esphome/components/wifi/wifi_component.h"
#endif
#ifdef USE_CAPTIVE_PORTAL
#include "esphome/components/captive_portal/captive_portal.h"
#endif
@@ -234,6 +238,10 @@ void Tuya::handle_command_(uint8_t command, uint8_t version, const uint8_t *buff
case TuyaCommandType::WIFI_TEST:
this->send_command_(TuyaCommand{.cmd = TuyaCommandType::WIFI_TEST, .payload = std::vector<uint8_t>{0x00, 0x00}});
break;
case TuyaCommandType::WIFI_RSSI:
this->send_command_(
TuyaCommand{.cmd = TuyaCommandType::WIFI_RSSI, .payload = std::vector<uint8_t>{get_wifi_rssi_()}});
break;
case TuyaCommandType::LOCAL_TIME_QUERY:
#ifdef USE_TIME
if (this->time_id_.has_value()) {
@@ -475,6 +483,15 @@ uint8_t Tuya::get_wifi_status_code_() {
return status;
}
uint8_t Tuya::get_wifi_rssi_() {
#ifdef USE_WIFI
if (wifi::global_wifi_component != nullptr)
return wifi::global_wifi_component->wifi_rssi();
#endif
return 0;
}
void Tuya::send_wifi_status_() {
uint8_t status = this->get_wifi_status_code_();

View File

@@ -55,6 +55,7 @@ enum class TuyaCommandType : uint8_t {
DATAPOINT_QUERY = 0x08,
WIFI_TEST = 0x0E,
LOCAL_TIME_QUERY = 0x1C,
WIFI_RSSI = 0x24,
VACUUM_MAP_UPLOAD = 0x28,
GET_NETWORK_STATUS = 0x2B,
};
@@ -123,6 +124,7 @@ class Tuya : public Component, public uart::UARTDevice {
void set_status_pin_();
void send_wifi_status_();
uint8_t get_wifi_status_code_();
uint8_t get_wifi_rssi_();
#ifdef USE_TIME
void send_local_time_();

View File

@@ -3,6 +3,7 @@ import esphome.config_validation as cv
from esphome.components import sensor
from esphome.const import (
ENTITY_CATEGORY_DIAGNOSTIC,
STATE_CLASS_TOTAL_INCREASING,
UNIT_SECOND,
ICON_TIMER,
DEVICE_CLASS_DURATION,
@@ -16,6 +17,7 @@ CONFIG_SCHEMA = sensor.sensor_schema(
unit_of_measurement=UNIT_SECOND,
icon=ICON_TIMER,
accuracy_decimals=0,
state_class=STATE_CLASS_TOTAL_INCREASING,
device_class=DEVICE_CLASS_DURATION,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
).extend(cv.polling_component_schema("60s"))

View File

@@ -1,6 +1,6 @@
"""Constants used by esphome."""
__version__ = "2023.3.0b2"
__version__ = "2023.3.1"
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"

View File

@@ -393,13 +393,13 @@ void hsv_to_rgb(int hue, float saturation, float value, float &red, float &green
}
// System APIs
#if defined(USE_ESP8266)
#if defined(USE_ESP8266) || defined(USE_RP2040)
// ESP8266 doesn't have mutexes, but that shouldn't be an issue as it's single-core and non-preemptive OS.
Mutex::Mutex() {}
void Mutex::lock() {}
bool Mutex::try_lock() { return true; }
void Mutex::unlock() {}
#elif defined(USE_ESP32) || defined(USE_RP2040)
#elif defined(USE_ESP32)
Mutex::Mutex() { handle_ = xSemaphoreCreateMutex(); }
void Mutex::lock() { xSemaphoreTake(this->handle_, portMAX_DELAY); }
bool Mutex::try_lock() { return xSemaphoreTake(this->handle_, 0) == pdTRUE; }

View File

@@ -17,9 +17,6 @@
#if defined(USE_ESP32)
#include <freertos/FreeRTOS.h>
#include <freertos/semphr.h>
#elif defined(USE_RP2040)
#include <FreeRTOS.h>
#include <semphr.h>
#endif
#define HOT __attribute__((hot))
@@ -539,7 +536,7 @@ class Mutex {
Mutex &operator=(const Mutex &) = delete;
private:
#if defined(USE_ESP32) || defined(USE_RP2040)
#if defined(USE_ESP32)
SemaphoreHandle_t handle_;
#endif
};

View File

@@ -71,7 +71,10 @@ class ComponentManifest:
@property
def auto_load(self) -> list[str]:
return getattr(self.module, "AUTO_LOAD", [])
al = getattr(self.module, "AUTO_LOAD", [])
if callable(al):
return al()
return al
@property
def codeowners(self) -> list[str]:

View File

@@ -2528,6 +2528,8 @@ color:
red: 0%
green: 1%
blue: 100%
- id: kbx_green
hex: "3DEC55"
display:
- platform: lcd_gpio