From 59b03344accb201f98585232ad1ec3deea070fec Mon Sep 17 00:00:00 2001 From: Beta-User <> Date: Wed, 5 Feb 2020 06:14:12 +0000 Subject: [PATCH] mqtt2.template: small changes to speech recogn 255 and OpenMQTTGateway git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@21124 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/lib/AttrTemplate/mqtt2.template | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/FHEM/lib/AttrTemplate/mqtt2.template b/FHEM/lib/AttrTemplate/mqtt2.template index 87c630424..b57a19935 100644 --- a/FHEM/lib/AttrTemplate/mqtt2.template +++ b/FHEM/lib/AttrTemplate/mqtt2.template @@ -77,8 +77,12 @@ filter:TYPE=MQTT2_DEVICE:FILTER=CID=speechrecognTesting order:100003 option:{my @devices=devspec2array("TYPE=(siri|alexa|gassistant)");;return 1 if $devices[0];;return 0} set DEVICE attrTemplate mqtt2_speech_recognition_type_light +par:NEWUSERREADINGS;NEWUSERREADINGS as set if sr_brightness is included, otherwise it will be added;{ my $old = AttrVal("DEVICE","userReadings",undef);; !defined $old ? 'sr_brightness:brightness.* {sprintf("%.0f", ReadingsNum("$name","brightness",0)/255*100)}' : $old =~ m,sr_brightness:brightness.*, ? $old : $old.', sr_brightness:brightness.* {sprintf("%.0f", ReadingsNum("$name","brightness",0)/255*100)}' } attr DEVICE genericDeviceType light -attr DEVICE homebridgeMapping Brightness=brightness::brightness,minValue=0,maxValue=100,max=255,factor=2.55 +attr DEVICE homebridgeMapping Brightness=brightness::brightness,minValue=0,maxValue=100,max=255 +#attr DEVICE homebridgeMapping Brightness=sr_brightness,cmd=brightness,max=255,minValue=0,maxValue=100 +#attr DEVICE userReadings sr_brightness:brightness.* {sprintf("%.0f", ReadingsNum("$name","brightness",0)/255*100)} +#attr DEVICE userReadings NEWUSERREADINGS option:TYPE=siri option:TYPE=alexa option:TYPE=gassistant @@ -2212,7 +2216,7 @@ par:OFF_COMMAND;ON_COMMAND typically is a set of parameters like "value":"133814 par:BASE_ID;BASE_ID typically is home;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)[/]OpenMQTTGateway[^/]*[/].*:, ? $1 : undef } par:DEVNAME;BASE_ID typically is home;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)[/](OpenMQTTGateway[^/]*)[/].*:, ? $2 : undef } par:DEVCID;CID of the new device - try to read the last RF value; { ReadingsVal("DEVICE","value","unknown") } -par:NEWDEVROOM;Room of the calling device; {AttrVal("DEVCID","room","MQTT2_\DEVICE" )} +par:NEWDEVROOM;Room of the calling device; {AttrVal("DEVICE","room","MQTT2_\DEVICE" )} defmod OMG_DEVCID MQTT2_\DEVICE DEVCID deletereading -q OMG_DEVCID (?!associatedWith).* defmod OMG_DEVCID MQTT2_\DEVICE DEVCID @@ -2255,19 +2259,17 @@ attr DEVICE autocreate 0 attr DEVICE readingList\ BASE_ID/DEVNAME/IRtoMQTT:.* { json2nameValue($EVENT) } attr DEVICE setList irsend:textField BASE_ID/DEVNAME/IRtoMQTT {"value":$EVTPART2,"protocol_name":"IR_$EVTPART1"} -attr DEVCID comment irsend needs Infos about protocol and value (n decimal), so e.g."IR_NEC 1587664935" should be fine... +attr DEVICE comment irsend needs Infos about protocol and value (n decimal), so e.g."IR_NEC 1587664935" should be fine... attr DEVICE model OpenMQTTGateway_ir - - name:OpenMQTTGateway_BT_temp_hum_sensor prereq:{my @devices=devspec2array("model=OpenMQTTGateway_MCU");;return 1 if $devices[0];;return 0} filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*OpenMQTTGateway.* desc:use this with an OpenMQTTGateway. For further details visit https://github.com/1technophile/OpenMQTTGateway/wiki
Recommended structure of the topic pattern home/OpenMQTTGateway/.*.
NOTE: You'll be asked to provide the HEX address of your sensor. Best start with looking at what "OpenMQTTGateway_BT_scanner" povides, e.g. if you have a reading name like "6C697244245E_id", "6C697244245E" (without quotes) is what you want to enter...
NOTE: this will create a new device! order:X_02d -par:BASE_ID;BASE_ID typically is home;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)[/]OpenMQTTGateway[^/]*[/].*:, ? $1 : undef } +par:BASE_ID;BASE_ID typically is home;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)[/]OpenMQTTGateway[^/]*[/].*, ? $1 : undef } par:BT_ID;Pls. enter your bluetooth device ID; {undef} -#par:DEVNAME;BASE_ID typically is home;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)[/](OpenMQTTGateway[^/]*)[/].*:, ? $2 : undef } +par:NEWDEVROOM;Room of the calling device; {AttrVal("DEVICE","room","MQTT2_\DEVICE" )} defmod OMG_BT_ID MQTT2_\DEVICE oMQTTgw_BT deletereading -q OMG_BT_ID (?!associatedWith).* attr OMG_BT_ID autocreate 0 @@ -2278,6 +2280,8 @@ attr OMG_BT_ID event-on-change-reading batteryPercent,temperature:0.2,humidity:0 attr OMG_BT_ID icon temperature_humidity attr OMG_BT_ID jsonMap batt:batteryPercent tem:temperature hum:humidity servicedatauuid:0 servicedata:0 attr OMG_BT_ID stateFormat T: temperature°C, H: humidity%rH +attr OMG_BT_ID room NEWDEVROOM +{ fhem "trigger $FW_wname JS:location.href='$FW_ME?detail=OMG_BT_ID'" if($cl && $cl->{TYPE} eq "FHEMWEB") } attr OMG_BT_ID model OpenMQTTGateway_BT_temp_hum_sensor