forked from esphome/esphome
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into feature/wireguard_component
- Loading branch information
Showing
90 changed files
with
5,489 additions
and
2,203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Restore Python | ||
inputs: | ||
python-version: | ||
description: Python version to restore | ||
required: true | ||
type: string | ||
cache-key: | ||
description: Cache key to use | ||
required: true | ||
type: string | ||
outputs: | ||
python-version: | ||
description: Python version restored | ||
value: ${{ steps.python.outputs.python-version }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Set up Python ${{ inputs.python-version }} | ||
id: python | ||
uses: actions/setup-python@v4.6.0 | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
- name: Restore Python virtual environment | ||
id: cache-venv | ||
uses: actions/cache/restore@v3.3.1 | ||
with: | ||
path: venv | ||
# yamllint disable-line rule:line-length | ||
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ inputs.cache-key }} | ||
- name: Create Python virtual environment | ||
if: steps.cache-venv.outputs.cache-hit != 'true' | ||
shell: bash | ||
run: | | ||
python -m venv venv | ||
. venv/bin/activate | ||
python --version | ||
pip install -r requirements.txt -r requirements_optional.txt -r requirements_test.txt | ||
pip install -e . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import esphome.codegen as cg | ||
import esphome.config_validation as cv | ||
from esphome.components import sensor, ble_client | ||
|
||
from esphome.const import ( | ||
DEVICE_CLASS_HUMIDITY, | ||
DEVICE_CLASS_TEMPERATURE, | ||
DEVICE_CLASS_PRESSURE, | ||
STATE_CLASS_MEASUREMENT, | ||
UNIT_PERCENT, | ||
UNIT_CELSIUS, | ||
UNIT_HECTOPASCAL, | ||
CONF_HUMIDITY, | ||
CONF_TVOC, | ||
CONF_PRESSURE, | ||
CONF_TEMPERATURE, | ||
DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS_PARTS, | ||
UNIT_PARTS_PER_BILLION, | ||
ICON_RADIATOR, | ||
) | ||
|
||
CODEOWNERS = ["@ncareau", "@jeromelaban"] | ||
|
||
DEPENDENCIES = ["ble_client"] | ||
|
||
airthings_wave_base_ns = cg.esphome_ns.namespace("airthings_wave_base") | ||
AirthingsWaveBase = airthings_wave_base_ns.class_( | ||
"AirthingsWaveBase", cg.PollingComponent, ble_client.BLEClientNode | ||
) | ||
|
||
|
||
BASE_SCHEMA = ( | ||
sensor.SENSOR_SCHEMA.extend( | ||
{ | ||
cv.Optional(CONF_HUMIDITY): sensor.sensor_schema( | ||
unit_of_measurement=UNIT_PERCENT, | ||
device_class=DEVICE_CLASS_HUMIDITY, | ||
state_class=STATE_CLASS_MEASUREMENT, | ||
accuracy_decimals=0, | ||
), | ||
cv.Optional(CONF_TEMPERATURE): sensor.sensor_schema( | ||
unit_of_measurement=UNIT_CELSIUS, | ||
accuracy_decimals=2, | ||
device_class=DEVICE_CLASS_TEMPERATURE, | ||
state_class=STATE_CLASS_MEASUREMENT, | ||
), | ||
cv.Optional(CONF_PRESSURE): sensor.sensor_schema( | ||
unit_of_measurement=UNIT_HECTOPASCAL, | ||
accuracy_decimals=1, | ||
device_class=DEVICE_CLASS_PRESSURE, | ||
state_class=STATE_CLASS_MEASUREMENT, | ||
), | ||
cv.Optional(CONF_TVOC): sensor.sensor_schema( | ||
unit_of_measurement=UNIT_PARTS_PER_BILLION, | ||
icon=ICON_RADIATOR, | ||
accuracy_decimals=0, | ||
device_class=DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS_PARTS, | ||
state_class=STATE_CLASS_MEASUREMENT, | ||
), | ||
} | ||
) | ||
.extend(cv.polling_component_schema("5min")) | ||
.extend(ble_client.BLE_CLIENT_SCHEMA) | ||
) | ||
|
||
|
||
async def wave_base_to_code(var, config): | ||
await cg.register_component(var, config) | ||
|
||
await ble_client.register_ble_node(var, config) | ||
|
||
if CONF_HUMIDITY in config: | ||
sens = await sensor.new_sensor(config[CONF_HUMIDITY]) | ||
cg.add(var.set_humidity(sens)) | ||
if CONF_TEMPERATURE in config: | ||
sens = await sensor.new_sensor(config[CONF_TEMPERATURE]) | ||
cg.add(var.set_temperature(sens)) | ||
if CONF_PRESSURE in config: | ||
sens = await sensor.new_sensor(config[CONF_PRESSURE]) | ||
cg.add(var.set_pressure(sens)) | ||
if CONF_TVOC in config: | ||
sens = await sensor.new_sensor(config[CONF_TVOC]) | ||
cg.add(var.set_tvoc(sens)) |
Oops, something went wrong.