Giter VIP home page Giter VIP logo

bm2-battery-monitor's People

Contributors

ayasystems avatar krystiand avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bm2-battery-monitor's Issues

BM2 / Vgate Battery Asst / BM3 / Same programmer but no compatibility

Hello! Congratulations for the excellent work. I wanted to ask you something. I bought this gizmo, thinking the mobile app was BM2. Instead, the qrcode, refers me to a site where to download the app (not present in the playstore). The app in question is called Battery Asst. I noticed that the same programmer made all these apps. Now, since the app really sucks, (no badge, no notification, no export way,ecc...) I was trying all the various apps, but unfortunately none "see" the device (I was interested in BM2). What's in the app that won't connect, with a different app? Do you need to work on the app or on the device? Is it doable, in your opinion? Thank you.

I've decompiled both, but my programmer knowledges aren't for android app :(

Error reading char at handle 46, status=2

Hi,

Thanks for this great project. I have successfully using it with my NodeMCU32, but it has insufficient Bluetooth range so I decided to install it a new Wemos ESP32 D1 Mini near my car.

For some reason it can't read the voltage now, but it's connecting successfully:

[18:05:30][W][ble_sensor:037]: [Voltage] Disconnected!
[18:05:30][W][ble_client:119]: connect to f8:30:02:xx:xx:xx failed, status=133
[18:05:40][I][ble_client:086]: Attempting BLE connection to f8:30:02:xx:xx:xx
[18:05:41][I][ble_sensor:031]: [Voltage] Connected successfully!
[18:05:43][I][ble_client:171]: Service UUID: 0x1800
[18:05:43][I][ble_client:172]:   start_handle: 0x1  end_handle: 0xb
[18:05:43][I][ble_client:384]:  characteristic 0x2A00, handle 0x3, properties 0x2
[18:05:43][I][ble_client:384]:  characteristic 0x2A01, handle 0x5, properties 0x2
[18:05:43][I][ble_client:384]:  characteristic 0x2A02, handle 0x7, properties 0xa
[18:05:43][I][ble_client:384]:  characteristic 0x2A03, handle 0x9, properties 0x8
[18:05:43][I][ble_client:384]:  characteristic 0x2A04, handle 0xb, properties 0x2
[18:05:43][I][ble_client:171]: Service UUID: 0x1801
[18:05:43][I][ble_client:172]:   start_handle: 0xc  end_handle: 0xf
[18:05:43][I][ble_client:384]:  characteristic 0x2A05, handle 0xe, properties 0x20
[18:05:43][I][ble_client:384]:  characteristic 0x2A26, handle 0x18, properties 0x2
[18:05:43][I][ble_client:384]:  characteristic 0x2A27, handle 0x1a, properties 0x2
[18:05:43][I][ble_client:384]:  characteristic 0x2A28, handle 0x1c, properties 0x2
[18:05:43][I][ble_client:384]:  characteristic 0x2A29, handle 0x1e, properties 0x2
[18:05:43][I][ble_client:384]:  characteristic 0x2A2A, handle 0x20, properties 0x2
[18:05:43][I][ble_client:384]:  characteristic 0x2A50, handle 0x22, properties 0x2
[18:05:43][I][ble_client:172]:   start_handle: 0x34  end_handle: 0xffff
[18:05:43][I][ble_client:384]:  characteristic F000FFC1-0451-4000-B000-000000000000, handle 0x36, properties 0x1c
[18:05:43][I][ble_client:384]:  characteristic F000FFC2-0451-4000-B000-000000000000, handle 0x3a, properties 0x1c
[18:05:46][W][api.connection:080]: Home Assistant 2022.8.7 (::FFFF:C0A8:16F): Connection closed
[18:05:48][W][ble_sensor:080]: Error reading char at handle 46, status=2
[18:06:46][W][api.connection:080]: Home Assistant 2022.8.7 (::FFFF:C0A8:16F): Connection closed
[18:06:48][W][ble_sensor:080]: Error reading char at handle 46, status=2

My esphome.yaml code:

esphome:
  name: bluetooth_gateway
  platform: ESP32
  board: esp-wrover-kit
  includes:
    - include.h
    
wifi:
  ssid: ""
  password: ""
  
  manual_ip:
    static_ip: 192.168.1.206
    gateway: 192.168.1.1
    subnet: 255.255.255.0

# Enable logging
logger:
  level: INFO
  
# Enable Home Assistant API
api:

ota:
    
# Enable Bluetooth scanning for this ESP32
esp32_ble_tracker:

sensor:

  - platform: ble_client
    ble_client_id: bm2_battery_meter
    name: Voltage
    service_uuid: 'fff0'
    characteristic_uuid: 'fff4'
    unit_of_measurement: 'V'
    accuracy_decimals: 2
    state_class: measurement
    device_class: voltage
    force_update: true
    notify: true
    lambda: |-
      mbedtls_aes_context aes;
      mbedtls_aes_init(&aes);
      unsigned char output[16];
      unsigned char key[16] = { 108, 101, 97, 103, 101, 110, 100, 255, 254, 49, 56, 56, 50, 52, 54, 54, };
      unsigned char iv[16] = {};
      mbedtls_aes_setkey_dec(&aes, key, 128);
      mbedtls_aes_crypt_cbc(&aes, MBEDTLS_AES_DECRYPT, 16, iv, (uint8_t*)&x[0], output);
      mbedtls_aes_free(&aes);
      return ((output[2] | (output[1] << 8)) >> 4) / 100.0f;  
      
ble_client:
  - mac_address: F8:30:02:2D:4D:9C
    id: bm2_battery_meter

BM6

Hey! thanks for doing this work :) I just got a BM6 and it is so stupid that the whole communication is not open. Or their app is not on github. I guess the BM6 is just a BM2 with a temperature probe.

I wonder if you experimented on things like how long does the device store data? what is their "patented" SoC estimation method?

Help to compile ESPHOME

Hi,

I'm ussing esphome docker container but i don´t know how to merge your file into one file only to compile my binary... Could you help me?? I'm very happy to see that i can read with ESP32 my B2M!

Connection refused

Hello, and thanks for this awesome repo!

I tried your code at my device and I get [Errno 111] Connection refused. errors. I assume this is because the KEY changed? Can you help?

[2023-02-28 01:26:47] A message handler raised an exception: [Errno 111] Connection refused.
Traceback (most recent call last):
File "src/dbus_fast/message_bus.py", line 811, in dbus_fast.message_bus.BaseMessageBus._process_message
File "/home/kreach3r/.local/lib/python3.9/site-packages/bleak/backends/bluezdbus/manager.py", line 860, in _parse_msg
on_value_changed(message.path, self_interface["Value"])
File "/home/kreach3r/.local/lib/python3.9/site-packages/bleak/backends/bluezdbus/client.py", line 152, in on_value_changed
callback(bytearray(value))
File "/home/kreach3r/bm2-battery-monitor/bm2_mqtt/bm2_mqtt.py", line 36, in notification_handler
single(payload=payload, topic=mqtt_topic, port=mqtt_port, hostname=mqtt_hostname)
File "/home/kreach3r/.local/lib/python3.9/site-packages/paho/mqtt/publish.py", line 240, in single
multiple([msg], hostname, port, client_id, keepalive, will, auth, tls,
File "/home/kreach3r/.local/lib/python3.9/site-packages/paho/mqtt/publish.py", line 176, in multiple
client.connect(hostname, port, keepalive)
File "/home/kreach3r/.local/lib/python3.9/site-packages/paho/mqtt/client.py", line 914, in connect
return self.reconnect()
File "/home/kreach3r/.local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1044, in reconnect
sock = self._create_socket_connection()
File "/home/kreach3r/.local/lib/python3.9/site-packages/paho/mqtt/client.py", line 3685, in _create_socket_connection
return socket.create_connection(addr, timeout=self._connect_timeout, source_address=source)
File "/usr/lib/python3.9/socket.py", line 843, in create_connection
raise err
File "/usr/lib/python3.9/socket.py", line 831, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
^CTraceback (most recent call last):
File "/home/kreach3r/bm2-battery-monitor/bm2_mqtt/bm2_mqtt.py", line 83, in
loop.run_until_complete(main())
File "/usr/lib/python3.9/asyncio/base_events.py", line 629, in run_until_complete
self.run_forever()
File "/usr/lib/python3.9/asyncio/base_events.py", line 596, in run_forever
self._run_once()
File "/usr/lib/python3.9/asyncio/base_events.py", line 1854, in _run_once
event_list = self._selector.select(timeout)
File "/usr/lib/python3.9/selectors.py", line 469, in select
fd_event_list = self._selector.poll(timeout, max_ev)
KeyboardInterrupt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.