From 81aeba8c14c402820d1b1d2e4654b3e69341b53d Mon Sep 17 00:00:00 2001 From: Marcel Date: Sat, 14 Aug 2021 13:40:36 +0200 Subject: [PATCH] [miio] add support for Mi Smart Standing Fan 2 (dmaker.fan.p18) (#11106) closing #11053 Signed-off-by: Marcel Verpaalen Signed-off-by: Dave J Schoepel --- bundles/org.openhab.binding.miio/README.md | 38 +++ .../binding/miio/internal/MiIoDevices.java | 1 + .../database/dmaker.fan.p18-miot.json | 317 ++++++++++++++++++ 3 files changed, 356 insertions(+) create mode 100644 bundles/org.openhab.binding.miio/src/main/resources/database/dmaker.fan.p18-miot.json diff --git a/bundles/org.openhab.binding.miio/README.md b/bundles/org.openhab.binding.miio/README.md index cabb4b57acaec..97a4486f14d62 100644 --- a/bundles/org.openhab.binding.miio/README.md +++ b/bundles/org.openhab.binding.miio/README.md @@ -211,6 +211,7 @@ Currently the miio binding supports more than 290 different models. | Mi Smart Tower Fan | miio:basic | [dmaker.fan.p9](#dmaker-fan-p9) | Yes | | | Mi Smart Standing Fan 2 | miio:basic | [dmaker.fan.p10](#dmaker-fan-p10) | Yes | | | Mi Smart Standing Fan Pro | miio:basic | [dmaker.fan.p15](#dmaker-fan-p15) | Yes | Identified manual actions for execution
`action{"did":"off-delay-time-toggle","siid":3,"aiid":1,"in":[]}`
Please test and feedback if they are working to they can be linked to a channel. | +| Mi Smart Standing Fan 2 | miio:basic | [dmaker.fan.p18](#dmaker-fan-p18) | Yes | Identified manual actions for execution
`action{"did":"fan-toggle","siid":2,"aiid":1,"in":[]}`
Please test and feedback if they are working to they can be linked to a channel.
Experimental support. Please report back if all channels are functional. Preferably share the debug log of property refresh and command responses | | Mi Robot Vacuum Mop 1C STYTJ01ZHM | miio:basic | [dreame.vacuum.mc1808](#dreame-vacuum-mc1808) | Yes | Identified manual actions for execution
`action{"did":"battery-start-charge","siid":2,"aiid":1,"in":[]}`
`action{"did":"vacuum-start-sweep","siid":3,"aiid":1,"in":[]}`
`action{"did":"vacuum-stop-sweeping","siid":3,"aiid":2,"in":[]}`
`action{"did":"brush-cleaner-reset-brush-life","siid":26,"aiid":1,"in":[]}`
`action{"did":"filter-reset-filter-life","siid":27,"aiid":1,"in":[]}`
`action{"did":"brush-cleaner-reset-brush-life","siid":28,"aiid":1,"in":[]}`
`action{"did":"clean-start-clean","siid":18,"aiid":1,"in":[]}`
`action{"did":"clean-stop-clean","siid":18,"aiid":2,"in":[]}`
`action{"did":"remote-start-remote","siid":21,"aiid":1,"in":[1.0, 2.0]}`
`action{"did":"remote-stop-remote","siid":21,"aiid":2,"in":[]}`
`action{"did":"remote-exit-remote","siid":21,"aiid":3,"in":[]}`
`action{"did":"map-map-req","siid":23,"aiid":1,"in":[2.0]}`
`action{"did":"audio-position","siid":24,"aiid":1,"in":[]}`
`action{"did":"audio-set-voice","siid":24,"aiid":2,"in":[]}`
`action{"did":"audio-play-sound","siid":24,"aiid":3,"in":[]}`
Please test and feedback if they are working to they can be linked to a channel. | | Dreame Robot Vacuum-Mop F9 | miio:basic | [dreame.vacuum.p2008](#dreame-vacuum-p2008) | Yes | Identified manual actions for execution
`action{"did":"vacuum-start-sweep","siid":2,"aiid":1,"in":[]}`
`action{"did":"vacuum-stop-sweeping","siid":2,"aiid":2,"in":[]}`
`action{"did":"battery-start-charge","siid":3,"aiid":1,"in":[]}`
`action{"did":"brush-cleaner-reset-brush-life","siid":9,"aiid":1,"in":[]}`
`action{"did":"brush-cleaner-reset-brush-life","siid":10,"aiid":1,"in":[]}`
`action{"did":"filter-reset-filter-life","siid":11,"aiid":1,"in":[]}`
`action{"did":"vacuum-extend-start-clean","siid":4,"aiid":1,"in":[10.0]}`
`action{"did":"vacuum-extend-stop-clean","siid":4,"aiid":2,"in":[]}`
`action{"did":"map-map-req","siid":6,"aiid":1,"in":[2.0]}`
`action{"did":"map-update-map","siid":6,"aiid":2,"in":[4.0]}`
`action{"did":"audio-position","siid":7,"aiid":1,"in":[]}`
`action{"did":"audio-play-sound","siid":7,"aiid":2,"in":[]}`
`action{"did":"time-delete-timer","siid":8,"aiid":1,"in":[3.0]}`
Please test and feedback if they are working to they can be linked to a channel.
Experimental support. Please report back if all channels are functional. Preferably share the debug log of property refresh and command responses | | Dreame Robot Vacuum D9 | miio:basic | [dreame.vacuum.p2009](#dreame-vacuum-p2009) | Yes | Identified manual actions for execution not linked in the database >`action{"did":"vacuum-extend-start-clean","siid":4,"aiid":1,"in":[10.0]}`
`action{"did":"vacuum-extend-stop-clean","siid":4,"aiid":2,"in":[]}`
`action{"did":"map-map-req","siid":6,"aiid":1,"in":[2.0]}`
`action{"did":"map-update-map","siid":6,"aiid":2,"in":[4.0]}`
`action{"did":"audio-position","siid":7,"aiid":1,"in":[]}`
`action{"did":"audio-play-sound","siid":7,"aiid":2,"in":[]}`
`action{"did":"time-delete-timer","siid":8,"aiid":1,"in":[3.0]}`
| @@ -831,6 +832,23 @@ e.g. `openhab:send actionCommand 'upd_timer["1498595904821", "on"]'` would enabl | off_delay_time | Number:Time | Off Delay Time - Off Delay Time | | | actions | String | Actions | Value mapping `["off-delay-time-toggle"="Off Delay Time Toggle"]` | +### Mi Smart Standing Fan 2 (dmaker.fan.p18) Channels + +| Channel | Type | Description | Comment | +|----------------------|----------------------|------------------------------------------|------------| +| actions | String | Actions | | +| on | Switch | Fan - Switch Status | | +| fan_level | Number | Fan - Fan Level | Value mapping `["1"="Level1","2"="Level2","3"="Level3","4"="Level4"]` | +| mode | Number | Fan - Mode | Value mapping `["0"="Straight Wind","1"="Natural Wind"]` | +| horizontal_swing | Switch | Fan - Horizontal Swing | | +| horizontal_angle | Number | Fan - Horizontal Angle | Value mapping `["30"="30","60"="60","90"="90","120"="120","140"="140"]` | +| off_delay_time | Number:Time | Fan - Power Off Delay Time | | +| brightness | Switch | Fan - Brightness | | +| alarm | Switch | Fan - Alarm | | +| motor_control | Number | Fan - Motor Control | Value mapping `["0"="NO","1"="LEFT","2"="RIGHT"]` | +| speed_level | Number | Fan - Speed Level | | +| physical_controls_locked | Switch | Physical Control Locked - Physical Control Locked | | + ### Mi Robot Vacuum Mop 1C STYTJ01ZHM (dreame.vacuum.mc1808) Channels | Channel | Type | Description | Comment | @@ -5492,6 +5510,26 @@ Number:Time off_delay_time "Off Delay Time - Off Delay Time" (G_fan) {channel="m String actions "Actions" (G_fan) {channel="miio:basic:fan:actions"} ``` +### Mi Smart Standing Fan 2 (dmaker.fan.p18) item file lines + +note: Autogenerated example. Replace the id (fan) in the channel with your own. Replace `basic` with `generic` in the thing UID depending on how your thing was discovered. + +``` +Group G_fan "Mi Smart Standing Fan 2" +String actions "Actions" (G_fan) {channel="miio:basic:fan:actions"} +Switch on "Fan - Switch Status" (G_fan) {channel="miio:basic:fan:on"} +Number fan_level "Fan - Fan Level" (G_fan) {channel="miio:basic:fan:fan_level"} +Number mode "Fan - Mode" (G_fan) {channel="miio:basic:fan:mode"} +Switch horizontal_swing "Fan - Horizontal Swing" (G_fan) {channel="miio:basic:fan:horizontal_swing"} +Number horizontal_angle "Fan - Horizontal Angle" (G_fan) {channel="miio:basic:fan:horizontal_angle"} +Number:Time off_delay_time "Fan - Power Off Delay Time" (G_fan) {channel="miio:basic:fan:off_delay_time"} +Switch brightness "Fan - Brightness" (G_fan) {channel="miio:basic:fan:brightness"} +Switch alarm "Fan - Alarm" (G_fan) {channel="miio:basic:fan:alarm"} +Number motor_control "Fan - Motor Control" (G_fan) {channel="miio:basic:fan:motor_control"} +Number speed_level "Fan - Speed Level" (G_fan) {channel="miio:basic:fan:speed_level"} +Switch physical_controls_locked "Physical Control Locked - Physical Control Locked" (G_fan) {channel="miio:basic:fan:physical_controls_locked"} +``` + ### Mi Robot Vacuum Mop 1C STYTJ01ZHM (dreame.vacuum.mc1808) item file lines note: Autogenerated example. Replace the id (vacuum) in the channel with your own. Replace `basic` with `generic` in the thing UID depending on how your thing was discovered. diff --git a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/MiIoDevices.java b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/MiIoDevices.java index 0e3988b81e2cd..dd45031ca1752 100644 --- a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/MiIoDevices.java +++ b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/MiIoDevices.java @@ -57,6 +57,7 @@ public enum MiIoDevices { DMAKER_FAN_P9("dmaker.fan.p9", "Mi Smart Tower Fan", THING_TYPE_BASIC), DMAKER_FAN_P10("dmaker.fan.p10", "Mi Smart Standing Fan 2", THING_TYPE_BASIC), DMAKER_FAN_P15("dmaker.fan.p15", "Mi Smart Standing Fan Pro", THING_TYPE_BASIC), + DMAKER_FAN_P18("dmaker.fan.p18", "Mi Smart Standing Fan 2", THING_TYPE_BASIC), DREAME_VACUUM_MC1808("dreame.vacuum.mc1808", "Mi Robot Vacuum Mop 1C STYTJ01ZHM", THING_TYPE_BASIC), DREAME_VACUUM_P2008("dreame.vacuum.p2008", "Dreame Robot Vacuum-Mop F9", THING_TYPE_BASIC), DREAME_VACUUM_P2009("dreame.vacuum.p2009", "Dreame Robot Vacuum D9 ", THING_TYPE_BASIC), diff --git a/bundles/org.openhab.binding.miio/src/main/resources/database/dmaker.fan.p18-miot.json b/bundles/org.openhab.binding.miio/src/main/resources/database/dmaker.fan.p18-miot.json new file mode 100644 index 0000000000000..f792d95677bb0 --- /dev/null +++ b/bundles/org.openhab.binding.miio/src/main/resources/database/dmaker.fan.p18-miot.json @@ -0,0 +1,317 @@ +{ + "deviceMapping": { + "id": [ + "dmaker.fan.p18" + ], + "propertyMethod": "get_properties", + "maxProperties": 1, + "channels": [ + { + "property": "", + "friendlyName": "Actions", + "channel": "actions", + "type": "String", + "stateDescription": { + "options": [ + { + "value": "fan-toggle", + "label": "Fan Toggle" + } + ] + }, + "actions": [ + { + "command": "action", + "parameterType": "EMPTY", + "siid": 2, + "aiid": 1, + "condition": { + "name": "matchValue", + "parameters": [ + { + "matchValue": "fan-toggle" + } + ] + } + } + ] + }, + { + "property": "on", + "siid": 2, + "piid": 1, + "friendlyName": "Fan - Switch Status", + "channel": "on", + "type": "Switch", + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "ONOFFBOOL" + } + ], + "category": "switch", + "tags": [ + "Switch" + ] + }, + { + "property": "fan-level", + "siid": 2, + "piid": 2, + "friendlyName": "Fan - Fan Level", + "channel": "fan_level", + "type": "Number", + "stateDescription": { + "options": [ + { + "value": "1", + "label": "Level1" + }, + { + "value": "2", + "label": "Level2" + }, + { + "value": "3", + "label": "Level3" + }, + { + "value": "4", + "label": "Level4" + } + ] + }, + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "NUMBER" + } + ], + "category": "fan", + "tags": [ + "SetPoint" + ], + "readmeComment": "Value mapping `[\"1\"\u003d\"Level1\",\"2\"\u003d\"Level2\",\"3\"\u003d\"Level3\",\"4\"\u003d\"Level4\"]`" + }, + { + "property": "mode", + "siid": 2, + "piid": 3, + "friendlyName": "Fan - Mode", + "channel": "mode", + "type": "Number", + "stateDescription": { + "options": [ + { + "value": "0", + "label": "Straight Wind" + }, + { + "value": "1", + "label": "Natural Wind" + } + ] + }, + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "NUMBER" + } + ], + "category": "flow", + "tags": [ + "Control" + ], + "readmeComment": "Value mapping `[\"0\"\u003d\"Straight Wind\",\"1\"\u003d\"Natural Wind\"]`" + }, + { + "property": "horizontal-swing", + "siid": 2, + "piid": 4, + "friendlyName": "Fan - Horizontal Swing", + "channel": "horizontal_swing", + "type": "Switch", + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "ONOFFBOOL" + } + ], + "category": "switch", + "tags": [ + "Switch" + ] + }, + { + "property": "horizontal-angle", + "siid": 2, + "piid": 5, + "friendlyName": "Fan - Horizontal Angle", + "channel": "horizontal_angle", + "type": "Number", + "stateDescription": { + "options": [ + { + "value": "30", + "label": "30" + }, + { + "value": "60", + "label": "60" + }, + { + "value": "90", + "label": "90" + }, + { + "value": "120", + "label": "120" + }, + { + "value": "140", + "label": "140" + } + ] + }, + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "STRING" + } + ], + "category": "incline", + "tags": [ + "Setpoint" + ], + "readmeComment": "Value mapping `[\"30\"\u003d\"30\",\"60\"\u003d\"60\",\"90\"\u003d\"90\",\"120\"\u003d\"120\",\"140\"\u003d\"140\"]`" + }, + { + "property": "off-delay-time", + "siid": 2, + "piid": 6, + "friendlyName": "Fan - Power Off Delay Time", + "channel": "off_delay_time", + "type": "Number:Time", + "unit": "minutes", + "stateDescription": { + "minimum": 0, + "maximum": 480, + "step": 1, + "pattern": "%.0f %unit%" + }, + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "STRING" + } + ] + }, + { + "property": "brightness", + "siid": 2, + "piid": 7, + "friendlyName": "Fan - Brightness", + "channel": "brightness", + "type": "Switch", + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "ONOFFBOOL" + } + ] + }, + { + "property": "alarm", + "siid": 2, + "piid": 8, + "friendlyName": "Fan - Alarm", + "channel": "alarm", + "type": "Switch", + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "ONOFFBOOL" + } + ] + }, + { + "property": "motor-control", + "siid": 2, + "piid": 9, + "friendlyName": "Fan - Motor Control", + "channel": "motor_control", + "type": "Number", + "stateDescription": { + "options": [ + { + "value": "0", + "label": "NO" + }, + { + "value": "1", + "label": "LEFT" + }, + { + "value": "2", + "label": "RIGHT" + } + ] + }, + "refresh": false, + "actions": [ + { + "command": "set_properties", + "parameterType": "NUMBER" + } + ], + "readmeComment": "Value mapping [\"0\"\u003d\"NO\",\"1\"\u003d\"LEFT\",\"2\"\u003d\"RIGHT\"]" + }, + { + "property": "speed-level", + "siid": 2, + "piid": 10, + "friendlyName": "Fan - Speed Level", + "channel": "speed_level", + "type": "Number", + "stateDescription": { + "minimum": 1, + "maximum": 100, + "step": 1, + "pattern": "%.0f" + }, + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "NUMBER" + } + ] + }, + { + "property": "physical-controls-locked", + "siid": 3, + "piid": 1, + "friendlyName": "Physical Control Locked - Physical Control Locked", + "channel": "physical_controls_locked", + "type": "Switch", + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "ONOFFBOOL" + } + ] + } + ], + "readmeComment": "Identified manual actions for execution\u003cbr /\u003e`action{\"did\":\"fan-toggle\",\"siid\":2,\"aiid\":1,\"in\":[]}`\u003cbr /\u003ePlease test and feedback if they are working to they can be linked to a channel.", + "experimental": true + } +}