ble2mqtt icon indicating copy to clipboard operation
ble2mqtt copied to clipboard

Add support for Deembot Atick

Open baz88ka opened this issue 1 year ago • 0 comments

Atick - ble impulse counter.

minimum code to get values:

import array
import asyncio
from bleak import BleakClient

address = "XX:XX:XX:XX:XX:XX"
UUID_SERVICE_AG = "348634B0-EFE4-11E4-B80C-0800200C9A66"
UUID_AG_ATTR_VALUES = "348634B8-EFE4-11E4-B80C-0800200C9A66"


def truncate_float(n, places):
        return int(n * (10 ** places)) / 10 ** places

async def main(address, UUID_AG_ATTR_VALUES):
    async with BleakClient(address) as client:
        characteristic_value = (client
            .services.get_service(UUID_SERVICE_AG)
            .get_characteristic(UUID_AG_ATTR_VALUES))

        data = await client.read_gatt_char(characteristic_value)
        values = array.array('f', data).tolist()
        counter_a_value = truncate_float(values[0], 2)
        counter_b_value = truncate_float(values[1], 2)
        print(f"counter a:", counter_a_value)
        print(f"counter b:",counter_b_value)


asyncio.run(main(address, UUID_AG_ATTR_VALUES))

there is also an extension for HA https://github.com/XNicON/hassio-atick/tree/main/custom_components/deembot_atick

baz88ka avatar Sep 24 '24 09:09 baz88ka