This project provides a simplified control of devices via MQTT. Supports the Hasso auto configuration protocol
Project description
pydevice2mqtt
Python class library for device handling via MQTT. All devices supports the auto discovery and configuration of Hassio
Build and Install
build wheel:
# from top folder:
pip install -e .
flit build
install wheel:
pip install pydevice2mqtt
Usage
import os
import pathlib
import pydevice2mqtt
# may create a dict with the device information
new_device: dict = {"ArbitrarySensor": [
{"name": "Sensor 1",
"device_class": "current",
"unit_of_measurement": "A",
"object_id": "special_ID1"},
{"name": "Sensor 2",
"device_class": "temperature",
"unit_of_measurement": "C",
"object_id": "special_ID2"}
]}
remote_config = "remote_config.yaml" # your config file with the mqtt settings
pydevice2mqtt.DeviceBridge.update_config(devices=new_device, config_file=remote_config)
my_bridge = pydevice2mqtt.DeviceBridge(config_file=remote_config)
my_bridge.configure_devices() # add new devices in Hassio
my_bridge.loop()
Update Sensor Value
from typing import Dict
import pydevice2mqtt
devices: Dict[str,pydevice2mqtt.RemoteDevice] = my_bridge.get_devices()
devices[<unique_sensor_id>].set_value(123)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pydevice2mqtt-0.2.5.tar.gz
(12.3 kB
view details)
Built Distribution
File details
Details for the file pydevice2mqtt-0.2.5.tar.gz
.
File metadata
- Download URL: pydevice2mqtt-0.2.5.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f34e3433fa3d4570e5259dff9103300e2dcc0c231a18c7e9fadfd8993ee0b93b |
|
MD5 | 4a714c5b2ac8faf13656c90f37fdda84 |
|
BLAKE2b-256 | 0d6feb32cff7429dab5b2c69783d12651b5b650f28dab88ed3f331021e45b988 |
File details
Details for the file pydevice2mqtt-0.2.5-py3-none-any.whl
.
File metadata
- Download URL: pydevice2mqtt-0.2.5-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | df8261b91788d15427a8237c171ffa95c94082c7a0a64b9183cb26b2612989a7 |
|
MD5 | 6a9eec826673bd9b10214c71efe353be |
|
BLAKE2b-256 | 93db5006c3c006b7b2fe986f67ae7acf061706edae2844126de76ef849914114 |