diff --git a/README.md b/README.md index 18eb1f8..4acafcd 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,8 @@ These topics are reported from the device: | `{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/deviceLedBrightness` | Bright, Dim, Off | Selected LED Brightness | | `{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) | @@ -36,6 +36,7 @@ These topics can control the device: | CMD Topic | Values expected | Meaning | |--------------------------------------------|------------------------------|----------------------------------------------------------------------------| +| `{mqtt_topic}/CMD/deviceLedBrightness` | Bright, Dim, Off | Sets the LED Brightness | `{mqtt_topic}/CMD/devicePower` | on/off | Turn the device on or off | | `{mqtt_topic}/CMD/deviceMode` | Auto, Silent, Favorite, Fan | The mode to run (turns the device on) | | `{mqtt_topic}/CMD/fanLevel` | 1, 2, 3 | The fanlevel preset to run (turns the device on) | diff --git a/miotAirpurifierBridge.py b/miotAirpurifierBridge.py index 979c7cc..f2a17a0 100644 --- a/miotAirpurifierBridge.py +++ b/miotAirpurifierBridge.py @@ -32,7 +32,7 @@ def updateMqttStateTopic(): mqttClient.publish(mqtt_stateTopic + "filterRfidTag", apStatus.filter_rfid_tag) mqttClient.publish(mqtt_stateTopic + "filterType", apStatus.filter_type.name) mqttClient.publish(mqtt_stateTopic + "deviceBuzzerEnabled", apStatus.buzzer) - mqttClient.publish(mqtt_stateTopic + "deviceLedBrightnes", apStatus.led_brightness.name) + mqttClient.publish(mqtt_stateTopic + "deviceLedBrightness", apStatus.led_brightness.name) mqttClient.publish(mqtt_stateTopic + "deviceChildLockActive", apStatus.child_lock) mqttClient.publish(mqtt_stateTopic + "devicePowerOn", apStatus.is_on) mqttClient.publish(mqtt_stateTopic + "devicePower", apStatus.power) @@ -98,6 +98,18 @@ def on_mqttMessage(client, userdata, message): ap.set_mode(miio.airpurifier_miot.OperationMode.Silent) else: msgDataUnknown() + elif ( mqttMsgTopic == mqtt_cmdTopic+"deviceLedBrightness" ): + if ( mqttMsgData == "Bright" ): + log(2, "ACTION: Set LED brightness Bright") + ap.set_led_brightness(miio.airpurifier_miot.LedBrightness.Bright) + elif ( mqttMsgData == "Dim" ): + log(2, "ACTION: Set LED brightness Dim") + ap.set_led_brightness(miio.airpurifier_miot.LedBrightness.Dim) + elif ( mqttMsgData == "Off" ): + log(2, "ACTION: Set LED brightness Off") + ap.set_led_brightness(miio.airpurifier_miot.LedBrightness.Off) + else: + msgDataUnknown() else: log(2, "The MQTT topic is invalid")