Skip to content

Commit

Permalink
add default waveform icon to sensors
Browse files Browse the repository at this point in the history
  • Loading branch information
stas-sl committed Sep 29, 2024
1 parent 776e621 commit 5095ce0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
env:
ESPHOME_VERSION: 2023.11.6
ESPHOME_VERSION: 2024.9.0
PLATFORMIO_LIBDEPS_DIR: ~/.platformio/libdeps
strategy:
fail-fast: false
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
- name: Run clang-format
run: |
clang-format-13 --dry-run --Werror $(git ls-files '*.cpp' '*.h')
clang-format --dry-run --Werror $(git ls-files '*.cpp' '*.h')
- name: Compile configs
run: |
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,9 @@ I'm not so familiar with assembler and it is hard to understand and maintain, so
### Supported platforms
Tested with ESPHome version 2023.2.0, platforms:
- [x] ESP32 (Arduino v2.0.5, ESP-IDF v4.4.2)
- [x] ESP32-IDF (ESP-IDF v4.4.2)
Tested with ESPHome version 2024.9.0, platforms:
- [x] ESP32 (Arduino v2.0.6, ESP-IDF v4.4.5)
- [x] ESP32-IDF (ESP-IDF v4.4.7)
### Sending data to sensor.community
Expand Down
13 changes: 9 additions & 4 deletions components/sound_level_meter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,25 @@
CONF_OFFSET = "offset"
CONF_IS_ON = "is_on"

ICON_WAVEFORM = "mdi:waveform"

CONFIG_SENSOR_SCHEMA = cv.typed_schema(
{
CONF_EQ: sensor.sensor_schema(
SoundLevelMeterSensorEq,
unit_of_measurement=UNIT_DECIBEL,
accuracy_decimals=2,
state_class=STATE_CLASS_MEASUREMENT
state_class=STATE_CLASS_MEASUREMENT,
icon=ICON_WAVEFORM
).extend({
cv.Optional(CONF_UPDATE_INTERVAL): cv.positive_time_period_milliseconds
}),
CONF_MAX: sensor.sensor_schema(
SoundLevelMeterSensorMax,
unit_of_measurement=UNIT_DECIBEL,
accuracy_decimals=2,
state_class=STATE_CLASS_MEASUREMENT
state_class=STATE_CLASS_MEASUREMENT,
icon=ICON_WAVEFORM
).extend({
cv.Optional(CONF_UPDATE_INTERVAL): cv.positive_time_period_milliseconds,
cv.Required(CONF_WINDOW_SIZE): cv.positive_time_period_milliseconds
Expand All @@ -79,7 +82,8 @@
SoundLevelMeterSensorMin,
unit_of_measurement=UNIT_DECIBEL,
accuracy_decimals=2,
state_class=STATE_CLASS_MEASUREMENT
state_class=STATE_CLASS_MEASUREMENT,
icon=ICON_WAVEFORM
).extend({
cv.Optional(CONF_UPDATE_INTERVAL): cv.positive_time_period_milliseconds,
cv.Required(CONF_WINDOW_SIZE): cv.positive_time_period_milliseconds
Expand All @@ -88,7 +92,8 @@
SoundLevelMeterSensorPeak,
unit_of_measurement=UNIT_DECIBEL,
accuracy_decimals=2,
state_class=STATE_CLASS_MEASUREMENT
state_class=STATE_CLASS_MEASUREMENT,
icon=ICON_WAVEFORM
).extend({
cv.Optional(CONF_UPDATE_INTERVAL): cv.positive_time_period_milliseconds
})
Expand Down

0 comments on commit 5095ce0

Please sign in to comment.