2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-21 07:56:03 +00:00

mqtt2.template: roll back to SetExtensions for Tasmota on-for-timer; add shelly dimmer

git-svn-id: https://svn.fhem.de/fhem/trunk@20544 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Beta-User 2019-11-20 06:02:02 +00:00
parent 9bdfa3d6cf
commit 8b94c2c552

View File

@ -137,7 +137,7 @@ attr DEVICE model zigbee2mqtt_light_dimmer
# A dimmable color light connected via zigbee2mqtt
name:zigbee2mqtt_light_cct
filter:TYPE=MQTT2_DEVICE:FILTER=CID=zigbee.*
desc: A dimmable light with color temperature via zigbee2mqtt
desc: A dimmable light with color temperature via zigbee2mqtt<br>Tested with: tradfri FLOALT panel WS 30x90
order:L_02b
par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef }
par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/]([^/]+).*:, ? $1 : undef }
@ -516,7 +516,6 @@ attr DEVICE setList \
off:noArg CMNDTOPIC/POWER1 0\
on:noArg CMNDTOPIC/POWER1 1\
toggle:noArg CMNDTOPIC/POWER1 2\
on-for-timer {my $duration = $EVTPART1 < 11.2 ? $EVTPART1*10 : $EVTPART1+100; 'CMNDTOPIC/Backlog pulseTime1 '.$duration.'; POWER1 1'}\
setOtaUrl:textField CMNDTOPIC/OtaUrl $EVTPART1\
upgrade:noArg CMNDTOPIC/upgrade 1
attr DEVICE readingList \
@ -527,7 +526,7 @@ attr DEVICE readingList \
STATTOPIC/RESULT:.* { json2nameValue($EVENT) }
deletereading -q DEVICE (?!associatedWith).*
attr DEVICE setStateList on off toggle
attr DEVICE comment NOTE: on-for-timer is limited to 18h max duration!
attr DEVICE comment NOTE: For on-for-timer SetExtensions are used. You may add on-for-timer option running on the device. The following is limited to 1h max duration, but will not affect future simple "on" commands:<br>on-for-timer {my $duration = $EVTPART1*10; 'cmnd/CMNDTOPIC/Backlog POWER1 1; delay '.$duration.'; POWER1 0'}<br>See the "Praxisbeispiele" in the wiki for "pulseTime1" alternative option and it's restrictions.
attr DEVICE autocreate 0
attr DEVICE model tasmota_basic_state_power1
@ -1499,6 +1498,33 @@ attr DEVICE_CH4 setList off:noArg shellies/DEVNAME/white/3/command off\
setreading DEVICE_CH4 associatedWith DEVICE,DEVICE_CH2,DEVICE_CH3
attr DEVICE_CH4 setStateList on off
#shellydimmer
# contributed by zeppelin, https://forum.fhem.de/index.php/topic,94495.msg994764.html#msg994764
name:shellydimmer
filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.*
desc:shellydimmer <br>Tested with 20191119-085746/master@e3a747f5
order:A_18
par:DEVNAME;name of this shelly;{ AttrVal("DEVICE","readingList","") =~ m,shellies/([^/]+)/, ? $1 : undef }
par:ICON;ICON as set, defaults to light_control;{ AttrVal("DEVICE","icon","light_control") }
attr DEVICE icon ICON
attr DEVICE setList\
off:noArg shellies/DEVNAME/light/0/command off\
on:noArg shellies/DEVNAME/light/0/command on\
pct:slider,0,1,100 shellies/DEVNAME/light/0/set {"turn": "on","brightness": $EVTPART1}
deletereading -q DEVICE status_.*
attr DEVICE readingList \
shellies/DEVNAME/light/0/status:.* {json2nameValue($EVENT)}\
shellies/DEVNAME/temperature:.* temperature\
shellies/DEVNAME/temperature_f:.* temperature_f\
shellies/DEVNAME/overtemperature:.* overtemperature\
shellies/DEVNAME/overload:.* overload\
shellies/DEVNAME/loaderror:.* loaderror\
shellies/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : undef }
attr DEVICE webCmd pct:on:off
attr DEVICE devStateIcon {my $lderr = ReadingsVal($name,"loaderror","true") eq "true"?"10px-kreis-rot":"10px-kreis-gruen";; my $light = ReadingsVal($name,"ison","false") eq "true"?"on":"off";; my $cons = ReadingsVal($name,"light_0_power","unknown");; FW_makeImage($lderr)."<a href=\"/fhem?cmd.dummy=set $name toggle&XHR=1\">".FW_makeImage($light)."</a><div>Leistung: $cons</div>"}
set DEVICE x_mqttcom announce
attr DEVICE model shellydimmer
###############
#ebusd
#
@ -1853,7 +1879,7 @@ name:roborock
filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*valetudo[/].*
desc:use this to control a rooted Xiamoni Vacuum / Roborock. For further details visit https://github.com/Hypfer/Valetudo<br><br>NOTE: Initial version, not yet fully tested, just build according to https://forum.fhem.de/index.php/topic,104804.0.html<br>
order:X_03
par:BASE_ID;BASE_ID typically is home;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)[/]valetudo[/].*:, ? $1 : undef }
par:BASE_ID;BASE_ID typically is valetudo;{ AttrVal("DEVICE","readingList","") =~ m,(valetudo)[/].*:, ? $1 : undef }
par:DEVNAME;DEVNAME typically is rockrobo;{ AttrVal("DEVICE","readingList","") =~ m,valetudo[/]([^/]+)[/].*:, ? $1 : undef }
deletereading -q DEVICE (?!associatedWith).*
defmod DEVICE MQTT2_DEVICE DEVNAME