Add CMD topic LedBrightness
To set the devices led brightness by mqtt.
This commit is contained in:
parent
6e44778cbb
commit
671d534f56
2 changed files with 15 additions and 2 deletions
|
@ -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) |
|
||||
|
|
|
@ -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")
|
||||
|
||||
|
|
Reference in a new issue