Skip to content

Esphome component related updates#274

Open
p1ngb4ck wants to merge 16 commits intokanflo:masterfrom
p1ngb4ck:esphome_related_updates
Open

Esphome component related updates#274
p1ngb4ck wants to merge 16 commits intokanflo:masterfrom
p1ngb4ck:esphome_related_updates

Conversation

@p1ngb4ck
Copy link
Copy Markdown

@p1ngb4ck p1ngb4ck commented Feb 3, 2026

As the title says - my esphome component allows for ethernet connectivity as well, therefore I propose the following rework.
Mostly just renaming from wifi to network and add ethernet logic & symbol.
Also, display backlight value was added to response-content and I changed default baud to 19200 after intensive changes (please just deny that change of course if you dont agree)
Removed the status code change and rather changed my esphome component to be fully backwards compatible, no need to reflash if someone doesnt need display backlight in query response etc.

Esphome component finished now as well, last remaining point is to create a nice HA custom card
ESPHome component features:

  • handle sensors for VIN/VOUT/CUR_OUT
  • handle inputs for voltage, current, output switch (enable/disable), lock, display
  • provides functionalits for data logging to sd
  • provides calibration value request & save to sd storage + auto-restore after flashing fw
  • fw upgrade function capable of handling different bootloader speeds (if bootloaders uart baud rate setting is different from "main" opendps one) and capable of using esphome-devices "local" storage (sd/usb/internal flash data/extra spi flash attached)
    to read fw bin file from
  • provides tcp bridge on configurable port, auto-pausing and resuming when/after external tcp client connects - use in dpsctly.py with param "-d tcp:"

As esphome can deal with ethernet/wifi + mqtt + api connections (ha & custom) -> these features are automatically available as well when replacing the esp8266 wifi-serial- proxy with an esphome based device using my opendps component

Hope this helps =)

Comment thread dpsboot/Makefile
Comment thread opendps/Makefile
Comment thread opendps/Makefile
Comment thread opendps/Makefile
@kanflo
Copy link
Copy Markdown
Owner

kanflo commented Feb 14, 2026

Thanks! I like this PR and only have a few minor comments.

@p1ngb4ck
Copy link
Copy Markdown
Author

Should be all done now, thanks so much again for this awesome project and still maintaining it !!!!!!!!
jftr - for readers that may see this:
After calibration with a cheap 8ohms 200W load using dpsctl.py, my OpenDPS (DPS5005 model) is extremely exact again (0-3mV/mA both compared to expensive Fluke multimeter measurements).
Together with the high-speed network update rate and integration into HA (automations etc) this is actually the lab psu I always wanted to have !

kleineckeoliver-boop and others added 2 commits April 18, 2026 16:12
Both dpsboot and opendps now always start at 9600. Main firmware reads
past_uart_baud on boot and switches to the saved operational baud.

- protocol: add cmd_set_baud (22) for runtime baud negotiation
- pastunits: add past_uart_baud for persisting operational baud
- opendps: add hw_set_baudrate(), opendps_set_uart_baud(), opendps_is_valid_baud()
- protocol_handler: add handle_set_baud() - ACKs at old baud, then switches
- dpsboot: add hw_set_baudrate_boot(), handle cmd_set_baud session-only
- Rename cmd_success_with_response (was cmd_success_but_i_actually_sent_my_own_status_thank_you_very_much)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@p1ngb4ck
Copy link
Copy Markdown
Author

Hey - would you mind having a look at this again?
Changed baudrate stuff as desired :

Bootloader & Firmware always start off at 9600
Bootloader can be set to different baudrate via CMD before upgrade if desired
Baud for main fw can be "set" and will be saved and re-applied. If master reset is done, it will revert back to 9600.

This way no baud config during compile is required, all bauds can be changed, it remains "simple" and is very safe as well, no bricking possible - not even "hard" to reach bl should be possible this way

kleineckeoliver-boop and others added 7 commits April 18, 2026 16:21
- protocol.py: add CMD_SET_BAUD (23), VALID_BAUD_RATES, create_set_baud()
- dpsctl.py: add --set-baud to set/save device UART baud at runtime
- dpsctl.py: add --upgrade-baud to switch bootloader to faster rate after
  upgrade_start ACK for faster data transfer
- tty_interface: add set_baudrate() to switch serial port without reconnecting
- handle_response: handle CMD_SET_BAUD response

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Eliminates per-sample ADC noise from display and query values.
OCP/OVP still operate on raw per-sample values for fast response.
i_out averaging uses offset-corrected value matching OCP logic.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…display

- hw.c: i_corrected was applying adc_i_offset twice when pwrctl_i_limit_raw
  was set (i already had offset added for OCP check). Fix: only apply offset
  in averaging path when the OCP block was skipped (limit not yet loaded).
- opendps.c: increase Vin display from 1 to 2 decimal places.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ADC offset calibration leaves a ~8mA residual baseline on this unit
due to ADC_CHA_IOUT_GOLDEN_VALUE being tuned for the developer's unit.
Clamp averaged i_out to 0 when <= 10 counts; 11mA+ is unaffected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…urrent

Derived from calibration data: A_ADC_K=1.64672816, A_ADC_C=-106.07878113
Zero count = 106.08/1.647 = 64.41 → 64 (was 69/0x45, causing +8mA baseline offset)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Set correct value (64) directly in dps-model.h for DPS5005 instead of
overriding via Makefile -D flag, which caused redefinition warnings
(dps-model.h defines unconditionally, hw.c has #ifndef guard, Makefile
-D was a third conflicting definition).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread dpsboot/dpsboot.c Outdated
}
uint8_t valid = 0;
switch (baud) {
case 9600: case 19200: case 38400: case 57600: case 115200:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or use opendps_is_valid_baud(...) ;)

Comment thread opendps/hw.c Outdated
void hw_set_baudrate(uint32_t baud)
{
switch (baud) {
case 9600: case 19200: case 38400: case 57600: case 115200:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or use opendps_is_valid_baud(...) ;)

Comment thread opendps/opendps.c Outdated
* UART meaning this message got lost. The ESP will however send the
* wifi_connected status when it connects but if that does not happen, the
* ui module will turn off the wifi icon after 10s to save the user's
* twork_connected status when it connects but if that does not happen, the
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Speling

@kanflo
Copy link
Copy Markdown
Owner

kanflo commented Apr 19, 2026

Just a few minor wrinkles and then we should be able to merge this before the weekend is over. Thanks for your contribution!

@p1ngb4ck
Copy link
Copy Markdown
Author

p1ngb4ck commented Apr 19, 2026

<3 thanks so much fort reviewing so quickly - a little ashamed of these "stupid" mistakes I left in there rn - gonna fix them quickly now

Edit says - should hopefully be fine now. Also added the function to dpsboot bootloader, just to make it all more consistent across project - and doesnt require "more" space for bootloader .. so I hope that`s fine
Edit 2 - compile error due to missing include fixed

@gengge2010
Copy link
Copy Markdown

gengge2010 commented Apr 19, 2026 via email

kleineckeoliver-boop and others added 2 commits April 19, 2026 12:54
…_baud to dpsboot, use it in both firmwares, fix spelling

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…or ui_parameter_t

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@p1ngb4ck
Copy link
Copy Markdown
Author

p1ngb4ck commented Apr 19, 2026

@kanflo I think u will also be proud as soon as u see what is possible with your opendps and my esphome component.
LVGL 9.5 display is almost fully complete, doing the last tiny additions/fixes at the moment.
Functions (in addition to obvious "default" functionality of opendps):

  • datalogger to sd/usb/nfs
  • fw upgrade via sd/usb/nfs-share/http-url
  • calibration via display menu & assistant
  • custom theme support (pre-defined themes + custom colors)
  • main/graphs/settings-pages
  • ethernet/wifi support in addition to "on screen controls), including ha-api & mqtt & voice-assistant support
  • very high modability - due to many unused gpios, spi/i2c available etc etc

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants