From 802212c90e542726c5aeca57a9a31fee2d2bdf92 Mon Sep 17 00:00:00 2001 From: Beta-User Date: Sun, 30 Dec 2018 12:33:34 +0000 Subject: [PATCH] mqtt2.template: enhance Milight templates git-svn-id: https://svn.fhem.de/fhem/trunk@18093 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/lib/AttrTemplate/mqtt2.template | 63 +++++++++++++++++++---- 1 file changed, 53 insertions(+), 10 deletions(-) diff --git a/fhem/FHEM/lib/AttrTemplate/mqtt2.template b/fhem/FHEM/lib/AttrTemplate/mqtt2.template index 56efa997b..361f4b179 100644 --- a/fhem/FHEM/lib/AttrTemplate/mqtt2.template +++ b/fhem/FHEM/lib/AttrTemplate/mqtt2.template @@ -38,10 +38,9 @@ attr DEVICE setList\ permit_join:true,false BASE_TOPIC/bridge/config/permit_join $EVTPART1\ remove:textField BASE_TOPIC/bridge/config/remove $EVTPART1\ rename:textField BASE_TOPIC/bridge/config/rename {"old":"$EVTPART1","new":"$EVTPART2"} +attr DEVICE setStateList on off attr DEVICE model L_01_zigbee2mqtt_bridge # Based on https://forum.fhem.de/index.php/topic,94060.msg872371.html#msg872371 -# networkmap networkmap_graphviz needs some additional configuration: https://forum.fhem.de/index.php/topic,84790.msg848840.html#msg848840 -# networkmap_result_g muß mind. noch nachbearbeitet werden: "| sfdp -Tpng | display -", name:L_01a_zigbee2mqtt_bridge_0x desc:The zigbee2mqtt bridge device
New version, using entire device name including "0x" @@ -73,6 +72,7 @@ attr DEVICE setList \ on:noArg BASE_TOPIC/DEV_ID/set {"state":"ON"}\ off:noArg BASE_TOPIC/DEV_ID/set {"state":"OFF"}\ brightness:colorpicker,BRI,0,15,255 BASE_TOPIC/DEV_ID/set {"state":"on","$EVTPART0":"$EVTPART1"} +attr DEVICE setStateList on off attr DEVICE model L_02a_zigbee2mqtt_bulb # A dimmable color light connected via zigbee2mqtt @@ -417,6 +417,7 @@ desc:use this with Chris Mullins ESP-Milight-Hub. for further details visit http par:BASE_ID;BASE_ID typically is milight;{ AttrVal("DEVICE","readingList","") =~ m,([^/]+)[/].*ates/.*:, ? $1 : undef } attr DEVICE bridgeRegexp BASE_ID/states/(0x....)/.*/([0-4])?.*:.* "milight_$1_$2" attr DEVICE autocreate 1 +attr DEVICE setStateList on off attr DEVICE model X_01_esp_milight_hub_bridge #rgbw-bulb @@ -442,9 +443,47 @@ attr DEVICE setList\ brightness:colorpicker,BRI,0,15,255 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ hue:colorpicker,HUE,0,1,359 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ command:uzsuSelectRadio,Weiss,Nacht BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"} +attr DEVICE setStateList on off #attr DEVICE userReadings rgb {sprintf("%02X%02X%02X", ReadingsVal($name,"color_r",255), ReadingsVal($name,"color_g",255), ReadingsVal($name,"color_b",255))} attr DEVICE model X_01_esp_milight_hub_rgbw_bulb +#rgbw_cct-bulb +name:X_01a_esp_milight_hub_rgb_cct_bulb +filter:TYPE=MQTT2_DEVICE +desc:For use with X_01_esp_milight_hub_bridge
NOTE: Development state is experimental!
Source: Forum +par:BASE_ID;BASE_ID typically is milight;{ AttrVal("DEVICE","readingList","") =~ m,([^/]+)[/].*ates/.*:, ? $1 : undef } +par:GROUP_ID;number from 0 to 4 representing one of the channels of an original bridge or remote;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/][^/]+[/][^/]+[/]([0-4]):, ? $1 : undef } +par:REMOTE_ID;HEX number representing a specific remote or bridge;{ AttrVal("DEVICE","readingList","") =~ m,([^/]+)[/](0x....)[/].*:, ? $2 : undef } +par:BULB_TYPE;rgbw, cct, rgb_cct, rgb, fut089, ;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/][^/]+[/][^/]+[/]([^/]+)[/].*:, ? $1 : undef } +deletereading DEVICE .*_.* +attr DEVICE icon light_control +attr DEVICE eventMap /set_white:Weiss/night_mode:Nacht/white_mode:white/on:on/off:off/ON:on/OFF:off/next_mode:Mode/mode_speed_up:Faster/mode_speed_down:Slower/level_up:Up/level_down:Down/ +attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name)} +attr DEVICE readingList BASE_ID/states/REMOTE_ID/BULB_TYPE/GROUP_ID:.* { json2nameValue($EVENT) }\ + BASE_ID/states/REMOTE_ID/BULB_TYPE/0:.* { json2nameValue($EVENT) }\ + BASE_ID/updates/REMOTE_ID/BULB_TYPE/GROUP_ID:.* { json2nameValue($EVENT) }\ + BASE_ID/updates/REMOTE_ID/BULB_TYPE/0:.* { json2nameValue($EVENT) } +attr DEVICE setList\ + on BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"status":"ON"}\ + off BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"status":"OFF"}\ + brightness:colorpicker,BRI,0,15,255 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ + hue:colorpicker,HUE,0,1,359 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ + color_temp:colorpicker,CT,153,1,370 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ + saturation:colorpicker,BRI,0,1,100 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ + command:uzsuSelectRadio,Weiss,Nacht BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ + program:uzsuSelectRadio,Mode,Faster,Slower BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"command":"$EVTPART1"}\ + mode:select,0,1,2,3,4,5,6,7,8 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ + dim:uzsuSelectRadio,Up,Down BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"command":"$EVTPART1"} +#attr DEVICE userReadings rgb {sprintf("%02X%02X%02X", ReadingsVal($name,"color_r",255), ReadingsVal($name,"color_g",255), ReadingsVal($name,"color_b",255))} +attr DEVICE webCmd brightness:dim:hue:command:color_temp:program:saturation:mode +attr DEVICE webCmdLabel brightness:dim\ + :hue:command\ + :color_temp:program\ + :saturation:mode +attr DEVICE setStateList on off +# computed_color will send RGB = 255,255,255 when in white mode. This is useful for HomeAssistant where it always expects the color to be set. +attr DEVICE model X_01a_esp_milight_hub_rgb_cct_bulb + #rgbw-bulb name:X_01x_esp_milight_hub_max_features_bulb filter:TYPE=MQTT2_DEVICE @@ -457,7 +496,6 @@ deletereading DEVICE .*_.* attr DEVICE icon light_control attr DEVICE eventMap /set_white:Weiss/night_mode:Nacht/white_mode:white/on:on/off:off/ON:on/OFF:off/next_mode:Mode/mode_speed_up:Faster/mode_speed_down:Slower/level_up:Up/level_down:Down/ attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name)} -attr DEVICE webCmd on:off:brightness:hue:color_temp:saturation:dim:command:program attr DEVICE readingList BASE_ID/states/REMOTE_ID/BULB_TYPE/GROUP_ID:.* { json2nameValue($EVENT) }\ BASE_ID/states/REMOTE_ID/BULB_TYPE/0:.* { json2nameValue($EVENT) }\ BASE_ID/updates/REMOTE_ID/BULB_TYPE/GROUP_ID:.* { json2nameValue($EVENT) }\ @@ -468,13 +506,18 @@ attr DEVICE setList\ brightness:colorpicker,BRI,0,15,255 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ hue:colorpicker,HUE,0,1,359 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ color_temp:colorpicker,CT,153,1,370 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ - saturation:colorpicker,sat,0,1,255 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ + saturation:colorpicker,BRI,0,1,100 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ command:uzsuSelectRadio,Weiss,Nacht BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ program:uzsuSelectRadio,Mode,Faster,Slower BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"command":"$EVTPART1"}\ - dim:uzsuSelectRadio,Up,Down milight/0xBE59/rgbw/1 {"command":"level_$EVTPART1"} -attr DEVICE userReadings rgb {sprintf("%02X%02X%02X", ReadingsVal($name,"color_r",255), ReadingsVal($name,"color_g",255), ReadingsVal($name,"color_b",255))} -attr DEVICE webCmdLabel on:off:brightness:hue\ - :color_temp:saturation\ - :dim:command:program + mode:select,0,1,2,3,4,5,6,7,8 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ + dim:uzsuSelectRadio,Up,Down BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"command":"$EVTPART1"} +#attr DEVICE userReadings rgb {sprintf("%02X%02X%02X", ReadingsVal($name,"color_r",255), ReadingsVal($name,"color_g",255), ReadingsVal($name,"color_b",255))} +attr DEVICE webCmd on:off:brightness:dim:hue:command:color_temp:program:saturation:mode +attr DEVICE webCmdLabel An:Aus\ + :Helligkeit:Dimmen\ + :HUE:Command\ + :Farb-Temp:Programm\ + :Sättigung:Modus +attr DEVICE setStateList on off # computed_color will send RGB = 255,255,255 when in white mode. This is useful for HomeAssistant where it always expects the color to be set. -attr DEVICE model X_01x_esp_milight_hub_max_features_bulb \ No newline at end of file +attr DEVICE model X_01x_esp_milight_hub_max_features_bulb