From c157e395dc6669189e57f765c328f24dca39dd53 Mon Sep 17 00:00:00 2001 From: Marcel Date: Wed, 28 Apr 2021 12:26:29 +0200 Subject: [PATCH] [miio] add support for yeelink.light.lamp15 Yeelight Screen Light Bar (#10603) closes #10589 Signed-off-by: Marcel Verpaalen --- bundles/org.openhab.binding.miio/README.md | 38 ++- .../binding/miio/internal/MiIoDevices.java | 1 + .../database/yeelink.light.light15.json | 280 ++++++++++++++++++ 3 files changed, 318 insertions(+), 1 deletion(-) create mode 100644 bundles/org.openhab.binding.miio/src/main/resources/database/yeelink.light.light15.json diff --git a/bundles/org.openhab.binding.miio/README.md b/bundles/org.openhab.binding.miio/README.md index fb73af90a..e530e91e1 100644 --- a/bundles/org.openhab.binding.miio/README.md +++ b/bundles/org.openhab.binding.miio/README.md @@ -173,7 +173,7 @@ This will change the communication method and the Mi IO binding can communicate # Mi IO Devices -Currently the miio binding supports more than 280 different models. +Currently the miio binding supports more than 290 different models. | Device | ThingType | Device Model | Supported | Remark | |------------------------------|------------------|------------------------|-----------|------------| @@ -419,6 +419,7 @@ Currently the miio binding supports more than 280 different models. | Yeelight | miio:basic | [yeelink.light.lamp6](#yeelink-light-lamp6) | Yes | | | Yeelight LED Light Sensor Desk Lamp V1 | miio:basic | [yeelink.light.lamp7](#yeelink-light-lamp7) | Yes | | | Yeelight | miio:basic | [yeelink.light.lamp8](#yeelink-light-lamp8) | Yes | | +| Yeelight Screen Light Bar | miio:basic | [yeelink.light.lamp15](#yeelink-light-lamp15) | Yes | | | Yeelight Bulb | miio:basic | [yeelink.light.mono1](#yeelink-light-mono1) | Yes | | | Yeelight White Bulb v2 | miio:basic | [yeelink.light.mono2](#yeelink-light-mono2) | Yes | | | Yeelight LED Filament Bulb | miio:basic | [yeelink.light.mono5](#yeelink-light-mono5) | Yes | | @@ -3394,6 +3395,22 @@ e.g. `openhab:send actionCommand 'upd_timer["1498595904821", "on"]'` would enabl | colorMode | Number | Color Mode | | | name | String | Name | | +### Yeelight Screen Light Bar (yeelink.light.lamp15) Channels + +| Channel | Type | Description | Comment | +|----------------------|----------------------|------------------------------------------|------------| +| power | Switch | Power | | +| brightness | Dimmer | Brightness | | +| delayoff | Number:Time | Shutdown Timer | | +| colorTemperature | Number:Temperature | Color Temperature | | +| colorMode | Number | Color Mode | Value mapping ["0"="Default","1"="CT mode","2"="RGB mode","3"="HSV mode","4"="Color Flow mode","5"="Night Light mode"] | +| rgbColor | Color | RGB Color | | +| ambientBrightness | Number | Ambient Brightness | | +| ambientPower | Switch | Ambient Power | | +| ambientColor | Color | Ambient Color | | +| ambientColorTemperature | Number | Ambient Color Temperature | | +| ambientColorMode | Number | Ambient Color Mode | | + ### Yeelight Bulb (yeelink.light.mono1) Channels | Channel | Type | Description | Comment | @@ -8467,6 +8484,25 @@ Number colorMode "Color Mode" (G_light) {channel="miio:basic:light:colorMode"} String name "Name" (G_light) {channel="miio:basic:light:name"} ``` +### Yeelight Screen Light Bar (yeelink.light.lamp15) item file lines + +note: Autogenerated example. Replace the id (light) in the channel with your own. Replace `basic` with `generic` in the thing UID depending on how your thing was discovered. + +``` +Group G_light "Yeelight Screen Light Bar" +Switch power "Power" (G_light) {channel="miio:basic:light:power"} +Dimmer brightness "Brightness" (G_light) {channel="miio:basic:light:brightness"} +Number:Time delayoff "Shutdown Timer" (G_light) {channel="miio:basic:light:delayoff"} +Number:Temperature colorTemperature "Color Temperature" (G_light) {channel="miio:basic:light:colorTemperature"} +Number colorMode "Color Mode" (G_light) {channel="miio:basic:light:colorMode"} +Color rgbColor "RGB Color" (G_light) {channel="miio:basic:light:rgbColor"} +Number ambientBrightness "Ambient Brightness" (G_light) {channel="miio:basic:light:ambientBrightness"} +Switch ambientPower "Ambient Power" (G_light) {channel="miio:basic:light:ambientPower"} +Color ambientColor "Ambient Color" (G_light) {channel="miio:basic:light:ambientColor"} +Number ambientColorTemperature "Ambient Color Temperature" (G_light) {channel="miio:basic:light:ambientColorTemperature"} +Number ambientColorMode "Ambient Color Mode" (G_light) {channel="miio:basic:light:ambientColorMode"} +``` + ### Yeelight Bulb (yeelink.light.mono1) item file lines note: Autogenerated example. Replace the id (light) 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 ad6d08637..882963420 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 @@ -303,6 +303,7 @@ public enum MiIoDevices { YEELINK_LIGHT_LAMP6("yeelink.light.lamp6", "Yeelight", THING_TYPE_BASIC), YEELINK_LIGHT_LAMP7("yeelink.light.lamp7", "Yeelight LED Light Sensor Desk Lamp V1", THING_TYPE_BASIC), YEELINK_LIGHT_LAMP8("yeelink.light.lamp8", "Yeelight", THING_TYPE_BASIC), + YEELINK_LIGHT_LAMP15("yeelink.light.lamp15", "Yeelight Screen Light Bar", THING_TYPE_BASIC), YEELINK_LIGHT_MONO1("yeelink.light.mono1", "Yeelight Bulb", THING_TYPE_BASIC), YEELINK_LIGHT_MONO2("yeelink.light.mono2", "Yeelight White Bulb v2", THING_TYPE_BASIC), YEELINK_LIGHT_MONO5("yeelink.light.mono5", "Yeelight LED Filament Bulb", THING_TYPE_BASIC), diff --git a/bundles/org.openhab.binding.miio/src/main/resources/database/yeelink.light.light15.json b/bundles/org.openhab.binding.miio/src/main/resources/database/yeelink.light.light15.json new file mode 100644 index 000000000..21f487a99 --- /dev/null +++ b/bundles/org.openhab.binding.miio/src/main/resources/database/yeelink.light.light15.json @@ -0,0 +1,280 @@ +{ + "deviceMapping": { + "id": [ + "yeelink.light.lamp15" + ], + "propertyMethod": "get_prop", + "maxProperties": 2, + "channels": [ + { + "property": "power", + "friendlyName": "Power", + "channel": "power", + "type": "Switch", + "refresh": true, + "actions": [ + { + "command": "set_power", + "parameterType": "ONOFF" + } + ], + "category": "switch", + "tags": [ + "Switch" + ] + }, + { + "property": "bright", + "friendlyName": "Brightness", + "channel": "brightness", + "type": "Dimmer", + "refresh": true, + "actions": [ + { + "command": "set_bright", + "parameterType": "NUMBER", + "condition": { + "name": "BrightnessExisting" + } + }, + { + "command": "set_power", + "parameterType": "ONOFF", + "condition": { + "name": "BrightnessOnOff" + } + } + ], + "category": "light", + "tags": [ + "Setpoint", + "Light" + ] + }, + { + "property": "delayoff", + "friendlyName": "Shutdown Timer", + "channel": "delayoff", + "type": "Number:Time", + "unit": "seconds", + "refresh": true, + "actions": [ + { + "command": "cron_add", + "parameterType": "NUMBER", + "parameters": [ + 0, + "$value$" + ] + } + ], + "category": "time", + "tags": [ + "Setpoint", + "Duration" + ] + }, + { + "property": "ct", + "friendlyName": "Color Temperature", + "channel": "colorTemperature", + "type": "Number:Temperature", + "unit": "kelvin", + "stateDescription": { + "minimum": 1700, + "maximum": 6500, + "step": 1, + "pattern": "%.0f %unit%" + }, + "refresh": true, + "actions": [ + { + "command": "set_ct_abx", + "parameterType": "NUMBER", + "parameters": [ + "$value$", + "smooth", + 500 + ] + } + ], + "category": "colorlight", + "tags": [ + "Setpoint", + "Temperature" + ] + }, + { + "property": "color_mode", + "friendlyName": "Color Mode", + "channel": "colorMode", + "type": "Number", + "stateDescription": { + "minimum": 0, + "maximum": 5, + "step": 1, + "options": [ + { + "value": "0", + "label": "Default" + }, + { + "value": "1", + "label": "CT mode" + }, + { + "value": "2", + "label": "RGB mode" + }, + { + "value": "3", + "label": "HSV mode" + }, + { + "value": "4", + "label": "Color Flow mode" + }, + { + "value": "5", + "label": "Night Light mode" + } + ] + }, + "refresh": true, + "actions": [ + { + "command": "set_power", + "parameterType": "NUMBER", + "parameters": [ + "on", + "smooth", + 500, + "$value$" + ] + } + ], + "category": "settings", + "tags": [ + "Control", + "Light" + ], + "readmeComment": "Value mapping [\"0\"\u003d\"Default\",\"1\"\u003d\"CT mode\",\"2\"\u003d\"RGB mode\",\"3\"\u003d\"HSV mode\",\"4\"\u003d\"Color Flow mode\",\"5\"\u003d\"Night Light mode\"]" + }, + { + "property": "rgb", + "friendlyName": "RGB Color", + "channel": "rgbColor", + "type": "Color", + "refresh": true, + "ChannelGroup": "actions", + "actions": [ + { + "command": "set_rgb", + "parameterType": "COLOR", + "parameters": [ + "$value$", + "smooth", + 500 + ], + "condition": { + "name": "HSBOnly" + } + }, + { + "command": "set_bright", + "parameterType": "NUMBER", + "condition": { + "name": "BrightnessExisting" + } + }, + { + "command": "set_power", + "parameterType": "ONOFF", + "condition": { + "name": "BrightnessOnOff" + } + } + ], + "category": "colorpicker", + "tags": [ + "Control", + "Light" + ] + }, + { + "property": "bg_bright", + "friendlyName": "Ambient Brightness", + "channel": "ambientBrightness", + "channelType": "ambientBrightness", + "type": "Number", + "refresh": true, + "ChannelGroup": "actions", + "actions": [ + { + "command": "bg_set_bright", + "parameterType": "NUMBER" + } + ] + }, + { + "property": "bg_power", + "friendlyName": "Ambient Power", + "channel": "ambientPower", + "channelType": "ambientPower", + "type": "Switch", + "refresh": true, + "ChannelGroup": "actions", + "actions": [ + { + "command": "bg_set_power", + "parameterType": "ONOFF" + } + ] + }, + { + "property": "bg_rgb", + "friendlyName": "Ambient Color", + "channel": "ambientColor", + "channelType": "ambientColor", + "type": "Color", + "refresh": true, + "ChannelGroup": "actions", + "actions": [ + { + "command": "bg_set_rgb", + "parameterType": "COLOR" + } + ] + }, + { + "property": "bg_ct", + "friendlyName": "Ambient Color Temperature", + "channel": "ambientColorTemperature", + "channelType": "ambientColorTemperature", + "type": "Number", + "refresh": true, + "ChannelGroup": "actions", + "actions": [ + { + "command": "bg_set_ct_abx", + "parameterType": "NUMBER", + "parameters": [ + "$value$", + "smooth", + 500 + ] + } + ] + }, + { + "property": "bg_lmode", + "friendlyName": "Ambient Color Mode", + "channel": "ambientColorMode", + "channelType": "ambientColorMode", + "type": "Number", + "refresh": true, + "actions": [] + } + ] + } +}