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§

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

Macros§

net_var_bag
Constructs NetVarBag of SimpleNetVars, for reading (from keys) or writing (from key => value pairs)

Structs§

Device
Information about a gree Device on the network.
GreeClientConfig
Low-level Gree client configuration
GreeConfig
Gree network configuration
GreeState
State of Gree network
SimpleNetVar
A basic implementation of NetVar

Enums§

Error
Op
NetVar Operation
Value
Represents any valid JSON value.

Traits§

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

Functions§

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

Type Aliases§

MacAddr
NetVarBag
A collection of network variables by internalized name
Result