Louisvdw / dbus-serialbattery

Battery Monitor driver for serial battery in VenusOS GX systems
MIT License
544 stars 147 forks source link

Permission denied #665

Closed Seb-Man closed 1 year ago

Seb-Man commented 1 year ago

Describe the problem

Hello, I can not change the DCL value on version V1.0.0. I got a "Permission denied" message. I don't understand.

Can you help me?

Thank you so much

Driver version

1.0.0 (20230508)

Venus OS device type

Cerbo GX

Venus OS version

2.94

BMS type

JKBMS / Heltec BMS

Cell count

16

Connection type

Serial USB adapter to RS485

Config file

login as: root
root@192.168.1.170's password:
Last login: Tue May 23 18:56:05 2023
root@einstein:~# /data/etc/dbus-serialbattery/reinstall-local.sh
Venus OS v2.92 is older than v3.00~14. Replacing VisibleItemModel with VisualIte                                                                                                                                                             mModel... done.
sed: /var/spool/cron/root: No such file or directory
No Bluetooth battery configuration found in "/data/etc/dbus-serialbattery/config                                                                                                                                                             .ini".
You can ignore this, if you are using only a serial connection.

SERIAL battery connection: The installation is complete. You don't have to do an                                                                                                                                                             ything more.

BLUETOOTH battery connection: There are a few more steps to complete installatio                                                                                                                                                             n.

    1. Please add the Bluetooth BMS to the config file "/data/etc/dbus-serialbat                                                                                                                                                             tery/config.ini" by adding "BLUETOOTH_BMS":
       Example with 1 BMS: BLUETOOTH_BMS = Jkbms_Ble C8:47:8C:00:00:00
       Example with 3 BMS: BLUETOOTH_BMS = Jkbms_Ble C8:47:8C:00:00:00, Jkbms_Bl                                                                                                                                                             e C8:47:8C:00:00:11, Jkbms_Ble C8:47:8C:00:00:22
       If your Bluetooth BMS are nearby you can show the MAC address with "bluet                                                                                                                                                             oothctl devices".

    2. Make sure to disable Settings -> Bluetooth in the remote console/GUI to p                                                                                                                                                             revent reconnects every minute.

    3. Re-run "/data/etc/dbus-serialbattery/reinstall-local.sh", if the Bluetoot                                                                                                                                                             h BMS were not added to the "config.ini" before.

    ATTENTION!
    If you changed the default connection PIN of your BMS, then you have to pair                                                                                                                                                              the BMS first using OS tools like the "bluetoothctl".
    See https://wiki.debian.org/BluetoothUser#Using_bluetoothctl for more detail                                                                                                                                                             s.

CUSTOM SETTINGS: If you want to add custom settings, then check the settings you                                                                                                                                                              want to change in "/data/etc/dbus-serialbattery/config.default.ini"
                 and add them to "/data/etc/dbus-serialbattery/config.ini" to pe                                                                                                                                                             rsist future driver updates.

root@einstein:~# /data/etc/dbus-serialbattery/config.default.ini
-sh: /data/etc/dbus-serialbattery/config.default.ini: Permission denied
root@einstein:~#

Relevant log output

login as: root
root@192.168.1.170's password:
Last login: Tue May 23 18:56:05 2023
root@einstein:~# /data/etc/dbus-serialbattery/reinstall-local.sh
Venus OS v2.92 is older than v3.00~14. Replacing VisibleItemModel with VisualIte                                                                                                                                                             mModel... done.
sed: /var/spool/cron/root: No such file or directory
No Bluetooth battery configuration found in "/data/etc/dbus-serialbattery/config                                                                                                                                                             .ini".
You can ignore this, if you are using only a serial connection.

SERIAL battery connection: The installation is complete. You don't have to do an                                                                                                                                                             ything more.

BLUETOOTH battery connection: There are a few more steps to complete installatio                                                                                                                                                             n.

    1. Please add the Bluetooth BMS to the config file "/data/etc/dbus-serialbat                                                                                                                                                             tery/config.ini" by adding "BLUETOOTH_BMS":
       Example with 1 BMS: BLUETOOTH_BMS = Jkbms_Ble C8:47:8C:00:00:00
       Example with 3 BMS: BLUETOOTH_BMS = Jkbms_Ble C8:47:8C:00:00:00, Jkbms_Bl                                                                                                                                                             e C8:47:8C:00:00:11, Jkbms_Ble C8:47:8C:00:00:22
       If your Bluetooth BMS are nearby you can show the MAC address with "bluet                                                                                                                                                             oothctl devices".

    2. Make sure to disable Settings -> Bluetooth in the remote console/GUI to p                                                                                                                                                             revent reconnects every minute.

    3. Re-run "/data/etc/dbus-serialbattery/reinstall-local.sh", if the Bluetoot                                                                                                                                                             h BMS were not added to the "config.ini" before.

    ATTENTION!
    If you changed the default connection PIN of your BMS, then you have to pair                                                                                                                                                              the BMS first using OS tools like the "bluetoothctl".
    See https://wiki.debian.org/BluetoothUser#Using_bluetoothctl for more detail                                                                                                                                                             s.

CUSTOM SETTINGS: If you want to add custom settings, then check the settings you                                                                                                                                                              want to change in "/data/etc/dbus-serialbattery/config.default.ini"
                 and add them to "/data/etc/dbus-serialbattery/config.ini" to pe                                                                                                                                                             rsist future driver updates.

root@einstein:~# /data/etc/dbus-serialbattery/config.default.ini
-sh: /data/etc/dbus-serialbattery/config.default.ini: Permission denied
root@einstein:~#

Any other information that may be helpful

No response

mr-manuel commented 1 year ago

Did you check the FAQ?

Seb-Man commented 1 year ago

yes several times, but I can't do it

Seb-Man commented 1 year ago

I had done it on a previous version, but on version V1.0.0 I don't understand the process

mr-manuel commented 1 year ago

This will not work, you cannot run a INI file root@einstein:~# /data/etc/dbus-serialbattery/config.default.ini

You have to edit it with a editor like nano: root@einstein:~# nano /data/etc/dbus-serialbattery/config.default.ini

Make your custom changes in the config.ini and not in the config.default.ini. https://louisvdw.github.io/dbus-serialbattery/general/install#settings-locationpath

Seb-Man commented 1 year ago

it is not possible to perform the same operation as on the previous versions? I'm a beginner I have a hard time understanding

Seb-Man commented 1 year ago
login as: root
root@192.168.1.170's password:
Last login: Tue May 23 21:05:07 2023 from 192.168.1.200
root@einstein:~# nano /data/etc/dbus-serialbattery/FILE_NAMEnano /data/etc/dbus-                 serialbattery/MAX_BATTERY_DISCHARGE_CURRENT
root@einstein:~# nano /data/etc/dbus-serialbattery/MAX_BATTERY_DISCHARGE_CURRENT                  = 120.0
root@einstein:~# reboot

Broadcast message from root@einstein (pts/0) (Tue May 23 21:15:59 2023):

The system is going down for reboot NOW!
root@einstein:~#

Is this the correct method?

mr-manuel commented 1 year ago

Unfortunately not. Just read correctly the documentation and my post above.

Alone this command nano /data/etc/dbus-serialbattery/FILE_NAME shows me that you did not read the documentation, but only copy and pasted the command you found. If you were able to edit the utils.py I don't know, why you are not able to edit the config.ini...

Here again the links to the documentation. Read all and it will work.

Settings location/path

How to edit utils.py or config.ini

Seb-Man commented 1 year ago

I'm really not good, I spent several hours trying to change the settings but I can't do it... I don't know if it's a translation problem as I'm French and don't speak English. Attached is a screenshot, is this the right way? putty

mr-manuel commented 1 year ago

Try deepl.com instead of Google translate. I speak four languages, but not french.

The file should look like this, so you are close.

[DEFAULT]

; --------- Battery Current limits ---------
MAX_BATTERY_CHARGE_CURRENT    = 50.0
MAX_BATTERY_DISCHARGE_CURRENT = 60.0
Seb-Man commented 1 year ago

thank you for your patience I made an error that bugged the system I can't get the V1.0.0 version to work I can only manage to install v0.14.3 Is this normal? Thank you

mr-manuel commented 1 year ago

I think the biggest problem in your case is the language barrier.

You can uninstall and remove the driver and then reinstall it.

Seb-Man commented 1 year ago

I have uninstalled several times and reinstalled like the screenshot and I have version 0.14.3 and not V1.0.0. I do not understand why V1.0.0 is the latest version recommended? putty instal

mr-manuel commented 1 year ago

I do not understand why V1.0.0 is the latest version recommended?

Because it contains a lot of fixes and improvements. Shortly it will be released as stable version.

Seb-Man commented 1 year ago

Hello, I have just installed the new version v1.0.20230531. It's great, many thanks for all the work you've done. But I still can't modify the CCL and DCL.

I tried with this code but still no change. I don't understand what I'm doing wrong.

Can you enlighten me?

Thank you

nano /data/etc/dbus-serialbattery
[DEFAULT]

; --------- Battery Current limits ---------
MAX_BATTERY_CHARGE_CURRENT    = 70.0
MAX_BATTERY_DISCHARGE_CURRENT = 120.0

; --------- Cell Voltages ---------
; Description: Cell min/max voltages which are used to calculate the min/max battery voltage
; Example: 16 cells * 3.45V/cell = 55.2V max charge voltage. 16 cells * 2.90V = 46.4V min discharge voltage
MIN_CELL_VOLTAGE   = 2.900
; Max voltage can seen as absorption voltage
MAX_CELL_VOLTAGE   = 3.450
FLOAT_CELL_VOLTAGE = 3.375

; --------- Charge mode ---------
; Choose the mode for voltage / current limitations (True / False)
; False is a step mode: This is the default with limitations on hard boundary steps
; True is a linear mode:
;     For CCL and DCL the values between the steps are calculated for smoother values (by WaldemarFech)
;     For CVL max battery voltage is calculated dynamically in order that the max cell voltage is not exceeded
LINEAR_LIMITATION_ENABLE = True

; Specify in seconds how often the linear values should be recalculated
LINEAR_RECALCULATION_EVERY = 60
; Specify in percent when the linear values should be recalculated immediately
; Example: 5 for a immediate change, when the value changes by more than 5%
LINEAR_RECALCULATION_ON_PERC_CHANGE = 5

; --------- Charge Voltage limitation (affecting CVL) ---------
; Description: Limit max charging voltage (MAX_CELL_VOLTAGE * cell count), switch from max voltage to float
;              voltage (FLOAT_CELL_VOLTAGE * cell count) and back
;     False: Max charging voltage is always kept
;     True: Max charging voltage is reduced based on charge mode
;         Step mode: After max voltage is reached for MAX_VOLTAGE_TIME_SEC it switches to float voltage. After
;                    SoC is below SOC_LEVEL_TO_RESET_VOLTAGE_LIMIT it switches back to max voltage.
;         Linear mode: After max voltage is reachend and cell voltage difference is smaller or equal to
;                      CELL_VOLTAGE_DIFF_KEEP_MAX_VOLTAGE_UNTIL it switches to float voltage after 300 (fixed)
;                      additional seconds.
;                      After cell voltage difference is greater or equal to CELL_VOLTAGE_DIFF_TO_RESET_VOLTAGE_LIMIT
;                      OR
;                      SoC is below SOC_LEVEL_TO_RESET_VOLTAGE_LIMIT
;                      it switches back to max voltage.
; Example: The battery reached max voltage of 55.2V and hold it for 900 seconds, the the CVL is switched to
;          float voltage of 53.6V to don't stress the batteries. Allow max voltage of 55.2V again, if SoC is
;          once below 90%
;          OR
;          The battery reached max voltage of 55.2V and the max cell difference is 0.010V, then switch to float
;          voltage of 53.6V after 300 additional seconds to don't stress the batteries. Allow max voltage of
;          55.2V again if max cell difference is above 0.080V or SoC below 90%.
; Charge voltage control management enable (True/False).
CVCM_ENABLE = True

; -- CVL reset based on cell voltage diff (linear mode)
; Specify cell voltage diff where CVL limit is kept until diff is equal or lower
CELL_VOLTAGE_DIFF_KEEP_MAX_VOLTAGE_UNTIL = 0.010
; Specify cell voltage diff where CVL limit is reset to max voltage, if value get above
; the cells are considered as imbalanced, if the cell diff exceeds 5% of the nominal cell voltage
; e.g. 3.2 V * 5 / 100 = 0.160 V
CELL_VOLTAGE_DIFF_TO_RESET_VOLTAGE_LIMIT = 0.080

; -- CVL reset based on SoC option (step mode)
; Specify how long the max voltage should be kept, if reached then switch to float voltage
MAX_VOLTAGE_TIME_SEC = 900
; Specify SoC where CVL limit is reset to max voltage, if value gets below
SOC_LEVEL_TO_RESET_VOLTAGE_LIMIT = 90

; --------- Cell Voltage Current limitation (affecting CCL/DCL) ---------
; Description: Maximal charge / discharge current will be in-/decreased depending on min and max cell voltages
; Example: 18 cells * 3.55V/cell = 63.9V max charge voltage
;          18 cells * 2.70V/cell = 48.6V min discharge voltage
;          But in reality not all cells reach the same voltage at the same time. The (dis)charge current
;          will be (in-/)decreased, if even ONE SINGLE BATTERY CELL reaches the limits

; Charge current control management referring to cell-voltage enable (True/False).
CCCM_CV_ENABLE = True
; Discharge current control management referring to cell-voltage enable (True/False).
DCCM_CV_ENABLE = True

; Set steps to reduce battery current
; The current will be changed linear between those steps if LINEAR_LIMITATION_ENABLE is set to True
CELL_VOLTAGES_WHILE_CHARGING   = 3.55, 3.50, 3.45, 3.30
MAX_CHARGE_CURRENT_CV_FRACTION =    0, 0.05,  0.5,    1

CELL_VOLTAGES_WHILE_DISCHARGING   = 2.70, 2.80, 2.90, 3.10
MAX_DISCHARGE_CURRENT_CV_FRACTION =    0,  0.1,  0.5,    1

; --------- Temperature limitation (affecting CCL/DCL) ---------
; Description: Maximal charge / discharge current will be in-/decreased depending on temperature
; Example: The temperature limit will be monitored to control the currents. If there are two temperature senors,
;          then the worst case will be calculated and the more secure lower current will be set.
; Charge current control management referring to temperature enable (True/False).
CCCM_T_ENABLE = True
; Charge current control management referring to temperature enable (True/False).
DCCM_T_ENABLE = True

; Set steps to reduce battery current
; The current will be changed linear between those steps if LINEAR_LIMITATION_ENABLE is set to True
TEMPERATURE_LIMITS_WHILE_CHARGING = 0,   2,   5,  10,  15, 20, 35,  40, 55
MAX_CHARGE_CURRENT_T_FRACTION     = 0, 0.1, 0.2, 0.4, 0.8,  1,  1, 0.4,  0

TEMPERATURE_LIMITS_WHILE_DISCHARGING = -20,   0,   5,  10, 15, 45, 55
MAX_DISCHARGE_CURRENT_T_FRACTION     =   0, 0.2, 0.3, 0.4,  1,  1,  0

; --------- SOC limitation (affecting CCL/DCL) ---------
; Description: Maximal charge / discharge current will be increased / decreased depending on State of Charge,
;              see CC_SOC_LIMIT1 etc.
; Example: The SoC limit will be monitored to control the currents.
; Charge current control management enable (True/False).
CCCM_SOC_ENABLE = True
; Discharge current control management enable (True/False).
DCCM_SOC_ENABLE = True

; Charge current soc limits
CC_SOC_LIMIT1 = 98
CC_SOC_LIMIT2 = 95
CC_SOC_LIMIT3 = 91

; Charge current limits
CC_CURRENT_LIMIT1_FRACTION = 0.1
CC_CURRENT_LIMIT2_FRACTION = 0.3
CC_CURRENT_LIMIT3_FRACTION = 0.5

; Discharge current soc limits
DC_SOC_LIMIT1 = 10
DC_SOC_LIMIT2 = 20
DC_SOC_LIMIT3 = 30

; Discharge current limits
DC_CURRENT_LIMIT1_FRACTION = 0.1
DC_CURRENT_LIMIT2_FRACTION = 0.3
DC_CURRENT_LIMIT3_FRACTION = 0.5

; --------- Time-To-Go ---------
; Description: Calculates the time to go shown in the GUI
;              Recalculation is done based on TIME_TO_SOC_RECALCULATE_EVERY
TIME_TO_GO_ENABLE = True

; --------- Additional settings ---------
; Specify only one BMS type to load else leave empty to try to load all available
; -- Available BMS:
; Daly, Ecs, HeltecModbus, HLPdataBMS4S, Jkbms, Lifepower, LltJbd, Renogy, Seplos
; -- Available BMS, but disabled by default:
; https://louisvdw.github.io/dbus-serialbattery/general/install#how-to-enable-a-disabled-bms
; Ant, MNB, Sinowealth
BMS_TYPE = Jkbms

; Publish the config settings to the dbus path "/Info/Config/"
PUBLISH_CONFIG_VALUES = 1

; Select the format of cell data presented on dbus [Valid values 0,1,2,3]
; 0 Do not publish all the cells (only the min/max cell data as used by the default GX)
; 1 Format: /Voltages/Cell (also available for display on Remote Console)
; 2 Format: /Cell/#/Volts
; 3 Both formats 1 and 2
BATTERY_CELL_DATA_FORMAT = 1

; Simulate Midpoint graph (True/False).
MIDPOINT_ENABLE = False

; Battery temperature
; Specify how the battery temperature is assembled
; 0 Get mean of temperature sensor 1 to sensor 4
; 1 Get only temperature from temperature sensor 1
; 2 Get only temperature from temperature sensor 2
; 3 Get only temperature from temperature sensor 3
; 4 Get only temperature from temperature sensor 4
TEMP_BATTERY = 0

; Temperature sensor 1 name
TEMP_1_NAME = Temp 1

; Temperature sensor 2 name
TEMP_2_NAME = Temp 2

; Temperature sensor 2 name
TEMP_3_NAME = Temp 3

; Temperature sensor 2 name
TEMP_4_NAME = Temp 4

; --------- BMS specific settings ---------

; -- LltJbd settings
; SoC low levels
; NOTE: SOC_LOW_WARNING is also used to calculate the Time-To-Go even if you are not using a LltJbd BMS
SOC_LOW_WARNING = 20
SOC_LOW_ALARM   = 10

; -- Daly settings
; Battery capacity (amps), if the BMS does not support reading it
BATTERY_CAPACITY = 280
; Invert Battery Current. Default non-inverted. Set to -1 to invert
INVERT_CURRENT_MEASUREMENT = 1

; -- ESC GreenMeter and Lipro device settings
GREENMETER_ADDRESS  = 1
LIPRO_START_ADDRESS = 2
LIPRO_END_ADDRESS   = 4
LIPRO_CELL_COUNT = 15

; -- HeltecModbus (Heltec SmartBMS/YYBMS) settings
; Set the Modbus addresses from the adapters
; Separate each address to check by a comma like: 1, 2, 3, ...
; factory default address will be 1
HELTEC_MODBUS_ADDR = 1

; --------- Battery monitor specific settings ---------
; If you are using a SmartShunt or something else as a battery monitor, the battery voltage reported
; from the BMS and SmartShunt could differ. This causes, that the driver never goapplies the float voltage,
; since max voltage is never reached.
; Example:
;     cell count: 16
;     MAX_CELL_VOLTAGE = 3.45
;     max voltage calculated = 16 * 3.45 = 55.20
;     CVL is set to 55.20 and the battery is now charged until the SmartShunt measures 55.20 V. The BMS
;     now measures 55.05 V since there is a voltage drop of 0.15 V. Since the dbus-serialbattery measures
;     55.05 V the max voltage is never reached for the driver and max voltage is kept forever.
;     Set VOLTAGE_DROP to 0.15
VOLTAGE_DROP = 0.00
mr-manuel commented 1 year ago
nano /data/etc/dbus-serialbattery

This for sure could not work. Please describe step for step what you did. Did you check the documentation?

Seb-Man commented 1 year ago

Hello, a friend came to help me translate. I finally managed to change the values.

Thank you for your help, you're doing a great job!

Thank you