Kann man dieses Shelly device "eleganter" lösen

Begonnen von supernova1963, 01 Mai 2021, 11:10:19

Vorheriges Thema - Nächstes Thema

supernova1963

Hallo zusammen,

ich spiele gerade mit meiner MQTT2_DEVICE Definition für einen Shelly mit meinem gefährlichem Halbwissen herum.
Mein erstes "Etappenziel" habe ich zwar erreicht, bin mir aber nicht sicher, ob die Umsetzung nicht eleganter, oder besser machbar ist.
Ich möchte in FHEMWEB die angehangene Darstellung mit folgenden Funktionalitäten erreichen:

  • Ist "new_fw" im announce = "true" soll z.B. ein Recycle Icon angezeigt werden und mit einem Klick auf dieses Icon soll die Funktion Firmware update auf dem Shelly gestartet werden
  • Mein individuelles "Schalter Icon" soll "an" und "aus" anzeigen und mit einem Klick auf dieses Icon soll das Relay des Shelly jeweils umgeschaltet werden
  • Mein individuelles "Status Icon" soll anzeigen, ob der Shelly erreichbar ist (userreading connection über online reading) und, wenn "true" den Link zum Shelly in neuem Fenster öffnen

Meine vielleicht zu optimierender Lösung:

Internals:
   CFGFN     
   CID        23_Wandleuchten
   DEF        23_Wandleuchten
   DEVICETOPIC 23_Wandleuchten
   FUUID      608cf89d-f33f-2177-c639-23d1dff012a66cbf
   IODev      mqtt
   LASTInputDev mqtt
   MSGCNT     3610
   NAME       23_Wandleuchten
   NR         121
   STATE      aktuell
off
<html><a target='_blank' href='http://10.100.1.60'><svg class=" eigene/lwt_status lime" data-txt="eigene/lwt_status@lime"    xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"    xmlns:dc="http://purl.org/dc/elements/1.1/"    xmlns:cc="http://creativecommons.org/ns#"    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"    xmlns:svg="http://www.w3.org/2000/svg"    xmlns="http://www.w3.org/2000/svg"    xmlns:xlink="http://www.w3.org/1999/xlink"    xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"    xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"    version="1.0"    width="500.000000pt"    height="1000.000000pt"    viewBox="0 0 500.000000 1000.000000"    preserveAspectRatio="xMidYMid meet"    id="svg68"    sodipodi:docname="lwt_status.svg"    inkscape:version="1.0 (4035a4f, 2020-05-01)">   <defs      id="defs72">     <linearGradient        inkscape:collect="always"        id="linearGradient1727">       <stop          style="stop-color:#000000;stop-opacity:1;"          offset="0"          id="stop1723" />       <stop          style="stop-color:#000000;stop-opacity:0;"          offset="1"          id="stop1725" />     </linearGradient>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1609"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1607"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000050;stroke-width:1pt;stroke-opacity:1;fill:lime;fill-opacity:1"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1551"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1549"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1499"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1497"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1453"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1451"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1413"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1411"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1379"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1377"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1351"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1349"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1329"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1327"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1313"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1311"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="Arrow1Lstart"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1041"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <linearGradient        id="linearGradient1013"        osb:paint="solid">       <stop          style="stop-color:#000050;stop-opacity:1;"          offset="0"          id="stop1011" />     </linearGradient>     <radialGradient        inkscape:collect="always"        xlink:href="#linearGradient1727"        id="radialGradient1729"        cx="247.782"        cy="502.53485"        fx="247.782"        fy="502.53485"        r="262.5"        gradientUnits="userSpaceOnUse"        gradientTransform="matrix(0.92857134,0,0,0.92857153,19.916812,33.360407)" />   </defs>   <sodipodi:namedview      inkscape:document-rotation="0"      pagecolor="#ffffff"      bordercolor="#666666"      borderopacity="1"      objecttolerance="10"      gridtolerance="10"      guidetolerance="10"      inkscape:pageopacity="0"      inkscape:pageshadow="2"      inkscape:window-width="1760"      inkscape:window-height="905"      id="namedview70"      showgrid="false"      inkscape:zoom="0.59175"      inkscape:cx="180.39713"      inkscape:cy="681.8758"      inkscape:window-x="62"      inkscape:window-y="23"      inkscape:window-maximized="0"      inkscape:current-layer="svg68" />   <metadata      id="metadata60"> Created by potrace 1.16, written by Peter Selinger 2001-2019 <rdf:RDF>   <cc:Work      rdf:about="">     <dc:format>image/svg+xml</dc:format>     <dc:type        rdf:resource="http://purl.org/dc/dcmitype/StillImage" />     <dc:title />   </cc:Work> </rdf:RDF> </metadata>   <g      transform="matrix(0.08601534,0,0,-0.0859459,34.95089,929.83984)"      fill="lime"      stroke="none"      id="g66">     <path        d="m 2370,6744 c -265,-29 -455,-81 -639,-174 -525,-263 -872,-739 -962,-1320 -17,-109 -17,-391 0,-500 111,-714 626,-1281 1316,-1448 141,-35 246,-46 415,-46 169,0 274,11 415,46 566,137 1031,555 1228,1103 74,205 101,365 101,595 0,230 -27,390 -101,595 -214,595 -735,1027 -1363,1131 -85,14 -345,26 -410,18 z"        id="path64" />   </g>   <ellipse      style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#radialGradient1729);stroke-width:69.6428;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"      id="path133"      cx="250"      cy="500"      rx="208.92856"      ry="208.92859" /> </svg></a></html>
   TYPE       MQTT2_DEVICE
   mqtt_MSGCNT 3610
   mqtt_TIME  2021-05-01 11:07:38
   OLDREADINGS:
     2021-05-01 10:10:06   state           on
   READINGS:
     2021-05-01 11:07:35   actions_stats_skipped 0
     2021-05-01 11:07:35   cfg_changed_cnt 0
     2021-05-01 11:07:35   cloud_connected false
     2021-05-01 11:07:35   cloud_enabled   false
     2021-05-01 11:07:38   connection      <html><a target='_blank' href='http://10.100.1.60'><svg class=" eigene/lwt_status lime" data-txt="eigene/lwt_status@lime"    xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"    xmlns:dc="http://purl.org/dc/elements/1.1/"    xmlns:cc="http://creativecommons.org/ns#"    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"    xmlns:svg="http://www.w3.org/2000/svg"    xmlns="http://www.w3.org/2000/svg"    xmlns:xlink="http://www.w3.org/1999/xlink"    xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"    xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"    version="1.0"    width="500.000000pt"    height="1000.000000pt"    viewBox="0 0 500.000000 1000.000000"    preserveAspectRatio="xMidYMid meet"    id="svg68"    sodipodi:docname="lwt_status.svg"    inkscape:version="1.0 (4035a4f, 2020-05-01)">   <defs      id="defs72">     <linearGradient        inkscape:collect="always"        id="linearGradient1727">       <stop          style="stop-color:#000000;stop-opacity:1;"          offset="0"          id="stop1723" />       <stop          style="stop-color:#000000;stop-opacity:0;"          offset="1"          id="stop1725" />     </linearGradient>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1609"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1607"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000050;stroke-width:1pt;stroke-opacity:1;fill:lime;fill-opacity:1"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1551"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1549"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1499"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1497"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1453"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1451"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1413"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1411"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1379"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1377"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1351"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1349"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1329"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1327"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1313"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1311"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="Arrow1Lstart"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1041"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <linearGradient        id="linearGradient1013"        osb:paint="solid">       <stop          style="stop-color:#000050;stop-opacity:1;"          offset="0"          id="stop1011" />     </linearGradient>     <radialGradient        inkscape:collect="always"        xlink:href="#linearGradient1727"        id="radialGradient1729"        cx="247.782"        cy="502.53485"        fx="247.782"        fy="502.53485"        r="262.5"        gradientUnits="userSpaceOnUse"        gradientTransform="matrix(0.92857134,0,0,0.92857153,19.916812,33.360407)" />   </defs>   <sodipodi:namedview      inkscape:document-rotation="0"      pagecolor="#ffffff"      bordercolor="#666666"      borderopacity="1"      objecttolerance="10"      gridtolerance="10"      guidetolerance="10"      inkscape:pageopacity="0"      inkscape:pageshadow="2"      inkscape:window-width="1760"      inkscape:window-height="905"      id="namedview70"      showgrid="false"      inkscape:zoom="0.59175"      inkscape:cx="180.39713"      inkscape:cy="681.8758"      inkscape:window-x="62"      inkscape:window-y="23"      inkscape:window-maximized="0"      inkscape:current-layer="svg68" />   <metadata      id="metadata60"> Created by potrace 1.16, written by Peter Selinger 2001-2019 <rdf:RDF>   <cc:Work      rdf:about="">     <dc:format>image/svg+xml</dc:format>     <dc:type        rdf:resource="http://purl.org/dc/dcmitype/StillImage" />     <dc:title />   </cc:Work> </rdf:RDF> </metadata>   <g      transform="matrix(0.08601534,0,0,-0.0859459,34.95089,929.83984)"      fill="lime"      stroke="none"      id="g66">     <path        d="m 2370,6744 c -265,-29 -455,-81 -639,-174 -525,-263 -872,-739 -962,-1320 -17,-109 -17,-391 0,-500 111,-714 626,-1281 1316,-1448 141,-35 246,-46 415,-46 169,0 274,11 415,46 566,137 1031,555 1228,1103 74,205 101,365 101,595 0,230 -27,390 -101,595 -214,595 -735,1027 -1363,1131 -85,14 -345,26 -410,18 z"        id="path64" />   </g>   <ellipse      style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#radialGradient1729);stroke-width:69.6428;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"      id="path133"      cx="250"      cy="500"      rx="208.92856"      ry="208.92859" /> </svg></a></html>
     2021-05-01 11:07:35   fs_free         145078
     2021-05-01 11:07:35   fs_size         233681
     2021-05-01 11:07:35   fw_ver          20210415-130044/v1.10.3-g23074d0
     2021-05-01 11:07:35   has_update      false
     2021-05-01 11:07:35   id              23_Wandleuchten
     2021-05-01 11:07:35   inputs_1_event 
     2021-05-01 11:07:35   inputs_1_event_cnt 0
     2021-05-01 11:07:35   inputs_1_input  0
     2021-05-01 11:07:35   inputs_2_event 
     2021-05-01 11:07:35   inputs_2_event_cnt 0
     2021-05-01 11:07:35   inputs_2_input  1
     2021-05-01 11:07:35   ip              10.100.1.60
     2021-05-01 11:07:35   mac             C82B9610B898
     2021-05-01 11:07:35   meters_1_counters_1 0.000
     2021-05-01 11:07:35   meters_1_counters_2 0.000
     2021-05-01 11:07:35   meters_1_counters_3 0.000
     2021-05-01 11:07:35   meters_1_is_valid true
     2021-05-01 11:07:35   meters_1_overpower 0.00
     2021-05-01 11:07:35   meters_1_power  0.00
     2021-05-01 11:07:35   meters_1_timestamp 1619867255
     2021-05-01 11:07:35   meters_1_total  20
     2021-05-01 11:07:35   meters_2_counters_1 0.000
     2021-05-01 11:07:35   meters_2_counters_2 0.000
     2021-05-01 11:07:35   meters_2_counters_3 0.000
     2021-05-01 11:07:35   meters_2_is_valid true
     2021-05-01 11:07:35   meters_2_overpower 0.00
     2021-05-01 11:07:35   meters_2_power  0.00
     2021-05-01 11:07:35   meters_2_timestamp 1619867255
     2021-05-01 11:07:35   meters_2_total  5012
     2021-05-01 11:07:35   model           SHSW-25
     2021-05-01 11:07:38   motion_2        1
     2021-05-01 11:07:35   mqtt_connected  true
     2021-05-01 11:07:35   new_fw          false
     2021-05-01 11:07:35   online          true
     2021-05-01 11:07:35   overtemperature false
     2021-05-01 11:07:35   ram_free        35768
     2021-05-01 11:07:35   ram_total       49288
     2021-05-01 11:07:38   relay_2         off
     2021-05-01 11:07:35   relays_1_has_timer false
     2021-05-01 11:07:35   relays_1_is_valid true
     2021-05-01 11:07:35   relays_1_ison   false
     2021-05-01 11:07:35   relays_1_overpower false
     2021-05-01 11:07:35   relays_1_overtemperature false
     2021-05-01 11:07:35   relays_1_source mqtt
     2021-05-01 11:07:35   relays_1_timer_duration 0
     2021-05-01 11:07:35   relays_1_timer_remaining 0
     2021-05-01 11:07:35   relays_1_timer_started 0
     2021-05-01 11:07:35   relays_2_has_timer false
     2021-05-01 11:07:35   relays_2_is_valid true
     2021-05-01 11:07:35   relays_2_ison   false
     2021-05-01 11:07:35   relays_2_overpower false
     2021-05-01 11:07:35   relays_2_overtemperature false
     2021-05-01 11:07:35   relays_2_source http
     2021-05-01 11:07:35   relays_2_timer_duration 0
     2021-05-01 11:07:35   relays_2_timer_remaining 0
     2021-05-01 11:07:35   relays_2_timer_started 0
     2021-05-01 11:07:35   serial          1
     2021-05-01 11:07:38   state           off
     2021-05-01 11:07:35   temperature     52.47
     2021-05-01 11:07:35   temperature_status Normal
     2021-05-01 11:07:35   time            11:07
     2021-05-01 11:07:35   tmp_is_valid    true
     2021-05-01 11:07:35   tmp_tC          52.47
     2021-05-01 11:07:35   tmp_tF          126.45
     2021-05-01 11:07:35   unixtime        1619860055
     2021-05-01 11:07:35   update          aktuell
     2021-05-01 11:07:35   update_has_update false
     2021-05-01 11:07:35   update_new_version 20210415-130044/v1.10.3-g23074d0
     2021-05-01 11:07:35   update_old_version 20210415-130044/v1.10.3-g23074d0
     2021-05-01 11:07:35   update_status   idle
     2021-05-01 11:07:35   uptime          288123
     2021-05-01 11:07:35   voltage         240.35
     2021-05-01 11:07:35   wifi_sta_connected true
     2021-05-01 11:07:35   wifi_sta_ip     10.100.1.60
     2021-05-01 11:07:35   wifi_sta_rssi   -57
     2021-05-01 11:07:35   wifi_sta_ssid   RAUNETWLANIOT
   helper:
     httpCMND   shelly
Attributes:
   IODev      mqtt
   alias      Wandleuchte Heizung
   appOptions {"template" : "shsw1"}
   cmdIcon    on:general_an@OrangeRed off:general_aus settings:rc_INFO@Darkblue reboot:control_standby@OrangeRed
   devStateIcon on:eigene/sw1_on@orangered
off:eigene/sw1_off@navy
update:refresh@OrangeRed:shelly_update_fw
aktuell:rc_BLANK
true:eigene/lwt_status@lime
false:eigene/lwt_status@red
   devStateStyle style="text-align:right"
   group      3_Beleuchtung
   icon       light_wall_1
   model      SHSW-25
   oldreadings state
   readingList shellies/23_Wandleuchten/relay/1:.* state
  shellies/23_Wandleuchten/relay/1:.* relay_2
  shellies/23_Wandleuchten/input/1:.* motion_2
  shellies/23_Wandleuchten/online:.* online
  shellies/23_Wandleuchten/announce:.* { json2nameValue($EVENT) }
  shellies/23_Wandleuchten/announce:.* { $EVENT =~ m,..new_fw..true, ? json2nameValue('{"update": "refresh" }') : json2nameValue('{"update": "aktuell"}')}
  shellies/announce:.* { $EVENT =~ m,..id...23_Wandleuchten...m.*, ? json2nameValue($EVENT) : return }
  shellies/23_Wandleuchten/info:.* { json2nameValue($EVENT) }
  shellies/23_Wandleuchten/input_event:.* { json2nameValue($EVENT) }
   room       20_KELLER->23_Heizung
   setList    off:noArg shellies/23_Wandleuchten/relay/0/command off
  on:noArg shellies/23_Wandleuchten/relay/0/command on
  toggle:noArg shellies/23_Wandleuchten/relay/0/command 2
  announce:noArg shellies/23_Wandleuchten/command $EVENT
  shelly_update:noArg {return "shellies/".ReadingsVal($NAME,"id",InternalVal($NAME,"CID",""))."/command update"}
  shelly_update_fw:noArg {return "shellies/".ReadingsVal($NAME,"id",InternalVal($NAME,"CID",""))."/command update_fw"}
  shelly_HTTPCommand {shelly_HttpRequest($NAME,ReadingsVal($NAME,"ip",InternalVal($NAME,"CID","")).",".$EVTPART2.",".shelly_ReadLogin($NAME))}
  shelly:noArg {shelly_HttpRequest($NAME,ReadingsVal($NAME,"ip",InternalVal($NAME,"CID","")).",shelly,".shelly_ReadLogin($NAME));}
  shelly_HTTPLoginSet {shelly_SetLogin($NAME,$EVTPART1)}
  shelly_HTTPLoginCheck:noArg {shelly_CheckHTTPLogin($NAME)}
   stateFormat update
state
connection
   userReadings connection
{
if (ReadingsVal($NAME,"online","false") eq "true") {
return "<html><a target='_blank' href='http://".ReadingsVal($NAME,"ip","")."'>".FW_makeImage('eigene/lwt_status@lime')."</a></html>";
}
else {
return "<html>".FW_makeImage('eigene/lwt_status@red')."</html>";
}
}
   webCmd     :


Vielen Dank für Eure Anregungen,

Gernot

P.S.: Die setList Befehle sind in meiner 99_MyShellyUtils.pm definiert

Otto123

Hallo Gernot,

zumindest für das devStateIcon:
ZitatLeerzeichen getrennte Auflistung von regexp:icon-name:cmd Dreierpärchen, icon-name und cmd dürfen leer sein.
Wenn STATE des Gerätes mit der regexp übereinstimmt, wird als icon-name das entsprechende Status Icon angezeigt, und (falls definiert), löst ein Klick auf das Icon das entsprechende cmd aus.
Also als Ansatz:
on:eigene/sw1_on@orangered:off

Gruß Otto
Viele Grüße aus Leipzig  ⇉  nächster Stammtisch an der Lindennaundorfer Mühle
RaspberryPi B B+ B2 B3 B3+ ZeroW,HMLAN,HMUART,Homematic,Fritz!Box 7590,WRT3200ACS-OpenWrt,Sonos,VU+,Arduino nano,ESP8266,MQTT,Zigbee,deconz

supernova1963

#2
Vielen Dank Otto,

klar, funktioniert so auch nicht. Habe ich korrigiert, ist bei dem Kopieren irgendwie verloren gegangen.

Gernot

Korrigiertes List:
Internals:
   CFGFN     
   CID        23_Wandleuchten
   DEF        23_Wandleuchten
   DEVICETOPIC 23_Wandleuchten
   FUUID      608cf89d-f33f-2177-c639-23d1dff012a66cbf
   IODev      mqtt
   LASTInputDev mqtt
   MSGCNT     4606
   NAME       23_Wandleuchten
   NR         121
   STATE      aktuell
off
<html><a target='_blank' href='http://10.100.1.60'><svg class=" eigene/lwt_status lime" data-txt="eigene/lwt_status@lime"    xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"    xmlns:dc="http://purl.org/dc/elements/1.1/"    xmlns:cc="http://creativecommons.org/ns#"    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"    xmlns:svg="http://www.w3.org/2000/svg"    xmlns="http://www.w3.org/2000/svg"    xmlns:xlink="http://www.w3.org/1999/xlink"    xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"    xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"    version="1.0"    width="500.000000pt"    height="1000.000000pt"    viewBox="0 0 500.000000 1000.000000"    preserveAspectRatio="xMidYMid meet"    id="svg68"    sodipodi:docname="lwt_status.svg"    inkscape:version="1.0 (4035a4f, 2020-05-01)">   <defs      id="defs72">     <linearGradient        inkscape:collect="always"        id="linearGradient1727">       <stop          style="stop-color:#000000;stop-opacity:1;"          offset="0"          id="stop1723" />       <stop          style="stop-color:#000000;stop-opacity:0;"          offset="1"          id="stop1725" />     </linearGradient>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1609"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1607"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000050;stroke-width:1pt;stroke-opacity:1;fill:lime;fill-opacity:1"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1551"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1549"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1499"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1497"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1453"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1451"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1413"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1411"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1379"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1377"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1351"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1349"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1329"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1327"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1313"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1311"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="Arrow1Lstart"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1041"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <linearGradient        id="linearGradient1013"        osb:paint="solid">       <stop          style="stop-color:#000050;stop-opacity:1;"          offset="0"          id="stop1011" />     </linearGradient>     <radialGradient        inkscape:collect="always"        xlink:href="#linearGradient1727"        id="radialGradient1729"        cx="247.782"        cy="502.53485"        fx="247.782"        fy="502.53485"        r="262.5"        gradientUnits="userSpaceOnUse"        gradientTransform="matrix(0.92857134,0,0,0.92857153,19.916812,33.360407)" />   </defs>   <sodipodi:namedview      inkscape:document-rotation="0"      pagecolor="#ffffff"      bordercolor="#666666"      borderopacity="1"      objecttolerance="10"      gridtolerance="10"      guidetolerance="10"      inkscape:pageopacity="0"      inkscape:pageshadow="2"      inkscape:window-width="1760"      inkscape:window-height="905"      id="namedview70"      showgrid="false"      inkscape:zoom="0.59175"      inkscape:cx="180.39713"      inkscape:cy="681.8758"      inkscape:window-x="62"      inkscape:window-y="23"      inkscape:window-maximized="0"      inkscape:current-layer="svg68" />   <metadata      id="metadata60"> Created by potrace 1.16, written by Peter Selinger 2001-2019 <rdf:RDF>   <cc:Work      rdf:about="">     <dc:format>image/svg+xml</dc:format>     <dc:type        rdf:resource="http://purl.org/dc/dcmitype/StillImage" />     <dc:title />   </cc:Work> </rdf:RDF> </metadata>   <g      transform="matrix(0.08601534,0,0,-0.0859459,34.95089,929.83984)"      fill="lime"      stroke="none"      id="g66">     <path        d="m 2370,6744 c -265,-29 -455,-81 -639,-174 -525,-263 -872,-739 -962,-1320 -17,-109 -17,-391 0,-500 111,-714 626,-1281 1316,-1448 141,-35 246,-46 415,-46 169,0 274,11 415,46 566,137 1031,555 1228,1103 74,205 101,365 101,595 0,230 -27,390 -101,595 -214,595 -735,1027 -1363,1131 -85,14 -345,26 -410,18 z"        id="path64" />   </g>   <ellipse      style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#radialGradient1729);stroke-width:69.6428;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"      id="path133"      cx="250"      cy="500"      rx="208.92856"      ry="208.92859" /> </svg></a></html>
   TYPE       MQTT2_DEVICE
   mqtt_MSGCNT 4606
   mqtt_TIME  2021-05-01 11:46:39
   OLDREADINGS:
     2021-05-01 10:10:06   state           on
   READINGS:
     2021-05-01 11:46:35   actions_stats_skipped 0
     2021-05-01 11:46:35   cfg_changed_cnt 0
     2021-05-01 11:46:35   cloud_connected false
     2021-05-01 11:46:35   cloud_enabled   false
     2021-05-01 11:46:39   connection      <html><a target='_blank' href='http://10.100.1.60'><svg class=" eigene/lwt_status lime" data-txt="eigene/lwt_status@lime"    xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"    xmlns:dc="http://purl.org/dc/elements/1.1/"    xmlns:cc="http://creativecommons.org/ns#"    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"    xmlns:svg="http://www.w3.org/2000/svg"    xmlns="http://www.w3.org/2000/svg"    xmlns:xlink="http://www.w3.org/1999/xlink"    xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"    xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"    version="1.0"    width="500.000000pt"    height="1000.000000pt"    viewBox="0 0 500.000000 1000.000000"    preserveAspectRatio="xMidYMid meet"    id="svg68"    sodipodi:docname="lwt_status.svg"    inkscape:version="1.0 (4035a4f, 2020-05-01)">   <defs      id="defs72">     <linearGradient        inkscape:collect="always"        id="linearGradient1727">       <stop          style="stop-color:#000000;stop-opacity:1;"          offset="0"          id="stop1723" />       <stop          style="stop-color:#000000;stop-opacity:0;"          offset="1"          id="stop1725" />     </linearGradient>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1609"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1607"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000050;stroke-width:1pt;stroke-opacity:1;fill:lime;fill-opacity:1"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1551"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1549"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1499"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1497"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1453"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1451"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1413"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1411"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1379"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1377"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1351"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1349"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1329"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1327"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="marker1313"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1311"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <marker        inkscape:stockid="Arrow1Lstart"        orient="auto"        refY="0.0"        refX="0.0"        id="Arrow1Lstart"        style="overflow:visible"        inkscape:isstock="true">       <path          id="path1041"          d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "          style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"          transform="scale(0.8) translate(12.5,0)" />     </marker>     <linearGradient        id="linearGradient1013"        osb:paint="solid">       <stop          style="stop-color:#000050;stop-opacity:1;"          offset="0"          id="stop1011" />     </linearGradient>     <radialGradient        inkscape:collect="always"        xlink:href="#linearGradient1727"        id="radialGradient1729"        cx="247.782"        cy="502.53485"        fx="247.782"        fy="502.53485"        r="262.5"        gradientUnits="userSpaceOnUse"        gradientTransform="matrix(0.92857134,0,0,0.92857153,19.916812,33.360407)" />   </defs>   <sodipodi:namedview      inkscape:document-rotation="0"      pagecolor="#ffffff"      bordercolor="#666666"      borderopacity="1"      objecttolerance="10"      gridtolerance="10"      guidetolerance="10"      inkscape:pageopacity="0"      inkscape:pageshadow="2"      inkscape:window-width="1760"      inkscape:window-height="905"      id="namedview70"      showgrid="false"      inkscape:zoom="0.59175"      inkscape:cx="180.39713"      inkscape:cy="681.8758"      inkscape:window-x="62"      inkscape:window-y="23"      inkscape:window-maximized="0"      inkscape:current-layer="svg68" />   <metadata      id="metadata60"> Created by potrace 1.16, written by Peter Selinger 2001-2019 <rdf:RDF>   <cc:Work      rdf:about="">     <dc:format>image/svg+xml</dc:format>     <dc:type        rdf:resource="http://purl.org/dc/dcmitype/StillImage" />     <dc:title />   </cc:Work> </rdf:RDF> </metadata>   <g      transform="matrix(0.08601534,0,0,-0.0859459,34.95089,929.83984)"      fill="lime"      stroke="none"      id="g66">     <path        d="m 2370,6744 c -265,-29 -455,-81 -639,-174 -525,-263 -872,-739 -962,-1320 -17,-109 -17,-391 0,-500 111,-714 626,-1281 1316,-1448 141,-35 246,-46 415,-46 169,0 274,11 415,46 566,137 1031,555 1228,1103 74,205 101,365 101,595 0,230 -27,390 -101,595 -214,595 -735,1027 -1363,1131 -85,14 -345,26 -410,18 z"        id="path64" />   </g>   <ellipse      style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#radialGradient1729);stroke-width:69.6428;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"      id="path133"      cx="250"      cy="500"      rx="208.92856"      ry="208.92859" /> </svg></a></html>
     2021-05-01 11:46:35   fs_free         145078
     2021-05-01 11:46:35   fs_size         233681
     2021-05-01 11:46:35   fw_ver          20210415-130044/v1.10.3-g23074d0
     2021-05-01 11:46:35   has_update      false
     2021-05-01 11:46:35   id              23_Wandleuchten
     2021-05-01 11:46:35   inputs_1_event 
     2021-05-01 11:46:35   inputs_1_event_cnt 0
     2021-05-01 11:46:35   inputs_1_input  0
     2021-05-01 11:46:35   inputs_2_event 
     2021-05-01 11:46:35   inputs_2_event_cnt 0
     2021-05-01 11:46:35   inputs_2_input  1
     2021-05-01 11:46:35   ip              10.100.1.60
     2021-05-01 11:46:35   mac             C82B9610B898
     2021-05-01 11:46:35   meters_1_counters_1 0.000
     2021-05-01 11:46:35   meters_1_counters_2 0.000
     2021-05-01 11:46:35   meters_1_counters_3 0.000
     2021-05-01 11:46:35   meters_1_is_valid true
     2021-05-01 11:46:35   meters_1_overpower 0.00
     2021-05-01 11:46:35   meters_1_power  0.00
     2021-05-01 11:46:35   meters_1_timestamp 1619869595
     2021-05-01 11:46:35   meters_1_total  20
     2021-05-01 11:46:35   meters_2_counters_1 0.000
     2021-05-01 11:46:35   meters_2_counters_2 0.000
     2021-05-01 11:46:35   meters_2_counters_3 0.000
     2021-05-01 11:46:35   meters_2_is_valid true
     2021-05-01 11:46:35   meters_2_overpower 0.00
     2021-05-01 11:46:35   meters_2_power  0.00
     2021-05-01 11:46:35   meters_2_timestamp 1619869595
     2021-05-01 11:46:35   meters_2_total  5012
     2021-05-01 11:46:35   model           SHSW-25
     2021-05-01 11:46:39   motion_2        1
     2021-05-01 11:46:35   mqtt_connected  true
     2021-05-01 11:46:35   new_fw          false
     2021-05-01 11:46:35   online          true
     2021-05-01 11:46:35   overtemperature false
     2021-05-01 11:46:35   ram_free        35768
     2021-05-01 11:46:35   ram_total       49288
     2021-05-01 11:46:39   relay_2         off
     2021-05-01 11:46:35   relays_1_has_timer false
     2021-05-01 11:46:35   relays_1_is_valid true
     2021-05-01 11:46:35   relays_1_ison   false
     2021-05-01 11:46:35   relays_1_overpower false
     2021-05-01 11:46:35   relays_1_overtemperature false
     2021-05-01 11:46:35   relays_1_source mqtt
     2021-05-01 11:46:35   relays_1_timer_duration 0
     2021-05-01 11:46:35   relays_1_timer_remaining 0
     2021-05-01 11:46:35   relays_1_timer_started 0
     2021-05-01 11:46:35   relays_2_has_timer false
     2021-05-01 11:46:35   relays_2_is_valid true
     2021-05-01 11:46:35   relays_2_ison   false
     2021-05-01 11:46:35   relays_2_overpower false
     2021-05-01 11:46:35   relays_2_overtemperature false
     2021-05-01 11:46:35   relays_2_source http
     2021-05-01 11:46:35   relays_2_timer_duration 0
     2021-05-01 11:46:35   relays_2_timer_remaining 0
     2021-05-01 11:46:35   relays_2_timer_started 0
     2021-05-01 11:46:35   serial          1
     2021-05-01 11:46:39   state           off
     2021-05-01 11:46:35   temperature     52.77
     2021-05-01 11:46:35   temperature_status Normal
     2021-05-01 11:46:35   time            11:46
     2021-05-01 11:46:35   tmp_is_valid    true
     2021-05-01 11:46:35   tmp_tC          52.77
     2021-05-01 11:46:35   tmp_tF          126.98
     2021-05-01 11:46:35   unixtime        1619862395
     2021-05-01 11:46:35   update          aktuell
     2021-05-01 11:46:35   update_has_update false
     2021-05-01 11:46:35   update_new_version 20210415-130044/v1.10.3-g23074d0
     2021-05-01 11:46:35   update_old_version 20210415-130044/v1.10.3-g23074d0
     2021-05-01 11:46:35   update_status   idle
     2021-05-01 11:46:35   uptime          290463
     2021-05-01 11:46:35   voltage         239.75
     2021-05-01 11:46:35   wifi_sta_connected true
     2021-05-01 11:46:35   wifi_sta_ip     10.100.1.60
     2021-05-01 11:46:35   wifi_sta_rssi   -62
     2021-05-01 11:46:35   wifi_sta_ssid   RAUNETWLANIOT
   helper:
     httpCMND   shelly
Attributes:
   IODev      mqtt
   alias      Wandleuchte Heizung
   appOptions {"template" : "shsw1"}
   cmdIcon    on:general_an@OrangeRed off:general_aus settings:rc_INFO@Darkblue reboot:control_standby@OrangeRed
   devStateIcon on:eigene/sw1_on@orangered:off
off:eigene/sw1_off@navy:on
update:refresh@OrangeRed:shelly_update_fw
aktuell:rc_BLANK
true:eigene/lwt_status@lime
false:eigene/lwt_status@red
   devStateStyle style="text-align:right"
   group      3_Beleuchtung
   icon       light_wall_1
   model      SHSW-25
   oldreadings state
   readingList shellies/23_Wandleuchten/relay/1:.* state
  shellies/23_Wandleuchten/relay/1:.* relay_2
  shellies/23_Wandleuchten/input/1:.* motion_2
  shellies/23_Wandleuchten/online:.* online
  shellies/23_Wandleuchten/announce:.* { json2nameValue($EVENT) }
  shellies/23_Wandleuchten/announce:.* { $EVENT =~ m,..new_fw...true, ? json2nameValue('{"update": "refresh" }') : json2nameValue('{"update": "aktuell"}')}
  shellies/announce:.* { $EVENT =~ m,..id...23_Wandleuchten...m.*, ? json2nameValue($EVENT) : return }
  shellies/23_Wandleuchten/info:.* { json2nameValue($EVENT) }
  shellies/23_Wandleuchten/input_event:.* { json2nameValue($EVENT) }
   room       20_KELLER->23_Heizung
   setList    off:noArg shellies/23_Wandleuchten/relay/0/command off
  on:noArg shellies/23_Wandleuchten/relay/0/command on
  toggle:noArg shellies/23_Wandleuchten/relay/0/command 2
  announce:noArg shellies/23_Wandleuchten/command $EVENT
  shelly_update:noArg {return "shellies/".ReadingsVal($NAME,"id",InternalVal($NAME,"CID",""))."/command update"}
  shelly_update_fw:noArg {return "shellies/".ReadingsVal($NAME,"id",InternalVal($NAME,"CID",""))."/command update_fw"}
  shelly_HTTPCommand {shelly_HttpRequest($NAME,ReadingsVal($NAME,"ip",InternalVal($NAME,"CID","")).",".$EVTPART2.",".shelly_ReadLogin($NAME))}
  shelly:noArg {shelly_HttpRequest($NAME,ReadingsVal($NAME,"ip",InternalVal($NAME,"CID","")).",shelly,".shelly_ReadLogin($NAME));}
  shelly_HTTPLoginSet {shelly_SetLogin($NAME,$EVTPART1)}
  shelly_HTTPLoginCheck:noArg {shelly_CheckHTTPLogin($NAME)}
   stateFormat update
state
connection
   userReadings connection
{
if (ReadingsVal($NAME,"online","false") eq "true") {
return "<html><a target='_blank' href='http://".ReadingsVal($NAME,"ip","")."'>".FW_makeImage('eigene/lwt_status@lime')."</a></html>";
}
else {
return "<html>".FW_makeImage('eigene/lwt_status@red')."</html>";
}
}
   webCmd     :

Otto123

Deine Antwort versteh ich jetzt irgendwie nicht  :-[
Viele Grüße aus Leipzig  ⇉  nächster Stammtisch an der Lindennaundorfer Mühle
RaspberryPi B B+ B2 B3 B3+ ZeroW,HMLAN,HMUART,Homematic,Fritz!Box 7590,WRT3200ACS-OpenWrt,Sonos,VU+,Arduino nano,ESP8266,MQTT,Zigbee,deconz

supernova1963

 "regexp:icon-name:cmd"

cmd habe ich bei on und off im devStateIcon ergänzt (Das war auch mal so, ist aber bei irgendeiner Aktion von mir herausgeflogen)

Kann man es irgendwie verhindern, das im Internal STATE der Code des svg erscheint?

Danke,

Gernot

Otto123

#5
STATE wird von Deinem Attribute stateFormat bestimmt. Hast Du irgendwie so gesetzt?
Und der HTML Code soll ja dann ein Bild ergeben? Also eigentlich muss der Code der bei Dir in stateFormat steht eher ins devStateIcon
Viele Grüße aus Leipzig  ⇉  nächster Stammtisch an der Lindennaundorfer Mühle
RaspberryPi B B+ B2 B3 B3+ ZeroW,HMLAN,HMUART,Homematic,Fritz!Box 7590,WRT3200ACS-OpenWrt,Sonos,VU+,Arduino nano,ESP8266,MQTT,Zigbee,deconz

supernova1963

Ja, im userreading "connection" mit der Funktion "FW_makeImage('eigene/lwt_status@lime')"


Otto123

stateFormat -> STATE -> devStateIcon

Du solltest nicht alles kompliziert setzen, Du willst ja final devStateIcon.
Also setze über stateFormat die Information die Du brauchst nach STATE und packe den gesamten Code in die Routine für devStateIcon.
Viele Grüße aus Leipzig  ⇉  nächster Stammtisch an der Lindennaundorfer Mühle
RaspberryPi B B+ B2 B3 B3+ ZeroW,HMLAN,HMUART,Homematic,Fritz!Box 7590,WRT3200ACS-OpenWrt,Sonos,VU+,Arduino nano,ESP8266,MQTT,Zigbee,deconz

supernova1963

OK, ist sicher auch eine Möglichkeit den vollständigen Code in defStateIcon Definition zu packen.,
Für mich persönlich ist das kompliziert, da damit Designänderungen bzw. individuelle Darstellungen echt kompliziert werden.

Dennoch, vielen Dank für Deinen Rat, vielleicht muß ich meinen Denkansatz, alle notwendigen Informationen bei der Ereignis Auswertung zu erstellen, doch noch einmal überprüfen.

Gernot

Otto123

Ich glaube es vereinfacht eher.
Ich habe das im sonos2mqtt auch lange im Device herumgetragen. jetzt steht dort ein Aufruf mit {sonos2mqtt($NAME,'Funktion')} und der Code steht in der Utils. Damit musst Du bei Änderungen nur noch die Utils editieren und der Code lässt sich dort besser strukturieren.
Viele Grüße aus Leipzig  ⇉  nächster Stammtisch an der Lindennaundorfer Mühle
RaspberryPi B B+ B2 B3 B3+ ZeroW,HMLAN,HMUART,Homematic,Fritz!Box 7590,WRT3200ACS-OpenWrt,Sonos,VU+,Arduino nano,ESP8266,MQTT,Zigbee,deconz