Skip to content

Commit

Permalink
Merge branch 'next' into hbridge-switch
Browse files Browse the repository at this point in the history
  • Loading branch information
kbx81 authored Dec 2, 2024
2 parents 0f24716 + 6af4943 commit 95f9ad9
Show file tree
Hide file tree
Showing 175 changed files with 2,032 additions and 543 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ updates:
schedule:
interval: daily
open-pull-requests-limit: 10
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
4 changes: 2 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ jobs:
steps:
-
name: Install pagefind
uses: jaxxstorm/action-install-gh-release@v1.12.0
uses: jaxxstorm/action-install-gh-release@v1.14.0
with:
repo: cloudcannon/pagefind
-
name: Checkout source code
uses: actions/checkout@v4.2.1
uses: actions/checkout@v4.2.2
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install pagefind
uses: jaxxstorm/action-install-gh-release@v1.12.0
uses: jaxxstorm/action-install-gh-release@v1.14.0
with:
repo: cloudcannon/pagefind
- uses: actions/checkout@v4.2.1
- uses: actions/checkout@v4.2.2
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion Doxygen
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "ESPHome"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 2024.11.0-dev
PROJECT_NUMBER = 2024.12.0-dev

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ESPHOME_PATH = ../esphome
ESPHOME_REF = dev
PAGEFIND_VERSION=1.1.0
ESPHOME_REF = 2024.11.2
PAGEFIND_VERSION=1.1.1
PAGEFIND=pagefind
NET_PAGEFIND=../pagefindbin/pagefind

Expand Down
64 changes: 64 additions & 0 deletions _extensions/apiref.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import re
import string
from docutils import nodes, utils


value_re = re.compile(r"^(.*)\s*<(.*)>$")
DOXYGEN_LOOKUP = {}
for s in string.ascii_lowercase + string.digits:
DOXYGEN_LOOKUP[s] = s
for s in string.ascii_uppercase:
DOXYGEN_LOOKUP[s] = "_{}".format(s.lower())
DOXYGEN_LOOKUP[":"] = "_1"
DOXYGEN_LOOKUP["_"] = "__"
DOXYGEN_LOOKUP["."] = "_8"


def split_text_value(value):
match = value_re.match(value)
if match is None:
return None, value
return match.group(1), match.group(2)


def encode_doxygen(value):
value = value.split("/")[-1]
try:
return "".join(DOXYGEN_LOOKUP[s] for s in value)
except KeyError:
raise ValueError("Unknown character in doxygen string! '{}'".format(value))


def apiref_role(name, rawtext, text, lineno, inliner, options=None, content=None):
text, value = split_text_value(text)
if text is None:
text = "API Reference"
ref = "/api/{}.html".format(encode_doxygen(value))
return [make_link_node(rawtext, text, ref, options)], []


def apiclass_role(name, rawtext, text, lineno, inliner, options=None, content=None):
text, value = split_text_value(text)
if text is None:
text = value
ref = "/api/classesphome_1_1{}.html".format(encode_doxygen(value))
return [make_link_node(rawtext, text, ref, options)], []


def apistruct_role(name, rawtext, text, lineno, inliner, options=None, content=None):
text, value = split_text_value(text)
if text is None:
text = value
ref = "/api/structesphome_1_1{}.html".format(encode_doxygen(value))
return [make_link_node(rawtext, text, ref, options)], []

def make_link_node(rawtext, text, ref, options=None):
options = options or {}
node = nodes.reference(rawtext, utils.unescape(text), refuri=ref, **options)
return node

def setup(app):
app.add_role("apiref", apiref_role)
app.add_role("apiclass", apiclass_role)
app.add_role("apistruct", apistruct_role)
return {"version": "1.0.0", "parallel_read_safe": True, "parallel_write_safe": True}
File renamed without changes.
49 changes: 49 additions & 0 deletions _extensions/github.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

import os

from docutils import nodes, utils


def libpr_role(name, rawtext, text, lineno, inliner, options=None, content=None):
ref = "https://github.com/esphome/esphome-core/pull/{}".format(text)
return [make_link_node(rawtext, "core#{}".format(text), ref, options)], []


def yamlpr_role(name, rawtext, text, lineno, inliner, options=None, content=None):
ref = "https://github.com/esphome/esphome/pull/{}".format(text)
return [make_link_node(rawtext, "esphome#{}".format(text), ref, options)], []


def docspr_role(name, rawtext, text, lineno, inliner, options=None, content=None):
ref = "https://github.com/esphome/esphome-docs/pull/{}".format(text)
return [make_link_node(rawtext, "docs#{}".format(text), ref, options)], []


def ghuser_role(name, rawtext, text, lineno, inliner, options=None, content=None):
ref = "https://github.com/{}".format(text)
return [make_link_node(rawtext, "@{}".format(text), ref, options)], []


def ghedit_role(name, rawtext, text, lineno, inliner, options=None, content=None):
path = os.path.relpath(
inliner.document.current_source, inliner.document.settings.env.app.srcdir
)
ref = "https://github.com/esphome/esphome-docs/blob/current/{}".format(path)
return [make_link_node(rawtext, "Edit this page on GitHub", ref, options)], []


def make_link_node(rawtext, text, ref, options=None):
options = options or {}
node = nodes.reference(rawtext, utils.unescape(text), refuri=ref, **options)
return node


def setup(app):
app.add_role("libpr", libpr_role)
app.add_role("corepr", libpr_role)
app.add_role("yamlpr", yamlpr_role)
app.add_role("esphomepr", yamlpr_role)
app.add_role("docspr", docspr_role)
app.add_role("ghuser", ghuser_role)
app.add_role("ghedit", ghedit_role)
return {"version": "1.0.0", "parallel_read_safe": True, "parallel_write_safe": True}
2 changes: 1 addition & 1 deletion seo.py → _extensions/seo.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def run(self):
if not image.startswith("/"):
local_img = f"/images/{image}"
image = "/_images/" + image
p = Path(__file__).parent / local_img[1:]
p = Path(__file__).parent.parent / local_img[1:]
if not p.is_file():
raise ValueError(f"File {p} for seo tag does not exist {self.state.document}")

Expand Down
File renamed without changes.
100 changes: 1 addition & 99 deletions github.py → _extensions/tables.py
Original file line number Diff line number Diff line change
@@ -1,98 +1,11 @@

import csv
from itertools import zip_longest
import os
import re
import string

from docutils import nodes, utils
from docutils.parsers.rst import directives
from docutils.parsers.rst.directives.tables import Table


def libpr_role(name, rawtext, text, lineno, inliner, options=None, content=None):
ref = "https://github.com/esphome/esphome-core/pull/{}".format(text)
return [make_link_node(rawtext, "core#{}".format(text), ref, options)], []


def yamlpr_role(name, rawtext, text, lineno, inliner, options=None, content=None):
ref = "https://github.com/esphome/esphome/pull/{}".format(text)
return [make_link_node(rawtext, "esphome#{}".format(text), ref, options)], []


def docspr_role(name, rawtext, text, lineno, inliner, options=None, content=None):
ref = "https://github.com/esphome/esphome-docs/pull/{}".format(text)
return [make_link_node(rawtext, "docs#{}".format(text), ref, options)], []


def ghuser_role(name, rawtext, text, lineno, inliner, options=None, content=None):
ref = "https://github.com/{}".format(text)
return [make_link_node(rawtext, "@{}".format(text), ref, options)], []


value_re = re.compile(r"^(.*)\s*<(.*)>$")
DOXYGEN_LOOKUP = {}
for s in string.ascii_lowercase + string.digits:
DOXYGEN_LOOKUP[s] = s
for s in string.ascii_uppercase:
DOXYGEN_LOOKUP[s] = "_{}".format(s.lower())
DOXYGEN_LOOKUP[":"] = "_1"
DOXYGEN_LOOKUP["_"] = "__"
DOXYGEN_LOOKUP["."] = "_8"


def split_text_value(value):
match = value_re.match(value)
if match is None:
return None, value
return match.group(1), match.group(2)


def encode_doxygen(value):
value = value.split("/")[-1]
try:
return "".join(DOXYGEN_LOOKUP[s] for s in value)
except KeyError:
raise ValueError("Unknown character in doxygen string! '{}'".format(value))


def apiref_role(name, rawtext, text, lineno, inliner, options=None, content=None):
text, value = split_text_value(text)
if text is None:
text = "API Reference"
ref = "/api/{}.html".format(encode_doxygen(value))
return [make_link_node(rawtext, text, ref, options)], []


def apiclass_role(name, rawtext, text, lineno, inliner, options=None, content=None):
text, value = split_text_value(text)
if text is None:
text = value
ref = "/api/classesphome_1_1{}.html".format(encode_doxygen(value))
return [make_link_node(rawtext, text, ref, options)], []


def apistruct_role(name, rawtext, text, lineno, inliner, options=None, content=None):
text, value = split_text_value(text)
if text is None:
text = value
ref = "/api/structesphome_1_1{}.html".format(encode_doxygen(value))
return [make_link_node(rawtext, text, ref, options)], []


def ghedit_role(name, rawtext, text, lineno, inliner, options=None, content=None):
path = os.path.relpath(
inliner.document.current_source, inliner.document.settings.env.app.srcdir
)
ref = "https://github.com/esphome/esphome-docs/blob/current/{}".format(path)
return [make_link_node(rawtext, "Edit this page on GitHub", ref, options)], []


def make_link_node(rawtext, text, ref, options=None):
options = options or {}
node = nodes.reference(rawtext, utils.unescape(text), refuri=ref, **options)
return node


# https://stackoverflow.com/a/3415150/8924614
def grouper(n, iterable, fillvalue=None):
"""Pythonic way to iterate over sequence, 4 items at a time.
Expand All @@ -105,7 +18,6 @@ def grouper(n, iterable, fillvalue=None):

# Based on https://www.slideshare.net/doughellmann/better-documentation-through-automation-creating-docutils-sphinx-extensions
class ImageTableDirective(Table):

option_spec = {
"columns": directives.positive_int,
}
Expand Down Expand Up @@ -272,16 +184,6 @@ def run(self):


def setup(app):
app.add_role("libpr", libpr_role)
app.add_role("corepr", libpr_role)
app.add_role("yamlpr", yamlpr_role)
app.add_role("esphomepr", yamlpr_role)
app.add_role("docspr", docspr_role)
app.add_role("ghuser", ghuser_role)
app.add_role("apiref", apiref_role)
app.add_role("apiclass", apiclass_role)
app.add_role("apistruct", apistruct_role)
app.add_role("ghedit", ghedit_role)
app.add_directive("imgtable", ImageTableDirective)
app.add_directive("pintable", PinTableDirective)
return {"version": "1.0.0", "parallel_read_safe": True, "parallel_write_safe": True}
1 change: 1 addition & 0 deletions _redirects
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
/components/ota.html /components/ota/esphome.html 301
/components/ota_http_request.html /components/ota/http_request.html 301
/components/sensor/mmc5063.html /components/sensor/mmc5603.html 301
/components/sensor/kalman_combinator.html /components/sensor/combination.html 301

/cookbook/brilliant-mirabella-genio-smart-plugs.html https://devices.esphome.io/devices/Mirabella-Genio-Wi-Fi-1-USB 301
/cookbook/zemismart-rgbw-downlights.html https://devices.esphome.io/devices/Zemismart-LED-RGBWW-Downlight 301
Expand Down
Binary file modified _static/changelog-2024.10.0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _static/changelog-2024.11.0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _static/changelog-2024.9.0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion _static/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024.11.0-dev
2024.12.0-dev
Loading

0 comments on commit 95f9ad9

Please sign in to comment.