Skip to main content

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  

Analytics and Forecasting

The package includes an optional analysis module to help calculate tank usage rates and forecast when the tank will be empty. This logic is decoupled from the core client to keep basic data fetching lightweight, and it processes the naive datetimes returned directly by the API.

from connectsensor import AsyncSensorClient, APIVersion
from connectsensor.analysis import (
    calculate_forecast_empty,
    calculate_usage_rate,
    filter_history,
)

async with AsyncSensorClient(version=APIVersion.KNECT_V1) as client:
    await client.login("test@example.com", "s3cret")
    tanks = await client.tanks
    
    # Fetch the raw history points
    history = await tanks[0].history()
    
    # Filter the data down to the last 14 days
    recent_history = filter_history(history, usage_window=14)
    
    # Calculate the average daily usage (litres/day)
    rate = calculate_usage_rate(recent_history)
    
    # Estimate the number of days until the tank is empty
    days_left = calculate_forecast_empty(recent_history, rate)
    
    print(f"Usage rate: {rate:.1f} L/day")
    print(f"Estimated days to empty: {days_left} days")

Analysis Utilities

  • filter_history(history, usage_window): Filters the raw history array to the specified number of days and sorts it chronologically.
  • calculate_usage_rate(history): Calculates the average daily usage in litres. This function automatically detects and ignores tank refills so they do not artificially skew your usage average.
  • calculate_forecast_empty(history, rate): Estimates the number of days until the tank reaches 0 litres based on the most recent tank level and the calculated usage rate.
  • TankData: The connectsensor.analysis module also exports a structured TankData dataclass, which is highly useful for downstream consumers like Home Assistant integrations that need to bundle the raw attributes and these calculated forecasts into a single object.

Metadata

Release files for kingspan-connect-sensor 4.6.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kingspan-connect-sensor 4.6.6
File Size Uploaded Provenance Actions
kingspan_connect_sensor-4.6.6.tar.gz 21.3 kB With provenance Details for kingspan_connect_sensor-4.6.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kingspan-connect-sensor 4.6.6
File Interpreter ABI Platform Actions
kingspan_connect_sensor-4.6.6-py3-none-any.whl Python 3 none any Details for kingspan_connect_sensor-4.6.6-py3-none-any.whl

Total release size: 37.3 kB

Release files / kingspan_connect_sensor-4.6.6.tar.gz

Download URL kingspan_connect_sensor-4.6.6.tar.gz
Size 21.3 kB
Tags Source
SHA-256 checksum
How to use checksums
82348861db4f4c3532b0edbcd6c4d33e3b58565c2822290f2e8ffcef2eff752c
BLAKE2b-256 checksum
How to use checksums
d760bc139d3f0c1e173fb7225caeb370d8224ed15ecfc057a81847ff36a74074
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Release files / kingspan_connect_sensor-4.6.6-py3-none-any.whl

Download URL kingspan_connect_sensor-4.6.6-py3-none-any.whl
Size 16.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
39e99ebbf741497c3e5f2ba226d369dc6f2dc6bc23109af5156f1189f2dcc0ac
BLAKE2b-256 checksum
How to use checksums
b17047d0e148cba9f989465f333547521fa52ce6eee5b57ddf1f155dfd283197
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Security for kingspan-connect-sensor 4.6.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for kingspan_connect_sensor-4.6.6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

4.6.6 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page