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 (paho-mqtt)
pip install 'lovensepy[ble]'    # Direct BLE (bleak, pick for examples)

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.1.tar.gz (123.0 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.1-py3-none-any.whl (124.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lovensepy-1.1.1.tar.gz
  • Upload date:
  • Size: 123.0 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.1.tar.gz
Algorithm Hash digest
SHA256 f7ba5ea0e67e83bcd22e867abf35e55018946d6c85f2115039e9795b47580a00
MD5 720158eb30b68ae6de83c83e7a2bb69b
BLAKE2b-256 fb2c9f24d38905d26877a50393767fb99de00f9bbc30d3f910c7c5e2635bcf25

See more details on using hashes here.

Provenance

The following attestation bundles were made for lovensepy-1.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: lovensepy-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 124.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9dbcd62287f053b61c5ffb545fc1a94b479ea72b3bc539820c384928b704e3a5
MD5 e14314c3497ca6a1a0d459902f763ca8
BLAKE2b-256 c0c4eb592c61bf2d2bf60e594ccbf116813480c33e2f7fc60cdde402fc1fcc0e

See more details on using hashes here.

Provenance

The following attestation bundles were made for lovensepy-1.1.1-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