Skip to main content

API to get oil tank from Kingspan SENSiT sensors

Project description

kingspan-connect-sensor

build: codecov PyPI Version

API to get oil tank from Kingspan SENSiT sensors.

To make use of the API, you will need the credentials you used to register with the App. You do not need other details such as the tank ID as these are already associated with your account. The new KNECT Pro service is supported only from version 4.0.

Installation

python3 -m pip kingspan-connect-sensor

Usage

Reading documents:

from connectsensor import SensorClient

client = SensorClient()
client.login("test@example.com", "s3cret")
tanks = client.tanks
tank_level = tanks[0].level

The tanks method returns a Tanks object which can be queried for the status of the specific tank.

Async Usage

async with AsyncSensorClient() as client:
    await client.login("test@example.com", "s3cret")
    tanks = await client.tanks
    tank_level = await tanks[0].level
    tank_capacity = await tanks[0].capacity
    tank_percent = 100 * (tank_level / tank_percent)
    print(f"Tank is {tank_percent:.1f}% full")

Tanks object

As of version 3.0, history no longer returns a Pandas dataframe to simplify package dependencies. Instead, an list of dicts is returned, where each list element is a sample from the web API, sorted by logging time. There should be one record per day. Each dict has the following keys:

  • reading_date: a datetime object indicating the time a measurement was made
  • level_percent: integer percentage full
  • level_litres: number of lites in the tank

You can construct a Pandas dataframe simply using:

tanks = await client.tanks
history = await tanks[0].history()
df = pd.DataFrame(history)

The history method takes optional parameters start_date and end_date which are datetime.datetime objects specifying the range of dates to query from the API.

Supported APIs

The package supports both the new JSON API used by the KNECT Pro app introduced in February 2026, and the legacy SOAP API. You can select the appropriate API using the api_version parameter passed to the SensorClient and AsyncSensorClient constructors. Valid version options are APIVersion.CONNECT_V1 and APIVersion.KNECT_V1.

NOTE: as of March 2026, the APIVersion.KNECT_V1 API uses HTTP without any password encryption as the TLS endpoint is unavailable.

Scripts

As of version 4.0, the notifier and export script have been removed as integrations like Home Assistant provide much better functionality. Reporting on the current status of the tank can still be performed kingspan-status:

% kingspan-status --username=test@example.com --password=s3cret

Home Tank:
 Capacity = 2000
 Serial Number = 20001999
 Model = Unknown
 Level = 90% (1148 litres)
 Last Read = 2021-10-09 00:42:47.947000

History:
 Reading date           %Full  Litres
 30-Jan-2021 00:29      94     1224 
 31-Jan-2021 00:59      80     1040 
 01-Feb-2021 00:29      78     1008 
 02-Feb-2021 00:59      76     986  

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

kingspan_connect_sensor-4.2.0.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

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

kingspan_connect_sensor-4.2.0-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file kingspan_connect_sensor-4.2.0.tar.gz.

File metadata

  • Download URL: kingspan_connect_sensor-4.2.0.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for kingspan_connect_sensor-4.2.0.tar.gz
Algorithm Hash digest
SHA256 ad55da52beb7d9d0374e12c0add8960f8b6f1d06929ce71241006b7dcccef839
MD5 62891a4a797643d9eda28aba5e7ad45e
BLAKE2b-256 764ebd305637b5fb8c9a2ea8dd7b40f43dc13e2af269cd4dc44b3f69510eafcd

See more details on using hashes here.

File details

Details for the file kingspan_connect_sensor-4.2.0-py3-none-any.whl.

File metadata

  • Download URL: kingspan_connect_sensor-4.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for kingspan_connect_sensor-4.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d71de4b4f401e045b95dcaee2535b284caed5fca41e5b99767b0465c3227b9d4
MD5 2ef6bf137df8fe8786beb4f420c0f876
BLAKE2b-256 df81a70420ee9faa7085c902e1e42e9ca4b48dfa4646b4ac1e183b7ce0245615

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