diff --git a/addons/binding/org.openhab.binding.miio/ESH-INF/thing/CommonChannels.xml b/addons/binding/org.openhab.binding.miio/ESH-INF/thing/CommonChannels.xml index aa6131adbee0f..aa488a2405ac7 100644 --- a/addons/binding/org.openhab.binding.miio/ESH-INF/thing/CommonChannels.xml +++ b/addons/binding/org.openhab.binding.miio/ESH-INF/thing/CommonChannels.xml @@ -44,6 +44,14 @@ Switch + + Switch + + + + Switch + + String @@ -62,6 +70,18 @@ Number + + Number + + + + Number + + + + Number + + Switch @@ -70,6 +90,10 @@ Number + + Number + + Number @@ -86,6 +110,10 @@ Number + + String + + Number diff --git a/addons/binding/org.openhab.binding.miio/database/philips.light.sread1.json b/addons/binding/org.openhab.binding.miio/database/philips.light.sread1.json new file mode 100644 index 0000000000000..c85ec4579a57e --- /dev/null +++ b/addons/binding/org.openhab.binding.miio/database/philips.light.sread1.json @@ -0,0 +1,88 @@ +{ + "deviceMapping": { + "id": [ + "philips.light.sread1" + ], + "channels": [ + { + "property": "power", + "friendlyName": "Power", + "channel": "power", + "type": "Switch", + "refresh": true, + "ChannelGroup": "", + "actions": [ + { + "command": "set_power", + "parameterType": "ONOFF" + } + ] + }, + { + "property": "bright", + "friendlyName": "Brightness", + "channel": "brightness", + "type": "Number", + "refresh": true, + "ChannelGroup": "actions", + "actions": [ + { + "command": "set_bright", + "parameterType": "NUMBER" + } + ] + }, + { + "property": "ambstatus", + "friendlyName": "Ambient Power", + "channel": "ambientPower", + "type": "Switch", + "refresh": true, + "ChannelGroup": "actions", + "actions": [ + { + "command": "enable_amb", + "parameterType": "ONOFF" + } + ] + }, + { + "property": "ambvalue", + "friendlyName": "Ambient Brightness", + "channel": "ambientBrightness", + "type": "Number", + "refresh": true, + "ChannelGroup": "actions", + "actions": [ + { + "command": "set_amb_bright", + "parameterType": "NUMBER" + } + ] + }, + { + "property": "dvalue", + "friendlyName": "Ambient Illumination", + "channel": "illumination", + "type": "Number", + "refresh": true, + "ChannelGroup": "", + "actions": [] + }, + { + "property": "eyecare", + "friendlyName": "Eyecare", + "channel": "eyecare", + "type": "Switch", + "refresh": true, + "ChannelGroup": "actions", + "actions": [ + { + "command": "set_eyecare", + "parameterType": "ONOFF" + } + ] + } + ] + } +} diff --git a/addons/binding/org.openhab.binding.miio/database/yeelink.light.ceiling4.json b/addons/binding/org.openhab.binding.miio/database/yeelink.light.ceiling4.json index 4ca64ad371958..5d7bf946d5833 100644 --- a/addons/binding/org.openhab.binding.miio/database/yeelink.light.ceiling4.json +++ b/addons/binding/org.openhab.binding.miio/database/yeelink.light.ceiling4.json @@ -32,6 +32,20 @@ } ] }, + { + "property": "bg_bright", + "friendlyName": "Ambient Brightness", + "channel": "ambientBrightness", + "type": "Number", + "refresh": true, + "ChannelGroup": "actions", + "actions": [ + { + "command": "bg_set_bright", + "parameterType": "NUMBER" + } + ] + }, { "property": "delayoff", "friendlyName": "delayoff", @@ -64,17 +78,12 @@ }, { "property": "color_mode", - "friendlyName": "colorMode", + "friendlyName": "Color Mode", "channel": "colorMode", "type": "Number", "refresh": true, - "ChannelGroup": "actions", - "actions": [ - { - "command": "set_scene", - "parameterType": "NUMBER" - } - ] + "ChannelGroup": "", + "actions": [] }, { "property": "name", @@ -90,6 +99,20 @@ } ] }, + { + "property": "bg_power", + "friendlyName": "Ambient Power", + "channel": "ambientPower", + "type": "Switch", + "refresh": true, + "ChannelGroup": "actions", + "actions": [ + { + "command": "bg_set_power", + "parameterType": "ONOFF" + } + ] + }, { "property": "bg_rgb", "friendlyName": "Ambient Color", @@ -114,9 +137,43 @@ "actions": [ { "command": "bg_set_ct_abx", - "parameterType": "NUMBER" + "parameterType": "NUMBER", + "parameter1": "\"smooth\"", + "parameter2": "500" } ] + }, + { + "property": "", + "friendlyName": "Set Scene", + "channel": "customScene", + "type": "String", + "refresh": false, + "ChannelGroup": "actions", + "actions": [ + { + "command": "set_scene", + "parameterType": "CUSTOMSTRING" + } + ] + }, + { + "property": "bg_lmode", + "friendlyName": "Ambient Color Mode", + "channel": "ambientColorMode", + "type": "Number", + "refresh": true, + "ChannelGroup": "", + "actions": [] + }, + { + "property": "nl_br", + "friendlyName": "Nightlight Brightness", + "channel": "nightlightBrightness", + "type": "Number", + "refresh": true, + "ChannelGroup": "", + "actions": [] } ] } diff --git a/addons/binding/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/handler/MiIoBasicHandler.java b/addons/binding/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/handler/MiIoBasicHandler.java index c50b169e6b7ae..20cf0265e73ab 100644 --- a/addons/binding/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/handler/MiIoBasicHandler.java +++ b/addons/binding/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/handler/MiIoBasicHandler.java @@ -144,7 +144,11 @@ public void handleCommand(ChannelUID channelUID, Command command) { cmd = cmd + "[]"; } } else if (command instanceof StringType) { - cmd = cmd + "[\"" + command.toString() + "\"" + para + "]"; + if (paramType == CommandParameterType.STRING) { + cmd = cmd + "[\"" + command.toString() + "\"" + para + "]"; + } else if (paramType == CommandParameterType.CUSTOMSTRING) { + cmd = cmd + "[" + command.toString() + para + "]"; + } } else if (command instanceof DecimalType) { cmd = cmd + "[" + command.toString().toLowerCase() + para + "]"; } diff --git a/addons/binding/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/MiIoDevices.java b/addons/binding/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/MiIoDevices.java index 87bbb72c46b01..00f06ba4f34d6 100644 --- a/addons/binding/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/MiIoDevices.java +++ b/addons/binding/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/MiIoDevices.java @@ -48,7 +48,7 @@ public enum MiIoDevices { LUMI_C11("lumi.ctrl_neutral1.v1", "Light Control (Wall Switch)", MiIoBindingConstants.THING_TYPE_UNSUPPORTED), LUMI_C12("lumi.ctrl_neutral2.v1", "Light Control (Wall Switch)", MiIoBindingConstants.THING_TYPE_UNSUPPORTED), PHILIPS_R1("philips.light.sread1", "Xiaomi Philips Eyecare Smart Lamp 2", - MiIoBindingConstants.THING_TYPE_UNSUPPORTED), + MiIoBindingConstants.THING_TYPE_BASIC), PHILIPS_C("philips.light.ceiling", "Xiaomi Philips LED Ceiling Lamp", MiIoBindingConstants.THING_TYPE_BASIC), PHILIPS_C2("philips.light.zyceiling", "Xiaomi Philips LED Ceiling Lamp", MiIoBindingConstants.THING_TYPE_BASIC), PHILIPS_BULB("philips.light.bulb", "Xiaomi Philips Bulb", MiIoBindingConstants.THING_TYPE_BASIC), diff --git a/addons/binding/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/basic/CommandParameterType.java b/addons/binding/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/basic/CommandParameterType.java index 7c0834dd9d1bb..6fcb62c4e7884 100644 --- a/addons/binding/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/basic/CommandParameterType.java +++ b/addons/binding/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/basic/CommandParameterType.java @@ -18,6 +18,7 @@ public enum CommandParameterType { EMPTY("empty"), ONOFF("onoff"), STRING("string"), + CUSTOMSTRING("customstring"), NUMBER("number"), COLOR("color"), UNKNOWN("unknown");