Hallo zusammen,
habe einen Shelly Plus 1 via MQTT in FHEM eingebunden und dafür das existierende Template verwendet.
ich würde zusätzlich gerne den Button Type (in_mode) von flip (edge) auf detached umstellen können um den am Shelly angeschlossenen Schalter bei bedarf deaktivieren zu können.
anbei die RAW von meinem device:
Code
defmod MQTT2_shellyplus1_441793a3b110 MQTT2_DEVICE shellyplus1_441793a3b110
attr MQTT2_shellyplus1_441793a3b110 alias Jens Ceilinglight
attr MQTT2_shellyplus1_441793a3b110 devStateIcon {my $onl = ReadingsVal($name,'online','false') eq 'false'?'10px-kreis-rot':'10px-kreis-gruen';; $onl = FW_makeImage($onl);; my $light = FW_makeImage(ReadingsVal($name,'state','off'));; my $temp = ReadingsVal($name,'temperature','-100');; my $ip = ReadingsVal($name,'ip','none');; my $reb = ReadingsVal($name,'sys_restart_required','false') eq 'true'?'<a href="/fhem?cmd.dummy=set '.$name.' x_reboot&XHR=1"> ... Notwendigen Reboot durchführen</a>':'';; qq(<a href="http://$ip" target="_blank">${onl}</a><a href="/fhem?cmd.dummy=set $name toggle&XHR=1">${light}</a>$reb<div>Temp: $temp °C</div>)}
attr MQTT2_shellyplus1_441793a3b110 devicetopic shellyplus1-441793a3b110
attr MQTT2_shellyplus1_441793a3b110 getList in_mode:noArg in_mode $DEVICETOPIC/rpc {"id": 1, "method": "Switch.GetConfig", "params": {"id": 0}}
attr MQTT2_shellyplus1_441793a3b110 icon light_ceiling_light@green
attr MQTT2_shellyplus1_441793a3b110 jsonMap switch_state:state switch_temperature_tC:temperature switch_temperature_tF:0 params_wifi_sta_ip:ip
attr MQTT2_shellyplus1_441793a3b110 model shellyPlus_1
attr MQTT2_shellyplus1_441793a3b110 readingList $DEVICETOPIC/online:.* online\
$DEVICETOPIC/events/rpc:.* { json2nameValue($EVENT,'',$JSONMAP) }\
$DEVICETOPIC/status/mqtt:.* { json2nameValue($EVENT, 'mqtt_', $JSONMAP) }\
$DEVICETOPIC/status/sys:.* { json2nameValue($EVENT, 'sys_', $JSONMAP) }\
$DEVICETOPIC/status/switch_0:.* { $EVENT =~ s/"output":true/"state":"on"/g;; $EVENT =~ s/"output":false/"state":"off"/g;; json2nameValue($EVENT, 'switch_', $JSONMAP) }\
$DEVICETOPIC/status/cloud:.* {}\
$DEVICETOPIC/rpc:.* {}\
fhem2shelly/rpc:.* {}\
shellyplus1_441793a3b110:shellyplus1-441793a3b110/status/input_0:.* { json2nameValue($EVENT) }\
shellyplus1_441793a3b110:shellyplus1-441793a3b110/status/script_1:.* { json2nameValue($EVENT) }
attr MQTT2_shellyplus1_441793a3b110 room Jens,MQTT2_DEVICE
attr MQTT2_shellyplus1_441793a3b110 setList toggle:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Toggle","params": {"id":0}}\
off:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":false}}\
on:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":true}}\
on-for-timer $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":true,"toggle_after":$EVTPART1}}\
off-for-timer $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":false,"toggle_after":$EVTPART1}}\
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"}\
x_eco:true,false $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Sys.SetConfig","params": {"config": {"device": {"eco_mode": $EVTPART1}}}}\
x_in_mode:flip,detached $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.SetConfig","params": {"id": 0: {"in_mode": $EVTPART1}}}
attr MQTT2_shellyplus1_441793a3b110 setStateList on off toggle on-for-timer off-for-timer
attr MQTT2_shellyplus1_441793a3b110 webCmd :
setstate MQTT2_shellyplus1_441793a3b110 off
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 10:12:16 IODev m2s
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 10:13:02 attrTemplateVersion 20220118
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 16:15:16 dst shellyplus1-441793a3b110/events
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 15:22:16 id 0
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 14:16:11 ip 192.168.177.47
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 16:15:16 method NotifyEvent
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 14:16:11 mqtt_connected true
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 14:16:11 online true
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 16:15:16 params_events_1_cfg_rev 24
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 16:15:16 params_events_1_component switch:0
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 16:15:16 params_events_1_event config_changed
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 16:15:16 params_events_1_id 0
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 16:15:16 params_events_1_restart_required false
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 16:15:16 params_events_1_ts 1646234117.11
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 15:22:16 params_input_0_id 0
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 15:22:16 params_input_0_state false
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 14:16:11 params_mqtt_connected true
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 11:30:44 params_script_1_id 1
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 11:30:44 params_script_1_running false
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 15:22:16 params_switch_0_id 0
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 15:22:16 params_switch_0_output false
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 15:22:16 params_switch_0_source switch
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 14:16:11 params_switch_0_temperature_tC 48.16
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 14:16:11 params_switch_0_temperature_tF 118.69
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 14:16:19 params_sys_available_updates_beta_version 0.10.0-beta5
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 14:15:58 params_sys_restart_required true
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 16:15:16 params_ts 1646234117.11
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 14:16:11 params_wifi_rssi -51
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 14:16:11 params_wifi_ssid WLAN-Alex
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 14:16:11 params_wifi_status got ip
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 11:30:53 running false
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 16:15:16 src shellyplus1-441793a3b110
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 15:22:16 state off
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 15:22:16 switch_id 0
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 15:22:16 switch_source switch
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 14:16:19 sys_available_updates_beta_version 0.10.0-beta5
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 14:16:19 sys_cfg_rev 17
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 14:16:19 sys_fs_free 237568
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 14:16:19 sys_fs_size 458752
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 14:16:19 sys_mac 441793A3B110
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 14:16:19 sys_ram_free 178144
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 14:16:19 sys_ram_size 249392
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 14:16:19 sys_restart_required false
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 14:16:19 sys_time 14:16
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 14:16:19 sys_unixtime 1646226979
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 14:16:19 sys_uptime 9
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 15:22:16 temperature 48.4
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 16:15:55 x_in_mode set flip
setstate MQTT2_shellyplus1_441793a3b110 2022-03-02 14:16:08 x_reboot set
Alles anzeigen
meine änderung ist das getList und die letzte Zeile in SetList.
ein über die FHEM cmd zeile ausgeführter "set <devicename> x_in_mode flip hat das reading x_in_mode set flip erzeugt, aber auch nichts geschaltet
würde mich über hilfe freuen
lg
Jens