OpenWonderLabs / SwitchBotAPI-BLE

SwitchBot BLE open API
98 stars 9 forks source link

Motion Sensor Status is always 0:No one moves #19

Closed eggapple15 closed 1 year ago

eggapple15 commented 1 year ago

Current Situation

The connection from the Windows PC to the Motion Sensor is successful and the battery capacity can be obtained, but the status remains unchanged at 0 when waving my hand in front of the sensor.

Logs

The executed program and output results are as follows

# executed program
import asyncio
import binascii
from bleak import BleakClient

address = "My DeviceID"
UUID = "UUID"

async def run(address, loop):
    async with BleakClient(address, loop=loop) as client:
        x = await client.is_connected()
        print("Connected: {0}".format(x))
        y = await client.read_gatt_char(UUID)
        servicedata = binascii.hexlify(y)
        move = servicedata[1] & 0b01000000
        battery = servicedata[2] & 0b01111111
        print("MoveDetected: " + str(move))
        print("Battery: " + str(battery))

loop = asyncio.get_event_loop()
loop.run_until_complete(run(address, loop))

# output results
Connected: True
MoveDetected: 0
Battery: 48

Configuration

None in particular.

Environment

Additional Context

No response

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 1 year ago

This issue has been automatically closed because it has not had recent activity. Thank you for your contributions.