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 -->|"HTTP and Toy Events WS"| RemoteApp
    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.0.tar.gz (109.1 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.0-py3-none-any.whl (111.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lovensepy-1.1.0.tar.gz
  • Upload date:
  • Size: 109.1 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.0.tar.gz
Algorithm Hash digest
SHA256 1a4139856e17ada0ef1ff94a1babdb15b7df053b462f6d97e7a60ea7b2258b75
MD5 684ffbd8c3d6508833584a2ac1e9604d
BLAKE2b-256 a7e90c601570fd1cde373a24236d472bea3917cf89a2c8bb9d1ff94f23dfa470

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: lovensepy-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 111.8 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4840ad36534dbf31a21d93ba14c69897025e6d68672cea7f73aaafc0f9d0bfcc
MD5 75c7a55eb3bb087a0da3c08141abaaf7
BLAKE2b-256 eaeef6429357ad3a893f0415048fb824a9e9d8144668a5bf7e06a084dbc55c88

See more details on using hashes here.

Provenance

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