MindFreeze / dalybms

Scripts for interfacing with Daly Smart BMS
MIT License
17 stars 8 forks source link

Noob request asistance :( Repostitory structure for main is not compliant) when integrating with hacs #1

Closed mamutel closed 2 years ago

mamutel commented 3 years ago

Noob request asistance :( Repostitory structure for main is not compliant) when integrating with hacs Please show a way to install in HA Thank you!

MindFreeze commented 3 years ago

Unfortunately I haven't structured it for integration through the UI. You have to download or clone the repo into your addons folder. You can do this with samba/ssh or other methods. Then go to Supervisor -> Addon store and reload addons from the top right dots menu. After a few seconds it will show up under 'local add-ons' and you can install it.

mamutel commented 3 years ago

21-07-07 22:41:50 INFO (MainThread) [supervisor.store.git] Cloning add-on https://github.com/MindFreeze/dalybms repository 21-07-07 22:41:51 ERROR (MainThread) [supervisor.store] https://github.com/MindFreeze/dalybms is not a valid add-on repository 21-07-07 22:41:51 INFO (MainThread) [supervisor.resolution.module] Create new issue IssueType.CORRUPT_REPOSITORY - ContextType.STORE / afe8d9fe 21-07-07 22:41:51 INFO (MainThread) [supervisor.resolution.module] Create new suggestion SuggestionType.EXECUTE_REMOVE - ContextType.STORE / afe8d9fe 21-07-07 22:41:52 WARNING (MainThread) [supervisor.store.data] No repository information exists at /data/addons/git/afe8d9fe

MindFreeze commented 3 years ago

Instead of explaining I just created a valid repository. Add https://github.com/MindFreeze/home-assistant-addons to the addon store and you will get a Daly Smart BMS listed there. Note that this assumes the BMS is /dev/ttyUSB0. If you have other USB to Serial devices connected this might be wrong.

mamutel commented 3 years ago

Hi Thank you for your effort. It is a great thing to get from online enviroment. I had installed but... log from instal: [s6-init] making user provided files available at /var/run/s6/etc...exited 0. [s6-init] ensuring user provided files have correct perms...exited 0. [fix-attrs.d] applying ownership & permissions fixes... [fix-attrs.d] done. [cont-init.d] executing container initialization scripts... [cont-init.d] done. [services.d] starting services [services.d] done. Log from the system: 21-07-11 18:36:54 INFO (SyncWorker_2) [supervisor.docker.interface] Cleaning addon_07ba83e9_dalybms application 21-07-11 18:36:56 INFO (SyncWorker_2) [supervisor.docker.addon] Starting Docker add-on 07ba83e9/aarch64-addon-dalybms with version 1.1.1 21-07-11 18:37:26 WARNING (MainThread) [supervisor.misc.tasks] Watchdog found a problem with 07ba83e9_dalybms! and ... Received message on illegal discovery topic 'homeassistant/sensor/Daly Smart BMS_soc/config' Received message on illegal discovery topic 'homeassistant/sensor/Daly Smart BMS_voltage/config' Received message on illegal discovery topic 'homeassistant/sensor/Daly Smart BMS_current/config' Received message on illegal discovery topic 'homeassistant/sensor/Daly Smart BMS_balance/config' Any ideea why? I didn't got automaticaly the sensors on the entyties file...or in any other file Do I need to define it in yaml? Thank you again

MindFreeze commented 3 years ago

Ok, my bad. The default value for the device_id option is invalid. I will fix this in the next version but for a quick fix, you can change it from 'Daly Smart BMS' to anything without spaces like 'Daly-Smart-BMS'

mamutel commented 3 years ago

Hi Some small issues... first- 21-07-15 21:55:25 INFO (SyncWorker_7) [supervisor.docker.addon] Starting Docker add-on 07ba83e9/aarch64-addon-dalybms with version 1.1.2 21-07-15 21:55:56 WARNING (MainThread) [supervisor.misc.tasks] Watchdog found a problem with 07ba83e9_dalybms! 21-07-15 21:55:56 INFO (SyncWorker_3) [supervisor.docker.interface] Cleaning addon_07ba83e9_dalybms application 21-07-15 21:55:58 INFO (SyncWorker_3) [supervisor.docker.addon] Starting Docker add-on 07ba83e9/aarch64-addon-dalybms with version 1.1.2 second- The infos available are not conclusive or very usable Battery Cell Balance Unknown Battery Current 0,0 A Battery SOC 0,0 % Battery Voltage 26,3 V I can provide any other details if needed.. Thank you in advance!

MindFreeze commented 3 years ago

Looks like I have hard coded the cell count to 16. I will make this an option when I have the time. This is why the balance is unknown and might be why it dies.

Current and SOC should have worked though. This might be caused if your BMS's protocol is different. When did you buy your BMS?

mamutel commented 3 years ago

Hi Order time: 09:22 Nov. 26 2020 The recent update made every data Unknown log: [s6-init] making user provided files available at /var/run/s6/etc...exited 0. [s6-init] ensuring user provided files have correct perms...exited 0. [fix-attrs.d] applying ownership & permissions fixes... [fix-attrs.d] done. [cont-init.d] executing container initialization scripts... [cont-init.d] done. [services.d] starting services [services.d] done. Traceback (most recent call last): File "/monitor.py", line 102, in get_battery_state() File "/monitor.py", line 86, in get_battery_state buffer = res[0] IndexError: list index out of range [cmd] /run.sh exited 1 [cont-finish.d] executing container finish scripts... [cont-finish.d] done. [s6-finish] waiting for services. [s6-finish] sending all processes the TERM signal. still superviser log: 21-07-17 10:36:09 WARNING (MainThread) [supervisor.misc.tasks] Watchdog found a problem with 07ba83e9_dalybms! 21-07-17 10:36:10 INFO (SyncWorker_6) [supervisor.docker.interface] Cleaning addon_07ba83e9_dalybms application

mamutel commented 3 years ago

now : {"cell_1":3.299,"cell_2":3.3,"cell_3":3.301,"cell_4":3.301,"cell_5":3.3,"cell_6":3.3,"cell_7":3.3,"cell_8":3.3,"sum":26.4,"avg":1.65,"min":3.299,"minCell":1,"max":3.301,"maxCell":3,"diff":0.002} {"voltage":26.4,"aquisition":0.0,"current":0.0,"soc":0.0} any chance with the state of charge? Thank you for all!!! Regards Adrian

MindFreeze commented 3 years ago

Sorry but without active debugging on the device I can't tell exactly what the problem is. Looks like the response from your BMS is not the same as mine but can't be sure.

mamutel commented 2 years ago

it works like a charm --- had to empty the batery and than charge it https://drive.google.com/file/d/1V_CGmP2iBn9yyR7sVR3AzrTRPRarbueZ/view?usp=sharing Can you add please a way to show - maybe power usage of battery for the animation of a home battery as part of the energy distribution for Home Energy management. in homeassistant https://www.home-assistant.io/images/blog/2021-09/energy-battery.gif

MindFreeze commented 2 years ago

You can do this easily. For power in W, just create a template sensor and multiply current*voltage. https://www.home-assistant.io/integrations/template/

Then to get kWh for energy you can create an integration sensor from the power sensor. https://www.home-assistant.io/integrations/integration/

mamutel commented 2 years ago

Hi I had tried the folowing without susccess: sensor:

and:

sensor:

MindFreeze commented 2 years ago

Your template seems wrong. It should be something like this {{ states('sensor.battery_voltage')|float * states('sensor.battery_current')|float }}

You can test it out quickly in HA Developer Tools -> TEMPLATE