ShellyWall Display

Begonnen von Hermann, 04 April 2024, 21:45:19

Vorheriges Thema - Nächstes Thema

joachimS

Ich nutze das Shelly Wall Display als Schalter und natürlich zur Steuerung von Shellies.
Habe heute mal MQTT angemacht und versucht das Template anzupassen obwohl ich da nicht fit bin.
Schalten geht über fhem und auch Readings für temperature, humidity, eingeschaltet, lux.
Allerdings sind temperature, humidity vom internen Sensor und nicht vom externen, der nirgendwo in den Readings auftaucht.
devStateIcon habe ich auch nicht hinbekommen, aber Logging tut.

Readings:
IODev MQTT2_FHEM_Server 2025-10-20 14:11:04
dst ShellyWallDisplay\/events 2025-10-20 14:36:09
eingeschaltet false 2025-10-20 14:24:05
humidity 38 2025-10-20 14:40:09
ip 192.168.2.114 2025-10-20 14:11:08
lux 30 2025-10-20 14:36:09
method NotifyStatus 2025-10-20 14:36:09
online true 2025-10-20 14:11:08
params_cloud_connected true 2025-10-20 14:11:08
params_devicepower_0_external_present true 2025-10-20 14:11:08
params_devicepower_0_id 0 2025-10-20 14:11:08
params_humidity_0_id 0 2025-10-20 14:36:09
params_illuminance_0_id 0 2025-10-20 14:36:09
params_illuminance_0_illumination twilight 2025-10-20 14:36:09
params_illuminance_0_lux 30 2025-10-20 14:08:09
params_input_0_id 0 2025-10-20 14:11:08
params_input_0_state false 2025-10-20 14:11:08
params_media_item_counts_audio 0 2025-10-20 14:11:08
params_media_item_counts_photo 0 2025-10-20 14:11:08
params_media_item_counts_video 0 2025-10-20 14:11:08
params_media_playback_buffering false 2025-10-20 14:11:08
params_media_playback_enable false 2025-10-20 14:11:08
params_media_playback_media_meta_thumb https:\/\/cdn.onlineradiobox.com\/img\/apple-touch-icon-120x120.png 2025-10-20 14:11:08
params_media_playback_media_meta_title JS Bach - Classical Radio 2025-10-20 14:11:08
params_media_playback_media_type RADIO 2025-10-20 14:11:08
params_media_playback_volume 10 2025-10-20 14:11:08
params_media_total_size 3885854 2025-10-20 14:11:08
params_media_total_size_h 3.706 MB 2025-10-20 14:11:08
params_mqtt_connected true 2025-10-20 14:11:08
params_switch_0_id 0 2025-10-20 14:24:05
params_switch_0_source HTTP \/relay legacy command 2025-10-20 14:24:05
params_sys_app WallDisplay 2025-10-20 14:11:08
params_sys_app_uptime 1013679 2025-10-20 14:11:08
params_sys_auth_en false 2025-10-20 14:11:08
params_sys_awaiting_auth_code false 2025-10-20 14:11:08
params_sys_batch_date 230930 2025-10-20 14:11:08
params_sys_batch_id 38612 2025-10-20 14:11:08
params_sys_cfg_rev 23 2025-10-20 14:11:08
params_sys_ch_1 switch:0 2025-10-20 14:11:08
params_sys_discoverable false 2025-10-20 14:11:08
params_sys_fs_free 4756504576 2025-10-20 14:11:08
params_sys_fs_size 4845625344 2025-10-20 14:11:08
params_sys_fw_id 20251002-123335\/2.4.5-32f73abb 2025-10-20 14:11:08
params_sys_gen 2 2025-10-20 14:11:08
params_sys_id ShellyWallDisplay-0008224FB3C8 2025-10-20 14:11:08
params_sys_mac 0008224FB3C8 2025-10-20 14:11:08
params_sys_model SAWD-0A1XX10EU1 2025-10-20 14:11:08
params_sys_platform vXD10000M2 2025-10-20 14:11:08
params_sys_ram_free 46204568 2025-10-20 14:11:08
params_sys_ram_size 134217728 2025-10-20 14:11:08
params_sys_relay_in_thermostat false 2025-10-20 14:11:08
params_sys_restart_required false 2025-10-20 14:11:08
params_sys_schedule_rev 0 2025-10-20 14:11:08
params_sys_sensor_in_thermostat false 2025-10-20 14:11:08
params_sys_serial SAWD89A54014L 2025-10-20 14:11:08
params_sys_unixtime 1760962258 2025-10-20 14:11:08
params_sys_uptime 1013758 2025-10-20 14:11:08
params_sys_ver 2.4.5 2025-10-20 14:11:08
params_sys_webhook_rev 6 2025-10-20 14:11:08
params_temperature_0_id 0 2025-10-20 14:36:09
params_temperature_0_tF 73.3 2025-10-20 14:36:09
params_ts 1760963760 2025-10-20 14:36:09
params_wifi_gw 192.168.2.1 2025-10-20 14:11:08
params_wifi_mac 00:08:22:4F:B3:C8 2025-10-20 14:11:08
params_wifi_nameserver 192.168.2.1 2025-10-20 14:11:08
params_wifi_netmask 255.255.255.0 2025-10-20 14:11:08
params_wifi_rssi -53 2025-10-20 14:11:08
params_wifi_ssid Home 2025-10-20 14:11:08
params_wifi_status got ip 2025-10-20 14:11:08
src ShellyWallDisplay-0008224FB3C8 2025-10-20 14:36:09
state set_off 2025-10-20 14:05:02
subscriptions ShellyWallDisplay/rpc 2025-10-20 14:11:58
temperature 23 2025-10-20 14:40:09

Mein config file:
# Shelly ShellyWallDisplay
define ShellyWallDisplay MQTT2_DEVICE ShellyWallDisplay
attr ShellyWallDisplay devStateIcon {my $onl = ReadingsVal($name,'eingeschaltet','false') eq 'false'?'10px-kreis-rot':'10px-kreis-gruen';; $onl = FW_makeImage($onl);; my $light = FW_makeImage(ReadingsVal($name,'state','off'));; my $humid = ReadingsVal($name,humidity,'-100');; 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>Feuchtigkeit: $humid % / Temp: $temp °C</div>)}
attr ShellyWallDisplay devicetopic ShellyWallDisplay
attr ShellyWallDisplay event-on-change-reading eingeschaltet,temperature,state,status,sys_restart_required,online,humidity,lux
attr ShellyWallDisplay getList in_mode:noArg in_mode $DEVICETOPIC/rpc {"id": 1,"src":"$DEVICETOPIC", "method": "Switch.GetConfig", "params": {"id": 0}}
attr ShellyWallDisplay group Shelly
attr ShellyWallDisplay jsonMap switch_state:state params_wifi_sta_ip:ip params_temperature_0_tC:temperature result_in_mode:in_mode params_switch_0_output:eingeschaltet params_humidity_0_rh:humidity params_illuminance_0_lux:lux
attr ShellyWallDisplay model ShellyWallDisplay
attr ShellyWallDisplay 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:.* { json2nameValue($EVENT,, $JSONMAP) }\
  $DEVICETOPIC/status/cloud:.* {}\
  $DEVICETOPIC/status:.* { json2nameValue($EVENT) }
attr ShellyWallDisplay room Raum->Wohnzimmer
attr ShellyWallDisplay 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}}\
  in_mode:toggle,flip,detached {fhem("sleep 0.2;; get $NAME in_mode");; my $val = $EVTPART1 ne 'toggle' ? $EVTPART1 : ReadingsVal($NAME,'in_mode','flip') eq 'flip' ? 'detached':'flip';; qq($DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Switch.SetConfig","params": {"id":0, "config": {"in_mode": "$val"}}})}\
  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}}}}
attr ShellyWallDisplay setStateList on off toggle on-for-timer off-for-timer
attr ShellyWallDisplay webCmd :
# FileLog
define Log_ShellyWallDisplay FileLog ./logs/ShellyWallDisplay-%Y.log ShellyWallDisplay:(temperature.*|humidity.*|eingeschaltet.*|lux.*)
attr Log_ShellyWallDisplay logtype text
attr Log_ShellyWallDisplay room Logs

define Graph_ShellyWallDisplay SVG Log_ShellyWallDisplay:hms_tf:CURRENT
attr Graph_ShellyWallDisplay room Raum->Wohnzimmer
attr Graph_ShellyWallDisplay title "WallDisplay Temperature Min:$data{min3} Max:$data{max3} Last:$data{currval3} -- Humidity Min:$data{min2} Max:$data{max2} Last:$data{currval2}"

Logfile:
025-10-20_14:32:09 ShellyWallDisplay humidity: 37.9
2025-10-20_14:31:09 ShellyWallDisplay temperature: 23
2025-10-20_14:29:09 ShellyWallDisplay humidity: 37.8
2025-10-20_14:29:09 ShellyWallDisplay temperature: 22.9
2025-10-20_14:28:09 ShellyWallDisplay temperature: 23.1
2025-10-20_14:27:09 ShellyWallDisplay humidity: 37.7
2025-10-20_14:26:09 ShellyWallDisplay humidity: 37.8
2025-10-20_14:26:09 ShellyWallDisplay temperature: 23
2025-10-20_14:25:09 ShellyWallDisplay humidity: 37.9
2025-10-20_14:24:09 ShellyWallDisplay lux: 30
2025-10-20_14:24:09 ShellyWallDisplay temperature: 23.1
2025-10-20_14:24:05 ShellyWallDisplay eingeschaltet: false
2025-10-20_14:23:10 ShellyWallDisplay lux: 5
2025-10-20_14:23:00 ShellyWallDisplay eingeschaltet: true
2025-10-20_14:22:09 ShellyWallDisplay humidity: 37.8
2025-10-20_14:22:09 ShellyWallDisplay temperature: 23
2025-10-20_14:21:45 ShellyWallDisplay eingeschaltet: false
2025-10-20_14:20:45 ShellyWallDisplay eingeschaltet: true
2025-10-20_14:20:09 ShellyWallDisplay humidity: 37.7
2025-10-20_14:20:09 ShellyWallDisplay temperature: 22.9
2025-10-20_14:19:24 ShellyWallDisplay eingeschaltet: false
2025-10-20_14:19:09 ShellyWallDisplay lux: 30
2025-10-20_14:19:09 ShellyWallDisplay humidity: 37.9
2025-10-20_14:19:09 ShellyWallDisplay temperature: 23
2025-10-20_14:18:15 ShellyWallDisplay eingeschaltet: true
2025-10-20_14:18:12 ShellyWallDisplay lux: 5
2025-10-20_14:18:09 ShellyWallDisplay humidity: 37.7
2025-10-20_14:17:09 ShellyWallDisplay humidity: 38
...
Gruss
Joachim

(fhem auf Synology DS209, CUL, FS20, FHT, EM, HM, Keymatic, Hue, OpenDTU)