FHEM Forum

FHEM - Hausautomations-Systeme => MQTT => Thema gestartet von: Huabafranze am 04 August 2020, 22:05:17

Titel: Anzeige von Version (Firmwarestand) Tasmota
Beitrag von: Huabafranze am 04 August 2020, 22:05:17
Hallo,
ich habe einige tasmota Geräte zuhause mit folgender Konfiguration verbaut:
IODev MQTT2_FHEM_Server
alias Entertainment
autocreate 1
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//Wohnzimmer/test/cmnd/tasmota/Backlog POWER1 1; delay '.$duration.'; POWER1 0'}<br>See the "Praxisbeispiele" in the wiki for "pulseTime1" alternative option and it's restrictions.
devStateIcon {my $online = ReadingsVal($name,"LWT","0") eq "Online"?"10px-kreis-gruen":"10px-kreis-rot";; my $stat = ReadingsVal($name,"POWER1","off") eq "on"?"it_television\@orange":"it_television\@black";; "<a href=\"http://".ReadingsVal($name,"IPAddress","none")." \"target=\"_blank\">".FW_makeImage($online). "</a> <a href=\"/fhem?cmd.dummy=set $name toggle&XHR=1\">".FW_makeImage($stat). "</a>"}
event-on-change-reading .*
genericDeviceType switch
icon it_television
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 HSBColor:0 Color:0
model tasmota_basic_state_power1
readingList /Wohnzimmer/test/tele/tasmota/LWT:.* LWT
  /Wohnzimmer/test/tele/tasmota/STATE:.* { json2nameValue($EVENT,'',$JSONMAP) }
  /Wohnzimmer/test/tele/tasmota/SENSOR:.* { json2nameValue($EVENT,'',$JSONMAP) }
  /Wohnzimmer/test/tele/tasmota/INFO.:.* { json2nameValue($EVENT,'',$JSONMAP) }
  /Wohnzimmer/test/tele/tasmota/UPTIME:.* { json2nameValue($EVENT,'',$JSONMAP) }
  /Wohnzimmer/test/tele/tasmota/POWER1:.* POWER1
  /Wohnzimmer/test/stat/tasmota/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) }
Gosund_06:/Wohnzimmer/test/stat/tasmota/POWER1:.* POWER1
Gosund_06:/Wohnzimmer/test/cmnd/tasmota/POWER:.* POWER
Gosund_06:/Wohnzimmer/test/stat/tasmota/UPGRADE:.* { json2nameValue($EVENT) }
room MQTT2_DEVICE
setList off:noArg    /Wohnzimmer/test/cmnd/tasmota/POWER1 0
  on:noArg     /Wohnzimmer/test/cmnd/tasmota/POWER1 1
  toggle:noArg /Wohnzimmer/test/cmnd/tasmota/POWER1 2
  setOtaUrl:textField /Wohnzimmer/test/cmnd/tasmota/OtaUrl $EVTPART1
  upgrade:noArg   /Wohnzimmer/test/cmnd/tasmota/upgrade 1
setStateList set_on set_off toggle
webCmd on:off


Ich würde nun noch gerne neben dem Icon die Firmwareversion anzeigen, also das Reading "Version". Was müsste ich da anpassen?
PS. ich kenne mich mit Perl codes eigentlich gar nicht aus. Was hier als "Perl" eingegeben ist, habe ich mit copy-paste gemacht.
Titel: Antw:Anzeige von Version (Firmwarestand) Tasmota
Beitrag von: Woody14623 am 05 November 2022, 05:36:09
In case you did not find it yet, what you want is:

attr <device_name> stateFormat state<br>Version

Note that if you edit it via the web interface, you can put a newline after state, and it will show the icon associated instead of just the state text.  I don't know  how to do that in the command line though.
Titel: Antw:Anzeige von Version (Firmwarestand) Tasmota
Beitrag von: carlos am 05 November 2022, 11:12:54
Bei mr haben alle tasmota Geräte dasselbe stateFormat
Hier ein sonoffdualR2 :

attr MQTT2_sonoffdualR2 stateFormat LWT\
<a href="http://IPAddress" target="_blank">Hostname</a>\
CH1\
1:POWER1 \
CH2\
2:POWER2\
<br>\
<b>Tasmota Revision:</b>\
Version\
<br>\
<b>Wifi AP Wifi_AP:</b>\
Wifi_SSId


Da habe ich alles was ich brauche.

btw. in den templates ist diesbezüglich, finde ich, auch ein ziemliches durcheinander.
Das könnte man mal vereinheitlichen auch im zusammenhang mit devStateIcon.
Wo ich das jetzt lese was ich geschrieben habe, hier ist noch mein devStateIcon:

attr MQTT2_sonoffdualR2 devStateIcon 1.on:on:POWER1+off 1.off:off:POWER1+on 2.on:on:POWER2+off 2.off:off:POWER2+on Online:10px-kreis-gruen@green Offline:10px-kreis-rot@red


Ist nur ein Verbesserungsvorschlag, die Template Geschichte an sich finde ich toll.
Gruß

Hubert