Skip to main content

A package to integrate Comfee Dehumidifiers with MQTT Broker.

Project description

ComfeePool

A package to integrate Comfee Equipments with MQTT Brokers. This package intends to discover Comfee or Midea Equipment in the network and manage it as a pool of devices that can be accessible through the MQTT Broker.

Introduction

The package is intended to establish an MQTT interface with the Comfee equipment. The equipment attributes will be readable in the MQTT Broker through a topic in the form /<level0>/<level1>/attribute. The equipment will be located within a hierarchy of levels in the MQTT Broker, being the device located into 2 levels, typically location and equipment, and within the equipment all the attributes of this device.

The special attribute /<level0>/<level1>/<command> is serving as a special attribute to send commands to the device. The commands are those available from the library midea_inventor_lib and the function behind this package simply wraps a json command with its arguments. This json content is simply passed onto the package midea_inventor_lib and executes the command onto the equipment. The json document including the execution of a command is in the form:

{
	"action": "name of the method",
	"args": "{
				"arg1": "value 1",
				"arg2": "value 2",
				"argN": "value N"
			}
}

The name of the the method is one of the midea_inventor_lib methods.

Workflow diagram

The device and the MQTT have the following communication diagram

sequenceDiagram
Device (Midea_inventor_lib)->> ComfeePool: Device Status
ComfeePool -->> MQTT Broker: Publish Topics
MQTT Broker ->> User Program: Status attributes 
User Program ->> MQTT Broker: { command, args }
MQTT Broker -->> ComfeePool: Subscribe Topics<br/>(command)
ComfeePool ->> Device (Midea_inventor_lib): Function call<br/> Execution command
Note right of User Program: Async calls to execute<br/>commands on device.

Configuration file

The package gives the possibility to configure parameters through a configuration file. This file can be, as an example, like this:

[comfee] logfile=comfeepool.log username=<YOUR_USERNAME> password=<YOUR_PASSWORD>

[broker] ip=127.0.0.1 port=1883

The configuration file will be splitted into two areas:

  • [comfee]: this area defines the midea account, user and password to operate with the device. It also gives the chance to log data to a logfile.
  • [broker]: this is the broker ip:port to connect to. This broker is to be setup apart from this package.

How to install

To install the library just execute:

pip install ComfeePool

Example

# Configuration of the Shelly device config = ComfeePool.ComfeeConfig(sys.argv[1]) params_Comfee = config.read(section="comfee") params_broker = config.read(section="broker")

print(f"Comfee Devices Pool Version {ComfeePool.__version__}") print(f"Creating Pool of Comfee Devices . . . ", end="") pool = ComfeePool.ComfeePool(username=params_Comfee['username'], password=params_Comfee['password'], brokerIP=params_broker['ip'], brokerPort=int(params_broker['port'])) print(f"[ OK ]")

print(f"Connecting the pool") pool.connect() print(f"Discovering devices") pool.discover()

print(f"Running the pool") pool.start()

print(f"Finalizing Comfee Pool . . . [ OK ]")

Release Notes

0.1.1 - Initial release

Credits

Project details


Download files

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

Source Distribution

comfeepool-0.1.1.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

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

comfeepool-0.1.1-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file comfeepool-0.1.1.tar.gz.

File metadata

  • Download URL: comfeepool-0.1.1.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.7

File hashes

Hashes for comfeepool-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a88805ae625222c91ab50116a151ba9fad8421a135c82b0342241bf9f5e396ff
MD5 dd736c424a3d73cbe32ebb8cdc142fc2
BLAKE2b-256 8c304f129f0f526e2e884bd050722e0074fbc5b051d44b084fad77d3cc00936b

See more details on using hashes here.

File details

Details for the file comfeepool-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: comfeepool-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.7

File hashes

Hashes for comfeepool-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b95bd0c0326e6a274fdd3f17cc02db04563785798b48e4526e3bf96c520bcc80
MD5 51e556f4f898c8c7409b21b14d1218ce
BLAKE2b-256 1b281260c343ea4b9f473f5d8129a445ca142d483fa4a8875085a460c4958037

See more details on using hashes here.

Supported by

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