Skip to content

Usermod libs matrix #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 53 commits into
base: usermod-libs
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
27d3420
Build each usermod in isolation
netmindz Jan 22, 2025
0e7d5dd
Build each usermod in isolation
netmindz Jan 22, 2025
04c7eac
Use JSON for usermods list
netmindz Jan 22, 2025
b3af04d
Use JSON for usermods list
netmindz Jan 22, 2025
b1b2eea
Use JSON for usermods list
netmindz Jan 22, 2025
8d4c911
Fix typo in env name
netmindz Jan 22, 2025
5f19608
Merge branch 'usermod-libs' into usermod-libs-matrix
netmindz Jan 22, 2025
7d48bba
build usermod_esp32
netmindz Jan 22, 2025
74672e2
Verify each usermod on change
netmindz Jan 22, 2025
99108f9
Swap ordering to see if naming is then clearer
netmindz Jan 22, 2025
199529a
Also run if the workflow changes
netmindz Jan 22, 2025
3a31d5d
Merge branch 'usermod-libs' into usermod-libs-matrix
netmindz Feb 7, 2025
e7e0eb0
Pinwheel Rework
Brandon502 Feb 14, 2025
80061e8
Pinwheel: Use sin/cos16_t
Brandon502 Feb 25, 2025
2012317
initial version, basically working but repetitive patterns, work in p…
DedeHai Mar 3, 2025
9553425
some speed improvements using better hash, scaling is still off...
DedeHai Mar 4, 2025
5e80730
3D works but needs finetuning to match old looks
DedeHai Mar 7, 2025
4ecc531
updated scaling, improved hashing, updated rotozoomer to not use a bu…
DedeHai Mar 8, 2025
a6d9a82
Merge pull request #4480 from willmmiles/usermod-libs
netmindz Mar 11, 2025
95dcb03
updated scaling
DedeHai Mar 12, 2025
229e7b9
added ranges, removed unused code
DedeHai Mar 12, 2025
494b72c
Merge remote-tracking branch 'upstream/main' into perlin_noise
DedeHai Mar 12, 2025
d2b7e47
add legacy defines for compatibility, reverted test changes in rotozo…
DedeHai Mar 14, 2025
a70bfa0
Merge pull request #4596 from Dschogo/patch-1
blazoncek Mar 15, 2025
6303151
Fix typo in build.yml
marcone Mar 22, 2025
befff2f
Merge pull request #4605 from marcone/patch-1
netmindz Mar 22, 2025
ed6efe4
Merge pull request #4551 from Brandon502/PinwheelRework
netmindz Mar 23, 2025
f328713
Fix typo
marcone Mar 23, 2025
86393e0
Merge pull request #4608 from marcone/patch-2
blazoncek Mar 23, 2025
a0d1a8c
Use enum class for json endpoint subtypes
willmmiles Mar 22, 2025
e21a09c
Separate FS write from serializeConfig
willmmiles Mar 23, 2025
9c8f8c6
Rename 'doSerializeConfig' to 'configNeedsWrite'
willmmiles Mar 23, 2025
22e2b6f
Have json/cfg return live config
willmmiles Mar 23, 2025
36cb1ca
settings_um: Use live config
willmmiles Mar 23, 2025
e76e9a3
Merge pull request #4594 from DedeHai/perlin_noise
DedeHai Mar 26, 2025
7e87891
Update USERMOD BME68X to version 1.0.2
gsieben Mar 28, 2025
b0b3196
Merge pull request #4620 from gsieben/USERMOD-BME68X-Update-to-Versio…
willmmiles Mar 29, 2025
b941654
Allow clock overlay to use LED beyond 255
blazoncek Mar 29, 2025
e979c58
Merge pull request #4609 from willmmiles/usermod-cfg-live
netmindz Apr 6, 2025
02f14ba
Updates to particle system (#4630)
DedeHai Apr 15, 2025
c661d8f
Merge pull request #4627 from blazoncek/overlay-fix
blazoncek Apr 20, 2025
3538684
Removed PS memory manager and some minor improvements (#4651)
DedeHai Apr 20, 2025
10b925a
bugfix in enumerating buttons and busses (#4657)
DedeHai Apr 23, 2025
f1d52a8
Bump h11 from 0.14.0 to 0.16.0
dependabot[bot] Apr 24, 2025
410025f
Merge pull request #4661 from wled/dependabot/pip/h11-0.16.0
netmindz Apr 25, 2025
adb9b77
Merge branch 'main' into usermod-libs-matrix
netmindz Apr 26, 2025
7852ff5
Build for each chipset
netmindz Apr 26, 2025
b77881f
Build for each chipset
netmindz Apr 26, 2025
fbb7ef7
fix custom_usermods setting
netmindz Apr 26, 2025
6c4d049
force new line
netmindz Apr 26, 2025
19ba257
usermod_esp32s3
netmindz Apr 26, 2025
92db9e0
fix envs
netmindz Apr 26, 2025
f1c88bc
fix envs
netmindz Apr 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:


build:
name: Build Enviornments
name: Build Environments
runs-on: ubuntu-latest
needs: get_default_envs
strategy:
Expand Down
70 changes: 70 additions & 0 deletions .github/workflows/usermods.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Usermod CI

on:
push:
paths:
- usermods/**
- .github/workflows/usermods.yml

jobs:

get_usermod_envs:
name: Gather Usermods
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Install PlatformIO
run: pip install -r requirements.txt
- name: Get default environments
id: envs
run: |
echo "usermods=$(find usermods/ -name library.json | xargs dirname | xargs -n 1 basename | jq -R | jq --slurp -c)" >> $GITHUB_OUTPUT
outputs:
usermods: ${{ steps.envs.outputs.usermods }}


build:
name: Build Enviornments
runs-on: ubuntu-latest
needs: get_usermod_envs
strategy:
fail-fast: false
matrix:
usermod: ${{ fromJSON(needs.get_usermod_envs.outputs.usermods) }}
environment: [usermods_esp32, usermods_esp32c3, usermods_esp32s2, usermods_esp32s3]
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: |
~/.platformio/.cache
~/.buildcache
build_output
key: pio-${{ runner.os }}-${{ matrix.environment }}-${{ hashFiles('platformio.ini', 'pio-scripts/output_bins.py') }}-${{ hashFiles('wled00/**', 'usermods/**') }}
restore-keys: pio-${{ runner.os }}-${{ matrix.environment }}-${{ hashFiles('platformio.ini', 'pio-scripts/output_bins.py') }}-
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Install PlatformIO
run: pip install -r requirements.txt
- name: Add usermods environment
run: |
cp -v usermods/platformio_override.usermods.ini platformio_override.ini
echo >> platformio_override.ini
echo "custom_usermods = ${{ matrix.usermod }}" >> platformio_override.ini

- name: Build firmware
run: pio run -e ${{ matrix.environment }}
2 changes: 1 addition & 1 deletion platformio_override.sample.ini
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ lib_deps = ${esp8266.lib_deps}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp8266.build_flags}
;
; *** To use the below defines/overrides, copy and paste each onto it's own line just below build_flags in the section above.
; *** To use the below defines/overrides, copy and paste each onto its own line just below build_flags in the section above.
;
; Set a release name that may be used to distinguish required binary for flashing
; -D WLED_RELEASE_NAME=\"ESP32_MULTI_USREMODS\"
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ click==8.1.8
# uvicorn
colorama==0.4.6
# via platformio
h11==0.14.0
h11==0.16.0
# via
# uvicorn
# wsproto
Expand Down
2,185 changes: 1,091 additions & 1,094 deletions usermods/BME68X_v2/BME68X_v2.cpp

Large diffs are not rendered by default.

102 changes: 65 additions & 37 deletions usermods/BME68X_v2/README.md
Original file line number Diff line number Diff line change
@@ -1,94 +1,100 @@
# Usermod BME68X
This usermod was developed for a BME680/BME68X sensor. The BME68X is not compatible with the BME280/BMP280 chip. It has its own library. The original 'BSEC Software Library' from Bosch was used to develop the code. The measured values are displayed on the WLED info page.

This usermod was developed for a BME680/BME68X sensor. The BME68X is not compatible with the BME280/BMP280 chip. It has its own library. The original 'BSEC Software Library' from Bosch was used to develop the code. The measured values are displayed on the WLED info page.

<p align="center"><img src="pics/pic1.png" style="width:60%;"></p>

In addition, the values are published on MQTT if this is active. The topic used for this is: 'wled/[MQTT Client ID]'. The Client ID is set in the WLED MQTT settings.

<p align="center"><img src="pics/pic2.png"></p>

If you use HomeAssistance discovery, the device tree for HomeAssistance is created. This is published under the topic 'homeassistant/sensor/[MQTT Client ID]' via MQTT.

<p align="center"><img src="pics/pic3.png"></p>

A device with the following sensors appears in HomeAssistant. Please note that MQTT must be activated in HomeAssistant.
<p align="center"><img src="pics/pic4.png" style="width:60%;"></p>

<p align="center"><img src="pics/pic4.png" style="width:60%;"></p>

## Features

Raw sensor types

Sensor Accuracy Scale Range
--------------------------------------------------------------------------------------------------
Temperature +/- 1.0 °C/°F -40 to 85 °C
Humidity +/- 3 % 0 to 100 %
Pressure +/- 1 hPa 300 to 1100 hPa
Gas Resistance Ohm
Sensor Accuracy Scale Range
-----------------------------

Temperature +/- 1.0 °C/°F -40 to 85 °C
Humidity +/- 3 % 0 to 100 %
Pressure +/- 1 hPa 300 to 1100 hPa
Gas Resistance Ohm
The BSEC Library calculates the following values via the gas resistance

Sensor Accuracy Scale Range
--------------------------------------------------------------------------------------------------
IAQ value between 0 and 500
Static IAQ same as IAQ but for permanently installed devices
CO2 PPM
VOC PPM
Gas-Percentage %

Sensor Accuracy Scale Range
-----------------------------

IAQ value between 0 and 500
Static IAQ same as IAQ but for permanently installed devices
CO2 PPM
VOC PPM
Gas-Percentage %
In addition the usermod calculates

Sensor Accuracy Scale Range
--------------------------------------------------------------------------------------------------
Absolute humidity g/m³
Dew point °C/°F
Sensor Accuracy Scale Range
-----------------------------

Absolute humidity g/m³
Dew point °C/°F

### IAQ (Indoor Air Quality)
The IAQ is divided into the following value groups.

The IAQ is divided into the following value groups.

<p align="center"><img src="pics/pic5.png"></p>

For more detailed information, please consult the enclosed Bosch product description (BME680.pdf).


## Calibration of the device

The gas sensor of the BME68X must be calibrated. This differs from the BME280, which does not require any calibration.
The gas sensor of the BME68X must be calibrated. This differs from the BME280, which does not require any calibration.
There is a range of additional information for this, which the driver also provides. These values can be found in HomeAssistant under Diagnostics.

- **STABILIZATION_STATUS**: Gas sensor stabilization status [boolean] Indicates initial stabilization status of the gas sensor element: stabilization is ongoing (0) or stabilization is finished (1).
- **RUN_IN_STATUS**: Gas sensor run-in status [boolean] Indicates power-on stabilization status of the gas sensor element: stabilization is ongoing (0) or stabilization is finished (1)

Furthermore, all GAS based values have their own accuracy value. These have the following meaning:
Furthermore, all GAS based values have their own accuracy value. These have the following meaning:

- **Accuracy = 0** means the sensor is being stabilized (this can take a while on the first run)
- **Accuracy = 1** means that the previous measured values show too few differences and cannot be used for calibration. If the sensor is at accuracy 1 for too long, you must ensure that the ambient air is chaning. Opening the windows is fine. Or sometimes it is sufficient to breathe on the sensor for approx. 5 minutes.
- **Accuracy = 0** means the sensor is being stabilized (this can take a while on the first run)
- **Accuracy = 1** means that the previous measured values show too few differences and cannot be used for calibration. If the sensor is at accuracy 1 for too long, you must ensure that the ambient air is chaning. Opening the windows is fine. Or sometimes it is sufficient to breathe on the sensor for approx. 5 minutes.
- **Accuracy = 2** means the sensor is currently calibrating.
- **Accuracy = 3** means that the sensor has been successfully calibrated. Once accuracy 3 is reached, the calibration data is automatically written to the file system. This calibration data will be used again at the next start and will speed up the calibration.

The IAQ index is therefore only meaningful if IAQ Accuracy = 3. In addition to the value for IAQ, BSEC also provides us with CO2 and VOC equivalent values. When using the sensor, the calibration value should also always be read out and displayed or transmitted.

Reasonably reliable values are therefore only achieved when accuracy displays the value 3.

## Settings

The settings of the usermods are set in the usermod section of wled.

## Settings
The settings of the usermods are set in the usermod section of wled.
<p align="center"><img src="pics/pic6.png"></p>

The possible settings are

- **Enable:** Enables / disables the usermod
- **I2C address:** I2C address of the sensor. You can choose between 0X77 & 0X76. The default is 0x77.
- **Interval:** Specifies the interval of seconds at which the usermod should be executed. The default is every second.
- **Pub Chages Only:** If this item is active, the values are only published if they have changed since the last publication.
- **Pub Accuracy:** The Accuracy values associated with the gas values are also published.
- **Pub Calib State:** If this item is active, STABILIZATION_STATUS& RUN_IN_STATUS are also published.
- **Interval:** Specifies the interval of seconds at which the usermod should be executed. The default is every second.
- **Pub Chages Only:** If this item is active, the values are only published if they have changed since the last publication.
- **Pub Accuracy:** The Accuracy values associated with the gas values are also published.
- **Pub Calib State:** If this item is active, STABILIZATION_STATUS& RUN_IN_STATUS are also published.
- **Temp Scale:** Here you can choose between °C and °F.
- **Temp Offset:** The temperature offset is always set in °C. It must be converted for Fahrenheit.
- **HA Discovery:** If this item is active, the HomeAssistant sensor tree is created.
- **Temp Offset:** The temperature offset is always set in °C. It must be converted for Fahrenheit.
- **HA Discovery:** If this item is active, the HomeAssistant sensor tree is created.
- **Pause While WLED Active:** If WLED has many LEDs to calculate, the computing power may no longer be sufficient to calculate the LEDs and read the sensor data. The LEDs then hang for a few microseconds, which can be seen. If this point is active, no sensor data is fetched as long as WLED is running.
- **Del Calibration Hist:** If a check mark is set here, the calibration file saved in the file system is deleted when the settings are saved.
- **Del Calibration Hist:** If a check mark is set here, the calibration file saved in the file system is deleted when the settings are saved.

### Sensors
Applies to all sensors. The number of decimal places is set here. If the sensor is set to -1, it will no longer be published. In addition, the IAQ values can be activated here in verbal form.

Applies to all sensors. The number of decimal places is set here. If the sensor is set to -1, it will no longer be published. In addition, the IAQ values can be activated here in verbal form.

It is recommended to use the Static IAQ for the IAQ values. This is recommended by Bosch for statically placed devices.

Expand All @@ -99,8 +105,9 @@ Data is published over MQTT - make sure you've enabled the MQTT sync interface.
In addition to outputting via MQTT, you can read the values from the Info Screen on the dashboard page of the device's web interface.

Methods also exist to read the read/calculated values from other WLED modules through code.

- getTemperature(); The scale °C/°F is depended to the settings
- getHumidity();
- getHumidity();
- getPressure();
- getGasResistance();
- getAbsoluteHumidity();
Expand All @@ -118,15 +125,36 @@ Methods also exist to read the read/calculated values from other WLED modules th
- getStabStatus();
- getRunInStatus();

## Compilation

To enable, compile with `BME68X` in `custom_usermods` (e.g. in `platformio_override.ini`)

Example:

```[env:esp32_mySpecial]
extends = env:esp32dev
custom_usermods = ${env:esp32dev.custom_usermods} BME68X
```

## Revision History

### Version 1.0.0

- First version of the BME68X_v user module

### Version 1.0.1

- Rebased to WELD Version 0.15
- Reworked some default settings
- A problem with the default settings has been fixed

### Version 1.0.2

* Rebased to WELD Version 0.16
* Fixed: Solved compilation problems related to some macro naming interferences.

## Known problems

- MQTT goes online at device start. Shortly afterwards it goes offline and takes quite a while until it goes online again. The problem does not come from this user module, but from the WLED core.
- If you save the settings often, WLED can get stuck.
- If many LEDS are connected to WLED, reading the sensor can cause a small but noticeable hang. The "Pause While WLED Active" option was introduced as a workaround.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name:": "BME68X_v2",
"build": { "libArchive": false},
"name:": "BME68X",
"dependencies": {
"boschsensortec/BSEC Software Library":"^1.8.1492"
}
Expand Down
2 changes: 1 addition & 1 deletion usermods/audioreactive/audio_reactive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ class AudioReactive : public Usermod {
const int AGC_preset = (soundAgc > 0)? (soundAgc-1): 0; // make sure the _compiler_ knows this value will not change while we are inside the function

#ifdef WLED_DISABLE_SOUND
micIn = inoise8(millis(), millis()); // Simulated analog read
micIn = perlin8(millis(), millis()); // Simulated analog read
micDataReal = micIn;
#else
#ifdef ARDUINO_ARCH_ESP32
Expand Down
49 changes: 49 additions & 0 deletions usermods/platformio_override.usermods.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[platformio]
default_envs = usermods_esp32, usermods_esp32c3, usermods_esp32s2, usermods_esp32s3

[env:usermods_esp32]
board = esp32dev
platform = ${esp32_idf_V4.platform}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32.build_flags} -D WLED_RELEASE_NAME=\"ESP32_USERMODS\"
lib_deps = ${esp32.lib_deps}
board_build.partitions = ${esp32.big_partitions}
board_build.flash_mode = dio
custom_usermods = ${usermods.custom_usermods}

[env:usermods_esp32c3]
extends = esp32c3dev
board = esp32-c3-devkitm-1
platform = ${esp32_idf_V4.platform}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32.build_flags} -D WLED_RELEASE_NAME=\"C3_USERMODS\"
lib_deps = ${esp32.lib_deps}
board_build.partitions = ${esp32.big_partitions}
board_build.flash_mode = qio
custom_usermods = ${usermods.custom_usermods}

[env:usermods_esp32s2]
extends = esp32s2dev
board = esp32-c3-devkitm-1
platform = ${esp32_idf_V4.platform}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32.build_flags} -D WLED_RELEASE_NAME=\"S2_USERMODS\"
lib_deps = ${esp32.lib_deps}
board_build.partitions = ${esp32.big_partitions}
board_build.flash_mode = dio
custom_usermods = ${usermods.custom_usermods}

[env:usermods_esp32s3]
extends = esp32s3
board = esp32-s3-devkitc-1
platform = ${esp32_idf_V4.platform}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32.build_flags} -D WLED_RELEASE_NAME=\"S3_USERMODS\"
lib_deps = ${esp32.lib_deps}
board_build.partitions = ${esp32.big_partitions}
custom_usermods = ${usermods.custom_usermods}
board_build.flash_mode = qio


[usermods]
# Added in CI
Loading