Skip to main content

StaticBadge

License PyPI version Supported Python versions PyPI downloads Code style: ruff Linter: ruff pre-commit.ci status Dependabot Updates

mausy5043-common

A Python 3.12+ library providing common functions and classes for interacting with various devices and services, including HomeWizard energy monitors, Sessy home batteries, SQLite3 databases, and meteorological calculations.

Requirements

  • Python 3.12 or higher
  • Dependencies: numpy, pandas, pyarrow, python-homewizard-energy, sessypy, zeroconf

NOTE: Before using the SQLite3 functions, ensure the SQLite3 server/client and default Python package are installed.

Installation

python3 -m pip install mausy5043-common

Modules

funfile

File operation utilities.

  • cat(file_name: str) -> str: Read a file into a variable.

funmeteo

Meteorological calculations and conversions.

  • moisture(temperature, relative_humidity, pressure) -> np.ndarray: Calculate moisture content of air (kg/m³).
  • wet_bulb_temperature(temperature, relative_humidity) -> float: Calculate wet bulb temperature (°C).
  • saturation_vapor_pressure(temperature) -> ArrayLike: Compute saturation vapor pressure (hPa).
  • dew_point_temperature(temperature, relative_humidity) -> ArrayLike: Compute dew point temperature (°C).
  • relative_humidity_t2(T1, RH1, T2) -> ArrayLike: Calculate new relative humidity after a temperature change.

libsqlite3

SQLite3 database interaction.

  • SqlDatabase: A class to interact with SQLite3 databases, supporting data queuing, insertion, and retrieval.

funzeroconf

ZeroConf service discovery for network devices.

  • discover_devices(search_time: float = 60.0) -> dict: Discover services on the network using Zeroconf.
  • get_ip(service: str, filtr: str = "", timeout: float = 60.0) -> list[str]: Retrieve IP addresses for a given service.
  • prune_services(devices: dict, services: list[str]) -> dict: Filter devices by supported services.
  • filter_properties(devices: dict, service: str, filtr: str) -> dict: Filter devices by property contents.

funhomewizard

HomeWizard energy monitor integration.

  • HomeWizard_V1: Class for interacting with HomeWizard P1-dongle (API v1).
  • HomeWizard_V2: Class for interacting with HomeWizard devices (API v2).
  • MyHomeWizard: High-level class to discover and connect to HomeWizard devices, supporting both API versions.

funsessy

Sessy home battery integration.

  • Sessy_v1: Class for interacting with Sessy batteries (API v1).
  • MySessyBattery: High-level class to connect and retrieve data from Sessy batteries.

Usage Examples

Meteorological Calculations

from mausy5043_common.funmeteo import moisture, wet_bulb_temperature

# Calculate moisture content
temperature = 25.0  # °C
relative_humidity = 60.0  # %
pressure = 1013.25  # hPa
moisture_content = moisture(temperature, relative_humidity, pressure)

# Calculate wet bulb temperature
wet_bulb = wet_bulb_temperature(temperature, relative_humidity)

SQLite3 Database

from mausy5043_common.libsqlite3 import SqlDatabase

db = SqlDatabase(
    database="example.db",
    table="measurements",
    insert="INSERT INTO measurements VALUES (?, ?, ?)"
)
db.queue({"timestamp": "2024-01-01", "value": 42})
db.insert()

HomeWizard Integration

from mausy5043_common.funhomewizard import MyHomeWizard

hw = MyHomeWizard(serial="YOUR_SERIAL", token="YOUR_TOKEN", debug=True)
hw.connect()
measurement = hw.get_measurement()

Sessy Battery Integration

from mausy5043_common.funsessy import MySessyBattery

battery = MySessyBattery(ip="192.168.1.100", user="admin", token="password", debug=True)
battery.connect()
measurement = battery.get_measurement()

ZeroConf Discovery

from mausy5043_common.funzeroconf import discover_devices, get_ip

# Discover all devices
devices = discover_devices(search_time=30.0)

# Get IP addresses for HomeWizard devices
homewizard_ips = get_ip(service="_homewizard", filtr="HWE-P1")

License

This project is licensed under the MIT License - see LICENSE for details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mausy5043_common-2.12.1.tar.gz (29.1 kB view details)

Uploaded Source

Built Distribution

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

mausy5043_common-2.12.1-py3-none-any.whl (29.6 kB view details)

Uploaded Python 3

File details

Details for the file mausy5043_common-2.12.1.tar.gz.

File metadata

  • Download URL: mausy5043_common-2.12.1.tar.gz
  • Upload date:
  • Size: 29.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.15

File hashes

Hashes for mausy5043_common-2.12.1.tar.gz
Algorithm Hash digest
SHA256 a633c7880e244fb4245995c62ce2566f4d4371b73dda32eb5d12a69edfec645f
MD5 7e6143d2238b3a5fbd183db8bd065b21
BLAKE2b-256 2d8a2dee83e5f879381ff7a73e3a9439458ffe4d4f7d45d2d15a6a52cba86349

See more details on using hashes here.

File details

Details for the file mausy5043_common-2.12.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mausy5043_common-2.12.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c6073e8cf2e83197e8b8706a03f03517d80dadc5ff632fbd34f10386bdecc23a
MD5 0f9c57d20990752f9551f7153f7e6304
BLAKE2b-256 3bf0cc2d90fe14461cee9fac357f99d291af9bf444ce9b837d39ac8bc0b2603b

See more details on using hashes here.

Release history Release notifications | RSS feed

2.12.2

2 files

This release

2.12.1 This release

2 files

2.11.7

2 files

2.11.6

2 files

2.11.5

2 files

2.11.3

2 files

2.11.2

2 files

2.11.1

2 files

2.10.6

2 files

2.10.5

2 files

2.10.4

2 files

2.10.3

2 files

2.10.2

2 files

2.10.1

2 files

2.8.2

2 files

2.6.1

2 files

2.4.6

2 files

2.4.5

2 files

2.4.4

2 files

2.4.3

2 files

2.4.2

2 files

2.4.1

2 files

2.2.7

2 files

2.2.6

2 files

2.2.5

2 files

2.2.4

2 files

2.2.3

2 files

2.2.2

2 files

2.2.1

2 files

2.1.1

2 files

1.12.2

2 files

1.12.1

2 files

1.10.1

2 files

1.8.2

2 files

1.8.1

2 files

1.6.8

2 files

1.6.7

2 files

1.6.6

2 files

1.6.5

2 files

1.6.2

2 files

1.6.1

2 files

1.4.10

2 files

1.4.9

2 files

1.4.8

2 files

1.4.7

2 files

1.4.4

2 files

1.4.3

2 files

1.4.2

2 files

1.4.1

2 files

1.2.3

2 files

1.2.2

2 files

1.2.1

2 files

1.1.2

2 files

1.1.1

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page