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

Added support for Wooliis LCD Coulometer/Battery Monitor #21732

Merged
merged 2 commits into from
Jul 17, 2024

Conversation

lmelette
Copy link
Contributor

@lmelette lmelette commented Jul 4, 2024

Description:

This commit adds the capability to gather data from Wooliis/Drok/AiLi battery monitors. They look like this:
wooliis_batmon
These devices are quite useful to monitor offgrid systems with a battery.
The integration requires only one communication pin, to receive serial data from the metering device.
Binary data is decoded and mapped to the following properties (Web UI):
wooliis_entries

Checklist:

  • The pull request is done against the latest development branch
  • Only relevant files were touched
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • The code change is tested and works with Tasmota core ESP8266 V.13.3.0
  • The code change is tested and works with Tasmota core ESP32 V.14.1.0
  • I accept the CLA.

@s-hadinger
Copy link
Collaborator

Awesome, thanks
I will let @arendst review it as well

@lmelette
Copy link
Contributor Author

lmelette commented Jul 5, 2024

And sorry for the confusion on the versions I reported in the checklist, they are Tasmota versions not "Tasmota core" ones. Anyway, I started using this code from v13.3 and now adjusted it to match the updates in v14.1.

dtostrfd(Wooliis.energy_out, 1, float_str);
ResponseAppend_P(PSTR("\"%s\":%s"), D_ENERGY, float_str);
dtostrfd(Wooliis.energy_in, 1, float_str);
ResponseAppend_P(PSTR("\"%s\":%s,"), D_ENERGY "_returned", float_str);
Copy link
Owner

Choose a reason for hiding this comment

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

Do not make composite fieldnames. To keep using already known names and keeping code as small as possible I would suggest to use D_JSON_EXPORT here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright, so for energy going into the battery I will use _IMPORT and for energy supplied by the battery I will use _EXPORT. Does that make sense?

Copy link
Owner

Choose a reason for hiding this comment

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

Yes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Regarding these items, I could easily use the D_JSON_ ones, but the D_ ones are missing. E.g.
#define D_IMPORT "Import"
#define D_EXPORT "Export"
Should I add them to my sensor code or to the language files?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@arendst this is the last question for you, all the rest has been modified and tested.

Copy link
Owner

Choose a reason for hiding this comment

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

yes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh well, so if yes means sensor code, it's done, here are the definitions:

#define D_IMPORT "Import"
#define D_EXPORT "Export"
#define D_JSON_CAPACITY "Capacity"
#define D_JSON_CHARGING "Charging"

If that was the wrong interpretation, I will change it.
Anything else to be modified?

Copy link
Owner

Choose a reason for hiding this comment

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

You've done enough to make it work.

I'll merge this and will change some duplicates to lower the codebase.

Thx.

@arendst arendst merged commit 9c8f382 into arendst:development Jul 17, 2024
59 checks passed
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