[GELÖST] devStateIcon - HTML doppelt dargestellt?

Begonnen von B10S, 07 April 2025, 16:03:12

Vorheriges Thema - Nächstes Thema

B10S

Hallöchen zusammen,
ich habe ein merkwürdiges Phänomen, ich wollte zu meinem Stromzähler (MQTT Device) eine schöne Tabelle mit den Werten als HTML im devStateIcon hinterlegen. Schon tausend mal gemacht für alle möglichen Geräte, aber bei dem wird der HTML Code einfach doppelt ausgegeben. Hat jemand ne Idee, woran das liegen könnte?
Chrome und Firefox das gleiche, wenn ich mir den Quelltext anzeigen lasse, steht es auch doppelt drin. Andere Geräte funktionieren einwandfrei, habe auch extra noch mal nen Dummy angelegt und da probiert, da geht es auch ohne Probleme.

defmod MQTT2_Stromzaehler MQTT2_DEVICE Stromzaehler
attr MQTT2_Stromzaehler DbLogExclude .*
attr MQTT2_Stromzaehler DbLogInclude e_energyLastYear_in,e_costLastYear_in,e_energyYear_in_kWh,e_energyLastYear_out,e_costLastYear_out,e_energyYear_out_kWh,e_energyOffsetYear_in,e_energyOffsetYear_out,e_energyLastMonth_in,e_costLastMonth_in,e_energyMonth_in_kWh,e_energyLastMonth_out,e_costLastMonth_out,e_energyMonth_out_kWh,e_energyOffsetMonth_in,e_energyOffsetMonth_out,e_average_kWh,e_energyYesterday_in_kWh,e_energyToday_in_kWh,e_energyYesterday_out_kWh,e_energyToday_out_kWh,e_energyOffsetDay_in,e_energyOffsetDay_out,E320_Total_in,E320_Total_out,E320_Power_in
attr MQTT2_Stromzaehler alias Stromzähler
attr MQTT2_Stromzaehler devStateIcon {'<span>Test</span>'}
attr MQTT2_Stromzaehler event-min-interval e_energyYesterday_in_kWh:600,e_energyToday_in_kWh:600,e_energyYesterday_out_kWh:600,e_energyToday_out_kWh:600,e_average_kWh:600
attr MQTT2_Stromzaehler event-on-change-reading .*
attr MQTT2_Stromzaehler event-on-update-reading e_energyYesterday_in_kWh,e_energyYesterday_out_kWh,e_average_kWh
attr MQTT2_Stromzaehler group Strom
attr MQTT2_Stromzaehler icon mdt-meter-electric-outline
attr MQTT2_Stromzaehler readingList Stromzaehler:tele/Stromzaehler/LWT:.* LWT\
Stromzaehler:tele/Stromzaehler/INFO1:.* { json2nameValue($EVENT) }\
Stromzaehler:tele/Stromzaehler/INFO2:.* { json2nameValue($EVENT) }\
Stromzaehler:tele/Stromzaehler/INFO3:.* { json2nameValue($EVENT) }\
Stromzaehler:stat/Stromzaehler/RESULT:.* { json2nameValue($EVENT) }\
Stromzaehler:stat/Stromzaehler/POWER:.* POWER\
Stromzaehler:tele/Stromzaehler/STATE:.* { json2nameValue($EVENT) }\
Stromzaehler:tele/Stromzaehler/SENSOR:.* { json2nameValue($EVENT) }\
Stromzaehler:tasmota/discovery/5CCF7F18AA55/config:.* { json2nameValue($EVENT) }\
Stromzaehler:tasmota/discovery/5CCF7F18AA55/sensors:.* { json2nameValue($EVENT) }
attr MQTT2_Stromzaehler room Strom

setstate MQTT2_Stromzaehler 2025-04-07 15:52:11 E320_Power_in -1792.000
setstate MQTT2_Stromzaehler 2025-04-07 15:52:11 E320_Total_in 1456.082
setstate MQTT2_Stromzaehler 2025-04-07 15:52:11 E320_Total_out 4927.616
setstate MQTT2_Stromzaehler 2025-04-07 15:52:11 Heap 19
setstate MQTT2_Stromzaehler 2025-04-07 15:32:02 IODev m2s
setstate MQTT2_Stromzaehler 2025-04-01 07:32:07 Info1_FallbackTopic cmnd/Stromzaehler_fb/
setstate MQTT2_Stromzaehler 2025-04-01 07:32:07 Info1_GroupTopic cmnd/tasmotas/
setstate MQTT2_Stromzaehler 2025-04-01 07:32:07 Info1_Module Sonoff Basic
setstate MQTT2_Stromzaehler 2025-04-01 07:32:07 Info1_Version 13.1.0(TasmoCompiler-esp8266generic)
setstate MQTT2_Stromzaehler 2025-04-01 07:32:07 Info2_Hostname Stromzaehler
...


passibe

Ist das vielleicht ein Problem mit dem haus-automatisierung.com Style?
Bei mir mit f18 funktioniert deine Definition ganz normal (also nur 1x "Test").

B10S

Gute Idee, sieht mit dem f18 Style aber leider genauso aus. Auf dem Screenshot ist auch der Dummy zu sehen mit dem gleichen devStyleIcon, der sieht ganz normal aus. Muss also irgendwas an dem MQTT Device sein, aber ich wüsste nicht, was einen solchen Fehler verursachen könnte.

carlos

Hallo,
Ich hatte so was ähnliches auch schon mal. Bei mir war das ein Problem mit devStateIcon und stateFormat.
Da hat was nicht zusammen gepasst. Keine Ahnung mehr was das war und wie ich es gelöst habe.
Aber wie ich sehe benutzt du kein stateFormat.
Hilft dir jetzt zwar nicht, aber nur als Hinweis.
Nimm mal stateFormat mit dazu, ab sich was ändert.

Ich mache das z.B.: immer so:

defmod sonoff4ch MQTT2_DEVICE sonoff4ch
attr sonoff4ch IODev myHA_Client
attr sonoff4ch autocreate 0
attr sonoff4ch 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/cmnd/sonoff4ch/Backlog POWER1 1;; delay '.$duration.';; POWER1 0'}<br>See the "Praxisbeispiele" in the wiki for "pulseTime1" alternative option and it's restrictions.
attr sonoff4ch devStateIcon Online:10px-kreis-gruen Offline:10px-kreis-rot 1.on:on:POWER1+off 1.off:off:POWER1+on 2.on:on:POWER2+off 2.off:off:POWER2+on 3.on:on:POWER3+off 3.off:off:POWER3+on 4.on:on:POWER4+off 4.off:off:POWER4+on
attr sonoff4ch genericDeviceType switch
attr sonoff4ch icon hue_filled_outlet
attr sonoff4ch jsonMap POWER1:0 POWER2:0 POWER3:0 POWER4:0 Dimmer:0 Channel_0:0 Channel_1:0 Channel_2:0 Channel_3:0 Channel_4:0 Channel_5:0 HSBColor:0 Color:0
attr sonoff4ch model tasmota_4ch_unified_icon
attr sonoff4ch readingList tele/sonoff4ch/LWT:.* LWT\
  tele/sonoff4ch/STATE:.* { json2nameValue($EVENT,'',$JSONMAP) }\
  tele/sonoff4ch/SENSOR:.* { json2nameValue($EVENT,'',$JSONMAP) }\
  tele/sonoff4ch/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ?  json2nameValue($1,'',$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) }\
  stat/sonoff4ch/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) }\
  tele/sonoff4ch/UPTIME:.* { json2nameValue($EVENT,'',$JSONMAP) }\
  stat/sonoff4ch/POWER1:.* POWER1\
  stat/sonoff4ch/POWER2:.* POWER2\
  stat/sonoff4ch/POWER3:.* POWER3\
  stat/sonoff4ch/POWER4:.* POWER4
attr sonoff4ch room NEU_MQTT2_DEVICE
attr sonoff4ch setList POWER1:on,off,toggle cmnd/sonoff4ch/POWER1 $EVTPART1\
  POWER2:on,off,toggle cmnd/sonoff4ch/POWER2 $EVTPART1\
  POWER3:on,off,toggle cmnd/sonoff4ch/POWER3 $EVTPART1\
  POWER4:on,off,toggle cmnd/sonoff4ch/POWER4 $EVTPART1
attr sonoff4ch setStateList on off toggle
attr sonoff4ch stateFormat LWT\
1:POWER1\
2:POWER2\
3:POWER3\
4:POWER4\
<br><a href="http://IPAddress" target="_blank">IPAddress</a>
attr sonoff4ch webCmd POWER1:POWER2:POWER3:POWER4

setstate sonoff4ch Online\
1:on\
2:on\
3:on\
4:on\
<br><a href="http://192.168.178.194" target="_blank">192.168.178.194</a>
setstate sonoff4ch 2025-03-16 21:48:11 BootCount 80
setstate sonoff4ch 2025-03-16 21:47:39 Command Unknown
setstate sonoff4ch 2025-03-16 21:39:32 DeviceName sonoff4ch
setstate sonoff4ch 2025-03-16 21:48:11 FallbackTopic cmnd/sonoff4ch_fb/
setstate sonoff4ch 2025-03-16 21:48:11 GroupTopic cmnd/tasmotas/
setstate sonoff4ch 2025-04-08 09:00:14 Heap 25
setstate sonoff4ch 2025-03-16 21:48:11 Hostname sonoff4ch
setstate sonoff4ch 2025-04-08 04:01:11 IODev myHA_Client
setstate sonoff4ch 2025-03-16 21:48:11 IPAddress 192.168.178.194
setstate sonoff4ch 2025-02-19 23:12:12 IPAddress1 192.168.178.194 (192.168.178.80)
setstate sonoff4ch 2025-02-19 23:08:32 IPAddress2 192.168.178.1
setstate sonoff4ch 2025-02-19 23:08:32 IPAddress3 255.255.255.0
setstate sonoff4ch 2025-02-19 23:08:32 IPAddress4 192.168.178.1
setstate sonoff4ch 2025-02-19 23:08:32 IPAddress5 0.0.0.0
setstate sonoff4ch 2025-03-16 21:47:39 Input STATUS 11
setstate sonoff4ch 2025-04-08 04:01:35 LWT Online
setstate sonoff4ch 2025-04-08 09:00:14 LoadAvg 19
setstate sonoff4ch 2025-03-16 21:48:11 Module Sonoff 4CH
setstate sonoff4ch 2025-04-08 09:00:14 MqttCount 119
setstate sonoff4ch 2025-03-16 21:46:12 OtaUrl http://ota.tasmota.com/tasmota//release/tasmota.bin.gz
setstate sonoff4ch 2025-03-16 21:48:11 POWER1 on
setstate sonoff4ch 2025-03-16 21:48:11 POWER2 on
setstate sonoff4ch 2025-03-16 21:48:11 POWER3 on
setstate sonoff4ch 2025-03-16 21:48:11 POWER4 on
setstate sonoff4ch 2025-03-16 21:48:11 RestartReason Software/System restart
setstate sonoff4ch 2025-02-19 23:12:19 SaveData off
setstate sonoff4ch 2025-02-04 16:00:14 SetOption26 on
setstate sonoff4ch 2025-04-08 09:00:14 Sleep 50
setstate sonoff4ch 2025-04-08 09:00:14 SleepMode Dynamic
setstate sonoff4ch 2025-02-04 16:00:14 StateText1 off
setstate sonoff4ch 2025-02-04 16:00:14 StateText2 on
setstate sonoff4ch 2025-02-04 16:00:14 StateText3 toggle
setstate sonoff4ch 2025-02-04 16:00:14 StateText4 hold
setstate sonoff4ch 2025-04-08 09:00:14 Time 2025-04-08T09:00:12
setstate sonoff4ch 2025-03-16 21:46:12 Upgrade Version 14.5.0 from http://ota.tasmota.com/tasmota//release/tasmota.bin.gz
setstate sonoff4ch 2025-04-08 09:00:14 Uptime 17T16:16:33
setstate sonoff4ch 2025-04-08 09:00:14 UptimeSec 1527393
setstate sonoff4ch 2025-02-19 06:51:28 Vcc 3.480
setstate sonoff4ch 2025-03-16 21:48:11 Version 14.5.0(release-tasmota)
setstate sonoff4ch 2025-03-16 21:48:11 WebServerMode Admin
setstate sonoff4ch 2025-04-08 09:00:14 Wifi_AP 2
setstate sonoff4ch 2025-04-08 09:00:14 Wifi_BSSId DC:39:6F:C7:5F:00
setstate sonoff4ch 2025-04-08 09:00:14 Wifi_Channel 1
setstate sonoff4ch 2025-04-08 09:00:14 Wifi_Downtime 0T00:14:19
setstate sonoff4ch 2025-04-08 09:00:14 Wifi_LinkCount 95
setstate sonoff4ch 2025-04-08 09:00:14 Wifi_Mode 11n
setstate sonoff4ch 2025-04-08 09:00:14 Wifi_RSSI 100
setstate sonoff4ch 2025-04-08 09:00:14 Wifi_SSId xxxx
setstate sonoff4ch 2025-04-08 09:00:14 Wifi_Signal -45
setstate sonoff4ch 2025-02-04 16:00:13 attrTemplateVersion 20210515
setstate sonoff4ch 2025-03-02 04:01:30 subscriptions cmnd/sonoff4ch/# cmnd/sonoff4ch_fb/# cmnd/tasmotas/#


Gruß

Hubert
FHEM svn auf Intel NUC mit proxmox, 3 Raspberry Pi, signalduino, nanoCUL,  toom Baumarkt Funksteckdosen, einige sonoffs, hue, shelly

Beta-User

Ohne das nachgesehen zu haben: Am Ende nutzlose HTML-Tags mit einfügen könnte eventuell helfen (sowas:"<b></b>").
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: ZigBee2mqtt, MiLight@ESP-GW, BT@OpenMQTTGw | ZWave | SIGNALduino | MapleCUN | RHASSPY
svn: u.a Weekday-&RandomTimer, Twilight,  div. attrTemplate-files, MySensors

rudolfkoenig

ZitatGute Idee, sieht mit dem f18 Style aber leider genauso aus.
Nicht bei mir, mit der gezeigten Beispieldefinition.
Da das auch bei @passibe der Fall ist, liegt das Problem vmtl. anderswo.

B10S

Zitat von: carlos am 08 April 2025, 09:04:26Bei mir war das ein Problem mit devStateIcon und stateFormat.
Ha! Ich hatte vorher ein stateFormat drin, in dem die aktuelle Leistung, die Zählerstände und die letzte Updatezeit drin standen und das dann aber raus genommen. Jetzt habe ich noch mal ein stateFormat mit "test" angelegt und siehe da, plötzlich nur noch eine Tabelle im Output. stateFormat gelöscht und immer noch nur eine Tabelle. Jetzt ist also quasi alles wie vorher... nur, dass es richtig angezeigt wird.
Bisschen rumgespielt und habe es reproduzieren können. Scheint sich so zu verhalten, sobald das stateFormat (scheinbar auch ein altes gelöschtes) zweizeilig ist/war.

Anbei mal drei Screenshots, die das Verhalten zeigen.

xenos1984

Zitat von: B10S am 08 April 2025, 11:13:07Scheint sich so zu verhalten, sobald das stateFormat (scheinbar auch ein altes gelöschtes) zweizeilig ist/war.

Ja, wenn das Internal STATE, das durch stateFormat generiert wird, mehrzeilig ist, wird devStateIcon auf jede Zeile einmal angewendet - bei zwei Zeilen bekommst du also zwei Kopien angezeigt.