Each device has a specification:
{
"<model>": ["<brand>", "<name>", "<market model>", "<other model>"],
"spec": [<list of converters>],
"ttl": <time to live>
}
- model - `lumi.xxx` for Zigbee devices, number (pdid) for BLE and Mesh devices
- spec - list of converters
- ttl - optional available timeout
Each converter has:
Converter(<attribute name>, <hass domain>, <mi name>)
- attribute - required, entity or attribute name in Hass
- domain - optional, hass entity type (`sensor`, `switch`, `binary_sensor`...)
- mi - optional, item name in:
- Lumi spec `mi="8.0.2012"`
- MIoT spec `mi="2.p.1"` or `mi="2.e.1"` or `mi="3.e.1012.p.1"`
- MiBeacon spec `mi=4100`
Old Zigbee devices uses Lumi format, new Zigbee 3 and Mesh devices uses MIoT format.
Converter may have different types:
- BaseConv - default, don't change/convert value
- BoolConv - converts int to bool on decode and bool to int on encode
- MapConv - translate value using mapping: `{0: "disarmed", 1: "armed_home"}`
- MathConv - support multiply, round value and min/max borders
- and many others...
For MIoT bool properties you should use `BaseConv`. For MIoT uint8 properties you
should use `BoolConv`.
If converter has `entity=ENTITY_LAZY` - it will work, but entity will setup only with
first data from device. Useful if we don't know exact spec of device. Example, battery
not exist on some firmwares of some devices.
The name of the attribute defines the device class, icon and unit of measure.
Recommended attributes names:
- `motion` - the sensor can only send motion detection (timeout in Hass)
- `occupancy` - the sensor can send motion start and motion stop
- `plug` - for sockets with male connector
- `outlet` - for sockets with only female connector (wall installation)
- `switch` - for relays and switches with buttons (wall installation, remotes)
- `led` - control device led light
- `wireless` - change mode from wired to wireless (decoupled)
- `power_on_state` - default state when electricity is supplied
- `contact` - for door/windor sensor (zigbee2mqtt - contact, hass - door or window)
- `water_leak` - for water leak sensor (zigbee2mqtt - water_leak, hass - moisture)
Nice project with MIoT spec description: https://home.miot-spec.com/
"""
from .converters.base import *
from .converters.const import *
from .converters.lumi import *
from .converters.mesh import *
from .converters.mibeacon import *
from .converters.zigbee import *
# Disable Black formatter and ignore line width
# fmt: off
# Gateways (lumi and miot specs)