Crate gree

source ·
Expand description

Controlling Gree Smart air conditioning units via Rust

This crate defines two clients, GreeClient and Gree, for each of two programming styles (synchronous and asynchronous). Asynchronous clients require tokio feature.

  • GreeClient is a low-level API
  • Gree is a high-level Gree protocol client. It maintains network state and provides a kind of automated workflow.

See documentation under sync_client and async_client.

Gree high-level client

In particular, in Gree scans and binds typically do not need to be invoked explicitly, as the client invokes them from within net_read/net_write/with_device if necessary. More precisely:

  • Bind is invoked if the Device’s key field is needed but empty
  • Scan is invoked if one of the following holds:
    • the last scan performed is older than max_scan_age
    • net_read/net_write/with_device is called against a device that is missing from the internal state
    • there was a network error communicating with the device
    • the scan was invoked explicitly
  • Scan is always bypassed if the last scan performed is younger than min_scan_age

Features

  • tokio - enable asynchronous clients with tokio

See also

Modules

  • Asynchronous Gree cilents (requires tokio)
  • Synchronous Gree cilents
  • Constants and definitions for Gree parameters and enumerations for their possible values

Macros

Structs

Enums

  • NetVar Operation
  • Represents any valid JSON value.

Traits

  • Network Variable (NetVar) defines a protocol for exchanging Values with the network.

Functions

  • Constructs NetVarBag from an iterator of names. The bag returned is ready to be used in a network read call.
  • Constructs NetVarBag from an iterator of (name, value) pairs. The bag returned is ready to be used in a network write call.
  • Converts NetVarBag into a json. Convenient for value reporting.

Type Definitions