Commit Graph

39 Commits

Author SHA1 Message Date
NP v/d Spek 71b3a14a29
update docstrings in cpp_generator.py (#6212) 2024-02-12 10:08:32 +13:00
Jesse Hills 972598a698
Handle nanoseconds in config (#5695) 2023-11-08 21:34:44 +13:00
Daniel Dunn 10eee47b6b
Make string globals persist-able using fixed size allocations (#5296)
Co-authored-by: Daniel Dunn <dannydunn@eternityforest.com>
2023-09-12 09:26:00 +12:00
dependabot[bot] 5997401e9e
Bump pylint from 2.15.10 to 2.16.2 (#4426)
* Bump pylint from 2.15.10 to 2.16.2

Bumps [pylint](https://github.com/PyCQA/pylint) from 2.15.10 to 2.16.2.
- [Release notes](https://github.com/PyCQA/pylint/releases)
- [Commits](https://github.com/PyCQA/pylint/compare/v2.15.10...v2.16.2)

---
updated-dependencies:
- dependency-name: pylint
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Lint

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2023-02-13 22:55:36 +00:00
Jesse Hills b184b01600
Remove a bunch of unnecessary pylint disabling (#4079) 2022-11-24 11:09:19 +13:00
Jesse Hills d220d41182
Bump python min to 3.9 (#3871) 2022-10-05 20:09:27 +13:00
Javier Peletier 05edfd0e82
Add cg.with_local_variable (#3577) 2022-10-05 11:50:03 +13:00
cstaahl 07c1cf7137
Pulse meter internal filter mode (#3082)
Co-authored-by: Paul Daumlechner <paul.daumlechner@live.de>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
Co-authored-by: Otto Winter <otto@otto-winter.com>
2022-02-21 09:32:35 +13:00
Otto Winter 35e6a13cd1
Remove unused obj attribute from AssignmentExpression (#3145) 2022-02-09 14:56:42 +01:00
stegm 58fa63ad88
Add Select for modbus (#3032)
Co-authored-by: Oxan van Leeuwen <oxan@oxanvanleeuwen.nl>
2022-02-08 22:27:22 +13:00
Otto Winter 871d3b66fb
Fix restoring globals (#2442) 2021-10-04 16:15:25 +02:00
Otto Winter a27a884191
Add missing MockObj operators (#2378) 2021-09-23 11:53:10 +02:00
Paul Monigatti 17dcba8f8a
Fix: Pin flags code generation returning FLAG_NONE (#2377)
Co-authored-by: Otto winter <otto@otto-winter.com>
2021-09-23 11:19:17 +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
Stefan Agner 159744e09e
Support library override using named library with repository (#2056) 2021-07-26 10:50:45 +02:00
Otto Winter a33bb32874
Convert components to async-def syntax (#1823)
* Convert components to async-def syntax

* Remove stray @coroutine

* Manual part

* Convert complexer components code to async-def

* Manual cleanup

* More manual cleanup
2021-05-24 21:45:31 +02:00
Stanislav Meduna 063d9c47a4
Refactor font creation to save stack (#1707) 2021-05-24 08:24:54 +12:00
Otto Winter aebad04c0b
Convert core components to async-def coroutine syntax (#1658)
Co-authored-by: Guillermo Ruffino <glm.net@gmail.com>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2021-05-23 22:10:30 +02:00
Otto Winter d4686c0fb1
Introduce new async-def coroutine syntax (#1657) 2021-05-17 17:14:15 +12:00
Keith Burzinski 818a7f1c78
Declare Color objects in main.cpp (#1395) 2021-03-19 23:40:05 +13: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
Niklas Wagner c2e0ea97d8
Upgrade dependencies 2020-05-23 20:33:58 -03:00
Tim Savage d447548893
Tests for CPP Code generation and some Python3 improvements (#961)
* Basic pytest configuration

* Added unit_test script that triggers pytest

* Changed "fixtures" to fixture_path

This is consistent with pytest's tmp_path

* Initial unit tests for esphome.helpers

* Disabled coverage reporting for esphome/components.

Focus initial unittest efforts on the core code.

* Migrated some ip_address to hypothesis

* Added a hypothesis MAC address strategy

* Initial tests for core

* Added hypothesis to requirements

* Added tests for core classes

TestTimePeriod
Lambda
ID
DocumentLocation
DocumentRange
Define
Library

* Updated test config so package root is discovered

* Setup fixtures and inital tests for pins

* Added tests for validate GPIO

* Added tests for pin type

* Added initial config_validation tests

* Added more tests for config_validation

* Added comparison unit tests

* Added repr to core.TimePeriod. Simplified identifying faults in tests

* Fixed inverted gt/lt tests

* Some tests for Espcore

* Updated syntax for Python3

* Removed usage of kwarg that isn't required

* Started writing test cases

* Started writing test cases for cpp_generator

* Additional docs and more Python3 releated improvements

* More test cases for cpp_generator.

* Fixed linter errors

* Add codegen tests to ensure file API remains stable

* Add test cases for cpp_helpers
2020-04-19 21:05:58 -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
Fritz Mueller 1d5f8d5a52 Use default format to render FloatLiteral (#717)
Fixes https://github.com/esphome/issues/issues/557
2019-09-04 11:06:18 +02:00
Otto Winter f811b1157c
Updates for 1.13 (#546)
* Update CI matcher

* Check Executable bit

* Quicklint

* Updates

* Allow pm1.0 and pm10.0 for PMS5003ST

Fixes https://github.com/esphome/feature-requests/issues/225

* PowerSupplyRequester

* Lint

* Include debug data in generated main.cpp

* Updates

* Auto-select bit_depth

* Updates
2019-05-12 23:04:36 +02:00
Otto Winter f1a0e5a313
Sun support (#531)
* Sun

* Add sun support

* Lint

* Updates

* Fix elevation

* Lint

* Update mqtt_climate.cpp
2019-05-11 12:31:00 +02:00
Otto Winter 766f6c045d
Updates 2019-04-24 23:49:02 +02:00
Otto Winter 8e75980ebd
Cleanup dashboard JS (#491)
* Cleanup dashboard JS

* Add vscode

* Save start_mark/end_mark

* Updates

* Updates

* Remove need for cv.nameable

It's a bit hacky but removes so much bloat from integrations

* Add enum helper

* Document APIs, and Improvements

* Fixes

* Fixes

* Update PULL_REQUEST_TEMPLATE.md

* Updates

* Updates

* Updates
2019-04-22 21:56:30 +02:00
Otto Winter 6682c43dfa
🏗 Merge C++ into python codebase (#504)
## Description:

Move esphome-core codebase into esphome (and a bunch of other refactors). See https://github.com/esphome/feature-requests/issues/97

Yes this is a shit ton of work and no there's no way to automate it :( But it will be worth it 👍

Progress:
- Core support (file copy etc): 80%
- Base Abstractions (light, switch): ~50%
- Integrations: ~10%
- Working? Yes, (but only with ported components).

Other refactors:
- Moves all codegen related stuff into a single class: `esphome.codegen` (imported as `cg`)
- Rework coroutine syntax
- Move from `component/platform.py` to `domain/component.py` structure as with HA
- Move all defaults out of C++ and into config validation.
- Remove `make_...` helpers from Application class. Reason: Merge conflicts with every single new integration.
- Pointer Variables are stored globally instead of locally in setup(). Reason: stack size limit.

Future work:
- Rework const.py - Move all `CONF_...` into a conf class (usage `conf.UPDATE_INTERVAL` vs `CONF_UPDATE_INTERVAL`). Reason: Less convoluted import block
- Enable loading from `custom_components` folder.

**Related issue (if applicable):** https://github.com/esphome/feature-requests/issues/97

**Pull request in [esphome-docs](https://github.com/esphome/esphome-docs) with documentation (if applicable):** esphome/esphome-docs#<esphome-docs PR number goes here>

## Checklist:
  - [ ] The code change is tested and works locally.
  - [ ] Tests have been added to verify that the new code works (under `tests/` folder).

If user exposed functionality or configuration variables are added/changed:
  - [ ] Documentation added/updated in [esphomedocs](https://github.com/OttoWinter/esphomedocs).
2019-04-17 12:06:00 +02:00
Otto Winter be5330b6ae
Simplify coroutine syntax (#503)
* Simplify coroutine syntax

* More

* Lint

* Fix

* More

* Lint
2019-04-09 14:30:12 +02:00
Otto Winter 7fd5634a51
Add cover position/tilt support (#496)
* Add climate support

* Fixes

* Updates

* Updates

* Add ota

* Remove climate changes

* Lint
2019-04-08 18:08:58 +02:00
Otto Winter de51bdda5b
Fix filter_out: nan filer (#486)
* Fix filter_out nan filter

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

* Add test
2019-03-18 15:07:20 +01:00
puuu 23df5d8af7 Support SDS011 component. (#467)
* Support SDS011 component.

* improve if condition

* Check update interval is multiple of minute

* do not allow update intervals longer than 30 min

* fix sensor schema name

* remove query_mode

* Warn if rx_only mode used together with update interval

* Allow update intervals below 1min

Messed that up before, as the docs say update intervals below 1min are allowed

* Use update interval in minutes

* use set_update_interval_min() to set update interval
2019-03-06 12:39:52 +01:00
Otto Winter 3b00cfd6c4
Convert automation engine to use variadic templates (#452) 2019-02-26 19:28:11 +01:00
Otto Winter 3d9301a0f7
Rename esphomeyaml to esphome (#426)
* Rename

* Update

* Add migration

* Fix

* Fix dashboard

* Change test

* Fixes

* Code cleanup

* Fix import order

* Update

* Automate docker builds

* Shellcheck
2019-02-13 16:54:02 +01:00