Metadata-Version: 2.4
Name: wiener-netze-smartmeter-serial
Version: 0.1.1
Summary: Python API for reading data from a Wiener Netze Smartmeter with a serial interface (via infrared)
Author-email: Tobias Perschon <tobias@perschon.at>
License-Expression: MIT
Project-URL: Homepage, https://github.com/tofuSCHNITZEL/wiener-netze-smartmeter-serial
Project-URL: Issues, https://github.com/tofuSCHNITZEL/wiener-netze-smartmeter-serial/issues
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aioserial<2,>=1.3.1
Requires-Dist: pycryptodome<4,>=3.23.0
Requires-Dist: typing-extensions<5,>=4.16.0
Provides-Extra: test
Requires-Dist: pytest<10,>=9.1.1; extra == "test"
Dynamic: license-file

# wiener-netze-smartmeter-serial

Python API for reading data from a Wiener Netze Smart Meter with a serial interface (via infrared)

Requires Python 3.10 or newer.

## Installation

```shell
pip install wiener-netze-smartmeter-serial
```

## Usage

For reading data from your Wiener Netze Smart Meter you need:

- A Smart Meter from Wiener Netze Type "Isramenko" or "Landis+ Gyr"
- An infrared serial adapter (only receiving is necessary)
- Your decryption key for 'Kundenschnittstelle' from Wiener Netze web portal (https://smartmeter-web.wienernetze.at/#/anlagedaten)"

To quickly test if data can be received and decrypted, use:

```shell
python3 -m wiener_netze_smartmeter_serial --interface COM1 --key aabbccddeeff00112233445566778899
```

To use it in your own Python project:

```python
import asyncio

from wiener_netze_smartmeter_serial import WienerNetzeSmartMeter


async def main() -> None:
	with WienerNetzeSmartMeter(
		"COM1", "aabbccddeeff00112233445566778899"
	) as meter:
		data = await meter.read_meter_data()
		print(f"Current Power Draw: {data.active_power_in} W")
		print(data)


asyncio.run(main())
```

Invalid configuration raises `ValueError`. Connection and decryption failures raise
`WienerNetzeSmartMeterConnectionException` and
`WienerNetzeSmartMeterDecryptionException`, respectively.

## Security

Supported Wiener Netze meters send DLMS encryption-only frames without an
authentication tag. The library can decrypt these frames but cannot
cryptographically verify their source or integrity. Treat raw and decrypted meter
data as sensitive, and review it before attaching it to an issue.

## Compatibility

- Currently only works with Wiener Netze Smart Meters of Type "Isramenko" and "Landis+ Gyr"  
  "Siemens" is currently not supported.  
  If you have a Siemens Smart Meter, you can help by opening an issue with a
  sanitized packet captured using the `--raw` flag.

## Credits

- This was made possible with the help and insight from: https://github.com/pocki80

## License

[MIT](https://choosealicense.com/licenses/mit/)
