Skip to main content

Python Lovense API client

Project description

LovensePy

License: Apache 2.0

LovensePy is a Python client for the Lovense developer APIs: Standard API over LAN (Game Mode) and cloud, Socket API (WebSocket, optional LAN command path), and Toy Events. Optional pieces include a Home Assistant MQTT bridge and direct BLE control.

Who it is for: developers building scripts, bots, dashboards, Home Assistant integrations, or experiments. Lovense’s official docs remain the source of truth for protocol behavior; this library wraps those flows in typed, tested Python.

Install

pip install lovensepy

Optional extras:

pip install 'lovensepy[mqtt]'   # Home Assistant MQTT bridge service + paho-mqtt; run: lovensepy-mqtt
pip install 'lovensepy[ble]'    # Direct BLE (bleak, pick for examples)

Docker Compose: Mosquitto + Home Assistant

The root docker-compose.yml starts Mosquitto and Home Assistant only. The LovensePy MQTT bridge runs on the host (BLE needs Bluetooth; LAN is simpler that way too). See compose/README.md and Home Assistant MQTT.

Minimal example (Game Mode)

from lovensepy import LANClient, Actions

client = LANClient("MyApp", "192.168.1.100", port=20011)
client.function_request({Actions.VIBRATE: 10}, time=3)

Enable Game Mode in Lovense Remote, use the app host’s IP, and pick the right port (e.g. 20011 for Remote, 34567 for Connect). Full setup, tutorials, and API tables are on GitHub Pages (or browse the docs folder in the repository).

For async/await code, AsyncLANClient, AsyncServerClient, BleDirectHub, and BleDirectClient all subclass LovenseAsyncControlClient: same control methods so you can switch transport by changing only construction. See Connection methods and the API reference.

How clients reach the toy

flowchart TB
    subgraph yourCode [Your app]
        LANClient
        AsyncLANClient
        ServerClient
        AsyncServerClient
        SocketAPIClient
        ToyEventsClient
        BleDirect[BleDirectClient / BleDirectHub]
        HAMqttBridge
    end

    subgraph localNet [Local network]
        RemoteApp[Lovense app]
        Toy[Lovense toy]
        MQTTBroker[MQTT broker]
    end

    subgraph cloudLayer [Lovense cloud]
        LovenseServer[Lovense server]
    end

    LANClient -->|"HTTP/HTTPS"| RemoteApp
    AsyncLANClient -->|"HTTP/HTTPS"| RemoteApp
    RemoteApp --> Toy

    ServerClient -->|"HTTPS"| LovenseServer
    AsyncServerClient -->|"HTTPS"| LovenseServer
    LovenseServer --> RemoteApp

    SocketAPIClient -->|"WebSocket"| LovenseServer
    SocketAPIClient -->|"HTTPS when use_local_commands"| RemoteApp

    ToyEventsClient -->|"WebSocket"| RemoteApp

    HAMqttBridge -->|"LAN: HTTP + Toy Events WS"| RemoteApp
    HAMqttBridge -.->|"BLE mode: direct"| Toy
    HAMqttBridge <-->|"MQTT"| MQTTBroker

    BleDirect -.->|"BLE"| Toy

Documentation and official APIs

Changelog

See CHANGELOG.md.

License

Apache License 2.0 — see LICENSE for full text.

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

lovensepy-1.1.4.tar.gz (140.7 kB view details)

Uploaded Source

Built Distribution

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

lovensepy-1.1.4-py3-none-any.whl (144.5 kB view details)

Uploaded Python 3

File details

Details for the file lovensepy-1.1.4.tar.gz.

File metadata

  • Download URL: lovensepy-1.1.4.tar.gz
  • Upload date:
  • Size: 140.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lovensepy-1.1.4.tar.gz
Algorithm Hash digest
SHA256 ba6221487e7313b4b1c78e04af3f38c1bb17f8199bdaeae150006fbbc9065147
MD5 5616fa98fb5b6949ad53e20a18b20f20
BLAKE2b-256 2231306a4249898faa35f9396b040984d323ba6f1e0fb8ddb47f3524c8019528

See more details on using hashes here.

Provenance

The following attestation bundles were made for lovensepy-1.1.4.tar.gz:

Publisher: publish-pypi.yml on koval01/lovensepy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lovensepy-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: lovensepy-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 144.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lovensepy-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 dc5c10daafc3804905291af911d49f00425c5ee18b6bf040b97fea7e167d1403
MD5 34d2435db179da6063dfe7ccac28552e
BLAKE2b-256 8131b45efdde0185c6dd613e991dbd6369b22ffc45e01831923ff440bbd03ed2

See more details on using hashes here.

Provenance

The following attestation bundles were made for lovensepy-1.1.4-py3-none-any.whl:

Publisher: publish-pypi.yml on koval01/lovensepy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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