Skip to main content

Pythgon API for GShock Watches using BLE

Project description

gshock_api

Announcement

The library now supports sending application-level notifications to watches that support it, namely:

  • DW-H5600

  • GBD-H2000

  • GBD-200

  • GBD-100

  • GBD-800

  • GBD-100BAR

  • GBX-100

The new API is send_app_notification function. See the examples/api_test.py file for usage examples.

Only the DW-H5600 watch has been tested. If you have any of the watches supporting notifications, please let me know your findings.

Overview

This is a Python API library for G-Shock watches that support Bluetooth Low Energy (BLE) communication.

G(M)W-5600, G(M)W-5000, GA-B2100, GA-B001-1AER, GST-B500, GST-B200, MSG-B100, G-B001, GBD-H1000 (Partial support), MRG-B5000, GCW-B5000, GG-B100, ABL-100WE, Edifice ECB-30, ECB-10, ECB-20, most Edifice watches, most Protrek models.

It can perform the following tasks:

  • Set watch’s time

  • Set Home Time (Home City)

  • Set Alarms

  • Set Reminders

  • Set watch’s settings.

  • Get watch’s name

  • Get watch’s battery level

  • Get Watch’s temperature

  • Get/Set watch’s Timer

  • Send notifications to watch (supported models)

Dependencies

This project requires the following Python packages: .. code-block:: sh

pytz bleak

So you can install them using the following command: .. code-block:: sh

pip3 install -r requirements.txt

To understand how to use the library, please refer to the `src/examples` folder.

Virtual Environment Setup

It is recommended that you create a virtual environment to run the tests:

  1. Create a virtual environment:

    # Create a virtual environment
    python3 -m venv venv
    
    # Activate it (Mac/Linux)
    source venv/bin/activate
    
    # Install dependencies
    pip3 install -e .
  2. Run the tests:

    python3 src/examples/api_tests.py [--multi-watch]

The optional `–multi-watch` parameter forces the library to scan for watches every time it tries to connect to a watch. If not provided, the library will try to connect to the last connected watch only. If you have multiple watches, you should use this parameter.

The optional `–multi-watch` parameter forces the library to scan for watches every time it tries to connect to a watch. If not provided, the library will try to connect to the last connected watch only. If you have multiple watches, you should use this parameter.

Installing the library for your project:

pip3 install gshock-api

See this project using this library to run a time server for G-Shock watches.

See also this blog for using the library in the SXMO mobile environment.

Troubleshooting:

If your watch cannot connect, and the `–multi-watch` parameter is not used, remove the `config.ini` file and try again.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gshock_api-2.0.9.tar.gz (27.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gshock_api-2.0.9-py3-none-any.whl (35.1 kB view details)

Uploaded Python 3

File details

Details for the file gshock_api-2.0.9.tar.gz.

File metadata

  • Download URL: gshock_api-2.0.9.tar.gz
  • Upload date:
  • Size: 27.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for gshock_api-2.0.9.tar.gz
Algorithm Hash digest
SHA256 252cf127ea74342f38fb5f5c25addeb8e6ed83fe2dd0a6fde20ce64e9bd78a05
MD5 63efbcbf3d5582fa62cb7e7271fc4e0c
BLAKE2b-256 6c2d30c41f91fe3def19e7d9489afc2614af8a66aeeed0eaf80c8182ac15128e

See more details on using hashes here.

File details

Details for the file gshock_api-2.0.9-py3-none-any.whl.

File metadata

  • Download URL: gshock_api-2.0.9-py3-none-any.whl
  • Upload date:
  • Size: 35.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for gshock_api-2.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 873bf0cc068e78530c56d24555e4789ce43cb69521ca71dc07d4a0f35ed2ef0c
MD5 d049216f2e5d3c47b8b3bbca63999321
BLAKE2b-256 1a93a4be63ff2c22ee992c8863366730abb646f3dc1b626bb1d4e5bc93941a42

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page