mqtt2.template: fix first fragment of shelly4pro

git-svn-id: https://svn.fhem.de/fhem/trunk@25419 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Beta-User 2022-01-04 19:50:06 +00:00
parent 58ebba7773
commit 46034b1a10

View File

@ -3385,30 +3385,25 @@ attr DEVICE setList toggle:noArg $DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","
x_update:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Shelly.Update","params": {"stage":"stable"}}\
x_reboot:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Shelly.Reboot"}
attr DEVICE jsonMap params_switch_0_state:state params_switch_0_aenergy_total:aenergy_total params_switch_0_apower:apower params_switch_0_temperature_tC:temperature params_switch_0_temperature_tF:0 params_wifi_sta_ip:ip
copy DEVICE DEVICE_CH2
defmod DEVICE_CH2 MQTT2_\DEVICE DEVICE_CH2
deleteattr DEVICE_CH2 stateFormat
deleteattr DEVICE_CH2 devStateIcon
attr DEVICE_CH2 readingList $DEVICETOPIC/events/rpc:.* { return if $EVENT !~ m{switch:1}; $EVENT =~ s/"output":true/"state":"on"/g; $EVENT =~ s/"output":false/"state":"off"/g; json2nameValue($EVENT,'',$JSONMAP) }
attr DEVICE_CH2 setList toggle:noArg $DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Switch.Toggle","params": {"id":1}}\
off:noArg $DEVICETOPIC/rpc {"id":1, "src":"fhem2shelly", "method":"Switch.Set", "params":{"id":1, "on":false}}\
on:noArg $DEVICETOPIC/rpc {"id":1, "src":"fhem2shelly", "method":"Switch.Set", "params":{"id":1, "on":true}}\
on-for-timer $DEVICETOPIC/rpc {"id":1, "src":"fhem2shelly", "method":"Switch.Set", "params":{"id":1, "on":true, "toggle_after":$EVTPART1}}
#loop:#:3:4
#copy DEVICE_CH2 DEVICE_CH#
#attr DEVICE_CH# $DEVICETOPIC/events/rpc:.* { return if $EVENT !~ m{switch:#}; $EVENT =~ s/"output":true/"state":"on"/g; $EVENT =~ s/"output":false/"state":"off"/g; json2nameValue($EVENT,'',$JSONMAP) }
#attr DEVICE_CH2 setList toggle:noArg $\DEVICETOPIC/rpc {"id":#,"src":"fhem2shelly","method":"Switch.Toggle","params": {"id":#}}\
# off:noArg $\DEVICETOPIC/rpc {"id":#,"src":"fhem2shelly","method":"Switch.Set","params": {"id":#,"on":false}}\
# on:noArg $\DEVICETOPIC/rpc {"id":#,"src":"fhem2shelly","method":"Switch.Set","params": {"id":#,"on":true}}\
# on-for-timer $\DEVICETOPIC/rpc {"id":#,"src":"fhem2shelly","method":"Switch.Set","params": {"id":#,"on":true,"toggle_after":$EVTPART1}}
#loop:END
set DEVICE attrTemplate set_associatedWith \CHANNELS=2
#set DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4 attrTemplate speechcontrol_type_switch
#setreading DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4 attrTemplateVersion 20220104
#attr DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4 model shellypro4pm
set DEVICE,DEVICE_CH2 attrTemplate speechcontrol_type_switch
setreading DEVICE,DEVICE_CH2 attrTemplateVersion 20220104
attr DEVICE,DEVICE_CH2 model shellypro4pm
loop:#:1:2:3
copy DEVICE DEVICE_CH#
defmod DEVICE_CH# MQTT2_\DEVICE DEVICE_CH#
deleteattr DEVICE_CH# stateFormat
deleteattr DEVICE_CH# devStateIcon
attr DEVICE_CH# jsonMap params_switch_#_state:state params_switch_#_aenergy_total:aenergy_total params_switch_#_apower:apower params_switch_#_temperature_tC:temperature params_switch_#_temperature_tF:0
attr DEVICE_CH# $DEVICETOPIC/events/rpc:.* { return if $EVENT !~ m{switch:#}; $EVENT =~ s/"output":true/"state":"on"/g; $EVENT =~ s/"output":false/"state":"off"/g; json2nameValue($EVENT,'',$JSONMAP) }
attr DEVICE_CH# setList toggle:noArg $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Toggle","params": {"id":#}}\
off:noArg $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":#,"on":false}}\
on:noArg $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":#,"on":true}}\
on-for-timer $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":#,"on":true,"toggle_after":$EVTPART1}}
loop:END
rename DEVICE_CH3 DEVICE_CH4
rename DEVICE_CH2 DEVICE_CH3
rename DEVICE_CH1 DEVICE_CH2
set DEVICE attrTemplate set_associatedWith \CHANNELS=4
set DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4 attrTemplate speechcontrol_type_switch
setreading DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4 attrTemplateVersion 20220104_2
attr DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4 model shellypro4pm
###########################################