mirror of
				https://github.com/esphome/esphome.git
				synced 2025-11-04 00:51:49 +00:00 
			
		
		
		
	Compare commits
	
		
			34 Commits
		
	
	
		
			jesserockz
			...
			2024.6.6
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					6c96281a1d | ||
| 
						 | 
					3727342bce | ||
| 
						 | 
					fc3f806555 | ||
| 
						 | 
					c013c3bf61 | ||
| 
						 | 
					849a98d5b4 | ||
| 
						 | 
					e4e404d54f | ||
| 
						 | 
					995db1d0e1 | ||
| 
						 | 
					5cb80619dd | ||
| 
						 | 
					0914dc7198 | ||
| 
						 | 
					12f00a9d3d | ||
| 
						 | 
					7b3d6747d5 | ||
| 
						 | 
					7904d3b157 | ||
| 
						 | 
					3a48b10757 | ||
| 
						 | 
					0e50cac399 | ||
| 
						 | 
					04225d5717 | ||
| 
						 | 
					86791422f0 | ||
| 
						 | 
					9c2af6318c | ||
| 
						 | 
					c747d7d45d | ||
| 
						 | 
					bbd7c9cf86 | ||
| 
						 | 
					169fb79c97 | ||
| 
						 | 
					1579dfeb80 | ||
| 
						 | 
					d8a6d8594a | ||
| 
						 | 
					7be071a0e9 | ||
| 
						 | 
					0262a99274 | ||
| 
						 | 
					09a947beaa | ||
| 
						 | 
					a6e1ef2dd1 | ||
| 
						 | 
					c5aae8ee25 | ||
| 
						 | 
					5bd5b777a6 | ||
| 
						 | 
					e39961f7f1 | ||
| 
						 | 
					0d3cf5cb78 | ||
| 
						 | 
					96d63de292 | ||
| 
						 | 
					ae2962259e | ||
| 
						 | 
					7dbc20b776 | ||
| 
						 | 
					a21dab334c | 
							
								
								
									
										4
									
								
								.github/actions/build-image/action.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/actions/build-image/action.yaml
									
									
									
									
										vendored
									
									
								
							@@ -46,7 +46,7 @@ runs:
 | 
			
		||||
 | 
			
		||||
    - name: Build and push to ghcr by digest
 | 
			
		||||
      id: build-ghcr
 | 
			
		||||
      uses: docker/build-push-action@v6.1.0
 | 
			
		||||
      uses: docker/build-push-action@v6.0.1
 | 
			
		||||
      with:
 | 
			
		||||
        context: .
 | 
			
		||||
        file: ./docker/Dockerfile
 | 
			
		||||
@@ -69,7 +69,7 @@ runs:
 | 
			
		||||
 | 
			
		||||
    - name: Build and push to dockerhub by digest
 | 
			
		||||
      id: build-dockerhub
 | 
			
		||||
      uses: docker/build-push-action@v6.1.0
 | 
			
		||||
      uses: docker/build-push-action@v6.0.1
 | 
			
		||||
      with:
 | 
			
		||||
        context: .
 | 
			
		||||
        file: ./docker/Dockerfile
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								.github/workflows/ci-api-proto.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/ci-api-proto.yml
									
									
									
									
										vendored
									
									
								
							@@ -21,7 +21,7 @@ jobs:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4.1.7
 | 
			
		||||
        uses: actions/checkout@v4.1.6
 | 
			
		||||
      - name: Set up Python
 | 
			
		||||
        uses: actions/setup-python@v5.1.0
 | 
			
		||||
        with:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								.github/workflows/ci-docker.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/ci-docker.yml
									
									
									
									
										vendored
									
									
								
							@@ -40,7 +40,7 @@ jobs:
 | 
			
		||||
        arch: [amd64, armv7, aarch64]
 | 
			
		||||
        build_type: ["ha-addon", "docker", "lint"]
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v4.1.7
 | 
			
		||||
      - uses: actions/checkout@v4.1.6
 | 
			
		||||
      - name: Set up Python
 | 
			
		||||
        uses: actions/setup-python@v5.1.0
 | 
			
		||||
        with:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										39
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										39
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							@@ -34,7 +34,7 @@ jobs:
 | 
			
		||||
      cache-key: ${{ steps.cache-key.outputs.key }}
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Check out code from GitHub
 | 
			
		||||
        uses: actions/checkout@v4.1.7
 | 
			
		||||
        uses: actions/checkout@v4.1.6
 | 
			
		||||
      - name: Generate cache-key
 | 
			
		||||
        id: cache-key
 | 
			
		||||
        run: echo key="${{ hashFiles('requirements.txt', 'requirements_optional.txt', 'requirements_test.txt') }}" >> $GITHUB_OUTPUT
 | 
			
		||||
@@ -66,7 +66,7 @@ jobs:
 | 
			
		||||
      - common
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Check out code from GitHub
 | 
			
		||||
        uses: actions/checkout@v4.1.7
 | 
			
		||||
        uses: actions/checkout@v4.1.6
 | 
			
		||||
      - name: Restore Python
 | 
			
		||||
        uses: ./.github/actions/restore-python
 | 
			
		||||
        with:
 | 
			
		||||
@@ -87,7 +87,7 @@ jobs:
 | 
			
		||||
      - common
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Check out code from GitHub
 | 
			
		||||
        uses: actions/checkout@v4.1.7
 | 
			
		||||
        uses: actions/checkout@v4.1.6
 | 
			
		||||
      - name: Restore Python
 | 
			
		||||
        uses: ./.github/actions/restore-python
 | 
			
		||||
        with:
 | 
			
		||||
@@ -108,7 +108,7 @@ jobs:
 | 
			
		||||
      - common
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Check out code from GitHub
 | 
			
		||||
        uses: actions/checkout@v4.1.7
 | 
			
		||||
        uses: actions/checkout@v4.1.6
 | 
			
		||||
      - name: Restore Python
 | 
			
		||||
        uses: ./.github/actions/restore-python
 | 
			
		||||
        with:
 | 
			
		||||
@@ -129,7 +129,7 @@ jobs:
 | 
			
		||||
      - common
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Check out code from GitHub
 | 
			
		||||
        uses: actions/checkout@v4.1.7
 | 
			
		||||
        uses: actions/checkout@v4.1.6
 | 
			
		||||
      - name: Restore Python
 | 
			
		||||
        uses: ./.github/actions/restore-python
 | 
			
		||||
        with:
 | 
			
		||||
@@ -150,7 +150,7 @@ jobs:
 | 
			
		||||
      - common
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Check out code from GitHub
 | 
			
		||||
        uses: actions/checkout@v4.1.7
 | 
			
		||||
        uses: actions/checkout@v4.1.6
 | 
			
		||||
      - name: Restore Python
 | 
			
		||||
        uses: ./.github/actions/restore-python
 | 
			
		||||
        with:
 | 
			
		||||
@@ -199,7 +199,7 @@ jobs:
 | 
			
		||||
      - common
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Check out code from GitHub
 | 
			
		||||
        uses: actions/checkout@v4.1.7
 | 
			
		||||
        uses: actions/checkout@v4.1.6
 | 
			
		||||
      - name: Restore Python
 | 
			
		||||
        uses: ./.github/actions/restore-python
 | 
			
		||||
        with:
 | 
			
		||||
@@ -229,7 +229,7 @@ jobs:
 | 
			
		||||
      - common
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Check out code from GitHub
 | 
			
		||||
        uses: actions/checkout@v4.1.7
 | 
			
		||||
        uses: actions/checkout@v4.1.6
 | 
			
		||||
      - name: Restore Python
 | 
			
		||||
        uses: ./.github/actions/restore-python
 | 
			
		||||
        with:
 | 
			
		||||
@@ -254,7 +254,7 @@ jobs:
 | 
			
		||||
      matrix: ${{ steps.set-matrix.outputs.matrix }}
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Check out code from GitHub
 | 
			
		||||
        uses: actions/checkout@v4.1.7
 | 
			
		||||
        uses: actions/checkout@v4.1.6
 | 
			
		||||
      - name: Find all YAML test files
 | 
			
		||||
        id: set-matrix
 | 
			
		||||
        run: echo "matrix=$(ls tests/test*.yaml | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
 | 
			
		||||
@@ -271,7 +271,7 @@ jobs:
 | 
			
		||||
        file: ${{ fromJson(needs.compile-tests-list.outputs.matrix) }}
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Check out code from GitHub
 | 
			
		||||
        uses: actions/checkout@v4.1.7
 | 
			
		||||
        uses: actions/checkout@v4.1.6
 | 
			
		||||
      - name: Restore Python
 | 
			
		||||
        uses: ./.github/actions/restore-python
 | 
			
		||||
        with:
 | 
			
		||||
@@ -303,7 +303,7 @@ jobs:
 | 
			
		||||
        file: ${{ fromJson(needs.compile-tests-list.outputs.matrix) }}
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Check out code from GitHub
 | 
			
		||||
        uses: actions/checkout@v4.1.7
 | 
			
		||||
        uses: actions/checkout@v4.1.6
 | 
			
		||||
      - name: Restore Python
 | 
			
		||||
        uses: ./.github/actions/restore-python
 | 
			
		||||
        with:
 | 
			
		||||
@@ -358,7 +358,7 @@ jobs:
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Check out code from GitHub
 | 
			
		||||
        uses: actions/checkout@v4.1.7
 | 
			
		||||
        uses: actions/checkout@v4.1.6
 | 
			
		||||
      - name: Restore Python
 | 
			
		||||
        uses: ./.github/actions/restore-python
 | 
			
		||||
        with:
 | 
			
		||||
@@ -387,13 +387,6 @@ jobs:
 | 
			
		||||
          echo "::add-matcher::.github/workflows/matchers/gcc.json"
 | 
			
		||||
          echo "::add-matcher::.github/workflows/matchers/clang-tidy.json"
 | 
			
		||||
 | 
			
		||||
      - name: Run 'pio run --list-targets -e esp32-idf-tidy'
 | 
			
		||||
        if: matrix.name == 'Run script/clang-tidy for ESP32 IDF'
 | 
			
		||||
        run: |
 | 
			
		||||
          . venv/bin/activate
 | 
			
		||||
          mkdir -p .temp
 | 
			
		||||
          pio run --list-targets -e esp32-idf-tidy
 | 
			
		||||
 | 
			
		||||
      - name: Run clang-tidy
 | 
			
		||||
        run: |
 | 
			
		||||
          . venv/bin/activate
 | 
			
		||||
@@ -417,7 +410,7 @@ jobs:
 | 
			
		||||
      count: ${{ steps.list-components.outputs.count }}
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Check out code from GitHub
 | 
			
		||||
        uses: actions/checkout@v4.1.7
 | 
			
		||||
        uses: actions/checkout@v4.1.6
 | 
			
		||||
        with:
 | 
			
		||||
          # Fetch enough history so `git merge-base refs/remotes/origin/dev HEAD` works.
 | 
			
		||||
          fetch-depth: 500
 | 
			
		||||
@@ -465,7 +458,7 @@ jobs:
 | 
			
		||||
        run: sudo apt-get install libsodium-dev libsdl2-dev
 | 
			
		||||
 | 
			
		||||
      - name: Check out code from GitHub
 | 
			
		||||
        uses: actions/checkout@v4.1.7
 | 
			
		||||
        uses: actions/checkout@v4.1.6
 | 
			
		||||
      - name: Restore Python
 | 
			
		||||
        uses: ./.github/actions/restore-python
 | 
			
		||||
        with:
 | 
			
		||||
@@ -491,7 +484,7 @@ jobs:
 | 
			
		||||
      matrix: ${{ steps.split.outputs.components }}
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Check out code from GitHub
 | 
			
		||||
        uses: actions/checkout@v4.1.7
 | 
			
		||||
        uses: actions/checkout@v4.1.6
 | 
			
		||||
      - name: Split components into 20 groups
 | 
			
		||||
        id: split
 | 
			
		||||
        run: |
 | 
			
		||||
@@ -519,7 +512,7 @@ jobs:
 | 
			
		||||
        run: sudo apt-get install libsodium-dev libsdl2-dev
 | 
			
		||||
 | 
			
		||||
      - name: Check out code from GitHub
 | 
			
		||||
        uses: actions/checkout@v4.1.7
 | 
			
		||||
        uses: actions/checkout@v4.1.6
 | 
			
		||||
      - name: Restore Python
 | 
			
		||||
        uses: ./.github/actions/restore-python
 | 
			
		||||
        with:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								.github/workflows/release.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								.github/workflows/release.yml
									
									
									
									
										vendored
									
									
								
							@@ -19,7 +19,7 @@ jobs:
 | 
			
		||||
      tag: ${{ steps.tag.outputs.tag }}
 | 
			
		||||
      branch_build: ${{ steps.tag.outputs.branch_build }}
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v4.1.7
 | 
			
		||||
      - uses: actions/checkout@v4.1.6
 | 
			
		||||
      - name: Get tag
 | 
			
		||||
        id: tag
 | 
			
		||||
        # yamllint disable rule:line-length
 | 
			
		||||
@@ -51,7 +51,7 @@ jobs:
 | 
			
		||||
      contents: read
 | 
			
		||||
      id-token: write
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v4.1.7
 | 
			
		||||
      - uses: actions/checkout@v4.1.6
 | 
			
		||||
      - name: Set up Python
 | 
			
		||||
        uses: actions/setup-python@v5.1.0
 | 
			
		||||
        with:
 | 
			
		||||
@@ -83,7 +83,7 @@ jobs:
 | 
			
		||||
          - linux/arm/v7
 | 
			
		||||
          - linux/arm64
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v4.1.7
 | 
			
		||||
      - uses: actions/checkout@v4.1.6
 | 
			
		||||
      - name: Set up Python
 | 
			
		||||
        uses: actions/setup-python@v5.1.0
 | 
			
		||||
        with:
 | 
			
		||||
@@ -174,7 +174,7 @@ jobs:
 | 
			
		||||
          - ghcr
 | 
			
		||||
          - dockerhub
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v4.1.7
 | 
			
		||||
      - uses: actions/checkout@v4.1.6
 | 
			
		||||
 | 
			
		||||
      - name: Download digests
 | 
			
		||||
        uses: actions/download-artifact@v4.1.7
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										6
									
								
								.github/workflows/sync-device-classes.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.github/workflows/sync-device-classes.yml
									
									
									
									
										vendored
									
									
								
							@@ -13,10 +13,10 @@ jobs:
 | 
			
		||||
    if: github.repository == 'esphome/esphome'
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v4.1.7
 | 
			
		||||
        uses: actions/checkout@v4.1.6
 | 
			
		||||
 | 
			
		||||
      - name: Checkout Home Assistant
 | 
			
		||||
        uses: actions/checkout@v4.1.7
 | 
			
		||||
        uses: actions/checkout@v4.1.6
 | 
			
		||||
        with:
 | 
			
		||||
          repository: home-assistant/core
 | 
			
		||||
          path: lib/home-assistant
 | 
			
		||||
@@ -36,7 +36,7 @@ jobs:
 | 
			
		||||
          python ./script/sync-device_class.py
 | 
			
		||||
 | 
			
		||||
      - name: Commit changes
 | 
			
		||||
        uses: peter-evans/create-pull-request@v6.1.0
 | 
			
		||||
        uses: peter-evans/create-pull-request@v6.0.5
 | 
			
		||||
        with:
 | 
			
		||||
          commit-message: "Synchronise Device Classes from Home Assistant"
 | 
			
		||||
          committer: esphomebot <esphome@nabucasa.com>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								.github/workflows/yaml-lint.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/yaml-lint.yml
									
									
									
									
										vendored
									
									
								
							@@ -18,7 +18,7 @@ jobs:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Check out code from GitHub
 | 
			
		||||
        uses: actions/checkout@v4.1.7
 | 
			
		||||
        uses: actions/checkout@v4.1.6
 | 
			
		||||
      - name: Run yamllint
 | 
			
		||||
        uses: frenck/action-yamllint@v1.5.0
 | 
			
		||||
        with:
 | 
			
		||||
 
 | 
			
		||||
@@ -34,28 +34,32 @@ RUN \
 | 
			
		||||
        python3-wheel=0.38.4-2 \
 | 
			
		||||
        iputils-ping=3:20221126-1 \
 | 
			
		||||
        git=1:2.39.2-1.1 \
 | 
			
		||||
        curl=7.88.1-10+deb12u5 \
 | 
			
		||||
        curl=7.88.1-10+deb12u6 \
 | 
			
		||||
        openssh-client=1:9.2p1-2+deb12u2 \
 | 
			
		||||
        python3-cffi=1.15.1-5 \
 | 
			
		||||
        libcairo2=1.16.0-7 \
 | 
			
		||||
        libmagic1=1:5.44-3 \
 | 
			
		||||
        patch=2.7.6-7; \
 | 
			
		||||
    if [ "$TARGETARCH$TARGETVARIANT" = "armv7" ]; then \
 | 
			
		||||
        apt-get install -y --no-install-recommends \
 | 
			
		||||
          build-essential=12.9 \
 | 
			
		||||
          python3-dev=3.11.2-1+b1 \
 | 
			
		||||
          zlib1g-dev=1:1.2.13.dfsg-1 \
 | 
			
		||||
          libjpeg-dev=1:2.1.5-2 \
 | 
			
		||||
          libfreetype-dev=2.12.1+dfsg-5 \
 | 
			
		||||
          libssl-dev=3.0.11-1~deb12u2 \
 | 
			
		||||
          libffi-dev=3.4.4-1 \
 | 
			
		||||
          libopenjp2-7=2.5.0-2 \
 | 
			
		||||
          libtiff6=4.5.0-6+deb12u1 \
 | 
			
		||||
          cargo=0.66.0+ds1-1 \
 | 
			
		||||
          pkg-config=1.8.1-1 \
 | 
			
		||||
          gcc-arm-linux-gnueabihf=4:12.2.0-3; \
 | 
			
		||||
    fi; \
 | 
			
		||||
    rm -rf \
 | 
			
		||||
        patch=2.7.6-7 \
 | 
			
		||||
    && ( \
 | 
			
		||||
        ( \
 | 
			
		||||
            [ "$TARGETARCH$TARGETVARIANT" = "armv7" ] && \
 | 
			
		||||
                apt-get install -y --no-install-recommends \
 | 
			
		||||
                build-essential=12.9 \
 | 
			
		||||
                python3-dev=3.11.2-1+b1 \
 | 
			
		||||
                zlib1g-dev=1:1.2.13.dfsg-1 \
 | 
			
		||||
                libjpeg-dev=1:2.1.5-2 \
 | 
			
		||||
                libfreetype-dev=2.12.1+dfsg-5+deb12u3 \
 | 
			
		||||
                libssl-dev=3.0.13-1~deb12u1 \
 | 
			
		||||
                libffi-dev=3.4.4-1 \
 | 
			
		||||
                libopenjp2-7=2.5.0-2 \
 | 
			
		||||
                libtiff6=4.5.0-6+deb12u1 \
 | 
			
		||||
                cargo=0.66.0+ds1-1 \
 | 
			
		||||
                pkg-config=1.8.1-1 \
 | 
			
		||||
                gcc-arm-linux-gnueabihf=4:12.2.0-3 \
 | 
			
		||||
        ) \
 | 
			
		||||
        || [ "$TARGETARCH$TARGETVARIANT" != "armv7" ] \
 | 
			
		||||
    ) \
 | 
			
		||||
    && rm -rf \
 | 
			
		||||
        /tmp/* \
 | 
			
		||||
        /var/{cache,log}/* \
 | 
			
		||||
        /var/lib/apt/lists/*
 | 
			
		||||
@@ -190,8 +194,8 @@ RUN \
 | 
			
		||||
        clang-format-13=1:13.0.1-11+b2 \
 | 
			
		||||
        clang-tidy-14=1:14.0.6-12 \
 | 
			
		||||
        patch=2.7.6-7 \
 | 
			
		||||
        software-properties-common=0.99.30-4 \
 | 
			
		||||
        nano=7.2-1 \
 | 
			
		||||
        software-properties-common=0.99.30-4.1~deb12u1 \
 | 
			
		||||
        nano=7.2-1+deb12u1 \
 | 
			
		||||
        build-essential=12.9 \
 | 
			
		||||
        python3-dev=3.11.2-1+b1 \
 | 
			
		||||
    && rm -rf \
 | 
			
		||||
 
 | 
			
		||||
@@ -60,6 +60,7 @@ from esphome.cpp_types import (  # noqa
 | 
			
		||||
    std_ns,
 | 
			
		||||
    std_shared_ptr,
 | 
			
		||||
    std_string,
 | 
			
		||||
    std_string_ref,
 | 
			
		||||
    std_vector,
 | 
			
		||||
    uint8,
 | 
			
		||||
    uint16,
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
import esphome.codegen as cg
 | 
			
		||||
import esphome.config_validation as cv
 | 
			
		||||
from esphome.components import i2c, esp32
 | 
			
		||||
from esphome.const import CONF_ID, CONF_TEMPERATURE_OFFSET
 | 
			
		||||
from esphome.const import CONF_ID, CONF_SAMPLE_RATE, CONF_TEMPERATURE_OFFSET
 | 
			
		||||
 | 
			
		||||
CODEOWNERS = ["@trvrnrth"]
 | 
			
		||||
DEPENDENCIES = ["i2c"]
 | 
			
		||||
@@ -11,7 +11,6 @@ MULTI_CONF = True
 | 
			
		||||
CONF_BME680_BSEC_ID = "bme680_bsec_id"
 | 
			
		||||
CONF_IAQ_MODE = "iaq_mode"
 | 
			
		||||
CONF_SUPPLY_VOLTAGE = "supply_voltage"
 | 
			
		||||
CONF_SAMPLE_RATE = "sample_rate"
 | 
			
		||||
CONF_STATE_SAVE_INTERVAL = "state_save_interval"
 | 
			
		||||
 | 
			
		||||
bme680_bsec_ns = cg.esphome_ns.namespace("bme680_bsec")
 | 
			
		||||
 
 | 
			
		||||
@@ -4,33 +4,33 @@ from esphome.components import sensor
 | 
			
		||||
from esphome.const import (
 | 
			
		||||
    CONF_GAS_RESISTANCE,
 | 
			
		||||
    CONF_HUMIDITY,
 | 
			
		||||
    CONF_IAQ_ACCURACY,
 | 
			
		||||
    CONF_PRESSURE,
 | 
			
		||||
    CONF_SAMPLE_RATE,
 | 
			
		||||
    CONF_TEMPERATURE,
 | 
			
		||||
    DEVICE_CLASS_ATMOSPHERIC_PRESSURE,
 | 
			
		||||
    DEVICE_CLASS_CARBON_DIOXIDE,
 | 
			
		||||
    DEVICE_CLASS_HUMIDITY,
 | 
			
		||||
    DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS_PARTS,
 | 
			
		||||
    DEVICE_CLASS_ATMOSPHERIC_PRESSURE,
 | 
			
		||||
    DEVICE_CLASS_TEMPERATURE,
 | 
			
		||||
    DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS_PARTS,
 | 
			
		||||
    ICON_GAS_CYLINDER,
 | 
			
		||||
    ICON_GAUGE,
 | 
			
		||||
    STATE_CLASS_MEASUREMENT,
 | 
			
		||||
    UNIT_CELSIUS,
 | 
			
		||||
    UNIT_HECTOPASCAL,
 | 
			
		||||
    UNIT_OHM,
 | 
			
		||||
    UNIT_PARTS_PER_MILLION,
 | 
			
		||||
    UNIT_PERCENT,
 | 
			
		||||
    ICON_GAS_CYLINDER,
 | 
			
		||||
    ICON_GAUGE,
 | 
			
		||||
)
 | 
			
		||||
from . import (
 | 
			
		||||
    BME680BSECComponent,
 | 
			
		||||
    CONF_BME680_BSEC_ID,
 | 
			
		||||
    CONF_SAMPLE_RATE,
 | 
			
		||||
    SAMPLE_RATE_OPTIONS,
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
DEPENDENCIES = ["bme680_bsec"]
 | 
			
		||||
 | 
			
		||||
CONF_IAQ = "iaq"
 | 
			
		||||
CONF_IAQ_ACCURACY = "iaq_accuracy"
 | 
			
		||||
CONF_CO2_EQUIVALENT = "co2_equivalent"
 | 
			
		||||
CONF_BREATH_VOC_EQUIVALENT = "breath_voc_equivalent"
 | 
			
		||||
UNIT_IAQ = "IAQ"
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,11 @@
 | 
			
		||||
import esphome.codegen as cg
 | 
			
		||||
import esphome.config_validation as cv
 | 
			
		||||
from esphome.components import text_sensor
 | 
			
		||||
from esphome.const import CONF_IAQ_ACCURACY
 | 
			
		||||
from . import BME680BSECComponent, CONF_BME680_BSEC_ID
 | 
			
		||||
 | 
			
		||||
DEPENDENCIES = ["bme680_bsec"]
 | 
			
		||||
 | 
			
		||||
CONF_IAQ_ACCURACY = "iaq_accuracy"
 | 
			
		||||
ICON_ACCURACY = "mdi:checkbox-marked-circle-outline"
 | 
			
		||||
 | 
			
		||||
TYPES = [CONF_IAQ_ACCURACY]
 | 
			
		||||
 
 | 
			
		||||
@@ -129,13 +129,13 @@ class Cover : public EntityBase, public EntityBase_DeviceClass {
 | 
			
		||||
   *
 | 
			
		||||
   * This is a legacy method and may be removed later, please use `.make_call()` instead.
 | 
			
		||||
   */
 | 
			
		||||
  ESPDEPRECATED("open() is deprecated, use make_call().set_command_open().perform() instead.", "2021.9")
 | 
			
		||||
  ESPDEPRECATED("open() is deprecated, use make_call().set_command_open() instead.", "2021.9")
 | 
			
		||||
  void open();
 | 
			
		||||
  /** Close the cover.
 | 
			
		||||
   *
 | 
			
		||||
   * This is a legacy method and may be removed later, please use `.make_call()` instead.
 | 
			
		||||
   */
 | 
			
		||||
  ESPDEPRECATED("close() is deprecated, use make_call().set_command_close().perform() instead.", "2021.9")
 | 
			
		||||
  ESPDEPRECATED("close() is deprecated, use make_call().set_command_close() instead.", "2021.9")
 | 
			
		||||
  void close();
 | 
			
		||||
  /** Stop the cover.
 | 
			
		||||
   *
 | 
			
		||||
 
 | 
			
		||||
@@ -145,24 +145,21 @@ bool DallasTemperatureSensor::check_scratch_pad_() {
 | 
			
		||||
float DallasTemperatureSensor::get_temp_c_() {
 | 
			
		||||
  int16_t temp = (this->scratch_pad_[1] << 8) | this->scratch_pad_[0];
 | 
			
		||||
  if ((this->address_ & 0xff) == DALLAS_MODEL_DS18S20) {
 | 
			
		||||
    if (this->scratch_pad_[7] != 0x10)
 | 
			
		||||
      ESP_LOGE(TAG, "unexpected COUNT_PER_C value: %u", this->scratch_pad_[7]);
 | 
			
		||||
    temp = ((temp & 0xfff7) << 3) + (0x10 - this->scratch_pad_[6]) - 4;
 | 
			
		||||
  } else {
 | 
			
		||||
    switch (this->resolution_) {
 | 
			
		||||
      case 9:
 | 
			
		||||
        temp &= 0xfff8;
 | 
			
		||||
        break;
 | 
			
		||||
      case 10:
 | 
			
		||||
        temp &= 0xfffc;
 | 
			
		||||
        break;
 | 
			
		||||
      case 11:
 | 
			
		||||
        temp &= 0xfffe;
 | 
			
		||||
        break;
 | 
			
		||||
      case 12:
 | 
			
		||||
      default:
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
    return (temp >> 1) + (this->scratch_pad_[7] - this->scratch_pad_[6]) / float(this->scratch_pad_[7]) - 0.25;
 | 
			
		||||
  }
 | 
			
		||||
  switch (this->resolution_) {
 | 
			
		||||
    case 9:
 | 
			
		||||
      temp &= 0xfff8;
 | 
			
		||||
      break;
 | 
			
		||||
    case 10:
 | 
			
		||||
      temp &= 0xfffc;
 | 
			
		||||
      break;
 | 
			
		||||
    case 11:
 | 
			
		||||
      temp &= 0xfffe;
 | 
			
		||||
      break;
 | 
			
		||||
    case 12:
 | 
			
		||||
    default:
 | 
			
		||||
      break;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return temp / 16.0f;
 | 
			
		||||
 
 | 
			
		||||
@@ -37,14 +37,18 @@ void DS1307Component::read_time() {
 | 
			
		||||
    ESP_LOGW(TAG, "RTC halted, not syncing to system clock.");
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  ESPTime rtc_time{.second = uint8_t(ds1307_.reg.second + 10 * ds1307_.reg.second_10),
 | 
			
		||||
                   .minute = uint8_t(ds1307_.reg.minute + 10u * ds1307_.reg.minute_10),
 | 
			
		||||
                   .hour = uint8_t(ds1307_.reg.hour + 10u * ds1307_.reg.hour_10),
 | 
			
		||||
                   .day_of_week = uint8_t(ds1307_.reg.weekday),
 | 
			
		||||
                   .day_of_month = uint8_t(ds1307_.reg.day + 10u * ds1307_.reg.day_10),
 | 
			
		||||
                   .day_of_year = 1,  // ignored by recalc_timestamp_utc(false)
 | 
			
		||||
                   .month = uint8_t(ds1307_.reg.month + 10u * ds1307_.reg.month_10),
 | 
			
		||||
                   .year = uint16_t(ds1307_.reg.year + 10u * ds1307_.reg.year_10 + 2000)};
 | 
			
		||||
  ESPTime rtc_time{
 | 
			
		||||
      .second = uint8_t(ds1307_.reg.second + 10 * ds1307_.reg.second_10),
 | 
			
		||||
      .minute = uint8_t(ds1307_.reg.minute + 10u * ds1307_.reg.minute_10),
 | 
			
		||||
      .hour = uint8_t(ds1307_.reg.hour + 10u * ds1307_.reg.hour_10),
 | 
			
		||||
      .day_of_week = uint8_t(ds1307_.reg.weekday),
 | 
			
		||||
      .day_of_month = uint8_t(ds1307_.reg.day + 10u * ds1307_.reg.day_10),
 | 
			
		||||
      .day_of_year = 1,  // ignored by recalc_timestamp_utc(false)
 | 
			
		||||
      .month = uint8_t(ds1307_.reg.month + 10u * ds1307_.reg.month_10),
 | 
			
		||||
      .year = uint16_t(ds1307_.reg.year + 10u * ds1307_.reg.year_10 + 2000),
 | 
			
		||||
      .is_dst = false,  // not used
 | 
			
		||||
      .timestamp = 0    // overwritten by recalc_timestamp_utc(false)
 | 
			
		||||
  };
 | 
			
		||||
  rtc_time.recalc_timestamp_utc(false);
 | 
			
		||||
  if (!rtc_time.is_valid()) {
 | 
			
		||||
    ESP_LOGE(TAG, "Invalid RTC time, not syncing to system clock.");
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,7 @@ from esphome.const import (
 | 
			
		||||
    CONF_VSYNC_PIN,
 | 
			
		||||
)
 | 
			
		||||
from esphome.core import CORE
 | 
			
		||||
from esphome.components.esp32 import add_idf_component
 | 
			
		||||
from esphome.components.esp32 import add_idf_sdkconfig_option
 | 
			
		||||
from esphome.cpp_helpers import setup_entity
 | 
			
		||||
 | 
			
		||||
DEPENDENCIES = ["esp32"]
 | 
			
		||||
@@ -290,11 +290,8 @@ async def to_code(config):
 | 
			
		||||
    cg.add_define("USE_ESP32_CAMERA")
 | 
			
		||||
 | 
			
		||||
    if CORE.using_esp_idf:
 | 
			
		||||
        add_idf_component(
 | 
			
		||||
            name="esp32-camera",
 | 
			
		||||
            repo="https://github.com/espressif/esp32-camera.git",
 | 
			
		||||
            ref="v2.0.9",
 | 
			
		||||
        )
 | 
			
		||||
        cg.add_library("espressif/esp32-camera", "1.0.0")
 | 
			
		||||
        add_idf_sdkconfig_option("CONFIG_RTCIO_SUPPORT_RTC_GPIO_DESC", True)
 | 
			
		||||
 | 
			
		||||
    for conf in config.get(CONF_ON_STREAM_START, []):
 | 
			
		||||
        trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,17 @@
 | 
			
		||||
import logging
 | 
			
		||||
 | 
			
		||||
import esphome.codegen as cg
 | 
			
		||||
import esphome.config_validation as cv
 | 
			
		||||
import esphome.final_validate as fv
 | 
			
		||||
from esphome.components.ota import BASE_OTA_SCHEMA, ota_to_code, OTAComponent
 | 
			
		||||
from esphome.config_helpers import merge_config
 | 
			
		||||
from esphome.const import (
 | 
			
		||||
    CONF_ESPHOME,
 | 
			
		||||
    CONF_ID,
 | 
			
		||||
    CONF_NUM_ATTEMPTS,
 | 
			
		||||
    CONF_OTA,
 | 
			
		||||
    CONF_PASSWORD,
 | 
			
		||||
    CONF_PLATFORM,
 | 
			
		||||
    CONF_PORT,
 | 
			
		||||
    CONF_REBOOT_TIMEOUT,
 | 
			
		||||
    CONF_SAFE_MODE,
 | 
			
		||||
@@ -12,6 +19,8 @@ from esphome.const import (
 | 
			
		||||
)
 | 
			
		||||
from esphome.core import coroutine_with_priority
 | 
			
		||||
 | 
			
		||||
_LOGGER = logging.getLogger(__name__)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
CODEOWNERS = ["@esphome/core"]
 | 
			
		||||
AUTO_LOAD = ["md5", "socket"]
 | 
			
		||||
@@ -21,6 +30,65 @@ esphome = cg.esphome_ns.namespace("esphome")
 | 
			
		||||
ESPHomeOTAComponent = esphome.class_("ESPHomeOTAComponent", OTAComponent)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def ota_esphome_final_validate(config):
 | 
			
		||||
    full_conf = fv.full_config.get()
 | 
			
		||||
    full_ota_conf = full_conf[CONF_OTA]
 | 
			
		||||
    new_ota_conf = []
 | 
			
		||||
    merged_ota_esphome_configs_by_port = {}
 | 
			
		||||
    ports_with_merged_configs = []
 | 
			
		||||
    for ota_conf in full_ota_conf:
 | 
			
		||||
        if ota_conf.get(CONF_PLATFORM) == CONF_ESPHOME:
 | 
			
		||||
            if (
 | 
			
		||||
                conf_port := ota_conf.get(CONF_PORT)
 | 
			
		||||
            ) not in merged_ota_esphome_configs_by_port:
 | 
			
		||||
                merged_ota_esphome_configs_by_port[conf_port] = ota_conf
 | 
			
		||||
            else:
 | 
			
		||||
                if merged_ota_esphome_configs_by_port[conf_port][
 | 
			
		||||
                    CONF_VERSION
 | 
			
		||||
                ] != ota_conf.get(CONF_VERSION):
 | 
			
		||||
                    raise cv.Invalid(
 | 
			
		||||
                        f"Found multiple configurations but {CONF_VERSION} is inconsistent"
 | 
			
		||||
                    )
 | 
			
		||||
                if (
 | 
			
		||||
                    merged_ota_esphome_configs_by_port[conf_port][CONF_ID].is_manual
 | 
			
		||||
                    and ota_conf.get(CONF_ID).is_manual
 | 
			
		||||
                ):
 | 
			
		||||
                    raise cv.Invalid(
 | 
			
		||||
                        f"Found multiple configurations but {CONF_ID} is inconsistent"
 | 
			
		||||
                    )
 | 
			
		||||
                if (
 | 
			
		||||
                    CONF_PASSWORD in merged_ota_esphome_configs_by_port[conf_port]
 | 
			
		||||
                    and CONF_PASSWORD in ota_conf
 | 
			
		||||
                    and merged_ota_esphome_configs_by_port[conf_port][CONF_PASSWORD]
 | 
			
		||||
                    != ota_conf.get(CONF_PASSWORD)
 | 
			
		||||
                ):
 | 
			
		||||
                    raise cv.Invalid(
 | 
			
		||||
                        f"Found multiple configurations but {CONF_PASSWORD} is inconsistent"
 | 
			
		||||
                    )
 | 
			
		||||
 | 
			
		||||
                ports_with_merged_configs.append(conf_port)
 | 
			
		||||
                merged_ota_esphome_configs_by_port[conf_port] = merge_config(
 | 
			
		||||
                    merged_ota_esphome_configs_by_port[conf_port], ota_conf
 | 
			
		||||
                )
 | 
			
		||||
        else:
 | 
			
		||||
            new_ota_conf.append(ota_conf)
 | 
			
		||||
 | 
			
		||||
    for port_conf in merged_ota_esphome_configs_by_port.values():
 | 
			
		||||
        new_ota_conf.append(port_conf)
 | 
			
		||||
 | 
			
		||||
    full_conf[CONF_OTA] = new_ota_conf
 | 
			
		||||
    fv.full_config.set(full_conf)
 | 
			
		||||
 | 
			
		||||
    if len(ports_with_merged_configs) > 0:
 | 
			
		||||
        _LOGGER.warning(
 | 
			
		||||
            "Found and merged multiple configurations for %s %s %s port(s) %s",
 | 
			
		||||
            CONF_OTA,
 | 
			
		||||
            CONF_PLATFORM,
 | 
			
		||||
            CONF_ESPHOME,
 | 
			
		||||
            ports_with_merged_configs,
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
CONFIG_SCHEMA = (
 | 
			
		||||
    cv.Schema(
 | 
			
		||||
        {
 | 
			
		||||
@@ -50,6 +118,8 @@ CONFIG_SCHEMA = (
 | 
			
		||||
    .extend(cv.COMPONENT_SCHEMA)
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
FINAL_VALIDATE_SCHEMA = ota_esphome_final_validate
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@coroutine_with_priority(52.0)
 | 
			
		||||
async def to_code(config):
 | 
			
		||||
 
 | 
			
		||||
@@ -631,7 +631,7 @@ void EthernetComponent::write_phy_register_(esp_eth_mac_t *mac, PHYRegister regi
 | 
			
		||||
  ESPHL_ERROR_CHECK(err, "Writing PHY Register failed");
 | 
			
		||||
 | 
			
		||||
  if (this->type_ == ETHERNET_TYPE_RTL8201 && register_data.page) {
 | 
			
		||||
    ESP_LOGD(TAG, "Select PHY Register Page 0x00");
 | 
			
		||||
    ESP_LOGD(TAG, "Select PHY Register Page 0x%02" PRIX32, 0x0);
 | 
			
		||||
    err = mac->write_phy_reg(mac, this->phy_addr_, eth_phy_psr_reg_addr, 0x0);
 | 
			
		||||
    ESPHL_ERROR_CHECK(err, "Select PHY Register Page 0 failed");
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -94,13 +94,15 @@ bool HOT IRAM_ATTR GPIOOneWireBus::read_bit_() {
 | 
			
		||||
 | 
			
		||||
  // measure from start value directly, to get best accurate timing no matter
 | 
			
		||||
  // how long pin_mode/delayMicroseconds took
 | 
			
		||||
  delayMicroseconds(12 - (micros() - start));
 | 
			
		||||
  uint32_t now = micros();
 | 
			
		||||
  if (now - start < 12)
 | 
			
		||||
    delayMicroseconds(12 - (now - start));
 | 
			
		||||
 | 
			
		||||
  // sample bus to read bit from peer
 | 
			
		||||
  bool r = pin_.digital_read();
 | 
			
		||||
 | 
			
		||||
  // read slot is at least 60µs; get as close to 60µs to spend less time with interrupts locked
 | 
			
		||||
  uint32_t now = micros();
 | 
			
		||||
  now = micros();
 | 
			
		||||
  if (now - start < 60)
 | 
			
		||||
    delayMicroseconds(60 - (now - start));
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -257,7 +257,7 @@ async def http_request_action_to_code(config, action_id, template_arg, args):
 | 
			
		||||
            trigger,
 | 
			
		||||
            [
 | 
			
		||||
                (cg.std_shared_ptr.template(HttpContainer), "response"),
 | 
			
		||||
                (cg.std_string, "body"),
 | 
			
		||||
                (cg.std_string_ref, "body"),
 | 
			
		||||
            ],
 | 
			
		||||
            conf,
 | 
			
		||||
        )
 | 
			
		||||
 
 | 
			
		||||
@@ -43,10 +43,10 @@ class HttpContainer : public Parented<HttpRequestComponent> {
 | 
			
		||||
  bool secure_{false};
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class HttpRequestResponseTrigger : public Trigger<std::shared_ptr<HttpContainer>, std::string> {
 | 
			
		||||
class HttpRequestResponseTrigger : public Trigger<std::shared_ptr<HttpContainer>, std::string &> {
 | 
			
		||||
 public:
 | 
			
		||||
  void process(std::shared_ptr<HttpContainer> container, std::string response_body) {
 | 
			
		||||
    this->trigger(std::move(container), std::move(response_body));
 | 
			
		||||
  void process(std::shared_ptr<HttpContainer> container, std::string &response_body) {
 | 
			
		||||
    this->trigger(std::move(container), response_body);
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -149,11 +149,21 @@ template<typename... Ts> class HttpRequestSendAction : public Action<Ts...> {
 | 
			
		||||
        }
 | 
			
		||||
        response_body.reserve(read_index);
 | 
			
		||||
        response_body.assign((char *) buf, read_index);
 | 
			
		||||
        allocator.deallocate(buf, max_length);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    for (auto *trigger : this->response_triggers_) {
 | 
			
		||||
      trigger->process(container, response_body);
 | 
			
		||||
    if (this->response_triggers_.size() == 1) {
 | 
			
		||||
      // if there is only one trigger, no need to copy the response body
 | 
			
		||||
      this->response_triggers_[0]->process(container, response_body);
 | 
			
		||||
    } else {
 | 
			
		||||
      for (auto *trigger : this->response_triggers_) {
 | 
			
		||||
        // with multiple triggers, pass a copy of the response body to each
 | 
			
		||||
        // one so that modifications made in one trigger are not visible to
 | 
			
		||||
        // the others
 | 
			
		||||
        auto response_body_copy = std::string(response_body);
 | 
			
		||||
        trigger->process(container, response_body_copy);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    container->end();
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@ import esphome.config_validation as cv
 | 
			
		||||
import esphome.codegen as cg
 | 
			
		||||
 | 
			
		||||
from esphome import pins
 | 
			
		||||
from esphome.const import CONF_CHANNEL, CONF_ID, CONF_NUMBER
 | 
			
		||||
from esphome.const import CONF_CHANNEL, CONF_ID, CONF_NUMBER, CONF_SAMPLE_RATE
 | 
			
		||||
from esphome.components import microphone, esp32
 | 
			
		||||
from esphome.components.adc import ESP32_VARIANT_ADC1_PIN_TO_CHANNEL, validate_adc_pin
 | 
			
		||||
 | 
			
		||||
@@ -20,7 +20,6 @@ DEPENDENCIES = ["i2s_audio"]
 | 
			
		||||
CONF_ADC_PIN = "adc_pin"
 | 
			
		||||
CONF_ADC_TYPE = "adc_type"
 | 
			
		||||
CONF_PDM = "pdm"
 | 
			
		||||
CONF_SAMPLE_RATE = "sample_rate"
 | 
			
		||||
CONF_BITS_PER_SAMPLE = "bits_per_sample"
 | 
			
		||||
CONF_USE_APLL = "use_apll"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -115,12 +115,15 @@ void LEDCOutput::write_state(float state) {
 | 
			
		||||
  const uint32_t max_duty = (uint32_t(1) << this->bit_depth_) - 1;
 | 
			
		||||
  const float duty_rounded = roundf(state * max_duty);
 | 
			
		||||
  auto duty = static_cast<uint32_t>(duty_rounded);
 | 
			
		||||
 | 
			
		||||
#ifdef USE_ARDUINO
 | 
			
		||||
  ESP_LOGV(TAG, "Setting duty: %u on channel %u", duty, this->channel_);
 | 
			
		||||
  ledcWrite(this->channel_, duty);
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef USE_ESP_IDF
 | 
			
		||||
  // ensure that 100% on is not 99.975% on
 | 
			
		||||
  if ((duty == max_duty) && (max_duty != 1)) {
 | 
			
		||||
    duty = max_duty + 1;
 | 
			
		||||
  }
 | 
			
		||||
  auto speed_mode = get_speed_mode(channel_);
 | 
			
		||||
  auto chan_num = static_cast<ledc_channel_t>(channel_ % 8);
 | 
			
		||||
  int hpoint = ledc_angle_to_htop(this->phase_angle_, this->bit_depth_);
 | 
			
		||||
 
 | 
			
		||||
@@ -312,7 +312,6 @@ async def to_code(config):
 | 
			
		||||
    esp32.add_idf_component(
 | 
			
		||||
        name="esp-tflite-micro",
 | 
			
		||||
        repo="https://github.com/espressif/esp-tflite-micro",
 | 
			
		||||
        ref="v1.3.1",
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    cg.add_build_flag("-DTF_LITE_STATIC_MEMORY")
 | 
			
		||||
 
 | 
			
		||||
@@ -293,4 +293,4 @@ async def to_code(config):
 | 
			
		||||
    if CONF_HUMIDITY_SETPOINT in config:
 | 
			
		||||
        sens = await sensor.new_sensor(config[CONF_HUMIDITY_SETPOINT])
 | 
			
		||||
        cg.add(var.set_humidity_setpoint_sensor(sens))
 | 
			
		||||
    cg.add_library("dudanov/MideaUART", "1.1.8")
 | 
			
		||||
    cg.add_library("dudanov/MideaUART", "1.1.9")
 | 
			
		||||
 
 | 
			
		||||
@@ -116,7 +116,8 @@ void ModbusController::on_modbus_read_registers(uint8_t function_code, uint16_t
 | 
			
		||||
        ESP_LOGD(TAG, "Matched register. Address: 0x%02X. Value type: %zu. Register count: %u. Value: %0.1f.",
 | 
			
		||||
                 server_register->address, static_cast<uint8_t>(server_register->value_type),
 | 
			
		||||
                 server_register->register_count, value);
 | 
			
		||||
        number_to_payload(sixteen_bit_response, value, server_register->value_type);
 | 
			
		||||
        std::vector<uint16_t> payload = float_to_payload(value, server_register->value_type);
 | 
			
		||||
        sixteen_bit_response.insert(sixteen_bit_response.end(), payload.cbegin(), payload.cend());
 | 
			
		||||
        current_address += server_register->register_count;
 | 
			
		||||
        found = true;
 | 
			
		||||
        break;
 | 
			
		||||
 
 | 
			
		||||
@@ -15,7 +15,7 @@ void ModbusTextSensor::parse_and_publish(const std::vector<uint8_t> &data) {
 | 
			
		||||
  std::ostringstream output;
 | 
			
		||||
  uint8_t items_left = this->response_bytes;
 | 
			
		||||
  uint8_t index = this->offset;
 | 
			
		||||
  char buffer[4];
 | 
			
		||||
  char buffer[5];
 | 
			
		||||
  while ((items_left > 0) && index < data.size()) {
 | 
			
		||||
    uint8_t b = data[index];
 | 
			
		||||
    switch (this->encode_) {
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,7 @@ async def to_code(config):
 | 
			
		||||
    var = await binary_sensor.new_binary_sensor(config)
 | 
			
		||||
    hub = await cg.get_variable(config[CONF_MPR121_ID])
 | 
			
		||||
    cg.add(var.set_channel(config[CONF_CHANNEL]))
 | 
			
		||||
    cg.register_parented(var, hub)
 | 
			
		||||
    await cg.register_parented(var, hub)
 | 
			
		||||
 | 
			
		||||
    if CONF_TOUCH_THRESHOLD in config:
 | 
			
		||||
        cg.add(var.set_touch_threshold(config[CONF_TOUCH_THRESHOLD]))
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,6 @@ from esphome.const import (
 | 
			
		||||
    DEVICE_CLASS_BATTERY,
 | 
			
		||||
    DEVICE_CLASS_CARBON_DIOXIDE,
 | 
			
		||||
    DEVICE_CLASS_CARBON_MONOXIDE,
 | 
			
		||||
    DEVICE_CLASS_CONDUCTIVITY,
 | 
			
		||||
    DEVICE_CLASS_CURRENT,
 | 
			
		||||
    DEVICE_CLASS_DATA_RATE,
 | 
			
		||||
    DEVICE_CLASS_DATA_SIZE,
 | 
			
		||||
@@ -83,7 +82,6 @@ DEVICE_CLASSES = [
 | 
			
		||||
    DEVICE_CLASS_BATTERY,
 | 
			
		||||
    DEVICE_CLASS_CARBON_DIOXIDE,
 | 
			
		||||
    DEVICE_CLASS_CARBON_MONOXIDE,
 | 
			
		||||
    DEVICE_CLASS_CONDUCTIVITY,
 | 
			
		||||
    DEVICE_CLASS_CURRENT,
 | 
			
		||||
    DEVICE_CLASS_DATA_RATE,
 | 
			
		||||
    DEVICE_CLASS_DATA_SIZE,
 | 
			
		||||
 
 | 
			
		||||
@@ -42,14 +42,6 @@ COLOR_ORDERS = {
 | 
			
		||||
}
 | 
			
		||||
DATA_PIN_SCHEMA = pins.internal_gpio_output_pin_schema
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def validate_dimension(value):
 | 
			
		||||
    value = cv.positive_int(value)
 | 
			
		||||
    if value % 2 != 0:
 | 
			
		||||
        raise cv.Invalid("Width/height/offset must be divisible by 2")
 | 
			
		||||
    return value
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
CONFIG_SCHEMA = cv.All(
 | 
			
		||||
    display.FULL_DISPLAY_SCHEMA.extend(
 | 
			
		||||
        cv.Schema(
 | 
			
		||||
@@ -60,14 +52,10 @@ CONFIG_SCHEMA = cv.All(
 | 
			
		||||
                    cv.dimensions,
 | 
			
		||||
                    cv.Schema(
 | 
			
		||||
                        {
 | 
			
		||||
                            cv.Required(CONF_WIDTH): validate_dimension,
 | 
			
		||||
                            cv.Required(CONF_HEIGHT): validate_dimension,
 | 
			
		||||
                            cv.Optional(
 | 
			
		||||
                                CONF_OFFSET_HEIGHT, default=0
 | 
			
		||||
                            ): validate_dimension,
 | 
			
		||||
                            cv.Optional(
 | 
			
		||||
                                CONF_OFFSET_WIDTH, default=0
 | 
			
		||||
                            ): validate_dimension,
 | 
			
		||||
                            cv.Required(CONF_WIDTH): cv.int_,
 | 
			
		||||
                            cv.Required(CONF_HEIGHT): cv.int_,
 | 
			
		||||
                            cv.Optional(CONF_OFFSET_HEIGHT, default=0): cv.int_,
 | 
			
		||||
                            cv.Optional(CONF_OFFSET_WIDTH, default=0): cv.int_,
 | 
			
		||||
                        }
 | 
			
		||||
                    ),
 | 
			
		||||
                ),
 | 
			
		||||
 
 | 
			
		||||
@@ -25,23 +25,7 @@ void QspiAmoLed::setup() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void QspiAmoLed::update() {
 | 
			
		||||
  if (!this->setup_complete_) {
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  this->do_update_();
 | 
			
		||||
  // Start addresses and widths/heights must be divisible by 2 (CASET/RASET restriction in datasheet)
 | 
			
		||||
  if (this->x_low_ % 2 == 1) {
 | 
			
		||||
    this->x_low_--;
 | 
			
		||||
  }
 | 
			
		||||
  if (this->x_high_ % 2 == 0) {
 | 
			
		||||
    this->x_high_++;
 | 
			
		||||
  }
 | 
			
		||||
  if (this->y_low_ % 2 == 1) {
 | 
			
		||||
    this->y_low_--;
 | 
			
		||||
  }
 | 
			
		||||
  if (this->y_high_ % 2 == 0) {
 | 
			
		||||
    this->y_high_++;
 | 
			
		||||
  }
 | 
			
		||||
  int w = this->x_high_ - this->x_low_ + 1;
 | 
			
		||||
  int h = this->y_high_ - this->y_low_ + 1;
 | 
			
		||||
  this->draw_pixels_at(this->x_low_, this->y_low_, w, h, this->buffer_, this->color_mode_, display::COLOR_BITNESS_565,
 | 
			
		||||
 
 | 
			
		||||
@@ -65,10 +65,13 @@ class QspiAmoLed : public display::DisplayBuffer,
 | 
			
		||||
 | 
			
		||||
  void set_reset_pin(GPIOPin *reset_pin) { this->reset_pin_ = reset_pin; }
 | 
			
		||||
  void set_enable_pin(GPIOPin *enable_pin) { this->enable_pin_ = enable_pin; }
 | 
			
		||||
  void set_width(uint16_t width) { this->width_ = width; }
 | 
			
		||||
  void set_dimensions(uint16_t width, uint16_t height) {
 | 
			
		||||
    this->width_ = width;
 | 
			
		||||
    this->height_ = height;
 | 
			
		||||
  }
 | 
			
		||||
  int get_width() override { return this->width_; }
 | 
			
		||||
  int get_height() override { return this->height_; }
 | 
			
		||||
  void set_invert_colors(bool invert_colors) {
 | 
			
		||||
    this->invert_colors_ = invert_colors;
 | 
			
		||||
    this->reset_params_();
 | 
			
		||||
 
 | 
			
		||||
@@ -8,10 +8,10 @@ static const char *const TAG = "remote.dooya";
 | 
			
		||||
 | 
			
		||||
static const uint32_t HEADER_HIGH_US = 5000;
 | 
			
		||||
static const uint32_t HEADER_LOW_US = 1500;
 | 
			
		||||
static const uint32_t BIT_ZERO_HIGH_US = 350;
 | 
			
		||||
static const uint32_t BIT_ZERO_LOW_US = 750;
 | 
			
		||||
static const uint32_t BIT_ONE_HIGH_US = 750;
 | 
			
		||||
static const uint32_t BIT_ONE_LOW_US = 350;
 | 
			
		||||
static const uint32_t BIT_ZERO_HIGH_US = 750;
 | 
			
		||||
static const uint32_t BIT_ZERO_LOW_US = 350;
 | 
			
		||||
static const uint32_t BIT_ONE_HIGH_US = 350;
 | 
			
		||||
static const uint32_t BIT_ONE_LOW_US = 750;
 | 
			
		||||
 | 
			
		||||
void DooyaProtocol::encode(RemoteTransmitData *dst, const DooyaData &data) {
 | 
			
		||||
  dst->set_carrier_frequency(0);
 | 
			
		||||
 
 | 
			
		||||
@@ -56,21 +56,20 @@ CONFIG_SCHEMA = cv.All(
 | 
			
		||||
 | 
			
		||||
@coroutine_with_priority(50.0)
 | 
			
		||||
async def to_code(config):
 | 
			
		||||
    if config[CONF_DISABLED]:
 | 
			
		||||
        return
 | 
			
		||||
    if not config[CONF_DISABLED]:
 | 
			
		||||
        var = cg.new_Pvariable(config[CONF_ID])
 | 
			
		||||
        await cg.register_component(var, config)
 | 
			
		||||
 | 
			
		||||
    var = cg.new_Pvariable(config[CONF_ID])
 | 
			
		||||
    await cg.register_component(var, config)
 | 
			
		||||
        for conf in config.get(CONF_ON_SAFE_MODE, []):
 | 
			
		||||
            trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
 | 
			
		||||
            await automation.build_automation(trigger, [], conf)
 | 
			
		||||
 | 
			
		||||
    for conf in config.get(CONF_ON_SAFE_MODE, []):
 | 
			
		||||
        trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
 | 
			
		||||
        await automation.build_automation(trigger, [], conf)
 | 
			
		||||
        condition = var.should_enter_safe_mode(
 | 
			
		||||
            config[CONF_NUM_ATTEMPTS],
 | 
			
		||||
            config[CONF_REBOOT_TIMEOUT],
 | 
			
		||||
            config[CONF_BOOT_IS_GOOD_AFTER],
 | 
			
		||||
        )
 | 
			
		||||
        cg.add(RawExpression(f"if ({condition}) return"))
 | 
			
		||||
 | 
			
		||||
    condition = var.should_enter_safe_mode(
 | 
			
		||||
        config[CONF_NUM_ATTEMPTS],
 | 
			
		||||
        config[CONF_REBOOT_TIMEOUT],
 | 
			
		||||
        config[CONF_BOOT_IS_GOOD_AFTER],
 | 
			
		||||
    )
 | 
			
		||||
    cg.add(RawExpression(f"if ({condition}) return"))
 | 
			
		||||
    CORE.data[CONF_SAFE_MODE] = {}
 | 
			
		||||
    CORE.data[CONF_SAFE_MODE][KEY_PAST_SAFE_MODE] = True
 | 
			
		||||
 
 | 
			
		||||
@@ -88,7 +88,7 @@ def validate_parameter_name(value):
 | 
			
		||||
    raise cv.Invalid(f"Script's parameter name cannot be {CONF_ID}")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ALLOWED_PARAM_TYPE_CHARSET = set("abcdefghijklmnopqrstuvwxyz0123456789_:*&[]<>")
 | 
			
		||||
ALLOWED_PARAM_TYPE_CHARSET = set("abcdefghijklmnopqrstuvwxyz0123456789_:*&[]")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def validate_parameter_type(value):
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@ import subprocess
 | 
			
		||||
 | 
			
		||||
import esphome.codegen as cg
 | 
			
		||||
import esphome.config_validation as cv
 | 
			
		||||
from esphome.components import display, key_provider
 | 
			
		||||
from esphome.components import display
 | 
			
		||||
from esphome.const import (
 | 
			
		||||
    CONF_ID,
 | 
			
		||||
    CONF_DIMENSIONS,
 | 
			
		||||
@@ -12,10 +12,8 @@ from esphome.const import (
 | 
			
		||||
    PLATFORM_HOST,
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
AUTO_LOAD = ["key_provider"]
 | 
			
		||||
 | 
			
		||||
sdl_ns = cg.esphome_ns.namespace("sdl")
 | 
			
		||||
Sdl = sdl_ns.class_("Sdl", display.Display, key_provider.KeyProvider)
 | 
			
		||||
Sdl = sdl_ns.class_("Sdl", display.Display, cg.Component)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
CONF_SDL_OPTIONS = "sdl_options"
 | 
			
		||||
 
 | 
			
		||||
@@ -84,10 +84,6 @@ void Sdl::loop() {
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
      case SDL_KEYUP:
 | 
			
		||||
        this->send_key_(e.key.keysym.sym);
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
      default:
 | 
			
		||||
        ESP_LOGV(TAG, "Event %d", e.type);
 | 
			
		||||
        break;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,10 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#ifdef USE_HOST
 | 
			
		||||
#include "esphome/components/display/display.h"
 | 
			
		||||
#include "esphome/components/key_provider/key_provider.h"
 | 
			
		||||
#include "esphome/core/application.h"
 | 
			
		||||
#include "esphome/core/component.h"
 | 
			
		||||
#include "esphome/core/log.h"
 | 
			
		||||
#include "esphome/core/application.h"
 | 
			
		||||
#include "esphome/components/display/display.h"
 | 
			
		||||
#define SDL_MAIN_HANDLED
 | 
			
		||||
#include "SDL.h"
 | 
			
		||||
 | 
			
		||||
@@ -14,7 +13,7 @@ namespace sdl {
 | 
			
		||||
 | 
			
		||||
constexpr static const char *const TAG = "sdl";
 | 
			
		||||
 | 
			
		||||
class Sdl : public display::Display, public key_provider::KeyProvider {
 | 
			
		||||
class Sdl : public display::Display {
 | 
			
		||||
 public:
 | 
			
		||||
  display::DisplayType get_display_type() override { return display::DISPLAY_TYPE_COLOR; }
 | 
			
		||||
  void update() override;
 | 
			
		||||
 
 | 
			
		||||
@@ -43,7 +43,6 @@ from esphome.const import (
 | 
			
		||||
    DEVICE_CLASS_BATTERY,
 | 
			
		||||
    DEVICE_CLASS_CARBON_DIOXIDE,
 | 
			
		||||
    DEVICE_CLASS_CARBON_MONOXIDE,
 | 
			
		||||
    DEVICE_CLASS_CONDUCTIVITY,
 | 
			
		||||
    DEVICE_CLASS_CURRENT,
 | 
			
		||||
    DEVICE_CLASS_DATA_RATE,
 | 
			
		||||
    DEVICE_CLASS_DATA_SIZE,
 | 
			
		||||
@@ -104,7 +103,6 @@ DEVICE_CLASSES = [
 | 
			
		||||
    DEVICE_CLASS_BATTERY,
 | 
			
		||||
    DEVICE_CLASS_CARBON_DIOXIDE,
 | 
			
		||||
    DEVICE_CLASS_CARBON_MONOXIDE,
 | 
			
		||||
    DEVICE_CLASS_CONDUCTIVITY,
 | 
			
		||||
    DEVICE_CLASS_CURRENT,
 | 
			
		||||
    DEVICE_CLASS_DATA_RATE,
 | 
			
		||||
    DEVICE_CLASS_DATA_SIZE,
 | 
			
		||||
 
 | 
			
		||||
@@ -258,7 +258,6 @@ KEY_UART_DEVICES = "uart_devices"
 | 
			
		||||
def final_validate_device_schema(
 | 
			
		||||
    name: str,
 | 
			
		||||
    *,
 | 
			
		||||
    uart_bus: str = CONF_UART_ID,
 | 
			
		||||
    baud_rate: Optional[int] = None,
 | 
			
		||||
    require_tx: bool = False,
 | 
			
		||||
    require_rx: bool = False,
 | 
			
		||||
@@ -269,7 +268,7 @@ def final_validate_device_schema(
 | 
			
		||||
    def validate_baud_rate(value):
 | 
			
		||||
        if value != baud_rate:
 | 
			
		||||
            raise cv.Invalid(
 | 
			
		||||
                f"Component {name} requires baud rate {baud_rate} for the uart referenced by {uart_bus}"
 | 
			
		||||
                f"Component {name} requires baud rate {baud_rate} for the uart bus"
 | 
			
		||||
            )
 | 
			
		||||
        return value
 | 
			
		||||
 | 
			
		||||
@@ -288,21 +287,21 @@ def final_validate_device_schema(
 | 
			
		||||
    def validate_data_bits(value):
 | 
			
		||||
        if value != data_bits:
 | 
			
		||||
            raise cv.Invalid(
 | 
			
		||||
                f"Component {name} requires {data_bits} data bits for the uart referenced by {uart_bus}"
 | 
			
		||||
                f"Component {name} requires {data_bits} data bits for the uart bus"
 | 
			
		||||
            )
 | 
			
		||||
        return value
 | 
			
		||||
 | 
			
		||||
    def validate_parity(value):
 | 
			
		||||
        if value != parity:
 | 
			
		||||
            raise cv.Invalid(
 | 
			
		||||
                f"Component {name} requires parity {parity} for the uart referenced by {uart_bus}"
 | 
			
		||||
                f"Component {name} requires parity {parity} for the uart bus"
 | 
			
		||||
            )
 | 
			
		||||
        return value
 | 
			
		||||
 | 
			
		||||
    def validate_stop_bits(value):
 | 
			
		||||
        if value != stop_bits:
 | 
			
		||||
            raise cv.Invalid(
 | 
			
		||||
                f"Component {name} requires {stop_bits} stop bits for the uart referenced by {uart_bus}"
 | 
			
		||||
                f"Component {name} requires {stop_bits} stop bits for the uart bus"
 | 
			
		||||
            )
 | 
			
		||||
        return value
 | 
			
		||||
 | 
			
		||||
@@ -317,14 +316,14 @@ def final_validate_device_schema(
 | 
			
		||||
            hub_schema[
 | 
			
		||||
                cv.Required(
 | 
			
		||||
                    CONF_TX_PIN,
 | 
			
		||||
                    msg=f"Component {name} requires uart referenced by {uart_bus} to declare a tx_pin",
 | 
			
		||||
                    msg=f"Component {name} requires this uart bus to declare a tx_pin",
 | 
			
		||||
                )
 | 
			
		||||
            ] = validate_pin(CONF_TX_PIN, device)
 | 
			
		||||
        if require_rx and uart_id_type_str in NATIVE_UART_CLASSES:
 | 
			
		||||
            hub_schema[
 | 
			
		||||
                cv.Required(
 | 
			
		||||
                    CONF_RX_PIN,
 | 
			
		||||
                    msg=f"Component {name} requires uart referenced by {uart_bus} to declare a rx_pin",
 | 
			
		||||
                    msg=f"Component {name} requires this uart bus to declare a rx_pin",
 | 
			
		||||
                )
 | 
			
		||||
            ] = validate_pin(CONF_RX_PIN, device)
 | 
			
		||||
        if baud_rate is not None:
 | 
			
		||||
@@ -338,7 +337,7 @@ def final_validate_device_schema(
 | 
			
		||||
        return cv.Schema(hub_schema, extra=cv.ALLOW_EXTRA)(hub_config)
 | 
			
		||||
 | 
			
		||||
    return cv.Schema(
 | 
			
		||||
        {cv.Required(uart_bus): fv.id_declaration_match_schema(validate_hub)},
 | 
			
		||||
        {cv.Required(CONF_UART_ID): fv.id_declaration_match_schema(validate_hub)},
 | 
			
		||||
        extra=cv.ALLOW_EXTRA,
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -69,7 +69,7 @@ async def setup_update_core_(var, config):
 | 
			
		||||
        await mqtt.register_mqtt_component(mqtt_, config)
 | 
			
		||||
 | 
			
		||||
    if web_server_id_config := config.get(CONF_WEB_SERVER_ID):
 | 
			
		||||
        web_server_ = cg.get_variable(web_server_id_config)
 | 
			
		||||
        web_server_ = await cg.get_variable(web_server_id_config)
 | 
			
		||||
        web_server.add_entity_to_sorting_list(web_server_, var, config)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -243,7 +243,7 @@ ErrorCode VEML7700Component::configure_() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  PSMRegister psm{0};
 | 
			
		||||
  psm.PSM = PSMMode::PSM_MODE_1;
 | 
			
		||||
  psm.PSM = PSM::PSM_MODE_1;
 | 
			
		||||
  psm.PSM_EN = false;
 | 
			
		||||
  ESP_LOGV(TAG, "Setting PSM to 0x%04X", psm.raw);
 | 
			
		||||
  err = this->write_register((uint8_t) CommandRegisters::PWR_SAVING, psm.raw_bytes, VEML_REG_SIZE);
 | 
			
		||||
 
 | 
			
		||||
@@ -24,7 +24,7 @@ enum class CommandRegisters : uint8_t {
 | 
			
		||||
  ALS_INT = 0x06      // R: ALS INT trigger event
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum Gain : uint16_t {
 | 
			
		||||
enum Gain : uint8_t {
 | 
			
		||||
  X_1 = 0,
 | 
			
		||||
  X_2 = 1,
 | 
			
		||||
  X_1_8 = 2,
 | 
			
		||||
@@ -32,7 +32,7 @@ enum Gain : uint16_t {
 | 
			
		||||
};
 | 
			
		||||
const uint8_t GAINS_COUNT = 4;
 | 
			
		||||
 | 
			
		||||
enum IntegrationTime : uint16_t {
 | 
			
		||||
enum IntegrationTime : uint8_t {
 | 
			
		||||
  INTEGRATION_TIME_25MS = 0b1100,
 | 
			
		||||
  INTEGRATION_TIME_50MS = 0b1000,
 | 
			
		||||
  INTEGRATION_TIME_100MS = 0b0000,
 | 
			
		||||
@@ -42,14 +42,14 @@ enum IntegrationTime : uint16_t {
 | 
			
		||||
};
 | 
			
		||||
const uint8_t INTEGRATION_TIMES_COUNT = 6;
 | 
			
		||||
 | 
			
		||||
enum Persistence : uint16_t {
 | 
			
		||||
enum Persistence : uint8_t {
 | 
			
		||||
  PERSISTENCE_1 = 0,
 | 
			
		||||
  PERSISTENCE_2 = 1,
 | 
			
		||||
  PERSISTENCE_4 = 2,
 | 
			
		||||
  PERSISTENCE_8 = 3,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum PSMMode : uint16_t {
 | 
			
		||||
enum PSM : uint8_t {
 | 
			
		||||
  PSM_MODE_1 = 0,
 | 
			
		||||
  PSM_MODE_2 = 1,
 | 
			
		||||
  PSM_MODE_3 = 2,
 | 
			
		||||
@@ -92,7 +92,7 @@ union PSMRegister {
 | 
			
		||||
  uint8_t raw_bytes[2];
 | 
			
		||||
  struct {
 | 
			
		||||
    bool PSM_EN : 1;
 | 
			
		||||
    PSMMode PSM : 2;
 | 
			
		||||
    uint8_t PSM : 2;
 | 
			
		||||
    uint16_t reserved : 13;
 | 
			
		||||
  } __attribute__((packed));
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -799,7 +799,7 @@ void VoiceAssistant::on_audio(const api::VoiceAssistantAudio &msg) {
 | 
			
		||||
    this->speaker_buffer_index_ += msg.data.length();
 | 
			
		||||
    this->speaker_buffer_size_ += msg.data.length();
 | 
			
		||||
    this->speaker_bytes_received_ += msg.data.length();
 | 
			
		||||
    ESP_LOGV(TAG, "Received audio: %u bytes from API", msg.data.length());
 | 
			
		||||
    ESP_LOGV(TAG, "Received audio: %" PRId32 " bytes from API", msg.data.length());
 | 
			
		||||
  } else {
 | 
			
		||||
    ESP_LOGE(TAG, "Cannot receive audio, buffer is full");
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -114,7 +114,7 @@ EAP_AUTH_SCHEMA = cv.All(
 | 
			
		||||
            cv.Optional(CONF_USERNAME): cv.string_strict,
 | 
			
		||||
            cv.Optional(CONF_PASSWORD): cv.string_strict,
 | 
			
		||||
            cv.Optional(CONF_CERTIFICATE_AUTHORITY): wpa2_eap.validate_certificate,
 | 
			
		||||
            cv.Optional(CONF_TTLS_PHASE_2): cv.All(
 | 
			
		||||
            cv.SplitDefault(CONF_TTLS_PHASE_2, esp32_idf="mschapv2"): cv.All(
 | 
			
		||||
                cv.enum(TTLS_PHASE_2), cv.only_with_esp_idf
 | 
			
		||||
            ),
 | 
			
		||||
            cv.Inclusive(
 | 
			
		||||
@@ -350,7 +350,7 @@ def eap_auth(config):
 | 
			
		||||
        ("ca_cert", ca_cert),
 | 
			
		||||
        ("client_cert", client_cert),
 | 
			
		||||
        ("client_key", key),
 | 
			
		||||
        ("ttls_phase_2", config.get(CONF_TTLS_PHASE_2, TTLS_PHASE_2["mschapv2"])),
 | 
			
		||||
        ("ttls_phase_2", config.get(CONF_TTLS_PHASE_2)),
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -27,13 +27,7 @@ CONFIG_SCHEMA = cv.All(
 | 
			
		||||
            cv.Optional(CONF_INITIAL_VALUE, default=1.0): cv.float_range(
 | 
			
		||||
                min=0.01, max=1.0
 | 
			
		||||
            ),
 | 
			
		||||
            cv.Optional(CONF_STEP_DELAY, default="1us"): cv.All(
 | 
			
		||||
                cv.positive_time_period_microseconds,
 | 
			
		||||
                cv.Range(
 | 
			
		||||
                    min=cv.TimePeriod(microseconds=1),
 | 
			
		||||
                    max=cv.TimePeriod(microseconds=100),
 | 
			
		||||
                ),
 | 
			
		||||
            ),
 | 
			
		||||
            cv.Optional(CONF_STEP_DELAY, default=1): cv.int_range(min=1, max=100),
 | 
			
		||||
        }
 | 
			
		||||
    )
 | 
			
		||||
)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
"""Constants used by esphome."""
 | 
			
		||||
 | 
			
		||||
__version__ = "2024.7.0-dev"
 | 
			
		||||
__version__ = "2024.6.6"
 | 
			
		||||
 | 
			
		||||
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
 | 
			
		||||
VALID_SUBSTITUTIONS_CHARACTERS = (
 | 
			
		||||
@@ -355,6 +355,7 @@ CONF_HUMIDITY_SENSOR = "humidity_sensor"
 | 
			
		||||
CONF_HYSTERESIS = "hysteresis"
 | 
			
		||||
CONF_I2C = "i2c"
 | 
			
		||||
CONF_I2C_ID = "i2c_id"
 | 
			
		||||
CONF_IAQ_ACCURACY = "iaq_accuracy"
 | 
			
		||||
CONF_IBEACON_MAJOR = "ibeacon_major"
 | 
			
		||||
CONF_IBEACON_MINOR = "ibeacon_minor"
 | 
			
		||||
CONF_IBEACON_UUID = "ibeacon_uuid"
 | 
			
		||||
@@ -719,6 +720,7 @@ CONF_RX_BUFFER_SIZE = "rx_buffer_size"
 | 
			
		||||
CONF_RX_ONLY = "rx_only"
 | 
			
		||||
CONF_RX_PIN = "rx_pin"
 | 
			
		||||
CONF_SAFE_MODE = "safe_mode"
 | 
			
		||||
CONF_SAMPLE_RATE = "sample_rate"
 | 
			
		||||
CONF_SAMSUNG = "samsung"
 | 
			
		||||
CONF_SATELLITES = "satellites"
 | 
			
		||||
CONF_SCAN = "scan"
 | 
			
		||||
@@ -1070,7 +1072,6 @@ DEVICE_CLASS_BUTTON = "button"
 | 
			
		||||
DEVICE_CLASS_CARBON_DIOXIDE = "carbon_dioxide"
 | 
			
		||||
DEVICE_CLASS_CARBON_MONOXIDE = "carbon_monoxide"
 | 
			
		||||
DEVICE_CLASS_COLD = "cold"
 | 
			
		||||
DEVICE_CLASS_CONDUCTIVITY = "conductivity"
 | 
			
		||||
DEVICE_CLASS_CONNECTIVITY = "connectivity"
 | 
			
		||||
DEVICE_CLASS_CURRENT = "current"
 | 
			
		||||
DEVICE_CLASS_CURTAIN = "curtain"
 | 
			
		||||
 
 | 
			
		||||
@@ -10,6 +10,7 @@ int_ = global_ns.namespace("int")
 | 
			
		||||
std_ns = global_ns.namespace("std")
 | 
			
		||||
std_shared_ptr = std_ns.class_("shared_ptr")
 | 
			
		||||
std_string = std_ns.class_("string")
 | 
			
		||||
std_string_ref = std_ns.namespace("string &")
 | 
			
		||||
std_vector = std_ns.class_("vector")
 | 
			
		||||
uint8 = global_ns.namespace("uint8_t")
 | 
			
		||||
uint16 = global_ns.namespace("uint16_t")
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +0,0 @@
 | 
			
		||||
dependencies:
 | 
			
		||||
  esp-tflite-micro:
 | 
			
		||||
    git: https://github.com/espressif/esp-tflite-micro.git
 | 
			
		||||
    version: v1.3.1
 | 
			
		||||
  esp32_camera:
 | 
			
		||||
    git: https://github.com/espressif/esp32-camera.git
 | 
			
		||||
    version: v2.0.9
 | 
			
		||||
  mdns:
 | 
			
		||||
    git: https://github.com/espressif/esp-protocols.git
 | 
			
		||||
    version: mdns-v1.2.5
 | 
			
		||||
    path: components/mdns
 | 
			
		||||
    rules:
 | 
			
		||||
      - if: "idf_version >=5.0"
 | 
			
		||||
@@ -64,7 +64,7 @@ lib_deps =
 | 
			
		||||
    freekode/TM1651@1.0.1                                 ; tm1651
 | 
			
		||||
    glmnet/Dsmr@0.7                                       ; dsmr
 | 
			
		||||
    rweather/Crypto@0.4.0                                 ; dsmr
 | 
			
		||||
    dudanov/MideaUART@1.1.8                               ; midea
 | 
			
		||||
    dudanov/MideaUART@1.1.9                               ; midea
 | 
			
		||||
    tonia/HeatpumpIR@1.0.23                               ; heatpumpir
 | 
			
		||||
build_flags =
 | 
			
		||||
    ${common.build_flags}
 | 
			
		||||
@@ -142,6 +142,7 @@ platform_packages =
 | 
			
		||||
framework = espidf
 | 
			
		||||
lib_deps =
 | 
			
		||||
    ${common:idf.lib_deps}
 | 
			
		||||
    espressif/esp32-camera@1.0.0  ; esp32_camera
 | 
			
		||||
    droscy/esp_wireguard@0.4.1    ; wireguard
 | 
			
		||||
build_flags =
 | 
			
		||||
    ${common:idf.build_flags}
 | 
			
		||||
 
 | 
			
		||||
@@ -101,10 +101,8 @@ def clang_options(idedata):
 | 
			
		||||
    # add library include directories using -isystem to suppress their errors
 | 
			
		||||
    for directory in sorted(set(idedata["includes"]["build"])):
 | 
			
		||||
        # skip our own directories, we add those later
 | 
			
		||||
        if (
 | 
			
		||||
            not directory.startswith(f"{root_path}/")
 | 
			
		||||
            or directory.startswith(f"{root_path}/.pio/")
 | 
			
		||||
            or directory.startswith(f"{root_path}/managed_components/")
 | 
			
		||||
        if not directory.startswith(f"{root_path}/") or directory.startswith(
 | 
			
		||||
            f"{root_path}/.pio/"
 | 
			
		||||
        ):
 | 
			
		||||
            cmd.extend(["-isystem", directory])
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,6 @@ from homeassistant.components.event import EventDeviceClass
 | 
			
		||||
from homeassistant.components.number import NumberDeviceClass
 | 
			
		||||
from homeassistant.components.sensor import SensorDeviceClass
 | 
			
		||||
from homeassistant.components.switch import SwitchDeviceClass
 | 
			
		||||
from homeassistant.components.update import UpdateDeviceClass
 | 
			
		||||
from homeassistant.components.valve import ValveDeviceClass
 | 
			
		||||
 | 
			
		||||
# pylint: enable=import-error
 | 
			
		||||
@@ -28,7 +27,6 @@ DOMAINS = {
 | 
			
		||||
    "number": NumberDeviceClass,
 | 
			
		||||
    "sensor": SensorDeviceClass,
 | 
			
		||||
    "switch": SwitchDeviceClass,
 | 
			
		||||
    "update": UpdateDeviceClass,
 | 
			
		||||
    "valve": ValveDeviceClass,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -24,8 +24,8 @@ fi
 | 
			
		||||
 | 
			
		||||
start_esphome() {
 | 
			
		||||
  # create dynamic yaml file in `build` folder.
 | 
			
		||||
  # `./tests/test_build_components/build/[target_component].[test_name].[target_platform_with_version].yaml`
 | 
			
		||||
  component_test_file="./tests/test_build_components/build/$target_component.$test_name.$target_platform_with_version.yaml"
 | 
			
		||||
  # `./tests/test_build_components/build/[target_component].[test_name].[target_platform].yaml`
 | 
			
		||||
  component_test_file="./tests/test_build_components/build/$target_component.$test_name.$target_platform.yaml"
 | 
			
		||||
 | 
			
		||||
  cp $target_platform_file $component_test_file
 | 
			
		||||
  if [[ "$OSTYPE" == "darwin"* ]]; then
 | 
			
		||||
@@ -36,7 +36,7 @@ start_esphome() {
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  # Start esphome process
 | 
			
		||||
  echo "> [$target_component] [$test_name] [$target_platform_with_version]"
 | 
			
		||||
  echo "> [$target_component] [$test_name] [$target_platform]"
 | 
			
		||||
  set -x
 | 
			
		||||
  # TODO: Validate escape of Command line substitution value
 | 
			
		||||
  python -m esphome -s component_name $target_component -s component_dir ../../components/$target_component -s test_name $test_name -s target_platform $target_platform $esphome_command $component_test_file
 | 
			
		||||
@@ -76,17 +76,16 @@ for f in ./tests/components/$target_component/*.*.yaml; do
 | 
			
		||||
    # 2. `./tests/test_build_components/build_components_base.[target_platform]-ard.yaml`
 | 
			
		||||
    target_platform_file="./tests/test_build_components/build_components_base.$target_platform.yaml"
 | 
			
		||||
    if ! [ -f "$target_platform_file" ]; then
 | 
			
		||||
      echo "No base test file [./tests/test_build_components/build_components_base.$target_platform.yaml] for component test [$f] found."
 | 
			
		||||
      exit 1
 | 
			
		||||
      # Try find arduino test framework as platform.
 | 
			
		||||
      target_platform_ard="$target_platform-ard"
 | 
			
		||||
      target_platform_file="./tests/test_build_components/build_components_base.$target_platform_ard.yaml"
 | 
			
		||||
      if ! [ -f "$target_platform_file" ]; then
 | 
			
		||||
        echo "No base test file [./tests/test_build_components/build_components_base.$target_platform.yaml, ./tests/build_components_base.$target_platform_ard.yaml] for component test [$f] found."
 | 
			
		||||
        exit 1
 | 
			
		||||
      fi
 | 
			
		||||
      target_platform=$target_platform_ard
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    for target_platform_file in ./tests/test_build_components/build_components_base.$target_platform*.yaml; do
 | 
			
		||||
      # trim off "./tests/test_build_components/build_components_base." prefix
 | 
			
		||||
      target_platform_with_version=${target_platform_file:52}
 | 
			
		||||
      # ...now remove suffix starting with "." leaving just the test target hardware and software platform (possibly with version)
 | 
			
		||||
      # For example: "esp32-s3-idf-50"
 | 
			
		||||
      target_platform_with_version=${target_platform_with_version%.*}
 | 
			
		||||
      start_esphome
 | 
			
		||||
    done
 | 
			
		||||
    start_esphome
 | 
			
		||||
  fi
 | 
			
		||||
done
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,13 @@
 | 
			
		||||
substitutions:
 | 
			
		||||
  tx_pin: GPIO4
 | 
			
		||||
  rx_pin: GPIO5
 | 
			
		||||
uart:
 | 
			
		||||
  - id: uart_a01nyub
 | 
			
		||||
    tx_pin:
 | 
			
		||||
      number: 4
 | 
			
		||||
    rx_pin:
 | 
			
		||||
      number: 5
 | 
			
		||||
    baud_rate: 9600
 | 
			
		||||
 | 
			
		||||
<<: !include common.yaml
 | 
			
		||||
sensor:
 | 
			
		||||
  - platform: a01nyub
 | 
			
		||||
    id: a01nyub_sensor
 | 
			
		||||
    name: a01nyub Distance
 | 
			
		||||
    uart_id: uart_a01nyub
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,9 @@
 | 
			
		||||
uart:
 | 
			
		||||
  - id: uart_a01nyub
 | 
			
		||||
    tx_pin: ${tx_pin}
 | 
			
		||||
    rx_pin: ${rx_pin}
 | 
			
		||||
    tx_pin:
 | 
			
		||||
      number: 4
 | 
			
		||||
    rx_pin:
 | 
			
		||||
      number: 5
 | 
			
		||||
    baud_rate: 9600
 | 
			
		||||
 | 
			
		||||
sensor:
 | 
			
		||||
@@ -1,5 +1,13 @@
 | 
			
		||||
substitutions:
 | 
			
		||||
  tx_pin: GPIO17
 | 
			
		||||
  rx_pin: GPIO16
 | 
			
		||||
uart:
 | 
			
		||||
  - id: uart_a01nyub
 | 
			
		||||
    tx_pin:
 | 
			
		||||
      number: 17
 | 
			
		||||
    rx_pin:
 | 
			
		||||
      number: 16
 | 
			
		||||
    baud_rate: 9600
 | 
			
		||||
 | 
			
		||||
<<: !include common.yaml
 | 
			
		||||
sensor:
 | 
			
		||||
  - platform: a01nyub
 | 
			
		||||
    id: a01nyub_sensor
 | 
			
		||||
    name: a01nyub Distance
 | 
			
		||||
    uart_id: uart_a01nyub
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										13
									
								
								tests/components/a01nyub/test.esp32.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								tests/components/a01nyub/test.esp32.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
uart:
 | 
			
		||||
  - id: uart_a01nyub
 | 
			
		||||
    tx_pin:
 | 
			
		||||
      number: 17
 | 
			
		||||
    rx_pin:
 | 
			
		||||
      number: 16
 | 
			
		||||
    baud_rate: 9600
 | 
			
		||||
 | 
			
		||||
sensor:
 | 
			
		||||
  - platform: a01nyub
 | 
			
		||||
    id: a01nyub_sensor
 | 
			
		||||
    name: a01nyub Distance
 | 
			
		||||
    uart_id: uart_a01nyub
 | 
			
		||||
							
								
								
									
										13
									
								
								tests/components/a01nyub/test.esp8266.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								tests/components/a01nyub/test.esp8266.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
uart:
 | 
			
		||||
  - id: uart_a01nyub
 | 
			
		||||
    tx_pin:
 | 
			
		||||
      number: 4
 | 
			
		||||
    rx_pin:
 | 
			
		||||
      number: 5
 | 
			
		||||
    baud_rate: 9600
 | 
			
		||||
 | 
			
		||||
sensor:
 | 
			
		||||
  - platform: a01nyub
 | 
			
		||||
    id: a01nyub_sensor
 | 
			
		||||
    name: a01nyub Distance
 | 
			
		||||
    uart_id: uart_a01nyub
 | 
			
		||||
							
								
								
									
										13
									
								
								tests/components/a01nyub/test.rp2040.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								tests/components/a01nyub/test.rp2040.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
uart:
 | 
			
		||||
  - id: uart_a01nyub
 | 
			
		||||
    tx_pin:
 | 
			
		||||
      number: 4
 | 
			
		||||
    rx_pin:
 | 
			
		||||
      number: 5
 | 
			
		||||
    baud_rate: 9600
 | 
			
		||||
 | 
			
		||||
sensor:
 | 
			
		||||
  - platform: a01nyub
 | 
			
		||||
    id: a01nyub_sensor
 | 
			
		||||
    name: a01nyub Distance
 | 
			
		||||
    uart_id: uart_a01nyub
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user