tbd
Project description
pydevice2mqtt
Python class library for generating and sending data to the Home Assistant via MQTT (AutoDiscovery) of data from devices
Build and Install
build wheel:
# from top folder:
pip install -e .
flit build
install wheel:
# inside dist folder:
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.0.1.dev0.tar.gz
(12.9 kB
view hashes)
Built Distribution
Close
Hashes for pydevice2mqtt-0.0.1.dev0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0967c7e7d711f84443fc84a4bef2d65a294124c5b6befc0d3cbd7090e7c5462 |
|
MD5 | 755d074e3abb4cf6bc0dc878b3b7ab7a |
|
BLAKE2b-256 | 9e77a95cd5c3aef43016a969be42828787fa627cd5261244b1252ee44eae6bba |