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

Compare commits

...

153 Commits

Author SHA1 Message Date
Guillermo Ruffino
1a04e2d1b8 Merge pull request #1277 from esphome/bump-1.15.0
1.15.0
2020-09-13 16:23:51 -03:00
Guillermo Ruffino
52c4dd0e35 Bump version to v1.15.0 2020-09-13 14:18:32 -03:00
Guillermo Ruffino
ff90f6a440 Merge branch 'beta' into bump-1.15.0 2020-09-13 14:18:19 -03:00
Guillermo Ruffino
839fe49e61 Merge pull request #1259 from esphome/bump-1.15.0b4
1.15.0b4
2020-08-23 22:08:10 -03:00
Guillermo Ruffino
ff050d634a Bump version to v1.15.0b4 2020-08-23 21:53:50 -03:00
Keith Burzinski
228670df78 Fix SSD1306 post-setup brightness control (#1090)
* Fix post-setup brightness control

* Add turn_on() and turn_off() methods

* Added is_on() method

* Set brightness later in setup()

* Use clamp() for brightness validation
2020-08-23 21:53:46 -03:00
Guillermo Ruffino
cfe4638665 fixes deg symbol not shown (#1248) 2020-08-23 21:53:45 -03:00
Guillermo Ruffino
b7352b1345 Image bit dephts (#1241) 2020-08-23 21:53:43 -03:00
Otto Winter
32ae8fc2d0 Bump docker base image to 2.6.0 (#1245) 2020-08-23 21:53:41 -03:00
Guillermo Ruffino
86df4c1d8d make powered on assume public (#1240) 2020-08-23 21:53:40 -03:00
Jesse Hills
dc4a88029c Script mode fix (#1238) 2020-08-23 21:53:38 -03:00
Otto Winter
5da9b2ede7 Fix tuya.cpp compile warning (#1232) 2020-08-23 21:53:37 -03:00
Otto Winter
29cfcfaf0f Fix ESP8266 core has a broken settimeofday implementation (#1231) 2020-08-23 21:53:36 -03:00
Otto Winter
61bfd347ea Bump ESPAsyncTCP from 1.2.2 to 1.2.3 (#1227) 2020-08-23 21:53:34 -03:00
Otto Winter
b7436c0b22 Bump ESP8266 Arduino framework from 2.7.2 to 2.7.3 (#1229) 2020-08-23 21:53:33 -03:00
Otto Winter
8a45dfac5c Fix release.yml invalid bash syntax (#1226) 2020-08-23 21:53:32 -03:00
Otto Winter
49233e4734 Merge pull request #1225 from esphome/bump-1.15.0b3
1.15.0b3
2020-07-29 20:19:06 +02:00
Otto Winter
e2b5ecb78b Bump version to v1.15.0b3 2020-07-29 20:05:22 +02:00
Otto Winter
351ce67eae Bump base image to 2.4.1 (#1224) 2020-07-29 20:05:22 +02:00
dr-oblivium
44af5e439c wpa2 enterprise fixes: also copy eap parameters, don't require psk password to be set (#1215) 2020-07-29 20:05:22 +02:00
Otto Winter
dbc0d500d8 Bump ESPAsyncWebServer-esphome to v1.2.7 (#1221) 2020-07-29 20:05:21 +02:00
Emil Hesslow
86736aa480 Stop infinite loop in light on_turn_on (#1219)
Co-authored-by: Otto Winter <otto@otto-winter.com>
2020-07-29 20:05:21 +02:00
Otto Winter
57eb05c0e3 Add job to update HassIO addon repo (#1218) 2020-07-29 20:05:21 +02:00
Guillermo Ruffino
f6fe6e6bff renamed icon molecule co2 (#1217)
* renamed icon molecule co2

* sort of course
2020-07-29 20:05:20 +02:00
Otto Winter
18560f9430 Fix sdist missing requirements.txt (#1214)
Fixes https://github.com/esphome/issues/issues/1378
2020-07-29 20:05:20 +02:00
Otto Winter
352004221e Merge pull request #1213 from esphome/bump-1.15.0b2 2020-07-28 12:21:58 +02:00
Otto Winter
fc6a3e31c2 Bump version to v1.15.0b2 2020-07-28 12:15:41 +02:00
Otto Winter
a32b58fdf1 Downgrade FastLED to 3.3.2 (#1212)
Fixes https://github.com/esphome/issues/issues/1375
2020-07-28 12:15:41 +02:00
Otto Winter
2d50ecbecf Fix prometheus has wrong setup priority (#1211)
Fixes https://github.com/esphome/issues/issues/1377
2020-07-28 12:15:40 +02:00
Gediminas Šaltenis
87f1ffec05 Fix AS3935 sensor configuration issues (#1210)
* Fix AS3935 coniguration

* Increase verbosity
2020-07-28 12:15:40 +02:00
Otto Winter
f0dfde9fa1 Fix base config should override packages config (#1209) 2020-07-28 12:15:40 +02:00
Otto Winter
e36dc2d05e ESP8266 change recommended framework version to 2.7.2 (#1208) 2020-07-28 12:15:39 +02:00
Otto Winter
08c8fa2c90 Mitigate CVE-2020-12638 WiFi WPA Downgrade (#1207)
Co-authored-by: Lukas Bachschwell <lukas@lbsfilm.at>
2020-07-28 12:15:39 +02:00
Guillermo Ruffino
51ab0f0b78 Bump version to v1.14.5 2020-06-23 22:39:24 -03:00
Otto Winter
bf0cce4ad8 Fix ESP32 interrupt enable/disable switched
Needs to be manually cherry-picked
2020-06-23 22:36:00 -03:00
Otto Winter
60e6366521 Bump version to v1.14.4 2020-06-05 12:56:23 +02:00
Otto Winter
072b2c445c Add ESP8266 core v2.6.2 (#905)
* Add ESP8266 core v2.6.2

* Upstream ESP8266 Wifi fixes

* Replace disable_interrupt with InterruptLock C++ class

* Update code to use InterruptLock

* Lint

* Update dht.cpp

* Improve InterruptLock docs, mark as ICACHE_RAM_ATTR

* Fixes
2020-06-05 12:56:10 +02:00
Otto Winter
219fe41831 Update ESP32 BLE ADV parse to match BLE spec (#904)
* Update ESP32 BLE ADV parse to match BLE spec

* Update xiaomi

* Update ruuvi

* Format

* Update esp32_ble_tracker.cpp

* Fix log

* Format

* Update xiaomi_ble.cpp
2020-06-05 12:55:24 +02:00
Otto Winter
dcc8bb83af Ignore ESP32 Camera unknown framesizes (#901)
Fixes https://github.com/esphome/issues/issues/866
2020-06-05 12:52:05 +02:00
Otto Winter
a8e3521f3c web_server call setup_controller (#899) 2020-06-05 12:52:05 +02:00
Otto Winter
706dc6d116 Fix MQTT logs Int or String expected Python 3 (#898)
Fixes https://github.com/esphome/issues/issues/850
2020-06-05 12:52:04 +02:00
Guillermo Ruffino
84accb6df6 fix climate_ir on receive optional (#897)
* fix climate on receive optional

* add climate tests
2020-06-05 12:52:04 +02:00
warpzone
8421570b18 fix the problem of missing part of advertising packet when activ… (#868)
* fix the problem of missing part of advertising packet when active scan is enabled.

* fix for ci-suggest-changes
2020-06-05 12:52:04 +02:00
Otto Winter
d355543ac9 Merge branch '1.14.4' 2020-06-05 12:42:56 +02:00
Otto Winter
3a597c5aa6 Fix gitignore intellij idea 2020-06-05 12:38:05 +02:00
Otto Winter
c7dddaded4 Upgrade docker base image to 2.1.1 2020-06-05 12:28:37 +02:00
Otto Winter
aae4b2ea5d Upgrade docker base image to 2.1.0 2020-06-05 12:27:26 +02:00
Otto Winter
310e2a0b20 Fix build 2020-06-05 12:25:29 +02:00
Niklas Wagner
0b04d143ac Upgrade dependencies 2020-06-05 12:00:20 +02:00
Otto Winter
53c231a7eb Revert "Atm90e32 pf fix (#841)"
This reverts commit 7842a55c81.
2019-11-17 23:37:00 +01:00
Otto Winter
d44ce82aa1 Bump version to v1.14.3 2019-11-17 23:34:04 +01:00
Otto Winter
a055de48e4 Change ESP8266 default wifi output power (#862)
See also https://github.com/esphome/issues/issues/455
2019-11-17 23:34:01 +01:00
Otto Winter
37b8d665fe Revert ESP32 BLE Tracker defaults (#863)
Fixes https://github.com/esphome/issues/issues/824
Fixes https://github.com/esphome/issues/issues/851
2019-11-17 23:34:01 +01:00
Otto Winter
dd7c8dabb1 Fix MQTT python 3 stringify IPAddress Type (#864)
Fixes https://github.com/esphome/issues/issues/850
2019-11-17 23:34:01 +01:00
Otto Winter
e41a9875e3 Improve WiFi disconnect messages (#857)
* Improve WiFi disconnect messages

* Fix

* Update wifi_component_esp32.cpp
2019-11-17 23:34:01 +01:00
Brandon Davidson
c5c42c4338 Tuya: Fix init sequence and handle wifi test command (#820)
* Handle WiFi test command

Also rename commands to match Tuya protocol docs

* Fix init sequence and product info check

* Fix clang-format suggestions

* Additional changes based on code review

* Fix temp command buffer scope

* Let the interval timer fire the first heatbeat

* Fix init steps; add logging

* Lint

* Remove setup_priority override

* Add delay to dump_config

* Refactor dump sequence

* Fix verbose logging

* Fix lints

* Don't bother suppressing duplicate config dumps

* nolint


Co-authored-by: Otto Winter <otto@otto-winter.com>
2019-11-17 23:34:00 +01:00
Brandon Davidson
531428b8b0 Fix logger uart conflict check (#858)
* Fix logger uart conflict check

* Fix class for check func

* Fix syntax

Hope lint is OK with moving the end of the conditional outside the #IFDEF

* Move end of conditional inside ifdef and remove extra whitespace

* Simplify

clang-format did not like the ifdefs and was reformatting in a way that killed clang-tidy.

Simple solution is to use logger's hw_serial as source of truth

Also simplifies the code - uart doesn't need to know what the logger uart settings mean
2019-11-17 23:34:00 +01:00
Otto Winter
ea8068e001 Switch to 115200 baud upload if 460800 fails (#856)
* Switch to 115200 baud upload if 460800 fails

* Update __main__.py
2019-11-17 23:34:00 +01:00
Mark
7842a55c81 Atm90e32 pf fix (#841)
* correct set_pf_sensor to set_power_factor_senor

* remove junk files added in error

* correct sensors.yaml reference to set_reactive_power

* Fixes
2019-11-17 23:33:56 +01:00
Samuel Sieb
51d39862b1 add position reporting to the template cover (#821)
* add position reporting to the template cover

* remove duplicate import

* use config flag instead


Co-authored-by: Samuel Sieb <samuel@sieb.net>
2019-11-17 23:33:21 +01:00
Otto Winter
bfea6ca79b Mark python 3.5 support deprecated (#849)
* Mark python 3.5 unsupported

Fixes https://github.com/esphome/issues/issues/831

* Update .travis.yml

* Update typing dep
2019-11-17 23:33:20 +01:00
Otto Winter
6297395018 Fix PZEM004T v2 (#846)
Fixes https://github.com/esphome/issues/issues/817
2019-11-17 23:33:20 +01:00
Otto Winter
a5b49dbfa6 Adjust some units (#852)
* Adjust some units

Fixes https://github.com/esphome/issues/issues/843

* Lint
2019-11-17 23:33:12 +01:00
Otto Winter
7c0d777173 Check DHT sensor exists before publishing (#850)
Fixes https://github.com/esphome/issues/issues/841
2019-11-17 23:31:36 +01:00
Otto Winter
74878276fc Web server CORS headers (#840)
* Add CORS header to web server

* Refactor

* Cleanup

See also https://github.com/esphome/issues/issues/806
2019-11-17 23:31:35 +01:00
Otto Winter
226e3b1dad Fix sensor force_update native API (#847)
Fixes https://github.com/esphome/issues/issues/842
2019-11-17 23:31:35 +01:00
Otto Winter
7752794fc5 Fix neopixelbus missing method pins (#848)
Fixes https://github.com/esphome/issues/issues/839
2019-11-17 23:31:35 +01:00
Otto Winter
b3094d6a53 Add missing state attribute (#851)
* Add api missing_state attribute

Fixes https://github.com/esphome/issues/issues/828

Adds a new property for missing state, so that HA can now when a sensor does not have a state yet.

* Update api.proto
2019-11-17 23:31:35 +01:00
Otto Winter
e3640e710f Add wifi output_power setting (#853)
* Add wifi output_power setting

See also:
 - https://github.com/esphome/feature-requests/issues/471#issuecomment-552350467
 - https://github.com/esp8266/Arduino/issues/6366
 - https://github.com/esp8266/Arduino/issues/6471
 - 849f8cf920/code/espurna/config/general.h (L593-L599)
 - https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/network/esp_wifi.html#_CPPv425esp_wifi_set_max_tx_power6int8_t

* Lint
2019-11-17 23:31:35 +01:00
Guillermo Ruffino
2ef64b55c5 fix missing checks of is_playing condition (#844) 2019-11-17 23:31:34 +01:00
Otto Winter
7f6672bb37 Fix calculations for negative sun declination (#839)
Fixes https://github.com/esphome/issues/issues/793

Also adds a clampd function that operates with doubles, not floats
2019-11-17 23:31:34 +01:00
Otto Winter
68a3b31628 Update variable in scheduler (#838)
Fixes https://github.com/esphome/issues/issues/826
2019-11-17 23:31:34 +01:00
Otto Winter
1b35855e68 Update platformio libraries (#837)
* Update platformio libraries

* Lint
2019-11-17 23:31:34 +01:00
Otto Winter
1e1837000d Fix homeassistant.service schema lambda (#833)
* Fix homeassistant.service schema lambda

Fixes https://github.com/esphome/issues/issues/820

* Improve

* Fix
2019-11-17 23:31:34 +01:00
Otto Winter
e2d5257632 Fix ESP32 rotary encoder (#834)
* Fix ESP32 rotary encoder

Fixes https://github.com/esphome/issues/issues/672

* Update rotary_encoder.cpp

* Lint
2019-11-17 23:31:34 +01:00
Otto Winter
387c75793b WiFi AP apply manual ip settings (#836) 2019-11-17 23:31:33 +01:00
Otto Winter
4f3a74d08a ESP8266 remove default opmode check (#835) 2019-11-17 23:31:33 +01:00
Otto Winter
fdbc59a159 Bump version to v1.14.2 2019-11-03 00:20:31 +01:00
Otto Winter
0db37bb55c Fix weird ESP8266 wifi crashes (#831)
* Try fix ESP8266 weird crashes

* Only call disconnect if STA is active
2019-11-03 00:20:25 +01:00
Otto Winter
2ff2750628 Fix stack trace decode for latest platformio (#830) 2019-11-02 21:19:36 +01:00
Otto Winter
eae5c17b87 Bump version to v1.14.1 2019-11-02 21:00:05 +01:00
Otto Winter
a59cde91ad Add servo missing restore option to codegen (#829)
See also https://github.com/esphome/issues/issues/609
2019-11-02 20:59:56 +01:00
Otto Winter
1f243ae37e Remove PCF8574 input_pullup mode and cleanup (#828)
Fixes https://github.com/esphome/issues/issues/755
Closes https://github.com/esphome/esphome/pull/822
Fixes https://github.com/esphome/issues/issues/667
Closes https://github.com/esphome/esphome/pull/808

Co-Authored-By: Amish Vishwakarma <amishv@users.noreply.github.com>
Co-Authored-By: S-Przybylski <s-przybylski@users.noreply.github.com>
2019-11-02 20:59:56 +01:00
Otto Winter
603f82977e Fix update-all input in dashboard (#826)
Fixes https://github.com/esphome/issues/issues/798
2019-11-02 20:59:56 +01:00
Otto Winter
2d70422a6f Move native API enums to new namespace (#825)
Fixes https://github.com/esphome/issues/issues/801
2019-11-02 20:59:55 +01:00
Otto Winter
e2c8b21195 Fix wizard mkdir (#824)
* Fix CLI wizard mkdir_p with empty path

Fixes https://github.com/esphome/issues/issues/796

* Cleanup

* Lint
2019-11-02 20:59:55 +01:00
Alexander Leisentritt
7adaeacd0b refactored xiaomi ble data parsing (#823) 2019-11-02 20:59:55 +01:00
Otto Winter
3aaa92fdff Bump version to v1.14.0 2019-11-01 18:27:24 +01:00
Otto Winter
5efd076c08 Merge branch 'beta' 2019-11-01 18:26:19 +01:00
Otto Winter
1ca241615d Bump version to v1.13.6 2019-06-14 12:55:23 +02:00
Otto Winter
b8aa84002a Re-add CustomMQTTDevice class (#640)
* Re-add CustomMQTTDevice class

Fixes https://github.com/esphome/issues/issues/427

* Fix
2019-06-14 12:55:20 +02:00
Otto Winter
10cc0b1d5b Fix remote_receiver raw binary sensor (#639)
* Fix remote_receiver raw binary sensor

Fixes https://github.com/esphome/issues/issues/439

* Lint
2019-06-14 12:55:19 +02:00
Otto Winter
11d9c203c1 Fix version.h file (#630)
* Fix version.h file

* Lint
2019-06-14 12:55:19 +02:00
Otto Winter
c9ab454c3c Fix globals.set (#635)
* Fix globals.set

* Update __init__.py
2019-06-14 12:55:19 +02:00
Otto Winter
4a55692885 Fix russia timezone detection (#637)
Fixes https://github.com/esphome/issues/issues/378#issuecomment-500219634
2019-06-14 12:55:19 +02:00
Otto Winter
88c129e705 Fix ESP32 RCSwitch Dump Stack Smash Protection (#636)
Fixes https://github.com/esphome/issues/issues/366
2019-06-14 12:55:19 +02:00
Otto Winter
80b48f01fb Fix esp8266_restore_from_flash (#638)
Fixes https://github.com/esphome/issues/issues/424
2019-06-14 12:36:30 +02:00
Otto Winter
642bc91a76 Update esp32_ble_tracker.cpp 2019-06-08 17:06:29 +02:00
Otto Winter
d69926ee56 Bump version to v1.13.5 2019-06-08 16:49:04 +02:00
Otto Winter
4758403d44 Work around ESP32 core WiFi Bug (#627)
* Work around ESP32 WiFi Bug

* Lint
2019-06-08 16:49:00 +02:00
Otto Winter
4b0ec5c28a Work around ESP32 BLE issue (#626) 2019-06-08 16:49:00 +02:00
Otto Winter
4b2a9e5e49 Fix status binary sensor for MQTT (#628)
Fixes https://github.com/esphome/issues/issues/417
2019-06-08 16:48:59 +02:00
Otto Winter
1449c51d49 Update base image to 1.8.3 (#625) 2019-06-08 16:48:59 +02:00
Otto Winter
a451705e0b Fix sun default elevation (#620) 2019-06-08 16:48:58 +02:00
Otto Winter
2e6db39173 Fix integration sensor, add test (#619)
* Fix integration sensor, add test

* Fix

* Fix
2019-06-08 16:48:58 +02:00
Otto Winter
373f75253c Update docker base image to 1.8.0 (#618) 2019-06-08 16:48:58 +02:00
Otto Winter
724842084e Make ForCondition a component (#616)
Fixes https://github.com/esphome/issues/issues/396
2019-06-08 16:48:57 +02:00
Otto Winter
8f3635b167 Fix remote_receiver always shows sony (#617)
Fixes https://github.com/esphome/issues/issues/383#issuecomment-498370572
2019-06-08 16:48:57 +02:00
Otto Winter
11605a36f7 Fix Hass.io addon SSL (#613)
Fixes https://github.com/esphome/issues/issues/404
2019-06-08 16:48:56 +02:00
Otto Winter
533f81d625 Template Cover don't auto-set current_operation (#612)
Fixes https://github.com/esphome/issues/issues/408
2019-06-08 16:48:56 +02:00
Otto Winter
aacb9e44e8 DHT22 ignore invalid values (#614)
Fixes https://github.com/esphome/issues/issues/397
2019-06-08 16:48:55 +02:00
Peter Tatrai
c6e3f1bca6 Fix ForCondition time duration check (#610)
According documentation ForCondition should evaluate to true if a nested condition is true for at least the specified time duration and not the less.
2019-06-08 16:48:55 +02:00
Otto Winter
a933d4aeb6 Move ESPHome version define (#607)
* Move ESPHome version define

* Lint
2019-06-08 16:48:55 +02:00
Otto Winter
caa5b20791 Bump version to v1.13.4 2019-06-03 15:24:10 +02:00
Otto Winter
e2ad9ed746 ESP8266 connect fixes (#605)
* ESP8266 Connection Fixes

* Update client.py

* Update mqtt_client.cpp

* Update mqtt_client.cpp

* Fix ping

* Async dump config

* Update base image to 1.7.0

* Update helpers.py

* Updates

* Update Dockerfile.lint
2019-06-03 15:23:57 +02:00
Otto Winter
32c0e7c2ae Fix ADS1115 calculation (#606)
Fixes https://github.com/esphome/issues/issues/393
2019-06-03 15:23:56 +02:00
Otto Winter
6c564c7b7f Fix validation infinite loop with empty platform block (#598)
* Fix validation infinite loop with empty platform block

* Update util.py
2019-06-03 15:23:56 +02:00
Otto Winter
c81e3a3be4 Fix hx711 (#602)
* Fix HX711

* Use signed value

* Update hx711.cpp
2019-06-03 15:23:56 +02:00
Otto Winter
6b1b9ef7ec Fix color wipe effect (#599) 2019-06-03 15:23:56 +02:00
Otto Winter
c26a8b8718 Allow old remote_transmitter repeat schema (#601)
Fixes https://github.com/esphome/issues/issues/389
2019-06-03 15:23:56 +02:00
Otto Winter
4a89a475bd Add better esphomeyaml migration path (#600)
Fixes https://github.com/esphome/issues/issues/387
2019-06-03 15:23:55 +02:00
Otto Winter
8cf15c7f5c Bump version to v1.13.3 2019-06-01 22:02:10 +02:00
Otto Winter
adc76ca1b8 Fix dashboard for Py3 installs (#596)
Fixes https://github.com/esphome/issues/issues/368
2019-06-01 22:02:05 +02:00
Otto Winter
8f8892440c Fix medium fan speed (#595) 2019-06-01 22:02:04 +02:00
Otto Winter
570843150d Fix flicker light effect turning itself off (#594)
Fixes https://github.com/esphome/issues/issues/382
2019-06-01 22:02:04 +02:00
Otto Winter
f3fc9e4142 Fix remote_receiver binary_sensor (#592)
Fixes https://github.com/esphome/issues/issues/369
2019-06-01 22:02:04 +02:00
Otto Winter
075fcb77a8 Fix timezone detection (#586)
* Fix timezone detection

* Update __init__.py
2019-06-01 22:02:04 +02:00
Otto Winter
e5899ff717 Fix scripts circular dependency (#591)
Fixes https://github.com/esphome/issues/issues/370
2019-06-01 22:02:04 +02:00
Otto Winter
2fb3970027 Fix addressable effects (#590) 2019-06-01 22:02:03 +02:00
Marc-Antoine Courteau
1a4efa1b8c List the correct boards when building for ESP32 (#589)
* List the ESP32 boards for ESP32 builds.

* Sort the list of valid boards.
2019-06-01 22:02:03 +02:00
Otto Winter
72f656ffef Bump version to v1.13.2 2019-05-31 16:37:56 +02:00
Otto Winter
b60239d5e5 Fix i2c setup priority (#585)
Fixes https://github.com/esphome/issues/issues/314
2019-05-31 16:37:49 +02:00
Otto Winter
d02e280c3c Fix light partition (#584)
* Fix light partition

Fixes https://github.com/esphome/issues/issues/365

* Lint
2019-05-31 16:37:48 +02:00
Otto Winter
6535b0966e Fix MQTT on_message trigger (#583)
Fixes https://github.com/esphome/issues/issues/363
Fixes https://github.com/esphome/issues/issues/364
2019-05-31 16:37:48 +02:00
Otto Winter
82dbacbee5 Fix travis build (#582) 2019-05-31 16:37:48 +02:00
Otto Winter
2432901974 Fix Rotary Encoder (#580)
Fixes https://github.com/esphome/issues/issues/360
2019-05-31 16:37:48 +02:00
Otto Winter
ebb5d58c14 Fix MQTT client_id changed (#579)
Fixes https://github.com/esphome/issues/issues/323
2019-05-31 16:37:48 +02:00
Otto Winter
605e365405 Fix remote_receiver binary_sensor schema (#578)
Fixes https://github.com/esphome/issues/issues/353#issuecomment-497491863
2019-05-31 16:37:47 +02:00
Otto Winter
5ab995d8ca Bump version to v1.13.1 2019-05-30 22:31:56 +02:00
Otto Winter
4248741b11 Fix waveshare 7.5in model (#576)
* Fix waveshare 7.5in model

Fixes https://github.com/esphome/issues/issues/357

* Fix platformio travis errors
2019-05-30 22:31:54 +02:00
Otto Winter
4b8ecc7634 Dashboard work around Hass.io bug (#575)
* Dashboard work around Hass.io bug

Ref https://github.com/home-assistant/hassio/issues/1103

* Lint
2019-05-30 22:31:53 +02:00
Otto Winter
25d04c759c Fix Sun Trigger (#572)
* Fix Sun Trigger

* Fix cwww lights
2019-05-30 22:31:53 +02:00
Otto Winter
b4ec84030e Fix validation TypeError (#574) 2019-05-30 22:31:53 +02:00
Otto Winter
29e8761373 Fix merge 2019-05-30 14:20:06 +02:00
Otto Winter
a04299c59e Bump version to v1.13.0 2019-05-30 14:15:41 +02:00
Otto Winter
d7bf3c51d9 Merge branch 'beta' 2019-05-30 14:15:28 +02:00
Otto Winter
ac0b095941 Bump version to v1.12.2 2019-03-31 13:13:12 +02:00
Otto Winter
cda9bad233 Upgrade docker base image to 1.4.3 (#499) 2019-03-31 13:13:09 +02:00
Otto Winter
41db8a1264 Fix text sensor MQTT settings (#495)
Fixes https://github.com/esphome/issues/issues/170
2019-03-31 13:13:09 +02:00
Otto Winter
e7e785fd60 Fix dashboard wizard unicode (#494)
* Fix dashboard wizard unicode

Fixes https://github.com/esphome/issues/issues/169

* Fix password md5
2019-03-31 13:13:08 +02:00
Otto Winter
300d3a1f46 Upgrade ESPAsyncTCP to 1.2.0 (#497) 2019-03-31 13:13:08 +02:00
Otto Winter
356554c08d ESP8266 SDK 2.3.0 compat (#490) 2019-03-31 13:13:08 +02:00
Guillermo Ruffino
ced28ad006 Better symlink support under Windows (#487)
* Better symlink support under Windows

* Conditional loading of ctypes wintypes module

* Shortening comment line for pylint

* Adding plint bypass for Python 3
2019-03-31 13:13:08 +02:00
48 changed files with 453 additions and 215 deletions

View File

@@ -25,7 +25,7 @@ jobs:
- uses: actions/checkout@v2
- name: Set up env variables
run: |
base_version="2.3.4"
base_version="2.6.0"
if [[ "${{ matrix.build_type }}" == "hassio" ]]; then
build_from="esphome/esphome-hassio-base-${{ matrix.arch }}:${base_version}"

View File

@@ -190,7 +190,7 @@ jobs:
echo "::set-env name=TAG::${TAG}"
- name: Set up env variables
run: |
base_version="2.3.4"
base_version="2.6.0"
if [[ "${{ matrix.build_type }}" == "hassio" ]]; then
build_from="esphome/esphome-hassio-base-${{ matrix.arch }}:${base_version}"

View File

@@ -210,7 +210,7 @@ jobs:
echo "::set-env name=TAG::${TAG}"
- name: Set up env variables
run: |
base_version="2.3.4"
base_version="2.6.0"
if [[ "${{ matrix.build_type }}" == "hassio" ]]; then
build_from="esphome/esphome-hassio-base-${{ matrix.arch }}:${base_version}"
@@ -222,13 +222,20 @@ jobs:
dockerfile="docker/Dockerfile"
fi
if [[ "${{ github.event.release.prerelease }}" == "true" ]]; then
cache_tag="beta"
else
cache_tag="latest"
fi
# Set env variables so these values don't need to be calculated again
echo "::set-env name=BUILD_FROM::${build_from}"
echo "::set-env name=BUILD_TO::${build_to}"
echo "::set-env name=DOCKERFILE::${dockerfile}"
echo "::set-env name=CACHE_TAG::${cache_tag}"
- name: Pull for cache
run: |
docker pull "${BUILD_TO}:latest" || true
docker pull "${BUILD_TO}:${CACHE_TAG}" || true
- name: Register QEMU binfmt
run: docker run --rm --privileged multiarch/qemu-user-static:5.0.0-2 --reset -p yes
- run: |
@@ -236,7 +243,7 @@ jobs:
--build-arg "BUILD_FROM=${BUILD_FROM}" \
--build-arg "BUILD_VERSION=${TAG}" \
--tag "${BUILD_TO}:${TAG}" \
--cache-from "${BUILD_TO}:latest" \
--cache-from "${BUILD_TO}:${CACHE_TAG}" \
--file "${DOCKERFILE}" \
.
- name: Log in to docker hub
@@ -300,3 +307,19 @@ jobs:
esphome/esphome-amd64:${TAG} \
esphome/esphome-armv7:${TAG}
docker manifest push esphome/esphome:latest
deploy-hassio-repo:
if: github.repository == 'esphome/esphome'
runs-on: ubuntu-latest
needs: [deploy-docker]
steps:
- env:
TOKEN: ${{ secrets.DEPLOY_HASSIO_TOKEN }}
run: |
TAG="${GITHUB_REF#refs/tags/v}"
curl \
-u ":$TOKEN" \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/esphome/hassio/actions/workflows/bump-version.yml/dispatches \
-d "{\"ref\":\"master\",\"inputs\":{\"version\":\"$TAG\"}}"

1
.gitignore vendored
View File

@@ -119,3 +119,4 @@ config/
tests/build/
tests/.esphome/
/.temp-clang-tidy.cpp
/.idea/

View File

@@ -1,5 +1,6 @@
include LICENSE
include README.md
include requirements.txt
include esphome/dashboard/templates/*.html
recursive-include esphome/dashboard/static *.ico *.js *.css *.woff* LICENSE
recursive-include esphome *.cpp *.h *.tcc

View File

@@ -1,4 +1,4 @@
ARG BUILD_FROM=esphome/esphome-base-amd64:2.3.4
ARG BUILD_FROM=esphome/esphome-base-amd64:2.6.0
FROM ${BUILD_FROM}
# First install requirements to leverage caching when requirements don't change

View File

@@ -1,4 +1,4 @@
FROM esphome/esphome-base-amd64:2.3.4
FROM esphome/esphome-base-amd64:2.6.0
COPY . .

View File

@@ -1,4 +1,4 @@
FROM esphome/esphome-lint-base:2.3.4
FROM esphome/esphome-lint-base:2.6.0
COPY requirements.txt requirements_test.txt /
RUN pip3 install --no-cache-dir -r /requirements.txt -r /requirements_test.txt

View File

@@ -25,7 +25,7 @@ AS3935_SCHEMA = cv.Schema({
cv.Optional(CONF_SPIKE_REJECTION, default=2): cv.int_range(min=1, max=11),
cv.Optional(CONF_LIGHTNING_THRESHOLD, default=1): cv.one_of(1, 5, 9, 16, int=True),
cv.Optional(CONF_MASK_DISTURBER, default=False): cv.boolean,
cv.Optional(CONF_DIV_RATIO, default=0): cv.one_of(0, 16, 22, 64, 128, int=True),
cv.Optional(CONF_DIV_RATIO, default=0): cv.one_of(0, 16, 32, 64, 128, int=True),
cv.Optional(CONF_CAPACITANCE, default=0): cv.int_range(min=0, max=15),
})

View File

@@ -26,6 +26,9 @@ void AS3935Component::setup() {
void AS3935Component::dump_config() {
ESP_LOGCONFIG(TAG, "AS3935:");
LOG_PIN(" Interrupt Pin: ", this->irq_pin_);
LOG_BINARY_SENSOR(" ", "Thunder alert", this->thunder_alert_binary_sensor_);
LOG_SENSOR(" ", "Distance", this->distance_sensor_);
LOG_SENSOR(" ", "Lightning energy", this->energy_sensor_);
}
float AS3935Component::get_setup_priority() const { return setup_priority::DATA; }

View File

@@ -27,4 +27,4 @@ def to_code(config):
if CONF_LIGHTNING_ENERGY in config:
conf = config[CONF_LIGHTNING_ENERGY]
lightning_energy_sensor = yield sensor.new_sensor(conf)
cg.add(hub.set_distance_sensor(lightning_energy_sensor))
cg.add(hub.set_energy_sensor(lightning_energy_sensor))

View File

@@ -12,4 +12,4 @@ def to_code(config):
cg.add_library('AsyncTCP-esphome', '1.1.1')
elif CORE.is_esp8266:
# https://github.com/OttoWinter/ESPAsyncTCP
cg.add_library('ESPAsyncTCP-esphome', '1.2.2')
cg.add_library('ESPAsyncTCP-esphome', '1.2.3')

View File

@@ -2,7 +2,7 @@ import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import i2c, sensor
from esphome.const import CONF_ID, ICON_RADIATOR, UNIT_PARTS_PER_MILLION, \
UNIT_PARTS_PER_BILLION, CONF_TEMPERATURE, CONF_HUMIDITY, ICON_PERIODIC_TABLE_CO2
UNIT_PARTS_PER_BILLION, CONF_TEMPERATURE, CONF_HUMIDITY, ICON_MOLECULE_CO2
DEPENDENCIES = ['i2c']
@@ -15,7 +15,7 @@ CONF_BASELINE = 'baseline'
CONFIG_SCHEMA = cv.Schema({
cv.GenerateID(): cv.declare_id(CCS811Component),
cv.Required(CONF_ECO2): sensor.sensor_schema(UNIT_PARTS_PER_MILLION, ICON_PERIODIC_TABLE_CO2,
cv.Required(CONF_ECO2): sensor.sensor_schema(UNIT_PARTS_PER_MILLION, ICON_MOLECULE_CO2,
0),
cv.Required(CONF_TVOC): sensor.sensor_schema(UNIT_PARTS_PER_BILLION, ICON_RADIATOR, 0),

View File

@@ -204,31 +204,33 @@ void DisplayBuffer::vprintf_(int x, int y, Font *font, Color color, TextAlign al
if (ret > 0)
this->print(x, y, font, color, align, buffer);
}
void DisplayBuffer::image(int x, int y, Image *image) { this->image(x, y, COLOR_ON, image); }
void DisplayBuffer::image(int x, int y, Color color, Image *image, bool invert) {
if (image->get_type() == BINARY) {
for (int img_x = 0; img_x < image->get_width(); img_x++) {
for (int img_y = 0; img_y < image->get_height(); img_y++) {
if (invert)
this->draw_pixel_at(x + img_x, y + img_y, image->get_pixel(img_x, img_y) ? COLOR_OFF : color);
else
this->draw_pixel_at(x + img_x, y + img_y, image->get_pixel(img_x, img_y) ? color : COLOR_OFF);
void DisplayBuffer::image(int x, int y, Image *image, Color color_on, Color color_off) {
switch (image->get_type()) {
case IMAGE_TYPE_BINARY:
for (int img_x = 0; img_x < image->get_width(); img_x++) {
for (int img_y = 0; img_y < image->get_height(); img_y++) {
this->draw_pixel_at(x + img_x, y + img_y, image->get_pixel(img_x, img_y) ? color_on : color_off);
}
}
}
} else if (image->get_type() == GRAYSCALE) {
for (int img_x = 0; img_x < image->get_width(); img_x++) {
for (int img_y = 0; img_y < image->get_height(); img_y++) {
this->draw_pixel_at(x + img_x, y + img_y, image->get_grayscale_pixel(img_x, img_y));
break;
case IMAGE_TYPE_GRAYSCALE:
for (int img_x = 0; img_x < image->get_width(); img_x++) {
for (int img_y = 0; img_y < image->get_height(); img_y++) {
this->draw_pixel_at(x + img_x, y + img_y, image->get_grayscale_pixel(img_x, img_y));
}
}
}
} else if (image->get_type() == RGB) {
for (int img_x = 0; img_x < image->get_width(); img_x++) {
for (int img_y = 0; img_y < image->get_height(); img_y++) {
this->draw_pixel_at(x + img_x, y + img_y, image->get_color_pixel(img_x, img_y));
break;
case IMAGE_TYPE_RGB24:
for (int img_x = 0; img_x < image->get_width(); img_x++) {
for (int img_y = 0; img_y < image->get_height(); img_y++) {
this->draw_pixel_at(x + img_x, y + img_y, image->get_color_pixel(img_x, img_y));
}
}
}
break;
}
}
void DisplayBuffer::get_text_bounds(int x, int y, const char *text, Font *font, TextAlign align, int *x1, int *y1,
int *width, int *height) {
int x_offset, baseline;
@@ -463,15 +465,14 @@ Color Image::get_grayscale_pixel(int x, int y) const {
if (x < 0 || x >= this->width_ || y < 0 || y >= this->height_)
return 0;
const uint32_t pos = (x + y * this->width_);
return Color(pgm_read_byte(this->data_start_ + pos) << 24);
const uint8_t gray = pgm_read_byte(this->data_start_ + pos);
return Color(gray | gray << 8 | gray << 16 | gray << 24);
}
int Image::get_width() const { return this->width_; }
int Image::get_height() const { return this->height_; }
ImageType Image::get_type() const { return this->type_; }
Image::Image(const uint8_t *data_start, int width, int height)
: width_(width), height_(height), data_start_(data_start) {}
Image::Image(const uint8_t *data_start, int width, int height, int type)
: width_(width), height_(height), type_((ImageType) type), data_start_(data_start) {}
Image::Image(const uint8_t *data_start, int width, int height, ImageType type)
: width_(width), height_(height), type_(type), data_start_(data_start) {}
DisplayPage::DisplayPage(const display_writer_t &writer) : writer_(writer) {}
void DisplayPage::show() { this->parent_->show_page(this); }

View File

@@ -68,7 +68,7 @@ extern const Color COLOR_OFF;
/// Turn the pixel ON.
extern const Color COLOR_ON;
enum ImageType { BINARY = 0, GRAYSCALE = 1, RGB = 2 };
enum ImageType { IMAGE_TYPE_BINARY = 0, IMAGE_TYPE_GRAYSCALE = 1, IMAGE_TYPE_RGB24 = 2 };
enum DisplayRotation {
DISPLAY_ROTATION_0_DEGREES = 0,
@@ -262,9 +262,15 @@ class DisplayBuffer {
__attribute__((format(strftime, 5, 0)));
#endif
/// Draw the `image` with the top-left corner at [x,y] to the screen.
void image(int x, int y, Image *image);
void image(int x, int y, Color color, Image *image, bool invert = false);
/** Draw the `image` with the top-left corner at [x,y] to the screen.
*
* @param x The x coordinate of the upper left corner.
* @param y The y coordinate of the upper left corner.
* @param image The image to draw
* @param color_on The color to replace in binary images for the on bits.
* @param color_off The color to replace in binary images for the off bits.
*/
void image(int x, int y, Image *image, Color color_on = COLOR_ON, Color color_off = COLOR_OFF);
/** Get the text bounds of the given string.
*
@@ -381,8 +387,7 @@ class Font {
class Image {
public:
Image(const uint8_t *data_start, int width, int height);
Image(const uint8_t *data_start, int width, int height, int type);
Image(const uint8_t *data_start, int width, int height, ImageType type);
bool get_pixel(int x, int y) const;
Color get_color_pixel(int x, int y) const;
Color get_grayscale_pixel(int x, int y) const;
@@ -393,7 +398,7 @@ class Image {
protected:
int width_;
int height_;
ImageType type_{BINARY};
ImageType type_;
const uint8_t *data_start_;
};

View File

@@ -36,5 +36,7 @@ def new_fastled_light(config):
yield light.register_light(var, config)
# https://github.com/FastLED/FastLED/blob/master/library.json
cg.add_library('FastLED', '3.3.3')
# 3.3.3 has an issue on ESP32 with RMT and fastled_clockless:
# https://github.com/esphome/issues/issues/1375
cg.add_library('FastLED', '3.3.2')
yield var

View File

@@ -4,7 +4,7 @@ import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import automation
from esphome.const import CONF_ID, CONF_TIMEOUT, CONF_ESPHOME, CONF_METHOD, \
CONF_ARDUINO_VERSION, ARDUINO_VERSION_ESP8266_2_5_1, CONF_URL
CONF_ARDUINO_VERSION, ARDUINO_VERSION_ESP8266, CONF_URL
from esphome.core import CORE, Lambda
from esphome.core_config import PLATFORMIO_ESP8266_LUT
@@ -34,7 +34,7 @@ def validate_framework(config):
return config
framework = PLATFORMIO_ESP8266_LUT[version] if version in PLATFORMIO_ESP8266_LUT else version
if framework < ARDUINO_VERSION_ESP8266_2_5_1:
if framework < ARDUINO_VERSION_ESP8266['2.5.1']:
raise cv.Invalid('This component is not supported on arduino framework version below 2.5.1')
return config

View File

@@ -4,14 +4,20 @@ from esphome import core
from esphome.components import display, font
import esphome.config_validation as cv
import esphome.codegen as cg
from esphome.const import CONF_FILE, CONF_ID, CONF_RESIZE, CONF_TYPE
from esphome.const import CONF_FILE, CONF_ID, CONF_TYPE, CONF_RESIZE
from esphome.core import CORE, HexInt
_LOGGER = logging.getLogger(__name__)
DEPENDENCIES = ['display']
MULTI_CONF = True
ImageType = {'binary': 0, 'grayscale': 1, 'rgb': 2}
ImageType = display.display_ns.enum('ImageType')
IMAGE_TYPE = {
'BINARY': ImageType.IMAGE_TYPE_BINARY,
'GRAYSCALE': ImageType.IMAGE_TYPE_GRAYSCALE,
'RGB24': ImageType.IMAGE_TYPE_RGB24,
}
Image_ = display.display_ns.class_('Image')
@@ -21,7 +27,7 @@ IMAGE_SCHEMA = cv.Schema({
cv.Required(CONF_ID): cv.declare_id(Image_),
cv.Required(CONF_FILE): cv.file_,
cv.Optional(CONF_RESIZE): cv.dimensions,
cv.Optional(CONF_TYPE): cv.string,
cv.Optional(CONF_TYPE, default='BINARY'): cv.enum(IMAGE_TYPE, upper=True),
cv.GenerateID(CONF_RAW_DATA_ID): cv.declare_id(cg.uint8),
})
@@ -37,44 +43,40 @@ def to_code(config):
except Exception as e:
raise core.EsphomeError(f"Could not load image file {path}: {e}")
width, height = image.size
if CONF_RESIZE in config:
image.thumbnail(config[CONF_RESIZE])
if CONF_TYPE in config:
if config[CONF_TYPE].startswith('GRAYSCALE'):
width, height = image.size
image = image.convert('L', dither=Image.NONE)
pixels = list(image.getdata())
data = [0 for _ in range(height * width)]
pos = 0
for pix in pixels:
data[pos] = pix
pos += 1
rhs = [HexInt(x) for x in data]
prog_arr = cg.progmem_array(config[CONF_RAW_DATA_ID], rhs)
cg.new_Pvariable(config[CONF_ID], prog_arr, width, height, ImageType['grayscale'])
elif config[CONF_TYPE].startswith('RGB'):
width, height = image.size
image = image.convert('RGB')
pixels = list(image.getdata())
data = [0 for _ in range(height * width * 3)]
pos = 0
for pix in pixels:
data[pos] = pix[0]
pos += 1
data[pos] = pix[1]
pos += 1
data[pos] = pix[2]
pos += 1
rhs = [HexInt(x) for x in data]
prog_arr = cg.progmem_array(config[CONF_RAW_DATA_ID], rhs)
cg.new_Pvariable(config[CONF_ID], prog_arr, width, height, ImageType['rgb'])
else:
image = image.convert('1', dither=Image.NONE)
width, height = image.size
else:
if width > 500 or height > 500:
_LOGGER.warning("The image you requested is very big. Please consider using"
" the resize parameter.")
if config[CONF_TYPE] == 'GRAYSCALE':
image = image.convert('L', dither=Image.NONE)
pixels = list(image.getdata())
data = [0 for _ in range(height * width)]
pos = 0
for pix in pixels:
data[pos] = pix
pos += 1
elif config[CONF_TYPE] == 'RGB24':
image = image.convert('RGB')
pixels = list(image.getdata())
data = [0 for _ in range(height * width * 3)]
pos = 0
for pix in pixels:
data[pos] = pix[0]
pos += 1
data[pos] = pix[1]
pos += 1
data[pos] = pix[2]
pos += 1
elif config[CONF_TYPE] == 'BINARY':
image = image.convert('1', dither=Image.NONE)
width8 = ((width + 7) // 8) * 8
data = [0 for _ in range(height * width8 // 8)]
for y in range(height):
@@ -84,6 +86,7 @@ def to_code(config):
pos = x + y * width8
data[pos // 8] |= 0x80 >> (pos % 8)
rhs = [HexInt(x) for x in data]
prog_arr = cg.progmem_array(config[CONF_RAW_DATA_ID], rhs)
cg.new_Pvariable(config[CONF_ID], prog_arr, width, height)
rhs = [HexInt(x) for x in data]
prog_arr = cg.progmem_array(config[CONF_RAW_DATA_ID], rhs)
cg.new_Pvariable(config[CONF_ID], prog_arr, width, height,
IMAGE_TYPE[config[CONF_TYPE]])

View File

@@ -103,10 +103,14 @@ class LightTurnOnTrigger : public Trigger<> {
LightTurnOnTrigger(LightState *a_light) {
a_light->add_new_remote_values_callback([this, a_light]() {
auto is_on = a_light->current_values.is_on();
if (is_on && !last_on_) {
// only trigger when going from off to on
auto should_trigger = is_on && !last_on_;
// Set new state immediately so that trigger() doesn't devolve
// into infinite loop
last_on_ = is_on;
if (should_trigger) {
this->trigger();
}
last_on_ = is_on;
});
last_on_ = a_light->current_values.is_on();
}
@@ -120,10 +124,14 @@ class LightTurnOffTrigger : public Trigger<> {
LightTurnOffTrigger(LightState *a_light) {
a_light->add_new_remote_values_callback([this, a_light]() {
auto is_on = a_light->current_values.is_on();
if (!is_on && last_on_) {
// only trigger when going from on to off
auto should_trigger = !is_on && last_on_;
// Set new state immediately so that trigger() doesn't devolve
// into infinite loop
last_on_ = is_on;
if (should_trigger) {
this->trigger();
}
last_on_ = is_on;
});
last_on_ = a_light->current_values.is_on();
}

View File

@@ -3,7 +3,7 @@ import esphome.config_validation as cv
from esphome import automation
from esphome.automation import maybe_simple_id
from esphome.components import sensor, uart
from esphome.const import CONF_CO2, CONF_ID, CONF_TEMPERATURE, ICON_PERIODIC_TABLE_CO2, \
from esphome.const import CONF_CO2, CONF_ID, CONF_TEMPERATURE, ICON_MOLECULE_CO2, \
UNIT_PARTS_PER_MILLION, UNIT_CELSIUS, ICON_THERMOMETER
DEPENDENCIES = ['uart']
@@ -18,7 +18,7 @@ MHZ19ABCDisableAction = mhz19_ns.class_('MHZ19ABCDisableAction', automation.Acti
CONFIG_SCHEMA = cv.Schema({
cv.GenerateID(): cv.declare_id(MHZ19Component),
cv.Required(CONF_CO2): sensor.sensor_schema(UNIT_PARTS_PER_MILLION, ICON_PERIODIC_TABLE_CO2, 0),
cv.Required(CONF_CO2): sensor.sensor_schema(UNIT_PARTS_PER_MILLION, ICON_MOLECULE_CO2, 0),
cv.Optional(CONF_TEMPERATURE): sensor.sensor_schema(UNIT_CELSIUS, ICON_THERMOMETER, 0),
cv.Optional(CONF_AUTOMATIC_BASELINE_CALIBRATION): cv.boolean,
}).extend(cv.polling_component_schema('60s')).extend(uart.UART_DEVICE_SCHEMA)

View File

@@ -38,7 +38,7 @@ def do_packages_pass(config: dict):
recursive_package = package_config
if isinstance(package_config, dict):
recursive_package = do_packages_pass(package_config)
config = _merge_package(config, recursive_package)
config = _merge_package(recursive_package, config)
del config[CONF_PACKAGES]
return config

View File

@@ -26,6 +26,10 @@ class PrometheusHandler : public AsyncWebHandler, public Component {
this->base_->init();
this->base_->add_handler(this);
}
float get_setup_priority() const override {
// After WiFi
return setup_priority::WIFI - 1.0f;
}
protected:
#ifdef USE_SENSOR

View File

@@ -3,7 +3,7 @@ import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import i2c, sensor
from esphome.const import CONF_ID, UNIT_PARTS_PER_MILLION, \
CONF_HUMIDITY, CONF_TEMPERATURE, ICON_PERIODIC_TABLE_CO2, \
CONF_HUMIDITY, CONF_TEMPERATURE, ICON_MOLECULE_CO2, \
UNIT_CELSIUS, ICON_THERMOMETER, ICON_WATER_PERCENT, UNIT_PERCENT, CONF_CO2
DEPENDENCIES = ['i2c']
@@ -22,7 +22,7 @@ def remove_altitude_suffix(value):
CONFIG_SCHEMA = cv.Schema({
cv.GenerateID(): cv.declare_id(SCD30Component),
cv.Required(CONF_CO2): sensor.sensor_schema(UNIT_PARTS_PER_MILLION,
ICON_PERIODIC_TABLE_CO2, 0),
ICON_MOLECULE_CO2, 0),
cv.Required(CONF_TEMPERATURE): sensor.sensor_schema(UNIT_CELSIUS, ICON_THERMOMETER, 1),
cv.Required(CONF_HUMIDITY): sensor.sensor_schema(UNIT_PERCENT, ICON_WATER_PERCENT, 1),
cv.Optional(CONF_AUTOMATIC_SELF_CALIBRATION, default=True): cv.boolean,

View File

@@ -18,14 +18,14 @@ ParallelScript = script_ns.class_('ParallelScript', Script)
CONF_SINGLE = 'single'
CONF_RESTART = 'restart'
CONF_QUEUE = 'queue'
CONF_QUEUED = 'queued'
CONF_PARALLEL = 'parallel'
CONF_MAX_RUNS = 'max_runs'
SCRIPT_MODES = {
CONF_SINGLE: SingleScript,
CONF_RESTART: RestartScript,
CONF_QUEUE: QueueingScript,
CONF_QUEUED: QueueingScript,
CONF_PARALLEL: ParallelScript,
}
@@ -33,7 +33,7 @@ SCRIPT_MODES = {
def check_max_runs(value):
if CONF_MAX_RUNS not in value:
return value
if value[CONF_MODE] not in [CONF_QUEUE, CONF_PARALLEL]:
if value[CONF_MODE] not in [CONF_QUEUED, CONF_PARALLEL]:
raise cv.Invalid("The option 'max_runs' is only valid in 'queue' and 'parallel' mode.",
path=[CONF_MAX_RUNS])
return value
@@ -65,7 +65,7 @@ def to_code(config):
if CONF_MAX_RUNS in conf:
cg.add(trigger.set_max_runs(conf[CONF_MAX_RUNS]))
if conf[CONF_MODE] == CONF_QUEUE:
if conf[CONF_MODE] == CONF_QUEUED:
yield cg.register_component(trigger, conf)
triggers.append((trigger, conf))

View File

@@ -33,7 +33,7 @@ void QueueingScript::execute() {
return;
}
ESP_LOGD(TAG, "Script '%s' queueing new instance (mode: queue)", this->name_.c_str());
ESP_LOGD(TAG, "Script '%s' queueing new instance (mode: queued)", this->name_.c_str());
this->num_runs_++;
return;
}

View File

@@ -1,7 +1,7 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import sensor, uart
from esphome.const import CONF_CO2, CONF_ID, ICON_PERIODIC_TABLE_CO2, UNIT_PARTS_PER_MILLION
from esphome.const import CONF_CO2, CONF_ID, ICON_MOLECULE_CO2, UNIT_PARTS_PER_MILLION
DEPENDENCIES = ['uart']
@@ -10,7 +10,7 @@ SenseAirComponent = senseair_ns.class_('SenseAirComponent', cg.PollingComponent,
CONFIG_SCHEMA = cv.Schema({
cv.GenerateID(): cv.declare_id(SenseAirComponent),
cv.Required(CONF_CO2): sensor.sensor_schema(UNIT_PARTS_PER_MILLION, ICON_PERIODIC_TABLE_CO2, 0),
cv.Required(CONF_CO2): sensor.sensor_schema(UNIT_PARTS_PER_MILLION, ICON_MOLECULE_CO2, 0),
}).extend(cv.polling_component_schema('60s')).extend(uart.UART_DEVICE_SCHEMA)

View File

@@ -2,7 +2,7 @@ import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import i2c, sensor
from esphome.const import CONF_ID, ICON_RADIATOR, UNIT_PARTS_PER_MILLION, \
UNIT_PARTS_PER_BILLION, ICON_PERIODIC_TABLE_CO2
UNIT_PARTS_PER_BILLION, ICON_MOLECULE_CO2
DEPENDENCIES = ['i2c']
@@ -22,7 +22,7 @@ CONF_TEMPERATURE_SOURCE = 'temperature_source'
CONFIG_SCHEMA = cv.Schema({
cv.GenerateID(): cv.declare_id(SGP30Component),
cv.Required(CONF_ECO2): sensor.sensor_schema(UNIT_PARTS_PER_MILLION,
ICON_PERIODIC_TABLE_CO2, 0),
ICON_MOLECULE_CO2, 0),
cv.Required(CONF_TVOC): sensor.sensor_schema(UNIT_PARTS_PER_BILLION, ICON_RADIATOR, 0),
cv.Optional(CONF_BASELINE): cv.Schema({
cv.Required(CONF_ECO2_BASELINE): cv.hex_uint16_t,

View File

@@ -1,6 +1,7 @@
from esphome.components import time as time_
import esphome.config_validation as cv
import esphome.codegen as cg
from esphome.core import CORE
from esphome.const import CONF_ID, CONF_SERVERS
@@ -27,3 +28,7 @@ def to_code(config):
yield cg.register_component(var, config)
yield time_.register_time(var, config)
if CORE.is_esp8266 and len(servers) > 1:
# We need LwIP features enabled to get 3 SNTP servers (not just one)
cg.add_build_flag('-DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY')

View File

@@ -41,7 +41,7 @@ def setup_ssd1036(var, config):
reset = yield cg.gpio_pin_expression(config[CONF_RESET_PIN])
cg.add(var.set_reset_pin(reset))
if CONF_BRIGHTNESS in config:
cg.add(var.set_brightness(config[CONF_BRIGHTNESS]))
cg.add(var.init_brightness(config[CONF_BRIGHTNESS]))
if CONF_EXTERNAL_VCC in config:
cg.add(var.set_external_vcc(config[CONF_EXTERNAL_VCC]))
if CONF_LAMBDA in config:

View File

@@ -5,7 +5,11 @@
namespace esphome {
namespace ssd1306_base {
static const char *TAG = "sd1306";
static const char *TAG = "ssd1306";
static const uint8_t BLACK = 0;
static const uint8_t WHITE = 1;
static const uint8_t SSD1306_MAX_CONTRAST = 255;
static const uint8_t SSD1306_COMMAND_DISPLAY_OFF = 0xAE;
static const uint8_t SSD1306_COMMAND_DISPLAY_ON = 0xAF;
@@ -69,27 +73,6 @@ void SSD1306::setup() {
break;
}
this->command(SSD1306_COMMAND_SET_CONTRAST);
switch (this->model_) {
case SSD1306_MODEL_128_32:
case SH1106_MODEL_128_32:
this->command(0x8F);
break;
case SSD1306_MODEL_128_64:
case SH1106_MODEL_128_64:
case SSD1306_MODEL_64_48:
case SH1106_MODEL_64_48:
this->command(int(255 * (this->brightness_)));
break;
case SSD1306_MODEL_96_16:
case SH1106_MODEL_96_16:
if (this->external_vcc_)
this->command(0x10);
else
this->command(0xAF);
break;
}
this->command(SSD1306_COMMAND_SET_PRE_CHARGE);
if (this->external_vcc_)
this->command(0x22);
@@ -104,7 +87,12 @@ void SSD1306::setup() {
this->command(SSD1306_COMMAND_DEACTIVATE_SCROLL);
this->command(SSD1306_COMMAND_DISPLAY_ON);
set_brightness(this->brightness_);
this->fill(BLACK); // clear display - ensures we do not see garbage at power-on
this->display(); // ...write buffer, which actually clears the display's memory
this->turn_on();
}
void SSD1306::display() {
if (this->is_sh1106_()) {
@@ -140,6 +128,22 @@ void SSD1306::update() {
this->do_update_();
this->display();
}
void SSD1306::set_brightness(float brightness) {
// validation
this->brightness_ = clamp(brightness, 0, 1);
// now write the new brightness level to the display
this->command(SSD1306_COMMAND_SET_CONTRAST);
this->command(int(SSD1306_MAX_CONTRAST * (this->brightness_)));
}
bool SSD1306::is_on() { return this->is_on_; }
void SSD1306::turn_on() {
this->command(SSD1306_COMMAND_DISPLAY_ON);
this->is_on_ = true;
}
void SSD1306::turn_off() {
this->command(SSD1306_COMMAND_DISPLAY_OFF);
this->is_on_ = false;
}
int SSD1306::get_height_internal() {
switch (this->model_) {
case SSD1306_MODEL_128_32:
@@ -178,7 +182,6 @@ int SSD1306::get_width_internal() {
size_t SSD1306::get_buffer_length_() {
return size_t(this->get_width_internal()) * size_t(this->get_height_internal()) / 8u;
}
void HOT SSD1306::draw_absolute_pixel_internal(int x, int y, Color color) {
if (x >= this->get_width_internal() || x < 0 || y >= this->get_height_internal() || y < 0)
return;

View File

@@ -29,8 +29,11 @@ class SSD1306 : public PollingComponent, public display::DisplayBuffer {
void set_model(SSD1306Model model) { this->model_ = model; }
void set_reset_pin(GPIOPin *reset_pin) { this->reset_pin_ = reset_pin; }
void set_external_vcc(bool external_vcc) { this->external_vcc_ = external_vcc; }
void set_brightness(float brightness) { this->brightness_ = brightness; }
void init_brightness(float brightness) { this->brightness_ = brightness; }
void set_brightness(float brightness);
bool is_on();
void turn_on();
void turn_off();
float get_setup_priority() const override { return setup_priority::PROCESSOR; }
void fill(Color color) override;
@@ -51,6 +54,7 @@ class SSD1306 : public PollingComponent, public display::DisplayBuffer {
SSD1306Model model_{SSD1306_MODEL_128_64};
GPIOPin *reset_pin_{nullptr};
bool external_vcc_{false};
bool is_on_{false};
float brightness_{1.0};
};

View File

@@ -66,6 +66,7 @@ def to_code(config):
cg.add(var.set_optimistic(config[CONF_OPTIMISTIC]))
cg.add(var.set_assumed_state(config[CONF_ASSUMED_STATE]))
cg.add(var.set_restore_mode(config[CONF_RESTORE_MODE]))
cg.add(var.set_has_position(config[CONF_HAS_POSITION]))
@automation.register_action('cover.template.publish', cover.CoverPublishAction, cv.Schema({

View File

@@ -4,6 +4,7 @@
#ifdef ARDUINO_ARCH_ESP8266
#include "sys/time.h"
#endif
#include "errno.h"
namespace esphome {
namespace time {
@@ -20,8 +21,18 @@ void RealTimeClock::synchronize_epoch_(uint32_t epoch) {
struct timeval timev {
.tv_sec = static_cast<time_t>(epoch), .tv_usec = 0,
};
ESP_LOGVV(TAG, "Got epoch %u", epoch);
timezone tz = {0, 0};
settimeofday(&timev, &tz);
int ret = settimeofday(&timev, &tz);
if (ret == EINVAL) {
// Some ESP8266 frameworks abort when timezone parameter is not NULL
// while ESP32 expects it not to be NULL
ret = settimeofday(&timev, nullptr);
}
if (ret != 0) {
ESP_LOGW(TAG, "setimeofday() failed with code %d", ret);
}
auto time = this->now();
char buf[128];

View File

@@ -232,7 +232,7 @@ uint8_t TM1637Display::print(uint8_t start_pos, const char* str) {
uint8_t pos = start_pos;
for (; *str != '\0'; str++) {
uint8_t data = TM1637_UNKNOWN_CHAR;
if (*str >= ' ' && *str <= '}')
if (*str >= ' ' && *str <= '~')
data = pgm_read_byte(&TM1637_ASCII_TO_RAW[*str - ' ']);
if (data == TM1637_UNKNOWN_CHAR) {

View File

@@ -22,8 +22,8 @@ void Tuya::loop() {
void Tuya::dump_config() {
ESP_LOGCONFIG(TAG, "Tuya:");
if (this->init_state_ != TuyaInitState::INIT_DONE) {
ESP_LOGCONFIG(TAG, " Configuration will be reported when setup is complete. Current init_state: %u", // NOLINT
this->init_state_);
ESP_LOGCONFIG(TAG, " Configuration will be reported when setup is complete. Current init_state: %u",
static_cast<uint8_t>(this->init_state_));
ESP_LOGCONFIG(TAG, " If no further output is received, confirm that this is a supported Tuya device.");
return;
}

View File

@@ -24,4 +24,4 @@ def to_code(config):
if CORE.is_esp32:
cg.add_library('FS', None)
# https://github.com/OttoWinter/ESPAsyncWebServer/blob/master/library.json
cg.add_library('ESPAsyncWebServer-esphome', '1.2.6')
cg.add_library('ESPAsyncWebServer-esphome', '1.2.7')

View File

@@ -41,11 +41,11 @@ void WhirlpoolClimate::transmit_state() {
remote_state[18] = 0x08;
auto powered_on = this->mode != climate::CLIMATE_MODE_OFF;
if (powered_on != this->powered_on_assumed_) {
if (powered_on != this->powered_on_assumed) {
// Set power toggle command
remote_state[2] = 4;
remote_state[15] = 1;
this->powered_on_assumed_ = powered_on;
this->powered_on_assumed = powered_on;
}
switch (this->mode) {
case climate::CLIMATE_MODE_AUTO:
@@ -215,14 +215,14 @@ bool WhirlpoolClimate::on_receive(remote_base::RemoteReceiveData data) {
if (powered_on) {
this->mode = climate::CLIMATE_MODE_OFF;
this->powered_on_assumed_ = false;
this->powered_on_assumed = false;
} else {
this->powered_on_assumed_ = true;
this->powered_on_assumed = true;
}
}
// Set received mode
if (powered_on_assumed_) {
if (powered_on_assumed) {
auto mode = remote_state[3] & 0x7;
ESP_LOGV(TAG, "Mode: %02X", mode);
switch (mode) {

View File

@@ -28,7 +28,7 @@ class WhirlpoolClimate : public climate_ir::ClimateIR {
void setup() override {
climate_ir::ClimateIR::setup();
this->powered_on_assumed_ = this->mode != climate::CLIMATE_MODE_OFF;
this->powered_on_assumed = this->mode != climate::CLIMATE_MODE_OFF;
}
/// Override control to change settings of the climate device.
@@ -39,15 +39,15 @@ class WhirlpoolClimate : public climate_ir::ClimateIR {
void set_model(Model model) { this->model_ = model; }
// used to track when to send the power toggle command
bool powered_on_assumed;
protected:
/// Transmit via IR the state of this climate controller.
void transmit_state() override;
/// Handle received IR Buffer
bool on_receive(remote_base::RemoteReceiveData data) override;
// used to track when to send the power toggle command
bool powered_on_assumed_;
bool send_swing_cmd_{false};
Model model_;

View File

@@ -201,7 +201,26 @@ void WiFiComponent::start_connecting(const WiFiAP &ap, bool two) {
} else {
ESP_LOGV(TAG, " BSSID: Not Set");
}
ESP_LOGV(TAG, " Password: " LOG_SECRET("'%s'"), ap.get_password().c_str());
#ifdef ESPHOME_WIFI_WPA2_EAP
if (ap.get_eap().has_value()) {
ESP_LOGV(TAG, " WPA2 Enterprise authentication configured:");
EAPAuth eap_config = ap.get_eap().value();
ESP_LOGV(TAG, " Identity: " LOG_SECRET("'%s'"), eap_config.identity.c_str());
ESP_LOGV(TAG, " Username: " LOG_SECRET("'%s'"), eap_config.username.c_str());
ESP_LOGV(TAG, " Password: " LOG_SECRET("'%s'"), eap_config.password.c_str());
bool ca_cert_present = eap_config.ca_cert != nullptr && strlen(eap_config.ca_cert);
bool client_cert_present = eap_config.client_cert != nullptr && strlen(eap_config.client_cert);
bool client_key_present = eap_config.client_key != nullptr && strlen(eap_config.client_key);
ESP_LOGV(TAG, " CA Cert: %s", ca_cert_present ? "present" : "not present");
ESP_LOGV(TAG, " Client Cert: %s", client_cert_present ? "present" : "not present");
ESP_LOGV(TAG, " Client Key: %s", client_key_present ? "present" : "not present");
} else {
#endif
ESP_LOGV(TAG, " Password: " LOG_SECRET("'%s'"), ap.get_password().c_str());
#ifdef ESPHOME_WIFI_WPA2_EAP
}
#endif
if (ap.get_channel().has_value()) {
ESP_LOGV(TAG, " Channel: %u", *ap.get_channel());
} else {
@@ -400,9 +419,17 @@ void WiFiComponent::check_scanning_finished() {
connect_params.set_channel(scan_res.get_channel());
connect_params.set_bssid(scan_res.get_bssid());
}
// set manual IP+password (if any)
// copy manual IP (if set)
connect_params.set_manual_ip(config.get_manual_ip());
#ifdef ESPHOME_WIFI_WPA2_EAP
// copy EAP parameters (if set)
connect_params.set_eap(config.get_eap());
#endif
// copy password (if set)
connect_params.set_password(config.get_password());
break;
}
@@ -576,9 +603,21 @@ bool WiFiScanResult::matches(const WiFiAP &config) {
// If BSSID configured, only match for correct BSSIDs
if (config.get_bssid().has_value() && *config.get_bssid() != this->bssid_)
return false;
// If PW given, only match for networks with auth (and vice versa)
#ifdef ESPHOME_WIFI_WPA2_EAP
// BSSID requires auth but no PSK or EAP credentials given
if (this->with_auth_ && (config.get_password().empty() && !config.get_eap().has_value()))
return false;
// BSSID does not require auth, but PSK or EAP credentials given
if (!this->with_auth_ && (!config.get_password().empty() || config.get_eap().has_value()))
return false;
#else
// If PSK given, only match for networks with auth (and vice versa)
if (config.get_password().empty() == this->with_auth_)
return false;
#endif
// If channel configured, only match networks on that channel.
if (config.get_channel().has_value() && *config.get_channel() != this->channel_) {
return false;

View File

@@ -391,6 +391,18 @@ void WiFiComponent::wifi_event_callback_(system_event_id_t event, system_event_i
auto it = info.auth_change;
ESP_LOGV(TAG, "Event: Authmode Change old=%s new=%s", get_auth_mode_str(it.old_mode),
get_auth_mode_str(it.new_mode));
// Mitigate CVE-2020-12638
// https://lbsfilm.at/blog/wpa2-authenticationmode-downgrade-in-espressif-microprocessors
if (it.old_mode != WIFI_AUTH_OPEN && it.new_mode == WIFI_AUTH_OPEN) {
ESP_LOGW(TAG, "Potential Authmode downgrade detected, disconnecting...");
// we can't call retry_connect() from this context, so disconnect immediately
// and notify main thread with error_from_callback_
err_t err = esp_wifi_disconnect();
if (err != ESP_OK) {
ESP_LOGW(TAG, "Disconnect failed: %s", esp_err_to_name(err));
}
this->error_from_callback_ = true;
}
break;
}
case SYSTEM_EVENT_STA_GOT_IP: {

View File

@@ -220,6 +220,7 @@ bool WiFiComponent::wifi_sta_connect_(WiFiAP ap) {
if (ap.get_password().empty()) {
conf.threshold.authmode = AUTH_OPEN;
} else {
// Only allow auth modes with at least WPA
conf.threshold.authmode = AUTH_WPA_PSK;
}
conf.threshold.rssi = -127;
@@ -399,6 +400,15 @@ void WiFiComponent::wifi_event_callback(System_Event_t *event) {
auto it = event->event_info.auth_change;
ESP_LOGV(TAG, "Event: Changed AuthMode old=%s new=%s", get_auth_mode_str(it.old_mode),
get_auth_mode_str(it.new_mode));
// Mitigate CVE-2020-12638
// https://lbsfilm.at/blog/wpa2-authenticationmode-downgrade-in-espressif-microprocessors
if (it.old_mode != AUTH_OPEN && it.new_mode == AUTH_OPEN) {
ESP_LOGW(TAG, "Potential Authmode downgrade detected, disconnecting...");
// we can't call retry_connect() from this context, so disconnect immediately
// and notify main thread with error_from_callback_
wifi_station_disconnect();
global_wifi_component->error_from_callback_ = true;
}
break;
}
case EVENT_STAMODE_GOT_IP: {

View File

@@ -5,7 +5,7 @@ from esphome.components import sensor
from esphome.const import CONF_ID, CONF_CLOCK_PIN, CONF_DATA_PIN, \
CONF_CO2, CONF_TEMPERATURE, CONF_HUMIDITY, \
UNIT_PARTS_PER_MILLION, UNIT_CELSIUS, UNIT_PERCENT, \
ICON_PERIODIC_TABLE_CO2, ICON_THERMOMETER, ICON_WATER_PERCENT
ICON_MOLECULE_CO2, ICON_THERMOMETER, ICON_WATER_PERCENT
from esphome.cpp_helpers import gpio_pin_expression
zyaura_ns = cg.esphome_ns.namespace('zyaura')
@@ -17,7 +17,7 @@ CONFIG_SCHEMA = cv.Schema({
pins.validate_has_interrupt),
cv.Required(CONF_DATA_PIN): cv.All(pins.internal_gpio_input_pin_schema,
pins.validate_has_interrupt),
cv.Optional(CONF_CO2): sensor.sensor_schema(UNIT_PARTS_PER_MILLION, ICON_PERIODIC_TABLE_CO2, 0),
cv.Optional(CONF_CO2): sensor.sensor_schema(UNIT_PARTS_PER_MILLION, ICON_MOLECULE_CO2, 0),
cv.Optional(CONF_TEMPERATURE): sensor.sensor_schema(UNIT_CELSIUS, ICON_THERMOMETER, 1),
cv.Optional(CONF_HUMIDITY): sensor.sensor_schema(UNIT_PERCENT, ICON_WATER_PERCENT, 1),
}).extend(cv.polling_component_schema('60s'))

View File

@@ -2,7 +2,7 @@
MAJOR_VERSION = 1
MINOR_VERSION = 15
PATCH_VERSION = '0b1'
PATCH_VERSION = '0'
__short_version__ = f'{MAJOR_VERSION}.{MINOR_VERSION}'
__version__ = f'{__short_version__}.{PATCH_VERSION}'
@@ -11,17 +11,36 @@ ESP_PLATFORM_ESP8266 = 'ESP8266'
ESP_PLATFORMS = [ESP_PLATFORM_ESP32, ESP_PLATFORM_ESP8266]
ALLOWED_NAME_CHARS = 'abcdefghijklmnopqrstuvwxyz0123456789_'
ARDUINO_VERSION_ESP32_DEV = 'https://github.com/platformio/platform-espressif32.git'
ARDUINO_VERSION_ESP32_1_0_0 = 'espressif32@1.5.0'
ARDUINO_VERSION_ESP32_1_0_1 = 'espressif32@1.6.0'
ARDUINO_VERSION_ESP32_1_0_2 = 'espressif32@1.9.0'
ARDUINO_VERSION_ESP32_1_0_3 = 'espressif32@1.10.0'
ARDUINO_VERSION_ESP32_1_0_4 = 'espressif32@1.11.0'
ARDUINO_VERSION_ESP8266_DEV = 'https://github.com/platformio/platform-espressif8266.git'
ARDUINO_VERSION_ESP8266_2_5_0 = 'espressif8266@2.0.1'
ARDUINO_VERSION_ESP8266_2_5_1 = 'espressif8266@2.1.0'
ARDUINO_VERSION_ESP8266_2_5_2 = 'espressif8266@2.2.3'
ARDUINO_VERSION_ESP8266_2_3_0 = 'espressif8266@1.5.0'
# Lookup table from ESP32 arduino framework version to latest platformio
# package with that version
# See also https://github.com/platformio/platform-espressif32/releases
ARDUINO_VERSION_ESP32 = {
'dev': 'https://github.com/platformio/platform-espressif32.git',
'1.0.4': 'espressif32@1.12.4',
'1.0.3': 'espressif32@1.10.0',
'1.0.2': 'espressif32@1.9.0',
'1.0.1': 'espressif32@1.7.0',
'1.0.0': 'espressif32@1.5.0',
}
# See also https://github.com/platformio/platform-espressif8266/releases
ARDUINO_VERSION_ESP8266 = {
'dev': 'https://github.com/platformio/platform-espressif8266.git',
'2.7.4': 'espressif8266@2.6.2',
'2.7.3': 'espressif8266@2.6.1',
'2.7.2': 'espressif8266@2.6.0',
'2.7.1': 'espressif8266@2.5.3',
'2.7.0': 'espressif8266@2.5.0',
'2.6.3': 'espressif8266@2.4.0',
'2.6.2': 'espressif8266@2.3.1',
'2.6.1': 'espressif8266@2.3.0',
'2.5.2': 'espressif8266@2.2.3',
'2.5.1': 'espressif8266@2.1.1',
'2.5.0': 'espressif8266@2.0.4',
'2.4.2': 'espressif8266@1.8.0',
'2.4.1': 'espressif8266@1.7.3',
'2.4.0': 'espressif8266@1.6.0',
'2.3.0': 'espressif8266@1.5.0',
}
SOURCE_FILE_EXTENSIONS = {'.cpp', '.hpp', '.h', '.c', '.tcc', '.ino'}
HEADER_FILE_EXTENSIONS = {'.h', '.hpp', '.tcc'}
@@ -570,10 +589,10 @@ ICON_GAS_CYLINDER = 'mdi:gas-cylinder'
ICON_GAUGE = 'mdi:gauge'
ICON_LIGHTBULB = 'mdi:lightbulb'
ICON_MAGNET = 'mdi:magnet'
ICON_MOLECULE_CO2 = 'mdi:molecule-co2'
ICON_MOTION_SENSOR = 'mdi:motion-sensor'
ICON_NEW_BOX = 'mdi:new-box'
ICON_PERCENT = 'mdi:percent'
ICON_PERIODIC_TABLE_CO2 = 'mdi:periodic-table-co2'
ICON_POWER = 'mdi:power'
ICON_PULSE = 'mdi:pulse'
ICON_RADIATOR = 'mdi:radiator'

View File

@@ -5,17 +5,14 @@ import re
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import automation, pins
from esphome.const import ARDUINO_VERSION_ESP32_DEV, ARDUINO_VERSION_ESP8266_DEV, \
CONF_ARDUINO_VERSION, CONF_BOARD, CONF_BOARD_FLASH_MODE, CONF_BUILD_PATH, \
CONF_COMMENT, CONF_ESPHOME, CONF_INCLUDES, CONF_LIBRARIES, \
from esphome.const import CONF_ARDUINO_VERSION, CONF_BOARD, CONF_BOARD_FLASH_MODE, \
CONF_BUILD_PATH, CONF_COMMENT, CONF_ESPHOME, CONF_INCLUDES, CONF_LIBRARIES, \
CONF_NAME, CONF_ON_BOOT, CONF_ON_LOOP, CONF_ON_SHUTDOWN, CONF_PLATFORM, \
CONF_PLATFORMIO_OPTIONS, CONF_PRIORITY, CONF_TRIGGER_ID, \
CONF_ESP8266_RESTORE_FROM_FLASH, ARDUINO_VERSION_ESP8266_2_3_0, \
ARDUINO_VERSION_ESP8266_2_5_0, ARDUINO_VERSION_ESP8266_2_5_1, ARDUINO_VERSION_ESP8266_2_5_2, \
ESP_PLATFORMS
CONF_ESP8266_RESTORE_FROM_FLASH, ARDUINO_VERSION_ESP8266, \
ARDUINO_VERSION_ESP32, ESP_PLATFORMS
from esphome.core import CORE, coroutine_with_priority
from esphome.helpers import copy_file_if_changed, walk_files
from esphome.pins import ESP8266_FLASH_SIZES, ESP8266_LD_SCRIPTS
_LOGGER = logging.getLogger(__name__)
@@ -46,33 +43,17 @@ def validate_board(value):
validate_platform = cv.one_of(*ESP_PLATFORMS, upper=True)
PLATFORMIO_ESP8266_LUT = {
'2.7.2': 'espressif8266@2.6.0',
'2.7.1': 'espressif8266@2.5.1',
'2.7.0': 'espressif8266@2.5.0',
'2.6.3': 'espressif8266@2.4.0',
'2.6.2': 'espressif8266@2.3.1',
'2.6.1': 'espressif8266@2.3.0',
'2.5.2': 'espressif8266@2.2.3',
'2.5.1': 'espressif8266@2.1.0',
'2.5.0': 'espressif8266@2.0.1',
'2.4.2': 'espressif8266@1.8.0',
'2.4.1': 'espressif8266@1.7.3',
'2.4.0': 'espressif8266@1.6.0',
'2.3.0': 'espressif8266@1.5.0',
'RECOMMENDED': 'espressif8266@2.2.3',
**ARDUINO_VERSION_ESP8266,
'RECOMMENDED': ARDUINO_VERSION_ESP8266['2.7.4'],
'LATEST': 'espressif8266',
'DEV': ARDUINO_VERSION_ESP8266_DEV,
'DEV': ARDUINO_VERSION_ESP8266['dev'],
}
PLATFORMIO_ESP32_LUT = {
'1.0.0': 'espressif32@1.4.0',
'1.0.1': 'espressif32@1.6.0',
'1.0.2': 'espressif32@1.9.0',
'1.0.3': 'espressif32@1.10.0',
'1.0.4': 'espressif32@1.12.4',
'RECOMMENDED': 'espressif32@1.12.1',
**ARDUINO_VERSION_ESP32,
'RECOMMENDED': ARDUINO_VERSION_ESP32['1.0.4'],
'LATEST': 'espressif32',
'DEV': ARDUINO_VERSION_ESP32_DEV,
'DEV': ARDUINO_VERSION_ESP32['dev'],
}
@@ -208,6 +189,26 @@ def add_includes(includes):
include_file(path, basename)
@coroutine_with_priority(-1000.0)
def _esp8266_add_lwip_type():
# If any component has already set this, do not change it
if any(flag.startswith('-DPIO_FRAMEWORK_ARDUINO_LWIP2_') for flag in CORE.build_flags):
return
# Default for platformio is LWIP2_LOW_MEMORY with:
# - MSS=536
# - LWIP_FEATURES enabled
# - this only adds some optional features like IP incoming packet reassembly and NAPT
# see also:
# https://github.com/esp8266/Arduino/blob/master/tools/sdk/lwip2/include/lwipopts.h
# Instead we use LWIP2_HIGHER_BANDWIDTH_LOW_FLASH with:
# - MSS=1460
# - LWIP_FEATURES disabled (because we don't need them)
# Other projects like Tasmota & ESPEasy also use this
cg.add_build_flag('-DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH')
@coroutine_with_priority(100.0)
def to_code(config):
cg.add_global(cg.global_ns.namespace('esphome').using)
@@ -228,22 +229,9 @@ def to_code(config):
yield cg.register_component(trigger, conf)
yield automation.build_automation(trigger, [], conf)
# Build flags
if CORE.is_esp8266 and CORE.board in ESP8266_FLASH_SIZES and \
CORE.arduino_version != ARDUINO_VERSION_ESP8266_2_3_0:
flash_size = ESP8266_FLASH_SIZES[CORE.board]
ld_scripts = ESP8266_LD_SCRIPTS[flash_size]
ld_script = None
if CORE.arduino_version in ('espressif8266@1.8.0', 'espressif8266@1.7.3',
'espressif8266@1.6.0'):
ld_script = ld_scripts[0]
elif CORE.arduino_version in (ARDUINO_VERSION_ESP8266_DEV, ARDUINO_VERSION_ESP8266_2_5_0,
ARDUINO_VERSION_ESP8266_2_5_1, ARDUINO_VERSION_ESP8266_2_5_2):
ld_script = ld_scripts[1]
if ld_script is not None:
cg.add_build_flag(f'-Wl,-T{ld_script}')
# Set LWIP build constants for ESP8266
if CORE.is_esp8266:
CORE.add_job(_esp8266_add_lwip_type)
cg.add_build_flag('-fno-exceptions')

View File

@@ -4,11 +4,12 @@ import re
from esphome.config import iter_components
from esphome.const import CONF_BOARD_FLASH_MODE, CONF_ESPHOME, CONF_PLATFORMIO_OPTIONS, \
HEADER_FILE_EXTENSIONS, SOURCE_FILE_EXTENSIONS, __version__
HEADER_FILE_EXTENSIONS, SOURCE_FILE_EXTENSIONS, __version__, ARDUINO_VERSION_ESP8266
from esphome.core import CORE, EsphomeError
from esphome.helpers import mkdir_p, read_file, write_file_if_changed, walk_files, \
copy_file_if_changed
from esphome.storage_json import StorageJSON, storage_path
from esphome.pins import ESP8266_FLASH_SIZES, ESP8266_LD_SCRIPTS
_LOGGER = logging.getLogger(__name__)
@@ -213,6 +214,28 @@ def get_ini_content():
flash_mode = CORE.config[CONF_ESPHOME][CONF_BOARD_FLASH_MODE]
data['board_build.flash_mode'] = flash_mode
# Build flags
if CORE.is_esp8266 and CORE.board in ESP8266_FLASH_SIZES:
flash_size = ESP8266_FLASH_SIZES[CORE.board]
ld_scripts = ESP8266_LD_SCRIPTS[flash_size]
versions_with_old_ldscripts = [
ARDUINO_VERSION_ESP8266['2.4.0'],
ARDUINO_VERSION_ESP8266['2.4.1'],
ARDUINO_VERSION_ESP8266['2.4.2'],
]
if CORE.arduino_version == ARDUINO_VERSION_ESP8266['2.3.0']:
# No ld script support
ld_script = None
if CORE.arduino_version in versions_with_old_ldscripts:
# Old ld script path
ld_script = ld_scripts[0]
else:
ld_script = ld_scripts[1]
if ld_script is not None:
data['board_build.ldscript'] = ld_script
# Ignore libraries that are not explicitly used, but may
# be added by LDF
# data['lib_ldf_mode'] = 'chain'

View File

@@ -13,10 +13,10 @@ lib_deps =
AsyncTCP-esphome@1.1.1
AsyncMqttClient-esphome@0.8.4
ArduinoJson-esphomelib@5.13.3
ESPAsyncWebServer-esphome@1.2.6
FastLED@3.3.3
ESPAsyncWebServer-esphome@1.2.7
FastLED@3.3.2
NeoPixelBus-esphome@2.5.7
ESPAsyncTCP-esphome@1.2.2
ESPAsyncTCP-esphome@1.2.3
1655@1.0.2 ; TinyGPSPlus (has name conflict)
6865@1.0.0 ; TM1651 Battery Display
6306@1.0.3 ; HM3301
@@ -44,7 +44,7 @@ build_flags = ${common.build_flags}
src_filter = ${common.src_filter} +<tests/livingroom8266.cpp>
[env:livingroom32]
platform = espressif32@1.12.1
platform = espressif32@1.12.4
board = nodemcu-32s
framework = arduino
lib_deps = ${common.lib_deps}

View File

@@ -0,0 +1,59 @@
#!/usr/bin/env python3
import argparse
import re
import sys
def sub(path, pattern, repl, expected_count=1):
with open(path) as fh:
content = fh.read()
content, count = re.subn(pattern, repl, content, flags=re.MULTILINE)
if expected_count is not None:
assert count == expected_count, f"Pattern {pattern} replacement failed!"
with open(path, "wt") as fh:
fh.write(content)
def write_version(version: str):
for p in [
".github/workflows/ci-docker.yml",
".github/workflows/release-dev.yml",
".github/workflows/release.yml"
]:
sub(
p,
r'base_version=".*"',
f'base_version="{version}"'
)
sub(
"docker/Dockerfile",
r"ARG BUILD_FROM=esphome/esphome-base-amd64:.*",
f"ARG BUILD_FROM=esphome/esphome-base-amd64:{version}"
)
sub(
"docker/Dockerfile.dev",
r"FROM esphome/esphome-base-amd64:.*",
f"FROM esphome/esphome-base-amd64:{version}"
)
sub(
"docker/Dockerfile.lint",
r"FROM esphome/esphome-lint-base:.*",
f"FROM esphome/esphome-lint-base:{version}"
)
def main():
parser = argparse.ArgumentParser()
parser.add_argument('new_version', type=str)
args = parser.parse_args()
version = args.new_version
print(f"Bumping to {version}")
write_version(version)
return 0
if __name__ == "__main__":
sys.exit(main() or 0)

View File

@@ -292,6 +292,21 @@ text_sensor:
script:
- id: my_script
mode: single
then:
- lambda: 'ESP_LOGD("main", "Hello World!");'
- id: my_script_queued
mode: queued
max_runs: 2
then:
- lambda: 'ESP_LOGD("main", "Hello World!");'
- id: my_script_parallel
mode: parallel
max_runs: 2
then:
- lambda: 'ESP_LOGD("main", "Hello World!");'
- id: my_script_restart
mode: restart
then:
- lambda: 'ESP_LOGD("main", "Hello World!");'
@@ -316,5 +331,3 @@ interval:
- logger.log: "Interval Run"
display: