2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-08 05:15:10 +00:00

mqtt_generic_bridge.template: some restructuring, add FBDECT thermostat

git-svn-id: https://svn.fhem.de/fhem/trunk@23629 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Beta-User 2021-01-27 18:08:02 +00:00
parent 5947b26a8f
commit 7ca71e9a64
2 changed files with 58 additions and 32 deletions

View File

@ -22,18 +22,21 @@ order:000000
name:base_settings_to_MQTT_GENERIC_BRIDGE
prereq:{my @devices=devspec2array("TYPE=MQTT_GENERIC_BRIDGE");return 1 if $devices[0];return 0}
filter:TYPE=MQTT_GENERIC_BRIDGE
desc:This template is proposal to fullfill requirements for the rest of the s some basic configuration on the MQTT_GENERIC_BRIDGE side itself, especially:<br>- different topic structures for sending readings values and receiving commands and/or reading values; <br>- Variable $name must be part of the base topic structures.<br>Note: All outgoing messages will be sent without retain flag; change this to 1, if you need values stored on your MQTT server (e.g. if your clients are not always connected).
desc:This template is proposal to fullfill requirements for the rest of the s some basic configuration on the MQTT_GENERIC_BRIDGE side itself, especially <b>different topic structures for sending readings values and receiving commands and/or reading values.</b><br>Note: All outgoing messages will be sent without retain flag; change this to 1, if you absulutely need values stored on your MQTT server (e.g. if your clients are not always connected).
order:000001
par:IODEVNAME;Name of the IO-Device; { AttrVal("DEVICE","IODev",undef) }
par:RADIO_SETCLIENTODERMGB_M2D;Set clientOrder on IODev to "MQTT_GENERIC_BRIDGE MQTT2_DEVICE" (recommended);{ my $io = AttrVal("DEVICE","IODev",""); return 0 if InternalVal($io,"TYPE","MQTT") eq "MQTT"; AttrVal($io,"clientOrder",undef) }
par:RADIO_SETCLIENTODERM2D_MGB;Set clientOrder on IODev to "MQTT2_DEVICE MQTT_GENERIC_BRIDGE" (default, may cause unintended autocreates);{ my $io = AttrVal("DEVICE","IODev",""); return 0 if InternalVal($io,"TYPE","MQTT") eq "MQTT"; AttrVal($io,"clientOrder",undef) }
par:RADIO_DONTSETCLIENTODER;Leave clientOrder on IODev (default is "MQTT2_DEVICE MQTT_GENERIC_BRIDGE", may cause unintended autocreates);{ my $io = AttrVal("DEVICE","IODev",""); return 0 if InternalVal($io,"TYPE","MQTT") eq "MQTT"; AttrVal($io,"clientOrder",undef) }
par:RADIO_SETCLIENTODERMGB_ONLY;Set clientOrder on IODev to "MQTT_GENERIC_BRIDGE" (MGB only mode);{ my $io = AttrVal("DEVICE",'IODev',""); return 0 if InternalVal($io,'TYPE','MQTT') eq 'MQTT'; AttrVal($io,"clientOrder",undef) }
par:RADIO_SETCLIENTODERM2D_MGB;Set clientOrder on IODev to "MQTT2_DEVICE MQTT_GENERIC_BRIDGE" (default, may cause unintended autocreates);{ my $io = AttrVal('DEVICE','IODev',""); return 0 if InternalVal($io,'TYPE','MQTT') eq 'MQTT'; AttrVal($io,'clientOrder',undef) }
par:RADIO_DONTSETCLIENTODER;Leave clientOrder on IODev (default is "MQTT2_DEVICE MQTT_GENERIC_BRIDGE", may cause unintended autocreates);{ my $io = AttrVal("DEVICE","IODev",""); return 0 if InternalVal($io,'TYPE','MQTT') eq 'MQTT'; AttrVal($io,'clientOrder',undef) }
attr DEVICE globalDefaults sub:base={"DEVICE/set"} pub:base={"DEVICE"}
option:{ RADIO_SETCLIENTODERMGB_M2D }
attr IODEVNAME clientOrder MQTT_GENERIC_BRIDGE MQTT2_\DEVICE
option:{ RADIO_SETCLIENTODERM2D_MGB }
attr IODEVNAME clientOrder MQTT2_\DEVICE MQTT_GENERIC_BRIDGE
farewell:Now you can start to configure your devices to send and receive messages over MQTT!
option:{ RADIO_SETCLIENTODERMGB_ONLY }
attr IODEVNAME clientOrder MQTT_GENERIC_BRIDGE
farewell:Configuring MQTT_GENERIC_BRIDGE has been successful, now you can start to configure your devices to send and receive messages over MQTT!
##########
## subordintated devices section
@ -61,14 +64,14 @@ filter:TYPE=MQTT_GENERIC_BRIDGE
desc:This template is a first showcase for use of AttrTemplate in MQTT_GENERIC_BRIDGE usage context.<br>NOTE: Early testing version, see https://forum.fhem.de/index.php/topic,117423.0.html for details.<br>Might still need some changes!
order:A_10000
par:TARGETDEV;Pls enter name of the device you want to put under MQTT_GENERIC_BRIDGE controll;{ undef }
par:TRGETDEVTYPE;TYPE of target device;{ InternalVal("TARGETDEV",'TYPE',undef) }
#par:TRGETDEVTYPE;TYPE of target device;{ InternalVal("TARGETDEV",'TYPE',undef) }
par:RADIO_SENDNOREADINGS;Do not send any readings from device to MQTT server;{ undef }
par:RADIO_SENDBASICREADINGS;Send only basic readings (desired-temp and temperature) to MQTT server;{ undef }
par:RADIO_SENDALLREADINGS;Send all Readings from device to MQTT server (not recommended);{ undef }
par:MQTTPREFIX;prefix used in MGB;{ InternalVal("DEVICE",'prefix',undef) }
option:global
set DEVICE attrTemplate mgb_thermostat_with_params \TARGETDEV=TARGETDEV \TRGETDEVTYPE=TRGETDEVTYPE SENDNOREADINGS=RADIO_SENDNOREADINGS SENDBASICREADINGS=RADIO_SENDBASICREADINGS SENDALLREADINGS=RADIO_SENDALLREADINGS \MQTTPREFIX=MQTTPREFIX
set DEVICE attrTemplate mgb_thermostat_with_params \TARGETDEV=TARGETDEV SENDNOREADINGS=RADIO_SENDNOREADINGS SENDBASICREADINGS=RADIO_SENDBASICREADINGS SENDALLREADINGS=RADIO_SENDALLREADINGS \MQTTPREFIX=MQTTPREFIX
name:mgb_thermostat_with_params
@ -80,38 +83,51 @@ par:SENDNOREADINGS;Do not send any readings from device to MQTT server;{ 0 }
par:SENDBASICREADINGS;Send only basic readings (desired-temp and temperature) to MQTT server;{ 0 }
par:SENDALLREADINGS;Send all Readings from device to MQTT server (not recommended);{ 0 }
par:MQTTPREFIX;prefix used in MGB;{ InternalVal("DEVICE",'prefix',undef) }
par:TRGETDEVTYPE;TYPE of target device;{ InternalVal("TARGETDEV",'TYPE',undef) }
option:{ "TRGETDEVTYPE" eq "ZWave" || "TRGETDEVTYPE" eq "CUL_HM" }
attr TARGETDEV MQTTPREFIXSubscribe desired-temp:stopic={"$base/$device/$name"}
option:{ "TRGETDEVTYPE" eq "MAX" }
attr TARGETDEV MQTTPREFIXSubscribe desiredTemperature:stopic={"$base/$device/$name"}
attr TARGETDEV MQTTPREFIXAlias desiredTemperature=desired-temp
#par:TRGETDEVTYPE;TYPE of target device;{ InternalVal("TARGETDEV",'TYPE',undef) }
option:{SENDNOREADINGS}
deleteattr TARGETDEV MQTTPREFIXPublish
option:{ SENDBASICREADINGS && "TRGETDEVTYPE" eq "ZWave" }
attr TARGETDEV MQTTPREFIXPublish desired-temp|temperature:topic={"$base/$device/$name"} temperature:expression={$value=~m,(-?\d+(\.\d+)?),?::round($1,1):undef}
option:{ InternalVal("TARGETDEV",'TYPE','none') eq 'CUL_HM' }
attr TARGETDEV MQTTPREFIXSubscribe desired-temp:stopic={"$base/$device/$name"}
option:{ SENDBASICREADINGS && "TRGETDEVTYPE" eq "CUL_HM" }
option:{ SENDBASICREADINGS && InternalVal("TARGETDEV",'TYPE','none') eq 'CUL_HM' }
attr TARGETDEV MQTTPREFIXAlias pub:measured-temp=temperature
attr TARGETDEV MQTTPREFIXPublish desired-temp|measured-temp:topic={"$base/$device/$name"}
option:{ SENDBASICREADINGS && "TRGETDEVTYPE" eq "MAX" }
attr TARGETDEV MQTTPREFIXPublish desiredTemperature|temperature:topic={"$base/$device/$name"}
option:{ SENDALLREADINGS && "TRGETDEVTYPE" eq "ZWave" }
attr TARGETDEV MQTTPREFIXPublish *:topic={"$base/$device/$name"} temperature:expression={$value=~m,(-?\d+(\.\d+)?),?::round($1,1):undef}
option:{ SENDALLREADINGS && "TRGETDEVTYPE" eq "CUL_HM" }
option:{ SENDALLREADINGS && InternalVal("TARGETDEV",'TYPE','none') eq 'CUL_HM' }
attr TARGETDEV MQTTPREFIXAlias pub:measured-temp=temperature
attr TARGETDEV MQTTPREFIXPublish *:topic={"$base/$device/$name"}
option:{ SENDALLREADINGS && "TRGETDEVTYPE" eq "MAX" }
option:{ InternalVal("TARGETDEV",'TYPE','none') eq 'FBDECT' }
attr TARGETDEV MQTTPREFIXSubscribe desired-temp:stopic={"$base/$device/$name"}
option:{ SENDBASICREADINGS && InternalVal("TARGETDEV",'TYPE','none') eq 'FBDECT' }
attr TARGETDEV MQTTPREFIXPublish desired-temp|temperature:topic={"$base/$device/$name"} desired-temp:expression={$value=~m,(-?\d+(\.\d+)?),?$1:undef}
option:{ SENDALLREADINGS && InternalVal("TARGETDEV",'TYPE','none') eq 'FBDECT' }
attr TARGETDEV MQTTPREFIXPublish *:topic={"$base/$device/$name"} desired-temp:expression={$value=~m,(-?\d+(\.\d+)?),?$1:undef}
option:{ InternalVal("TARGETDEV",'TYPE','none') eq 'MAX' }
attr TARGETDEV MQTTPREFIXSubscribe desiredTemperature:stopic={"$base/$device/$name"}
attr TARGETDEV MQTTPREFIXAlias desiredTemperature=desired-temp
option:{ SENDBASICREADINGS && InternalVal("TARGETDEV",'TYPE','none') eq 'MAX' }
attr TARGETDEV MQTTPREFIXPublish desiredTemperature|temperature:topic={"$base/$device/$name"}
option:{ SENDALLREADINGS && InternalVal("TARGETDEV",'TYPE','none') eq 'MAX' }
attr TARGETDEV MQTTPREFIXPublish *:topic={"$base/$device/$name"}
option:{ InternalVal("TARGETDEV",'TYPE','none') eq 'ZWave' }
attr TARGETDEV MQTTPREFIXSubscribe desired-temp:stopic={"$base/$device/$name"}
option:{ SENDBASICREADINGS && InternalVal("TARGETDEV",'TYPE','none') eq 'ZWave' }
attr TARGETDEV MQTTPREFIXPublish desired-temp|temperature:topic={"$base/$device/$name"} temperature:expression={$value=~m,(-?\d+(\.\d+)?),?::round($1,1):undef}
option:{ SENDALLREADINGS && InternalVal("TARGETDEV",'TYPE','none') eq 'ZWave' }
attr TARGETDEV MQTTPREFIXPublish *:topic={"$base/$device/$name"} temperature:expression={$value=~m,(-?\d+(\.\d+)?),?::round($1,1):undef}
############
name:mgb_shutter
prereq:{my @devices=devspec2array("TYPE=MQTT_GENERIC_BRIDGE");return 1 if $devices[0];return 0}
@ -119,14 +135,14 @@ filter:TYPE=MQTT_GENERIC_BRIDGE
desc:This template is starting point to configure shutter devices in MQTT_GENERIC_BRIDGE usage context.<br>NOTE: Early testing version, see https://forum.fhem.de/index.php/topic,117423.0.html for details.<br>Might still need some changes!
order:C_10000
par:TARGETDEV;Pls enter name of the device you want to put under MQTT_GENERIC_BRIDGE controll;{ undef }
par:TRGETDEVTYPE;TYPE of target device;{ InternalVal("TARGETDEV",'TYPE',undef) }
#par:TRGETDEVTYPE;TYPE of target device;{ InternalVal("TARGETDEV",'TYPE',undef) }
par:RADIO_SENDNOREADINGS;Do not send any readings from device to MQTT server;{ undef }
par:RADIO_SENDBASICREADINGS;Send only basic readings (pct, motor (if available) and state) to MQTT server;{ undef }
par:RADIO_SENDALLREADINGS;Send all Readings from device to MQTT server (not recommended);{ undef }
par:MQTTPREFIX;prefix used in MGB;{ InternalVal("DEVICE",'prefix',undef) }
option:global
set DEVICE attrTemplate mgb_shutter_with_params \TARGETDEV=TARGETDEV \TRGETDEVTYPE=TRGETDEVTYPE SENDNOREADINGS=RADIO_SENDNOREADINGS SENDBASICREADINGS=RADIO_SENDBASICREADINGS SENDALLREADINGS=RADIO_SENDALLREADINGS \MQTTPREFIX=MQTTPREFIX
set DEVICE attrTemplate mgb_shutter_with_params \TARGETDEV=TARGETDEV SENDNOREADINGS=RADIO_SENDNOREADINGS SENDBASICREADINGS=RADIO_SENDBASICREADINGS SENDALLREADINGS=RADIO_SENDALLREADINGS \MQTTPREFIX=MQTTPREFIX
name:mgb_shutter_with_params
@ -138,17 +154,27 @@ par:SENDNOREADINGS;Do not send any readings from device to MQTT server;{ 0 }
par:RADIO_SENDBASICREADINGS;Send only basic readings (pct, motor (if available) and state) to MQTT server;{ undef }
par:SENDALLREADINGS;Send all Readings from device to MQTT server (not recommended);{ 0 }
par:MQTTPREFIX;prefix used in MGB;{ InternalVal("DEVICE",'prefix',undef) }
par:TRGETDEVTYPE;TYPE of target device;{ InternalVal("TARGETDEV",'TYPE',undef) }
#par:TRGETDEVTYPE;TYPE of target device;{ InternalVal("TARGETDEV",'TYPE',undef) }
option:{ "TRGETDEVTYPE" eq "CUL_HM" }
option:{ InternalVal("TARGETDEV",'TYPE','none') eq 'CUL_HM' }
attr TARGETDEV MQTTPREFIXSubscribe state:stopic={"$base/$device"} pct:stopic={"$base/$device/$name"}
option:{SENDNOREADINGS}
deleteattr TARGETDEV MQTTPREFIXPublish
option:{ SENDBASICREADINGS && "TRGETDEVTYPE" eq "CUL_HM" }
option:{ SENDBASICREADINGS && InternalVal("TARGETDEV",'TYPE','none') eq 'CUL_HM' }
attr TARGETDEV MQTTPREFIXPublish state:topic={"$base/$device"} pct|motor:topic={"$base/$device/$name"} motor:expression={$value=~m,([^:]+)?,?$1:undef}
option:{ SENDALLREADINGS && "TRGETDEVTYPE" eq "CUL_HM" }
option:{ SENDALLREADINGS && InternalVal("TARGETDEV",'TYPE','none') eq 'CUL_HM' }
attr TARGETDEV MQTTPREFIXPublish *:topic={"$base/$device/$name"}
option:{ InternalVal("TARGETDEV",'TYPE','none') eq 'FBDECT' }
attr TARGETDEV MQTTPREFIXSubscribe state:stopic={"$base/$device"} dim:stopic={"$base/$device/$name"}
option:{ SENDBASICREADINGS && InternalVal("TARGETDEV",'TYPE','none') eq 'FBDECT' }
attr TARGETDEV MQTTPREFIXPublish state:topic={"$base/$device"} dim:topic={"$base/$device/$name"}
attr TARGETDEV MQTTPREFIXAlias dim=pct
option:{ SENDALLREADINGS && InternalVal("TARGETDEV",'TYPE','none') eq 'FBDECT' }
attr TARGETDEV MQTTPREFIXPublish *:topic={"$base/$device/$name"}
attr TARGETDEV MQTTPREFIXAlias dim=pct

View File

@ -1,5 +1,5 @@
###########################################
# $Id: speechcontrol.template Beta-User $
# $Id$
#
# This file provides add-on templates for use with speech recognistion modules
# Originally developped for mqtt2-device, see forum thread here: https://forum.fhem.de/index.php/topic,99195.0.html