diff --git a/.clang-format b/.clang-format
index a7c337f80e..f2d86c57cd 100644
--- a/.clang-format
+++ b/.clang-format
@@ -49,7 +49,7 @@ ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
-DerivePointerAlignment: true
+DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
diff --git a/.clang-tidy b/.clang-tidy
index 5e486e6a0c..fc5ce854f1 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -4,14 +4,24 @@ Checks: >-
-abseil-*,
-android-*,
-boost-*,
- -bugprone-macro-parentheses,
+ -bugprone-branch-clone,
+ -bugprone-narrowing-conversions,
+ -bugprone-signed-char-misuse,
+ -bugprone-too-small-loop-variable,
-cert-dcl50-cpp,
-cert-err58-cpp,
- -clang-analyzer-core.CallAndMessage,
+ -cert-oop57-cpp,
+ -cert-str34-c,
+ -clang-analyzer-optin.cplusplus.UninitializedObject,
-clang-analyzer-osx.*,
- -clang-analyzer-security.*,
+ -clang-diagnostic-shadow-field,
+ -cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-avoid-goto,
- -cppcoreguidelines-c-copy-assignment-signature,
+ -cppcoreguidelines-avoid-magic-numbers,
+ -cppcoreguidelines-init-variables,
+ -cppcoreguidelines-macro-usage,
+ -cppcoreguidelines-narrowing-conversions,
+ -cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-owning-memory,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-pro-bounds-constant-array-index,
@@ -24,40 +34,51 @@ Checks: >-
-cppcoreguidelines-pro-type-union-access,
-cppcoreguidelines-pro-type-vararg,
-cppcoreguidelines-special-member-functions,
- -fuchsia-*,
-fuchsia-default-arguments,
-fuchsia-multiple-inheritance,
-fuchsia-overloaded-operator,
-fuchsia-statically-constructed-objects,
+ -fuchsia-default-arguments-declarations,
+ -fuchsia-default-arguments-calls,
-google-build-using-namespace,
-google-explicit-constructor,
-google-readability-braces-around-statements,
-google-readability-casting,
-google-readability-todo,
- -google-runtime-int,
-google-runtime-references,
-hicpp-*,
+ -llvm-else-after-return,
-llvm-header-guard,
-llvm-include-order,
- -misc-unconventional-assign-operator,
+ -llvm-qualified-auto,
+ -llvmlibc-*,
+ -misc-non-private-member-variables-in-classes,
+ -misc-no-recursion,
-misc-unused-parameters,
- -modernize-deprecated-headers,
- -modernize-pass-by-value,
- -modernize-pass-by-value,
+ -modernize-avoid-c-arrays,
-modernize-return-braced-init-list,
-modernize-use-auto,
-modernize-use-default-member-init,
-modernize-use-equals-default,
+ -modernize-use-trailing-return-type,
-mpi-*,
-objc-*,
- -performance-unnecessary-value-param,
-readability-braces-around-statements,
+ -readability-const-return-type,
+ -readability-convert-member-functions-to-static,
-readability-else-after-return,
-readability-implicit-bool-conversion,
+ -readability-isolate-declaration,
+ -readability-magic-numbers,
+ -readability-make-member-function-const,
-readability-named-parameter,
+ -readability-qualified-auto,
+ -readability-redundant-access-specifiers,
-readability-redundant-member-init,
- -warnings-as-errors,
- -zircon-*
+ -readability-redundant-string-init,
+ -readability-uppercase-literal-suffix,
+ -readability-use-anyofallof,
+ -warnings-as-errors
WarningsAsErrors: '*'
HeaderFilterRegex: '^.*/src/esphome/.*'
AnalyzeTemporaryDtors: false
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 8f7d751437..3904962d7c 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -2,16 +2,29 @@
"name": "ESPHome Dev",
"context": "..",
"dockerFile": "../docker/Dockerfile.dev",
- "postCreateCommand": "mkdir -p config && pip3 install -e .",
- "runArgs": ["--privileged", "-e", "ESPHOME_DASHBOARD_USE_PING=1"],
+ "postCreateCommand": [
+ "script/devcontainer-post-create"
+ ],
+ "runArgs": [
+ "--privileged",
+ "-e",
+ "ESPHOME_DASHBOARD_USE_PING=1"
+ ],
"appPort": 6052,
"extensions": [
+ // python
"ms-python.python",
"visualstudioexptteam.vscodeintellicode",
- "redhat.vscode-yaml"
+ // yaml
+ "redhat.vscode-yaml",
+ // cpp
+ "ms-vscode.cpptools",
+ // editorconfig
+ "editorconfig.editorconfig",
],
"settings": {
- "python.pythonPath": "/usr/local/bin/python",
+ "python.languageServer": "Pylance",
+ "python.pythonPath": "/usr/bin/python3",
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"python.formatting.provider": "black",
@@ -19,7 +32,7 @@
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true,
- "terminal.integrated.shell.linux": "/bin/bash",
+ "terminal.integrated.defaultProfile.linux": "bash",
"yaml.customTags": [
"!secret scalar",
"!lambda scalar",
@@ -27,6 +40,18 @@
"!include_dir_list scalar",
"!include_dir_merge_list scalar",
"!include_dir_merge_named scalar"
- ]
+ ],
+ "files.exclude": {
+ "**/.git": true,
+ "**/.DS_Store": true,
+ "**/*.pyc": {
+ "when": "$(basename).py"
+ },
+ "**/__pycache__": true
+ },
+ "files.associations": {
+ "**/.vscode/*.json": "jsonc"
+ },
+ "C_Cpp.clang_format_path": "/usr/bin/clang-format-11",
}
}
diff --git a/.dockerignore b/.dockerignore
index e1baed38ca..9f14b98059 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -103,6 +103,10 @@ venv.bak/
# mypy
.mypy_cache/
+# PlatformIO
+.pio/
+
+# ESPHome
config/
examples/
Dockerfile
diff --git a/.editorconfig b/.editorconfig
index 29cbb1e32f..8ccf1eeebc 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -7,7 +7,7 @@ insert_final_newline = true
charset = utf-8
# python
-[*.{py}]
+[*.py]
indent_style = space
indent_size = 4
@@ -25,4 +25,10 @@ indent_size = 2
[*.{yaml,yml}]
indent_style = space
indent_size = 2
-quote_type = single
\ No newline at end of file
+quote_type = single
+
+# JSON
+[*.json]
+indent_style = space
+indent_size = 2
+
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index 52ac3648b0..864586fe6b 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1,8 +1,3 @@
# These are supported funding model platforms
-github:
-patreon: ottowinter
-open_collective:
-ko_fi:
-tidelift:
-custom: https://esphome.io/guides/supporters.html
+custom: https://www.nabucasa.com
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 0d77eee7aa..aa90ef365f 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,25 +1,22 @@
# What does this implement/fix?
-Quick description
+Quick description and explanation of changes
## Types of changes
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
-- [ ] Configuration change (this will require users to update their yaml configuration files to keep working)
+- [ ] Other
**Related issue or feature (if applicable):** fixes
**Pull request in [esphome-docs](https://github.com/esphome/esphome-docs) with documentation (if applicable):** esphome/esphome-docs#
-
-# Test Environment
+
+## Test Environment
- [ ] ESP32
- [ ] ESP8266
-- [ ] Windows
-- [ ] Mac OS
-- [ ] Linux
## Example entry for `config.yaml`:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {% if begin and len(entries) == 1 %}
-
- {% end %}
-
-