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

single cell values in logfile / debugfile #48

Closed
dakoal opened this issue Sep 17, 2021 · 10 comments · Fixed by #54
Closed

single cell values in logfile / debugfile #48

dakoal opened this issue Sep 17, 2021 · 10 comments · Fixed by #54

Comments

@dakoal
Copy link

dakoal commented Sep 17, 2021

HI.

I am always logging BMS data of the different BMS's I am using.
The single cell voltages are also logged, so I can see in a graph over time if one cell is faster dropping/rising.

Is there a way to get the (even the raw hex values) out of your wonderful piece of code into a /var/log/serial-starter/debug.txt ?

Thank you for your work.

@Louisvdw
Copy link
Owner

Hi @dakoal
There is no such logging currently, but you can add it yourself. Logging to a log file tend to be slow and we poll the BMS data for most batteries every second so I try to keep it as light as possible.

For the battery that you are using, it's driver file will have a refresh_data(self) function. Create your own log function that you can call at the end of this function.

def log_data(self):
   # this will print to screen
   for c in range(self.cell_count):
       print ("Cell {0} voltage    {1}V".format(c, self.cells[c].voltage)

@dakoal
Copy link
Author

dakoal commented Sep 17, 2021

Ok, I will try. It's a daly BMS. I will see if I can handle this in memory without file operation.

@Louisvdw
Copy link
Owner

Louisvdw commented Sep 17, 2021

It's a daly BMS.

I hope you have the Sinowealth Daly version. It has the data for each cell. The normal Daly we only use the min/max cell data that the BMS publish.
In the log file it will either say "Daly/Sinowealth BMS" or "Daly BMS" connected.

@SanderV4n
Copy link
Contributor

If its a Daly with Sinowealth chip then it should already print the cell voltages to the log.

@dakoal
Copy link
Author

dakoal commented Sep 17, 2021

If its a Daly with Sinowealth chip then it should already print the cell voltages to the log.

This one: /data/log/dbus-serialbattery.ttyUSB0/current ?
There is nothing logged, only if an error occurs.

@Louisvdw
Copy link
Owner

That is the correct log file for the USB0. You can chech which USB port your battery use in Remote Console uder your battery -> Device -> Connection

@dakoal
Copy link
Author

dakoal commented Sep 20, 2021

If its a Daly with Sinowealth chip then it should already print the cell voltages to the log.

I think it's not. No single cell values there. But with a selfmade script I can check them.

@SanderV4n
Copy link
Contributor

Here is an example from my log:

root@beaglebone:~# tail -f /data/log/dbus-serialbattery.ttyUSB0/current
@40000000614859681c9f27f4 INFO:utils:>>> INFO: current pack current: 0.000000
@40000000614859681d9c391c INFO:utils:>>> INFO: Cell 1 voltage: 3.334000 V
@40000000614859681e94ae94 INFO:utils:>>> INFO: Cell 2 voltage: 3.318000 V
@40000000614859681f9e2784 INFO:utils:>>> INFO: Cell 3 voltage: 3.334000 V
@400000006148596821386adc INFO:utils:>>> INFO: Cell 4 voltage: 3.335000 V

If the info stuff is not in there you might not have a Sinowealth BMS? What is in your log?

Louisvdw added a commit that referenced this issue Sep 29, 2021
fix #48 Cell logging
@Louisvdw Louisvdw mentioned this issue Sep 29, 2021
@Louisvdw
Copy link
Owner

@dakoal the latest beta has cell logging as an option. You need to edit the utuls.py line 10 and change the loggin level from WARNING to INFO to activate it.
logger.setLevel(logging.INFO)
https://github.com/Louisvdw/dbus-serialbattery/releases/tag/v0.9beta1
https://github.com/Louisvdw/dbus-serialbattery/wiki/How-to-install

PS @SanderV4n if you want to keep the same level of logging for your Sinowealth you need to do the same.

@SanderV4n
Copy link
Contributor

@Louisvdw I was looking at your changes, they look good! The logging was mostly for development, so its fine to have it at a lower level.

CaptKrisp pushed a commit to CaptKrisp/dbus-serialbattery that referenced this issue Sep 23, 2024
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 a pull request may close this issue.

3 participants