Commit Graph

72 Commits

Author SHA1 Message Date
dependabot[bot] 29045b0435
Bump pylint from 2.13.9 to 2.14.3 (#3589)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2022-06-21 16:27:33 +12:00
Guillermo Ruffino f002a23d2d
Language schema 202204 (#3492) 2022-06-17 13:46:20 +12:00
Maurice Makaay ebca936b7e
Fix percentage validation for wrong data type input (#3524)
Co-authored-by: Maurice Makaay <mmakaay1@xs4all.net>
2022-06-07 23:00:27 +12:00
Guillermo Ruffino 05dc97099a
New vscode schema gen (#3336) 2022-04-03 19:30:22 +12:00
Jesse Hills a13a1225b7
Allow framework version validator to be maximum version (#3197) 2022-02-15 11:57:47 +13:00
Oxan van Leeuwen 2f46267994
Add cv.require_esphome_version helper (#3103) 2022-01-24 20:10:27 +01:00
VitaliyKurokhtin 8187a4bce9
Command retain option for MQTT component (#3078) 2022-01-23 21:05:37 +13:00
Paul Monigatti 05fe5db030
Relax the icon validator to allow non-mdi icons (#2764) 2021-11-23 09:21:14 +01:00
Otto Winter 8aa72f4c1e
Neopixelbus redo method definitions (#2616) 2021-11-11 07:35:31 +13:00
Jesse Hills 3c0414c420
Add Entity categories for Home Assistant (#2636) 2021-11-08 07:24:52 +13:00
Oxan van Leeuwen 87328686a0
Allow setting URL as platform_version (#2598) 2021-10-26 10:55:09 +02:00
Oxan van Leeuwen f7b3f52731
Limit hostnames to 31 characters (#2531) 2021-10-22 12:09:47 +02:00
Paul Monigatti 471b82f727
EntityBase Refactor (#2418)
* Renamed Nameable to EntityBase (cpp)

* Renamed NAMEABLE_SCHEMA to ENTITY_BASE_SCHEMA (Python)

* Renamed cg.Nameable to cg.EntityBase (Python)

* Remove redundant use of CONF_NAME from esp32_touch

* Remove redundant use of CONF_NAME from mcp3008

* Updated test

* Moved EntityBase from Component.h and Component.cpp

* Added icon property to EntityBase

* Added CONF_ICON to ENTITY_BASE_SCHEMA and added setup_entity function to cpp_helpers

* Added MQTT component getters for icon and disabled_by_default

* Lint

* Removed icon field from MQTT components

* Code generation now uses setup_entity to setENTITY_BASE_SCHEMA fields

* Removed unused import

* Added cstdint include

* Optimisation: don't set icon if it is empty

* Remove icon from NumberTraits and SelectTraits

* Removed unused import

* Integration and Total Daily Energy sensors now inherit icons from their parents during code generation

* Minor comment correction

* Removed redundant icon-handling code from sensor, switch, and text_sensor

* Update esphome/components/tsl2591/tsl2591.h

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

* Added icon property to binary sensor, climate, cover, and fan component tests

* Added icons for Binary Sensor, Climate, Cover, Fan, and Light  to API

* Consolidated EntityBase fields in MQTT components

Co-authored-by: Oxan van Leeuwen <oxan@oxanvanleeuwen.nl>
2021-10-10 10:37:05 +02:00
Otto Winter ac0d921413
ESP-IDF support and generic target platforms (#2303)
* Socket refactor and SSL

* esp-idf temp

* Fixes

* Echo component and noise

* Add noise API transport support

* Updates

* ESP-IDF

* Complete

* Fixes

* Fixes

* Versions update

* New i2c APIs

* Complete i2c refactor

* SPI migration

* Revert ESP Preferences migration, too complex for now

* OTA support

* Remove echo again

* Remove ssl again

* GPIOFlags updates

* Rename esphal and ICACHE_RAM_ATTR

* Make ESP32 arduino compilable again

* Fix GPIO flags

* Complete pin registry refactor and fixes

* Fixes to make test1 compile

* Remove sdkconfig file

* Ignore sdkconfig file

* Fixes in reviewing

* Make test2 compile

* Make test4 compile

* Make test5 compile

* Run clang-format

* Fix lint errors

* Use esp-idf APIs instead of btStart

* Another round of fixes

* Start implementing ESP8266

* Make test3 compile

* Guard esp8266 code

* Lint

* Reformat

* Fixes

* Fixes v2

* more fixes

* ESP-IDF tidy target

* Convert ARDUINO_ARCH_ESPxx

* Update WiFiSignalSensor

* Update time ifdefs

* OTA needs millis from hal

* RestartSwitch needs delay from hal

* ESP-IDF Uart

* Fix OTA blank password

* Allow setting sdkconfig

* Fix idf partitions and allow setting sdkconfig from yaml

* Re-add read/write compat APIs and fix esp8266 uart

* Fix esp8266 store log strings in flash

* Fix ESP32 arduino preferences not initialized

* Update ifdefs

* Change how sdkconfig change is detected

* Add checks to ci-custom and fix them

* Run clang-format

* Add esp-idf clang-tidy target and fix errors

* Fixes from clang-tidy idf round 2

* Fixes from compiling tests with esp-idf

* Run clang-format

* Switch test5.yaml to esp-idf

* Implement ESP8266 Preferences

* Lint

* Re-do PIO package version selection a bit

* Fix arduinoespressif32 package version

* Fix unit tests

* Lint

* Lint fixes

* Fix readv/writev not defined

* Fix graphing component

* Re-add all old options from core/config.py

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2021-09-20 11:47:51 +02:00
dependabot[bot] dbb195691b
Bump pylint from 2.10.2 to 2.11.1 (#2334)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Otto winter <otto@otto-winter.com>
2021-09-19 19:22:28 +02:00
Jesse Hills f9b0666adf
Allow using a git source for a package (#2193) 2021-09-06 08:23:06 +12:00
Jesse Hills 54337befc2
Fix some lint errors in pylint 2.10.2 (#2226) 2021-08-31 14:00:58 +12:00
Paul Monigatti 56225701f9
Fix Packages when using MQTT (#2210) 2021-08-30 09:27:38 +12:00
Dave T 1771e673d2
Warn if underscore character is used in hostname (#2079)
* Prevent underscore character being used in 'name'.

* Restrict underscores in hostnames, not all names.

* Use hostname validator for node name.

* Allow underscore in hostname but warn once.

* Add renaming instructions link to warning.

* Point underscore warning to FAQ section

Co-authored-by: Otto Winter <otto@otto-winter.com>

Co-authored-by: Otto Winter <otto@otto-winter.com>
2021-08-10 14:14:42 +02:00
Jesse Hills 93796491af
Allow entities to be disabled by default in HA (#2113)
Co-authored-by: Otto Winter <otto@otto-winter.com>
2021-08-10 13:45:31 +12:00
Oxan van Leeuwen 5983ccc55c
Color mode implementation (#2012) 2021-07-29 19:11:56 +02:00
Keith Burzinski 04d926af39
Add variable bit width for Samsung protocol (#1927) 2021-06-18 13:54:46 +12:00
Otto Winter 2419bc3678
Improve config final validation (#1917) 2021-06-18 07:54:14 +12:00
wifwucite 8d8d421286
allow default option for typed_schema (#1700)
Co-authored-by: Otto Winter <otto@otto-winter.com>
2021-05-24 08:24:24 +12:00
Guillermo Ruffino 3d6dcc9eee
Add more json schema generation features (#1690)
* some enums

* extract enums, light effects remote_receiver etc

* more pins schema

* update to core changes
2021-05-14 20:35:39 -03:00
Otto Winter 229bf719a2 Implement external custom components installing from YAML (#1630)
* Move components import loading to importlib MetaPathFinder and importlib.resources

* Add external_components component

* Fix

* Fix

* fix cv.url return

* fix validate shorthand git

* implement git refresh

* Use finders from sys.path_hooks instead of looking for __init__.py

* use github:// schema

* error handling

* add test

* fix handling git output

* revert file check handling

* fix test

* allow full component path be specified for local

* fix test

* fix path handling

* lint

Co-authored-by: Guillermo Ruffino <glm.net@gmail.com>
2021-05-07 15:02:17 -03:00
Guillermo Ruffino 1e227e8051
Schema dump (#1564)
* schema dump idea

accept boolean or anything default

accept null also for full dicts

added some common validators

more simple validators

support multi_conf

better handle automations

updates

updates

handle lists

removed not needed class

move to own folder

generalized for automations lists, etc

updates

updates

clean up

clean up

fix automations

made comment optional

basic docs support

added more docs

fixes docs handling

updates

updates

fix components parent

updates

updates

updates

Fix inkplate 6 registration

updates

Disable logging for vscode add on

better handle buses

keep extended order as in CONFIGs

updates

updates

updates

disable comments

moved to scripts/build_jsonschema

added configurable decorators

path handling

fix handle list_schema

fixes and cleanup

add jschema_extractor to maybe

updates

lint

no schema in git

add generated loggers list

* lint
2021-03-07 21:05:08 -03:00
Guillermo Ruffino 69879920eb
add-black (#1593)
* Add black

Update pre commit

Update pre commit

add empty line

* Format with black
2021-03-07 16:03:16 -03:00
Guillermo Ruffino 28e39f7f76
Add config validator location (#1490)
* show validation source location for id

* show validation source location for lambda

* refactor lambda #line position

* account content offset on made lambdas

* lint

* remove redundant check
2021-02-06 12:09:15 -03:00
Andrew Zaborowski c7c71089ce
codegen: Lambda improvements (#1476)
* Use #line directives in generated C++ code for lambdas

The #line directive in gcc is meant specifically for pieces of imported
code included in generated code, exactly what happens with lambdas in
the yaml files: https://gcc.gnu.org/onlinedocs/cpp/Line-Control.html

With this change, if I add the following at line 165 of kithen.yaml:
    - lambda: undefined_var == 5;

then "$ esphome kitchen.yaml compile" shows the following:

INFO Reading configuration kitchen.yaml...
INFO Generating C++ source...
INFO Compiling app...
INFO Running:  platformio run -d kitchen
<...>
Compiling .pioenvs/kitchen/src/main.cpp.o
kitchen.yaml: In lambda function:
kitchen.yaml:165:7: error: 'undefined_var' was not declared in this scope
*** [.pioenvs/kitchen/src/main.cpp.o] Error 1
== [FAILED] Took 2.37 seconds ==

* Silence gcc warning on multiline macros in lambdas

When the \ is used at the end of the C++ source in a lambda (line
continuation, often used in preprocessor macros), esphome will copy that
into main.cpp once as code and once as a // commment.  gcc will complain
about the multiline commment:

Compiling .pioenvs/kitchen/src/main.cpp.o
kitchen.yaml:640:3: warning: multi-line comment [-Wcomment]

Try to replace the \ with a "<cont>" for lack of a better idea.
2021-01-23 20:17:15 -03:00
Michel Marti f2d218e5ad
scd30: Allow setting ambient pressure compensation (#1365) 2020-11-16 07:03:08 +13:00
Andrej Komelj 5f619e6f01
fix mqtt config check in OnlyWith configuration helper (#1304)
* fix config check in OnlyWith configuration helper

OnlyWith configuration helper check now verifies whether a component
is configured in any of the packages not only in raw configuration

* fix C0301(line-too-long) pylint in imports

* fix flake8 (E127) over-indented line
2020-10-15 10:14:07 -03:00
dependabot[bot] e7bd93b4b0
Bump pylint from 2.5.3 to 2.6.0 (#1262)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Otto Winter <otto@otto-winter.com>
2020-09-16 12:12:40 +02:00
Ian Leeder 8a294e4134
Clean up ALLOWED_CHARS (#1235) 2020-08-06 17:29:45 +02:00
Ian Leeder aea2e9a6bb
Add hyphen to supported name characters (#1223)
Co-authored-by: Otto Winter <otto@otto-winter.com>
2020-07-30 00:02:34 +02:00
Otto Winter 55388724af
Revert "Sort keys in dicts in output yaml for 'config' command (#1049)" (#1191) 2020-07-25 14:21:56 +02:00
Otto Winter 32efa5d83e
New script modes POC (#1168)
Co-authored-by: Guillermo Ruffino <glm.net@gmail.com>
2020-07-25 14:20:51 +02:00
Peter Kuehne 2012c769f6
Feature/fix unit tests (#1129) 2020-07-14 13:11:58 +02:00
Samuel Sieb f9a8629157
fix percentage handling (#1094)
* fix percentage handling

* add test

* fix lint errors

Co-authored-by: Samuel Sieb <samuel@sieb.net>
2020-06-19 20:59:19 -03:00
Alexander Pohl 3fba3a5e2e
Add support for additional Xiaomi BLE sensors (#1027) (#1027) 2020-05-26 19:33:28 -03:00
Otto Winter 056c72d50d
Drop Python 2 Support (#793)
* Remove Python 2 support

* Remove u-strings

* Remove docker symlinks

* Remove from travis

* Update requirements

* Upgrade flake8/pylint

* Fixes

* Manual

* Run pyupgrade

* Lint

* Remove base_int

* Fix

* Update platformio_api.py

* Update component.cpp
2019-12-07 18:28:55 +01:00
Otto Winter b7dff4bbab
Add magic value REPLACEME (#881)
* Add magic value REPLACEME

* Lint
2019-12-04 15:58:40 +01:00
Otto Winter fad05d5a2e
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-12 17:39:27 +01:00
Otto Winter 864c5d8908
Allow TimePeriod for time_period_str_unit (#815) 2019-10-31 20:09:57 +01:00
Guillermo Ruffino 84cfcf2b4a vscode support check file exists (#763)
* vscode support check file exists

* ups. formatter got disabled
2019-10-18 09:17:16 +02:00
Otto Winter 7ad593d674
Add setup, loop as reserved IDs
Fixes https://github.com/esphome/issues/issues/496
2019-07-03 15:25:38 +02:00
Otto Winter e5485ab650
Fix registry entry value copy 2019-06-30 12:18:41 +02:00
Otto Winter e05688d639
Fix remote_receiver binary_sensor schema (#578)
Fixes https://github.com/esphome/issues/issues/353#issuecomment-497491863
2019-05-31 10:36:23 +02:00
Otto Winter 31ddd3f668
Add uart.write action (#567)
* Add uart.write action

* Lint
2019-05-29 19:32:18 +02:00
Otto Winter f35f6d2348
Use copy for custom includes (#568) 2019-05-29 19:30:35 +02:00