From e7bccfd0061cf4b070031573fe26d4ad67dc35a8 Mon Sep 17 00:00:00 2001 From: Beta-User <> Date: Fri, 8 Mar 2019 07:29:56 +0000 Subject: [PATCH] mqtt2.template: changed GeneralBridge template, add ebusd base template git-svn-id: https://svn.fhem.de/fhem/trunk@18824 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 4 ++- fhem/FHEM/lib/AttrTemplate/mqtt2.template | 40 +++++++++++++++++++++-- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index f7e0641f5..016688f40 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,6 +1,8 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. - - bufgix: 49_SSCam: back to V8.11.0 due to some problems with 8.11.2 + - feature: mqtt2.template: A_00_MQTT2_CLIENT_general_bridge revised for better + compability with popular devices + - bugfix: 49_SSCam: back to V8.11.0 due to some problems with 8.11.2 - feature: 70_ENIGMA2: add remotecontrolChannel attribute to customize channelUp/channelDown remote control commands - feature: 50_MOBILEALERTSGW: attribut allowfrom added diff --git a/fhem/FHEM/lib/AttrTemplate/mqtt2.template b/fhem/FHEM/lib/AttrTemplate/mqtt2.template index b384839b1..83d89f604 100644 --- a/fhem/FHEM/lib/AttrTemplate/mqtt2.template +++ b/fhem/FHEM/lib/AttrTemplate/mqtt2.template @@ -18,10 +18,24 @@ desc: Forum Thread< # name:A_00_MQTT2_CLIENT_general_bridge filter:TYPE=MQTT2_DEVICE -desc:recommended to use this as general bridgeing device when using MQTT2_CLIENT as IO to get around missing CID info for distinguishing different devices -attr DEVICE bridgeRegexp [^:]+:([^/]+)/([^/]+)[/]?.*:.* "$1_$2" +desc:recommended to use this as general bridgeing device when using MQTT2_CLIENT as IO to get around missing CID info for distinguishing different popular devices
NOTE:
NOTE:
- for use with MQTT2_CLIENT use a copy of the device and change its DEF to a different clientId like GeneralBridge, delete original's readingList after applying the template! +par:IODEVNAME;Name of the IO-Device; {AttrVal("DEVICE","IODev","") ? AttrVal("DEVICE","IODev","" ) : undef } +par:DEVTYPE;TYPE of the device; { InternalVal("DEVICE","TYPE","")} +par:DEVCID;CID of the device as written in the DEF; { InternalVal(AttrVal("DEVICE","IODev",""),"clientId","mosquitto") eq InternalVal("DEVICE","DEF","mosquitto") ? "MQTT2_GeneralBridge" : InternalVal("DEVICE","DEF","mosquitto")} +par:IODEVROOM;Room of the IOdevice; {AttrVal(AttrVal("DEVICE","IODev",""),"room","" ) ? AttrVal(AttrVal("DEVICE","IODev",""),"room","" ) : undef } +attr DEVICE bridgeRegexp (tele|cmnd)[/]([^/]+)[/].*:.* "$2"\ + shellies[/]([^/]+)[/].*:.* "$1"\ + (ESPClient_[^/]+)[/].*:.* "$1" attr DEVICE autocreate 1 +attr DEVICE room IODEVROOM attr DEVICE setStateList on off +#modify DEVICE DEVCID +#copy DEVICE DEVCID +deleteAttr DEVICE readingList +#deleteAttr DEVCID readingList +#delete DEVICE +#reload 10_DEVTYPE.pm +#attr DEVCID model A_00_MQTT2_CLIENT_general_bridge attr DEVICE model A_00_MQTT2_CLIENT_general_bridge ########################################### @@ -348,7 +362,7 @@ attr DEVICE model A_01a_tasmota_basic_state_power1 # sonoff 1 channel device flashed with Tasmota. name:A_01_tasmota_basic filter:TYPE=MQTT2_DEVICE -desc:Applies to Sonoff 1 Channel devices using POWER-topic for relay state
NOTE: Power topic will be set to POWER1; the format the device is sending data will also be changed to lowercase! +desc:Applies to Sonoff 1 Channel devices using POWER-topic for relay state
NOTE:
- Power topic will be set to POWER1;
- the format the device is sending data will also be changed to lowercase!
- finally, you'll see the device as model A_01a_tasmota_basic_state_power1. set DEVICE attrTemplate A_01a_tasmota_basic_state_power1 name:A_01x_tasmota_clear_readings_reset_readingsList_and_reboot @@ -763,6 +777,25 @@ attr DEVICE stateFormat T: temperature °C H: humidity % B: battery % attr DEVICE model A_16_shellyht +############### +#ebusd +# +#ebus daemon device +name:E_01a_eBus_daemon_splitter +filter:TYPE=MQTT2_DEVICE +desc:Device containing all status messages from the ebus daemon itself
NOTE: acts also as a bridge device to split up the hardware on the bus into different mqtt2_devices
NOTE:
- for use with MQTT2_CLIENT use a copy of the Device with the same clientId than the IO, delete original's readingList after applying the template!
- this might change the devices CID +par:DEVTYPE;Internal TYPE of the device; { InternalVal("DEVICE","TYPE","")} +par:DEV_ID;base topic set ebus;{ AttrVal("DEVICE","readingList","") =~ m,[^:]+:?(ebus[a-zA-Z])[^/]*[/].*:, ? $1 : "ebusd" } +modify DEVICE DEV_ID +attr DEVICE autocreate 1 +attr DEVICE bridgeRegexp (ebus.)[^/]*/(bai|broadcast)/.*:.* "$1_bai"\ + (ebus.)[^/]*/([\d]+)/.*:.* "$1_$2"\ + (ebus.)[^/]*[/][^b][a-zA-Z]+[/].*:.* "$1" +#attr DEVICE icon icoTempHeizung +#attr DEVICE devStateStyle style="text-align:right" +attr DEVICE model E_01a_eBus_daemon_splitter + + ############### #ESP Milight Hub #use this with Chris Mullins ESP-Milight-Hub. for further details visit https://github.com/sidoh/esp8266_milight_hub @@ -940,3 +973,4 @@ attr DEVICE webCmdLabel An:Aus\ :Sättigung:Modus attr DEVICE setStateList on off attr DEVICE model X_01x_esp_milight_hub_max_features_bulb +