diff --git a/README.md b/README.md index e84fb06..c70f1ff 100644 --- a/README.md +++ b/README.md @@ -6,51 +6,51 @@ This script bridges the air pufifier to the following state and control topics i These topics are reported from the device: -| STATE Topic | Values to expect | Meaning | -|-------------------------------------|------------------------------|----------------------------------------------------------------------------| -| $device/STATE/TIMESTAMP | 2020-03-29T15:44 | Timestamp of the last state update | -| $device/STATE/airQualityIndex | 0-999 | AQI current value (ppm2.5?) | -| $device/STATE/airQualityIndexAvg | 0-999 | AQI as displayed on the frontpanel (?) | -| $device/STATEairTemperatureC | FLOAT | Current temperature in °C | -| $device/STATE/airRelHumidityPercent | 0-100 | Relative humidity in % | -| $device/STATE/fanMotorSpeed | INT | Current motorspeed in rpm | -| $device/STATE/fanLevel | 1-3 | Fanlevel preset as selected by the button (1,2,3 waves) | -| $device/STATE/fanFavoriteSetLevel | 1-14 | Fanlevel preset for heart-mode (fanLevels 1-3 are positions in this range) | -| $device/STATE/filterUsedHours | INT | Filter-usage-time in hours | -| $device/STATE/filterRemainingPercent| 0-100 | Remaining filter-live in % | -| $device/STATE/filterRfidProductId | 0:0:31:31 | Filter product-id | -| $device/STATE/filterType | Regular, ... | Common name for the filtertype | -| $device/STATE/filterRfidTag | 80:66:58:da:7f:55:4 | The filters unique ID | -| $device/STATE/deviceBuzzerEnabled | True/False | Can the buzzer buzz? | -| $device/STATE/deviceLedBrightnes | Bright, Dim, Off | Brightness... | -| $device/STATE/deviceChildLockActive | True/False | Is the childlock active? | -| $device/STATE/devicePowerOn | True/False | Is the device powered on? | -| $device/STATE/devicePower | on/off | Power... | -| $device/STATE/deviceMode | Auto, Silent, Favorite, Fan | Mode as selcted by the front-button. (3 fanmodes indicated by fanLevel) | -| $device/STATE/statPurifiedVolumeM3 | INT | Purified volume of air | -| $device/STATE/statTimeActive | INT | Seconds active | +| STATE Topic | Values to expect | Meaning | +|--------------------------------------------|------------------------------|----------------------------------------------------------------------------| +| `{mqtt_topic}/STATE/TIMESTAMP` | 2020-03-29T15:44 | Timestamp of the last state update | +| `{mqtt_topic}/STATE/airQualityIndex` | 0-999 | AQI current value from the frontpanel (PM2.5[µg/m³]) | +| `{mqtt_topic}/STATE/airQualityIndexAvg` | 0-999 | Average AQI (Not yet seen elsewehere) | +| `{mqtt_topic}/STATEairTemperatureC` | NUM-1 | Current temperature in °C | +| `{mqtt_topic}/STATE/airRelHumidityPercent` | 0-100 | Relative humidity in % | +| `{mqtt_topic}/STATE/fanMotorSpeed` | 0.0-2500.0 | Current motorspeed in rpm | +| `{mqtt_topic}/STATE/fanLevel` | 1-3 | Fanlevel preset as selected by the button (1, 2, 3 waves) | +| `{mqtt_topic}/STATE/fanFavoriteSetLevel` | 1-14 | Fanlevel preset for heart-mode (fanLevels 1-3 are positions in this range) | +| `{mqtt_topic}/STATE/filterUsedHours` | INT | Filter-usage-time in hours | +| `{mqtt_topic}/STATE/filterRemainingPercent`| 0-100 | Remaining filter-live in % | +| `{mqtt_topic}/STATE/filterRfidProductId` | 0:0:31:31 | Filter product-id | +| `{mqtt_topic}/STATE/filterType` | Regular, ... | Commonname for the filtertype | +| `{mqtt_topic}/STATE/filterRfidTag` | 80:66:58:da:7f:55:4 | The current filters unique ID | +| `{mqtt_topic}/STATE/deviceBuzzerEnabled` | True/False | Can the buzzer buzz? | +| `{mqtt_topic}/STATE/deviceLedBrightnes` | Bright, Dim, Off | Selected LED Brightness | +| `{mqtt_topic}/STATE/deviceChildLockActive` | True/False | Is the childlock active? | +| `{mqtt_topic}/STATE/devicePowerOn` | True/False | Is the device powered on? | +| `{mqtt_topic}/STATE/devicePower` | on/off | Power... | +| `{mqtt_topic}/STATE/deviceMode` | Auto, Silent, Favorite, Fan | Mode as selcted by the front-button. (3 fanmodes indicated by fanLevel) | +| `{mqtt_topic}/STATE/statPurifiedVolumeM3` | INT | Purified volume of air | +| `{mqtt_topic}/STATE/statTimeActive` | INT | Seconds active | These topics can control the device: -| CMD Topic | Values expected | Meaning | -|----------------------|------------------|-------------------------------| -| $device/CMD/power | on/off | Turn the device on or off | +| CMD Topic | Values expected | Meaning | +|-----------------------------|------------------|-------------------------------| +| `{mqtt_topic}/CMD/power` | on/off | Turn the device on or off | ## Prerequisits -- Python 3 -- PAHO MQTT-Client module -- python-miio > 5.0.1 (available from PIP) -- The devices security token +* Python 3 + * paho-mqtt + * python-miio >= 0.5.0.1 (available from pip / pyPI) +* The devices security token ## Usage -- Copy airpurifier.conf.sample to airpurifier.conf -- Adjust the values in airpurifier.conf -- Run miotAirpurifierBridge.py +* Copy `airpurifier.conf.sample` to `airpurifier.conf` +* Adjust the values in `airpurifier.conf` +* Run `miotAirpurifierBridge.py` Set the environment `airpurifierConfigFile` to use a different configfile. diff --git a/airpurifier.conf.sample b/airpurifier.conf.sample index 4bae939..35c8274 100644 --- a/airpurifier.conf.sample +++ b/airpurifier.conf.sample @@ -1,8 +1,8 @@ -mqtt_ip = "1.2.3.5" # MQTT Broker IP -mqtt_topic = "testing/airPurifierBridge" # MQTT Topic to use +mqtt_ip = "1.2.3.5" # MQTT broker IP or hostname +mqtt_topic = "testing/airPurifierBridge" # MQTT topic to use -miot_ip ="1.2.3.4" # Xiaomi Arpurfier 3H IP-Address -miot_token ="1234567890ABCDEFGHIJKLMNopqrstuv" # device Token +miot_ip ="1.2.3.4" # Xiaomi arpurfier 3H IP or hostname +miot_token ="1234567890ABCDEFGHIJKLMNopqrstuv" # Device security token update_interval = (10 * 60) # Update between regular updates of the state (10 minutes)