jblance / jkbms

repo with attempts to test connectivity to JK-BMS via BLE
GNU General Public License v3.0
25 stars 5 forks source link

installation update #1

Closed bhavin6666 closed 4 years ago

bhavin6666 commented 4 years ago

first to begin with thanks for all your efforts and work on LV5048 and jkbms. first time user but was able to get through the LV5048 setup. took me about a week to understand and setup the pi and data collection. not perfect but still need to learn a lot more of grafana and influx db. for this project of jkbms had to install python3 systemd, glib 2.0 in addition whatever was in the readme. maybe add more details to getting and adding the bluetooth address in jkbms.conf overall update the install document with more details for noobs like me.

still not working for me. not sure what am i missing added the correct jkbms and the bluetooth address and service and all that after browsing through all the files but still not working. how to check if the jkbms is talking to pi and sending the data? how to see the data in grafana?

jblance commented 4 years ago

Hi and thanks

Yes this is very new and kinda rough. I dont have a JK-BMS so testing was done by another It looks like you are using the daemon / service? Did you follow that readme (it has the need to install python systemd in it)?

The best way to test is start on the command line. First what model JKBMS do you have? Is the app working (can you post the version details from there)

Can you post the output of sudo hcitool lescan jkbms -d jkbms -D -p

Cheers

bhavin6666 commented 4 years ago

pi@raspberrypi:~ $ jkbms -d Query BMS via BLE Reading config file: /etc/jkbms/jkbms.conf {'SETUP': {'mqtt_broker': 'mqtthost', 'max_connection_attempts': '3', 'records': '1', 'logging_level': '20'}, 'Power Wall 1': {'model': 'JK-B1A24S', 'mac': '3C:A5:09:0A:CF:6C', 'command': 'command', 'tag': 'Power_Wall_1', 'format': 'influx2'}} Traceback (most recent call last): File "/usr/local/bin/jkbms", line 11, in load_entry_point('jkbms==0.1.0', 'console_scripts', 'jkbms')() File "/usr/local/lib/python3.7/dist-packages/jkbms-0.1.0-py3.7.egg/jkbms/init.py", line 55, in main NameError: name 'sys' is not defined

bhavin6666 commented 4 years ago

pi@raspberrypi:~ $ jkbms -D -p Query BMS via BLE Reading config file: /etc/jkbms/jkbms.conf Logging level: 10 DEBUG:JKBMS-BT:Config data - name: Power Wall 1, model: JK-B1A24S, mac: 3C:A5:09:0A:CF:6C, command: command, tag: Power_Wall_1, format: influx2 DEBUG:JKBMS-BT:Additional config - records: 1, maxConnectionAttempts: 3, mqttBroker: None jkBMS Logging level: 10 DEBUG:JKBMS-BT:JKBMS instance --- name: Power Wall 1, model: JK-B1A24S, mac: 3C:A5:09:0A:CF:6C, command: command, tag: Power_Wall_1, format: influx2, records: 1, maxConnectionAttempts: 3, mqttBroker: None Delegate JKBMS instance --- name: Power Wall 1, model: JK-B1A24S, mac: 3C:A5:09:0A:CF:6C, command: command, tag: Power_Wall_1, format: influx2, records: 1, maxConnectionAttempts: 3, mqttBroker: None INFO:JKBMS-BT:Attempting to connect to Power Wall 1 WARNING:JKBMS-BT:Cannot connect to Power Wall 1 with mac 3C:A5:09:0A:CF:6C - exceeded 3 attempts Traceback (most recent call last): File "/usr/local/bin/jkbms", line 11, in load_entry_point('jkbms==0.1.0', 'console_scripts', 'jkbms')() File "/usr/local/lib/python3.7/dist-packages/jkbms-0.1.0-py3.7.egg/jkbms/init.py", line 98, in main NameError: name 'self' is not defined

bhavin6666 commented 4 years ago

pi@raspberrypi:~ $ sudo hcitool lescan LE Scan ... 2E:76:88:FF:59:F5 (unknown) 3C:A5:09:0A:CF:6C (unknown) 3C:A5:09:0A:CF:6C JK-B1A24S Disable scan failed: Input/output error pi@raspberrypi:~ $ pi@raspberrypi:~ $ sudo hcitool lescan LE Scan ... 24:6E:F4:75:81:03 (unknown) 74:2F:C2:CF:51:45 (unknown) 74:2F:C2:CF:51:45 (unknown) 2E:76:88:FF:59:F5 (unknown) 8C:DE:52:F3:F8:A1 BEDJET 8C:DE:52:F3:F8:A1 (unknown) 50:EA:1B:6A:CD:71 (unknown) 41:9D:07:0A:83:7C (unknown) 65:20:B0:19:EE:45 (unknown) 65:20:B0:19:EE:45 (unknown) 5C:DE:DC:95:E8:58 (unknown) 0C:2C:D6:02:DC:A0 (unknown) 5C:DE:DC:95:E8:58 (unknown) ^Cpi@raspberrypi:~ $

bhavin6666 commented 4 years ago

i used a Bluetooth scanner on my phone to find out about the Bluetooth address first but after some reading i realized i can do it on pi. app is working fine v2.5.0

DMIINC commented 4 years ago

I am sure jblance will respond but I had to change my logging level to 30 in jkbms.conf.

DMIINC commented 4 years ago

Also make sure that phone app is not running.

bhavin6666 commented 4 years ago

after changing the log level to 30

pi@raspberrypi:~ $ jkbms -D -p Query BMS via BLE Reading config file: /etc/jkbms/jkbms.conf Logging level: 10 DEBUG:JKBMS-BT:Config data - name: Power Wall 1, model: JK-B1A24S, mac: 3C:A5:09:0A:CF:6C, command: command, tag: Power_Wall_1, format: influx2 DEBUG:JKBMS-BT:Additional config - records: 1, maxConnectionAttempts: 3, mqttBroker: None jkBMS Logging level: 10 DEBUG:JKBMS-BT:JKBMS instance --- name: Power Wall 1, model: JK-B1A24S, mac: 3C:A5:09:0A:CF:6C, command: command, tag: Power_Wall_1, format: influx2, records: 1, maxConnectionAttempts: 3, mqttBroker: None Delegate JKBMS instance --- name: Power Wall 1, model: JK-B1A24S, mac: 3C:A5:09:0A:CF:6C, command: command, tag: Power_Wall_1, format: influx2, records: 1, maxConnectionAttempts: 3, mqttBroker: None INFO:JKBMS-BT:Attempting to connect to Power Wall 1 INFO:JKBMS-BT:Connected to b'JK-B1A24S\x00' INFO:JKBMS-BT:Read characteristic: Characteristic , handle 10 INFO:JKBMS-BT:Enable 0x0b handle INFO:JKBMS-BT:Enable read handle INFO:JKBMS-BT:Write getInfo to read handle DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data INFO:JKBMS-BT:Processing info record INFO:JKBMS-BT:Record number: 36 INFO:JKBMS-BT:VendorID: JK-B1A24S {'VendorID': 'JK-B1A24S'}:influx2:None:Power_Wall_1 INFO:JKBMS-BT:Device Name: JK-B1A24S {'DeviceName': 'JK-B1A24S'}:influx2:None:Power_Wall_1 DEBUG:JKBMS-BT:Pass Code: 1234 INFO:JKBMS-BT:Hardware Version: 3.0 {'HardwareVersion': '3.0'}:influx2:None:Power_Wall_1 INFO:JKBMS-BT:Software Version: 3.2.4 {'SoftwareVersion': '3.2.4'}:influx2:None:Power_Wall_1 INFO:JKBMS-BT:Uptime: 1D15H19M59S {'Uptime': '1D15H19M59S'}:influx2:None:Power_Wall_1 DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data INFO:JKBMS-BT:notificationData has ACK INFO:JKBMS-BT:Write getCellInfo to read handle INFO:JKBMS-BT:Grabbing 1 records (after inital response) DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 16 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 4 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data DEBUG:JKBMS-BT:From handle: 0x0a Got 20 bytes of data Got 1 records INFO:JKBMS-BT:Disconnecting... pi@raspberrypi:~ $

bhavin6666 commented 4 years ago

so it is getting something but how do i see it and how do i extrapolate that data in grafana

DMIINC commented 4 years ago

Did you setup service and data base?

bhavin6666 commented 4 years ago

setup the service as described in other document. not sure about db. did not see any explicit instructions. can i not add it to the current influx db

DMIINC commented 4 years ago

yes of course you can add it to existing db. jkbms.conf. What address you have for MQTT broker?

bhavin6666 commented 4 years ago

i used the mppsolar setup for LV5048 from his earlier project.

bhavin6666 commented 4 years ago

just and FYI @DMIINC i used a direct USB cable connection to my raspberry pi with the mppsolar for LV5048 setup. just need to change the target a bit. it is noted in the documentation but since i am not that good at programming it took me a while to understand. still using raspian not ubuntu.

DMIINC commented 4 years ago

I am not good at programing either. However I have learned some things along the way with jblance. Question/s You have setup DB for LV5048? You have data flowing into your DB for LV5048? You can display data from LV5048 DB in Grafana? If answer is yes to all three question you are super close to having jkbms running and storing data in the same DB as LV5048. I have it setup exactly the same way.

bhavin6666 commented 4 years ago

yes to all 3 question. just need to get the jkbms data in there so i can have everything in same dashboard.

DMIINC commented 4 years ago

OK. can you copy paste contents of your jkbms.conf file in this thread?

bhavin6666 commented 4 years ago

i see it now. i am missing the command = command

DMIINC commented 4 years ago

mqtt broker?

DMIINC commented 4 years ago

What does it say?

bhavin6666 commented 4 years ago

[SETUP] mqtt_broker = mqtthost max_connection_attempts = 3 records = 1

Uncomment one of the logging_level lines

All messages at the uncommented level and higher will be displayed

i.e. DEBUG gives the most output and CRITICAL gives the least

DEBUG

logging_level = 10

INFO

logging_level = 20

WARNING

logging_level = 30

ERROR

logging_level = 40

CRITICAL

logging_level = 50

JKBMS

[Power Wall 1] model = JK-B1A24S mac = 3C:A5:09:0A:CF:6C command = command tag = Power_Wall_1 format = influx2

bhavin6666 commented 4 years ago

it should actually be set to 20 but for some reason it was not working

bhavin6666 commented 4 years ago

with 30 it shows something.

DMIINC commented 4 years ago

line 2 is worong. It should be: mqtt_broker = localhost (or ip address)

DMIINC commented 4 years ago

And yes keep it at 30

bhavin6666 commented 4 years ago

got it. now need to figure out how to display in grafana

DMIINC commented 4 years ago

go to terminal type influx use (you database name) command select * from jkbms limit 20

and see what you get

bhavin6666 commented 4 years ago

i was able to get it in grafana. not able to label each cell but thats ok. i can at least see all the cells. that is very much convenient than walking over to the garage to see the status to be in range of the jkbms. Thanks @DMIINC and @jblance you guys rock.

DMIINC commented 4 years ago

You should be able to label cells. All depends what you are doing in grafana. You are welcome.

jblance commented 4 years ago

Thanks both - closing this as it looks resolved