Skip to content
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

Usermod INA219 Current, Voltage & Power Sensor #4237

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open

Conversation

KrX3D
Copy link

@KrX3D KrX3D commented Oct 31, 2024

Hi,

i created a usermod for the ina219 Current, Voltage & Power Sensor:

INA219-Pin-Outs

I took a liking to the INA226 Usermod here:

https://github.com/Aircoookie/WLED/tree/0_15/usermods/INA226_v2

and took some parts and added my 3 cents to it.

I hope the readme states everything needed to get what can be done.

the only think i couldnt solved is to add the sensors data to the wled home assistant integration page (if thats even possible) so instead it is added just to mqtt. if there is a way to have the autodiscover to add it directly to the wled integrations page, i would be more than happy to change the usermod.

also i hope i added everything correctly in git, since its my first time working like this in git

@DedeHai
Copy link
Collaborator

DedeHai commented Nov 1, 2024

since you keep adding commits, is this work in progress? if so, mark it as such or better yet: commit to this PR once you are finished.

@KrX3D
Copy link
Author

KrX3D commented Nov 1, 2024

since you keep adding commits, is this work in progress? if so, mark it as such or better yet: commit to this PR once you are finished.

Hi,

no its finsied. I just did some small formatting changes while waiting for a reply. But now im happy with it ;)

EDIT: im also using it for like 2 weeks now without any problems

@DedeHai
Copy link
Collaborator

DedeHai commented Nov 1, 2024

ok nice. did you test it working on different ESPs?

@KrX3D
Copy link
Author

KrX3D commented Nov 1, 2024

i tested it on an ESP32 S2 (lolin_s2_mini) and an C3 (esp32c3dev) where it is working.

like i said its already running for around 2 weeks

@KrX3D
Copy link
Author

KrX3D commented Nov 14, 2024

Hi,

i tested it now also with an ESp32 Wroom-32 (esp32dev) and it also worked.

did i forget something so it will be added to version 0,15?
im new to git with all this pull request stuff

@DedeHai
Copy link
Collaborator

DedeHai commented Nov 14, 2024

looks fine, needs more testing and review, there are a few usermods in pipeline so please be patient.

changed uint8_t to int8_t for _sdaPin and _sclPin --->  to be able to pick "unused" in pin selection which is -1,
Several optimizations for WLED_MQTT_CONNECTED and if Usermod is enabled/disabled
@netmindz netmindz changed the base branch from 0_15 to main December 16, 2024 13:29
usermods/INA219/usermod_ina219.h Outdated Show resolved Hide resolved
usermods/INA219/usermod_ina219.h Outdated Show resolved Hide resolved
usermods/INA219/usermod_ina219.h Outdated Show resolved Hide resolved
@KrX3D KrX3D requested a review from DedeHai January 29, 2025 18:31
wled00/const.h Outdated Show resolved Hide resolved
usermods/INA219/usermod_ina219.h Outdated Show resolved Hide resolved
usermods/INA219/usermod_ina219.h Outdated Show resolved Hide resolved
KrX3D added 3 commits January 30, 2025 18:34
- Moved configurable settings to the top of the file for better readability.
- Defined default values for each configuration option using #ifndef directives.
- Updated default I2C pins to WLED ESP32 defaults (SDA: 21, SCL: 22).
- Cleaned up variable initialization to use pre-defined constants for configuration.
@KrX3D KrX3D requested a review from DedeHai January 31, 2025 16:59
@DedeHai
Copy link
Collaborator

DedeHai commented Feb 1, 2025

looks good now.
did you test that the UM compiles on all platforms? if it does not: throw compile errors for platforms not supported.

@DedeHai DedeHai added the usermod usermod related label Feb 1, 2025
@KrX3D
Copy link
Author

KrX3D commented Feb 1, 2025

Hi,
i updated ReadMe and pictues since i removed the SDA/SCL pin selection from the usermod.


im not sure if i also should add this under lib_deps inside platformio.ini:
wollewald/INA219_WE@~1.3.8

i already added the info to the readme. I mean here:

image


i compiled it for all default_envs (v0.15) and got no errors:

image


for my own info, is there a way to exclude COM1 from beeing uploaded? compiling was taking to long that way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants