This commit is contained in:
Sebastian Muszynski 2024-06-05 20:48:37 +02:00 committed by GitHub
parent 642da39692
commit 7ac4faf60d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 56 additions and 38 deletions

View File

@ -21,17 +21,23 @@ jobs:
lint-clang-format:
env:
esphome_directory: esphome
esphome_version: 2022.9.3
runs-on: ubuntu-latest
# cpp lint job runs with esphome-lint docker image so that clang-format-*
# doesn't have to be installed
container: esphome/esphome-lint:latest
steps:
- uses: actions/checkout@v2
# Set up the pio project so that the cpp checks know how files are compiled
# (build flags, libraries etc)
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.12'
- name: Cache pip modules
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: esphome-pip-3.12-${{ hashFiles('setup.py') }}
restore-keys: |
esphome-pip-3.12-
- name: 💣 Clone esphome project
run: git clone -b ${{ env.esphome_version }} https://github.com/esphome/esphome.git
run: git clone https://github.com/esphome/esphome.git
- name: 💣 Copy component into the esphome project
run: |
cp -r ../components/* esphome/components/
@ -41,6 +47,14 @@ jobs:
git commit -a -m "Add external component"
working-directory: ${{ env.esphome_directory }}
- name: Add missing requirements
run: pip3 install setuptools wheel
- name: Set up python environment
run: VIRTUAL_ENV=false script/setup
working-directory: ${{ env.esphome_directory }}
# Set up the pio project so that the cpp checks know how files are compiled
# (build flags, libraries etc)
- name: Set up platformio environment
run: pio init --ide vscode
working-directory: ${{ env.esphome_directory }}
@ -56,17 +70,24 @@ jobs:
lint-clang-tidy:
env:
esphome_directory: esphome
esphome_version: 2022.9.3
runs-on: ubuntu-latest
# cpp lint job runs with esphome-lint docker image so that clang-format-*
# doesn't have to be installed
container: esphome/esphome-lint:latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.12'
- name: Cache pip modules
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: esphome-pip-3.12-${{ hashFiles('setup.py') }}
restore-keys: |
esphome-pip-3.12-
- name: 💣 Clone esphome project
run: git clone -b ${{ env.esphome_version }} https://github.com/esphome/esphome.git
- name: 💣 Copy component into the esphome project
- name: 💣Clone esphome project
run: git clone https://github.com/esphome/esphome.git
- name: 💣Copy component into the esphome project
run: |
cp -r ../components/* esphome/components/
git config user.name "ci"
@ -75,6 +96,12 @@ jobs:
git commit -a -m "Add external component"
working-directory: ${{ env.esphome_directory }}
- name: Add missing requirements
run: pip3 install setuptools wheel
- name: Set up python environment
run: VIRTUAL_ENV=false script/setup
working-directory: ${{ env.esphome_directory }}
# Set up the pio project so that the cpp checks know how files are compiled
# (build flags, libraries etc)
- name: Set up platformio environment
@ -95,7 +122,6 @@ jobs:
lint-python:
env:
esphome_directory: esphome
esphome_version: 2022.9.3
# Don't use the esphome-lint docker image because it may contain outdated requirements.
# This way, all dependencies are cached via the cache action.
runs-on: ubuntu-latest
@ -104,17 +130,17 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
python-version: '3.12'
- name: Cache pip modules
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: esphome-pip-3.9-${{ hashFiles('setup.py') }}
key: esphome-pip-3.12-${{ hashFiles('setup.py') }}
restore-keys: |
esphome-pip-3.9-
esphome-pip-3.12-
- name: 💣Clone esphome project
run: git clone -b ${{ env.esphome_version }} https://github.com/esphome/esphome.git
run: git clone https://github.com/esphome/esphome.git
- name: 💣Copy component into the esphome project
run: |
cp -r ../components/* esphome/components/
@ -148,10 +174,10 @@ jobs:
steps:
- name: ⤵️ Check out configuration from GitHub
uses: actions/checkout@v2
- name: Setup Python 3.9
- name: Setup Python 3.12
uses: actions/setup-python@v1
with:
python-version: 3.9
python-version: 3.12
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
@ -161,6 +187,8 @@ jobs:
- name: Write secrets.yaml
shell: bash
run: 'echo -e "wifi_ssid: ssid\nwifi_password: password\nmqtt_host: host\nmqtt_username: username\nmqtt_password: password" > secrets.yaml; cp secrets.yaml tests'
- run: |
esphome -s external_components_source components config bluesmart-charger-esp32-example.yaml
- run: |
esphome -s external_components_source components config smartsolar-mppt-esp8266-example.yaml
- run: |
@ -204,10 +232,10 @@ jobs:
path: .pioenvs
key: esphome-compile-pioenvs-${{ hashFiles('*.yaml') }}
restore-keys: esphome-compile-pioenvs-
- name: Set up Python 3.9
- name: Set up Python 3.12
uses: actions/setup-python@v1
with:
python-version: 3.9
python-version: 3.12
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
@ -221,6 +249,8 @@ jobs:
- name: Write secrets.yaml
shell: bash
run: 'echo -e "wifi_ssid: ssid\nwifi_password: password\nmqtt_host: host\nmqtt_username: username\nmqtt_password: password" > secrets.yaml'
- run: |
esphome -s external_components_source components compile bluesmart-charger-esp32-example.yaml
- run: |
esphome -s external_components_source components compile smartsolar-mppt-esp8266-example.yaml
- run: |

View File

@ -8,14 +8,6 @@ yaml-files:
ignore: |
/.cache/
esphome/**/*.pio*
config/automations.yaml
config/known_devices.yaml
config/scenes.yaml
config/google_calendars.yaml
config/custom_components/scheduler
config/custom_components/xiaomi_cloud_map_extractor
config/custom_components/zha_map
config/custom_components/hacs
rules:
braces:

View File

@ -1,4 +1,3 @@
substitutions:
name: bluesmart-charger
external_components_source: github://KinDR007/VictronMPPT-ESPHOME@main
@ -25,7 +24,6 @@ ota:
logger:
baud_rate: 0
mqtt:
broker: !secret mqtt_host
username: !secret mqtt_username
@ -34,8 +32,8 @@ mqtt:
uart:
id: uart_0
tx_pin: D8 # Not connected! The communication is read-only
rx_pin: D7 # Connect this this GPIO and GND to the charger
tx_pin: GPIO16 # Not connected! The communication is read-only
rx_pin: GPIO17 # Connect this this GPIO and GND to the charger
baud_rate: 19200
rx_buffer_size: 256
@ -57,7 +55,6 @@ sensor:
charging_mode_id:
name: "${name} mode id"
text_sensor:
- platform: victron
victron_id: victron0
@ -73,4 +70,3 @@ text_sensor:
name: "${name} error"
charging_mode:
name: "${name} Charging mode"

View File

@ -5,8 +5,8 @@ from esphome.const import (
CONF_BATTERY_VOLTAGE,
DEVICE_CLASS_CURRENT,
DEVICE_CLASS_EMPTY,
DEVICE_CLASS_POWER,
DEVICE_CLASS_ENERGY,
DEVICE_CLASS_POWER,
DEVICE_CLASS_TEMPERATURE,
DEVICE_CLASS_VOLTAGE,
ICON_CURRENT_AC,