odinvolk

<<< Back

Шаблон класса / Class Template Термостат

Шаблон класса для термостата на svg нарисовано по мотивам форума.
При установке заменяет стандартный шаблон Простых устройств Термостат

Шаблон класса для термостата на svg нарисовано по мотивам форума. Кнопки вверх и вниз пока переключают режимы normal и eco (надо подумать как их лучше использовать), кнопка выкл переключают режимы normal и eco, отображает текущую уставку, текущую температуру, время последней активности, название помещения (.object_description) надо подписать объект или изменить на (%.linkedRoom%) или (%.object_title%), кнопки плюс и минус меняют текущую уставку температуры, шестерёнка выводит диаграмму (только в панеле простых устройств и дашборде)

Код вставить в Панель управления/classes/SDevices/SControllers/SThermostats/Шаблон отображения.
Для изменения размера корректируем (width="241" height="169")

<div align="center">
<svg id="%.object_title%%.linkedRoom%" version="1.1" viewBox="0 0 241 169" width="241" height="169" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
 <rect id="ofon%.linkedRoom%" x=".05" y=".05" width="240" height="168" rx="2" ry="2" 
       fill="#051f1c" onclick="return partLoad(this.href);" fill-opacity='%.status|"1;0.9;"%' stroke="#f00" stroke-linecap="round" stroke-linejoin="round" stroke-width=".1" style="paint-order:normal"/>
 <text id="w%.linkedRoom%" x="150.2" y="82" fill="lime" font-family="'Droid Sans'" font-size="16px" letter-spacing="0px" stroke-width="1px" word-spacing="0px" style="font-variant-caps:normal;font-variant-ligatures:normal;font-variant-numeric:normal;line-height:25px" xml:space="preserve">
  <tspan id="p%.linkedRoom%" x="150.2" y="82">%.updatedText%</tspan></text>
 <path id="ac%.linkedRoom%" d="m2.07 0.101h81c1.11 0 2 0.892 2 2l0.0331 30.9c-24.7-0.031-47 22.7-47 48.2l-36.1-0.034c-1.11-1e-3 -2-0.892-2-2v-77c0-1.11 0.892-2 2-2z" 
       fill="#2091b8" style="paint-order:normal"/>
 <path id="fup%.linkedRoom%" d="m4.77 3.05h74.9c1.02 0 1.85 0.738 1.85 1.65l0.0306 25.5c-23.2 0.548-46.1 23.4-46.4 47.9l-30.4 3e-3c-1.02 1.1e-4 -1.85-0.738-1.85-1.65v-71.8c0-0.917 0.825-1.65 1.85-1.65z" 
       fill="#051f1c" style="paint-order:normal" onclick="ajaxSetGlobal('%.object_title%.status','1');"/>
 <path id="rpower%.linkedRoom%" d="m238 0.101h-81c-1.11 0-2 0.892-2 2l-0.0331 30.9c24.7-0.031 47 22.7 47 48.2l36.1-0.034c1.11-1e-3 2-0.892 2-2v-77c0-1.11-0.892-2-2-2z" 
       fill="#2091b8" style='paint-order:normal'/>
 <path id="fpower%.linkedRoom%" d="m236 3.05h-74.9c-1.02 0-1.85 0.738-1.85 1.65l-0.0306 25.5c23.2 0.548 46.1 23.4 46.4 47.9l30.4 3e-3c1.02 1.1e-4 1.85-0.738 1.85-1.65v-71.8c0-0.917-0.825-1.65-1.85-1.65z" 
       fill="#051f1c" style="paint-order:normal" onClick='callMethod("%.object_title%.switch");return false;'/>
 <path id="aa%.linkedRoom%" d="m238 168h-81c-1.11 0-2-0.892-2-2l-0.0331-30.9c24.7 0.031 47-22.7 47-48.2l36.1 0.034c1.11 1e-3 2 0.892 2 2v77c0 1.11-0.892 2-2 2z" 
       fill="#2091b8" style="paint-order:normal"/>
 <path id="fpcart%.linkedRoom%" d="m236 165h-74.9c-1.02 0-1.85-0.738-1.85-1.65l-0.0306-25.5c23.2-0.548 46.1-23.4 46.4-47.9l30.4-3e-3c1.02-1.1e-4 1.85 0.738 1.85 1.65v71.8c0 0.917-0.825 1.65-1.85 1.65z" 
       fill="#051f1c" style="paint-order:normal" onclick="var url=('/pChart/?p[]=%.object_title%'+'.value&p[]=%.object_title%'+'.relay_status&op=log&subop=24h&minimal=1');$.fancybox.open({ href: url, type: 'iframe' });return false;"/>
 <path id="d%.linkedRoom%" d="m2.02 168h81c1.11 0 2-0.892 2-2l0.0331-30.9c-24.7 0.031-47-22.7-47-48.2l-36.1 0.034c-1.11 1e-3 -2 0.892-2 2v77c0 1.11 0.892 2 2 2z" 
       fill="#2091b8" style="paint-order:normal"/>
 <path id="fdown%.linkedRoom%" d="m4.72 165h74.9c1.02 0 1.85-0.738 1.85-1.65l0.0306-25.5c-23.2-0.548-46.1-23.4-46.4-47.9l-30.4-3e-3c-1.02-1.1e-4 -1.85 0.738-1.85 1.65v71.8c0 0.917 0.825 1.65 1.85 1.65z" 
       fill="#051f1c" style="paint-order:normal" onclick="ajaxSetGlobal('%.object_title%.status','0');"/>
 <rect id="ae%.linkedRoom%" x="91.2" y=".101" width="57.9" height="32.8" rx="2" ry="2" fill="#2091b8" style="paint-order:normal"/>
 <rect id="fplas%.linkedRoom%" x="94.3" y="3.2" width="51.8" height="26.6" rx="2" ry="2" 
       fill="#051f1c" style="paint-order:normal" onClick='callMethod("%.object_title%.tempUp");return false;'/>
 <rect id="h%.linkedRoom%" x="91.2" y="136" width="57.9" height="32.8" rx="2" ry="2" fill="#2091b8" style="paint-order:normal"/>
 <rect id="fmines%.linkedRoom%" x="94.3" y="139" width="51.8" height="26.6" rx="2" ry="2" 
       fill="#051f1c" style="paint-order:normal" onClick='callMethod("%.object_title%.tempDown");return false;'/>
 <path id="fup%.linkedRoom%" d="m13.5 36.5 15-14.4c0.477-0.339 1.07-0.417 1.54 9e-3l14.9 14.3c0.434 0.432 0.381 0.995 4e-3 1.34l-2.54 2.3c-0.49 0.418-1.12 0.307-1.46-0.0215l-9.47-9.08c-1.53-1.39-3.14-1.25-4.5 0.079l-9.42 9.04c-0.483 0.44-1.12 0.338-1.46 0.0215l-2.51-2.28c-0.384-0.338-0.44-0.939-0.02-1.36zm-2.71 1.65c-0.811-0.787-0.799-1.97 6e-3 -2.73l16.9-15.9c0.656-0.655 2.01-0.851 2.91-1e-3l16.9 15.9c0.802 0.775 0.83 1.93 5e-3 2.74l-4.84 4.56c-0.897 0.773-2.06 0.756-2.91 3e-3l-10-9.51c-0.317-0.324-0.693-0.324-1.13 0l-10.1 9.51c-0.82 0.754-2.13 0.751-2.91-2e-3z" 
       fill='%.status|"#2091b8;#ffcb00;"%' fill-rule="evenodd"/>
 <path id="fdown%.linkedRoom%" d="m10.8 132 15 14.4c0.477 0.339 1.07 0.417 1.54-9e-3l14.9-14.3c0.434-0.432 0.381-0.995 4e-3 -1.34l-2.54-2.3c-0.49-0.418-1.12-0.307-1.46 0.0215l-9.47 9.08c-1.53 1.39-3.14 1.25-4.5-0.079l-9.42-9.04c-0.483-0.44-1.12-0.338-1.46-0.0215l-2.51 2.28c-0.384 0.338-0.44 0.939-0.02 1.36zm-2.71-1.65c-0.811 0.787-0.799 1.97 6e-3 2.73l16.9 15.9c0.656 0.655 2.01 0.851 2.91 1e-3l16.9-15.9c0.802-0.775 0.83-1.93 5e-3 -2.74l-4.84-4.56c-0.897-0.773-2.06-0.756-2.91-3e-3l-10 9.51c-0.317 0.324-0.693 0.324-1.13 0l-10.1-9.51c-0.82-0.754-2.13-0.751-2.91 2e-3z" 
       fill='%.status|"#ffcb00;#2091b8;"%' fill-rule="evenodd"/>
 <path id="x%.linkedRoom%" d="m111 150h18c0.277 0 0.5 0.223 0.5 0.5v3c0 0.277-0.223 0.5-0.5 0.5h-18c-0.277 0-0.5-0.223-0.5-0.5v-3c0-0.277 0.223-0.5 0.5-0.5zm-2-2h22c0.277 0 0.5 0.223 0.5 0.5v7c0 0.277-0.223 0.5-0.5 0.5h-22c-0.277 0-0.5-0.223-0.5-0.5v-7c0-0.277 0.223-0.5 0.5-0.5z" 
       fill="#2091b8" fill-rule="evenodd" style="paint-order:normal"/>
 <path id="f%.linkedRoom%" d="m111 15c0.0418-0.283 0.172-0.483 0.5-0.5h7v-7c0.0298-0.314 0.204-0.473 0.5-0.5h3c0.334 5e-3 0.497 0.266 0.5 0.5v7h7c0.333 0.058 0.5 0.225 0.5 0.5v3c-0.0177 0.333-0.222 0.458-0.5 0.5h-7v7c-0.0161 0.355-0.241 0.449-0.5 0.5h-3c-0.298-0.0508-0.495-0.191-0.5-0.5v-7h-7c-0.25-0.0291-0.457-0.129-0.5-0.5zm-2-2c0.0294-0.299 0.188-0.473 0.5-0.5h7v-7c0.0494-0.318 0.21-0.493 0.5-0.5h7c0.232 0.0192 0.435 0.104 0.5 0.5v7h7c0.294 0.0242 0.467 0.183 0.5 0.5v7c-8e-3 0.323-0.214 0.45-0.5 0.5h-7v7c-0.0254 0.287-0.176 0.468-0.5 0.5h-7c-0.292-9e-3 -0.452-0.184-0.5-0.5v-7h-7c-0.31-0.0333-0.477-0.2-0.5-0.5z" 
       fill="#2091b8" fill-rule="evenodd"/>
 <path id="kpower%.linkedRoom%" d="m209 12.5c-1.15 0.125-2.01 1.05-2 2.15v15.7c-0.0441 0.794 0.375 1.55 1.09 1.96 0.717 0.407 1.61 0.407 2.33 0 0.728-0.418 1.15-1.17 1.09-1.96v-15.7c0.0111-0.616-0.265-1.2-0.739-1.61-0.486-0.418-1.13-0.616-1.78-0.543zm6.96 5.02c-0.971 0.115-1.77 0.814-1.94 1.73-0.188 0.919 0.287 1.84 1.16 2.29 0.607 0.376 1.18 0.825 1.72 1.34 4.3 4.07 4.3 10.7 0 14.7-4.31 4.08-11.3 4.08-15.6 0-4.3-4.08-4.3-10.7 0-14.7 0.541-0.512 1.11-0.961 1.73-1.34 0.861-0.522 1.25-1.51 0.949-2.44-0.298-0.919-1.21-1.53-2.23-1.5-0.43 9e-3 -0.85 0.146-1.2 0.386-0.861 0.543-1.67 1.15-2.42 1.86-6.04 5.71-6.04 15 0 20.8 6.04 5.71 15.9 5.71 22 0 6.05-5.72 6.05-15 0-20.8-0.75-0.71-1.58-1.32-2.44-1.86-0.486-0.365-1.09-0.522-1.7-0.459z" 
       fill="none" stroke='%.relay_status|"#2091b8;#ffcb00;"%' stroke-width="2.5"/>
 <a id="ad%.linkedRoom%" image-rendering="optimizeSpeed" onclick="6" 
    target="2" xlink:actuate="8" xlink:arcrole="5" xlink:href="1" xlink:role="4" xlink:show="7" xlink:title="История" xlink:type="3">
   <path id="kpcart%.linkedRoom%" d="m207 125-1.21 2.16-3.18 0.36-2.21-1.49-2.62 1.03 0.286 2.43-1.93 1.4-3.69-0.487-1.79 2.03 0.866 3.32 0.839 0.886l-4.32 1.3-0.17 2.77 1.09 3.51 4.37-0.302 0.116 0.0877-2.73 2.95 0.946 3.5s1.54 1.47 1.87 1.74c0.321 0.263 0.768 0.487 1.09 0.273 0.321-0.224 3.94-2.62 3.94-2.62l3.23 1.19v1.28l0.563 3.59 4.32 0.0877 1.54-4.65 3.91-0.915 3.57 3.32 3.18-2.03 0.357-3.53-1.08-2.06 0.857-1.07 4.61 0.643 0.75-2.8 0.509-3.44-3.49-1.52 2.09-0.944 0.509-3.25-1.18-2.29-4.13 0.0976-0.723-0.974 0.25-2.86-2.4-1.16-2.54 1.46-3.19-0.847-0.384-1.89zm0.277 7.24c5.08-0.0585 9.24 2.71 9.51 6.5 0.01 0.0586 0 0.127 0 0.185-1.42 2.95-5.1 5.25-9.54 5.63-4.71 0.399-8.87-1.5-10.5-4.47 0-3.89 4.15-7.37 9.51-7.82 0.348-0.029 0.696-0.029 1.04-0.029zm-0.143-3.14c-0.357 0-0.714 0.029-1.09 0.0585-5.92 0.487-10.5 4.27-10.2 8.49 0.125 1.72 1.06 3.24 2.51 4.41-0.679-0.584-1.24-1.25-1.64-1.98 0-3.89 4.15-7.37 9.51-7.82 0.348-0.029 0.696-0.029 1.04-0.029 5.05-0.0586 9.2 2.68 9.51 6.45 0.402-0.886 0.607-1.83 0.536-2.79-0.295-3.95-4.75-6.84-10.2-6.79z" 
       fill="#2091b8" title="Edit" onclick="var url=('/pChart/?p[]=%.object_title%'+'.value&p[]=%.object_title%'+'.relay_status&op=log&subop=24h&minimal=1');$.fancybox.open({ href: url, type: 'iframe' });return false;"/>
</a> 
 <text id="v%.linkedRoom%" x="47" y="82" fill="lime" font-family="'Droid Sans'" font-size="18.7px" letter-spacing="0px" stroke-width="1px" word-spacing="0px" style="font-variant-caps:normal;font-variant-ligatures:normal;font-variant-numeric:normal" xml:space="preserve">
  <tspan id="o%.linkedRoom%" x="47" y="82">%.value%</tspan></text>
 <text id="i%.linkedRoom%" x="85" y="130" fill="lime" font-family="'Droid Sans'" font-size="16px" letter-spacing="0px" stroke-width="1px" word-spacing="0px" style="font-variant-caps:normal;font-variant-ligatures:normal;font-variant-numeric:normal;line-height:25px" xml:space="preserve">
  <tspan id="k%.linkedRoom%" x="85" y="130">%.object_description%</tspan></text>
 <text id="ba%.linkedRoom%" x="95.2" y="66.8" fill="#bd0000" font-family="'DejaVu Sans'" font-size="37.3px" letter-spacing="0px" stroke-width=".265px" word-spacing="0px" style="font-variant-caps:normal;font-variant-ligatures:normal;font-variant-numeric:normal;line-height:24.99601364px" xml:space="preserve">
  <tspan id="af%.linkedRoom%" x="95.1" y="66.1" stroke-width=".265px">%.currentTargetValue%</tspan></text>
<path id="eco%.linkedRoom%" d="m84.7 63.4c-2.75 0.232-5.05-0.919-6.34-3.04l0.19 2.3-0.611 0.38c-1.06 0.662-2.64 1.13-4.32 1.26-4.12 0.347-7.1-2.3-7.41-6.6-0.0142-0.166-0.0204-0.335-0.0258-0.504-1.31 1.15-3.34 1.9-6.06 2.23 0.439 0.193 0.977 0.19 1.32 0.163 1.22-0.102 2.29-0.459 3.29-1.09l1.39-0.868 0.923 5.57-0.647 0.422c-2.07 1.36-4.56 1.69-5.54 1.77-4.4 0.37-7.23-2.17-7.57-6.79-0.373-5.06 2.65-10.6 8.35-11.1 2.95-0.248 5.26 1.2 6.02 3.7 1.65-2.79 4.51-4.58 7.83-4.86 1.59-0.135 2.79 0.153 3.22 0.282l1.04 0.307-0.494 2.2c1.55-2.12 3.86-3.46 6.52-3.68 4.08-0.341 7.14 2.39 7.45 6.65 0.445 6.06-3.14 10.8-8.53 11.3zm0.968-12.2c-1.45 0.121-2.17 2.98-2.02 4.91 0.0799 1.1 0.495 1.63 1.23 1.56 1.12-0.0938 2.13-2.64 1.96-4.97-0.079-1.06-0.471-1.57-1.17-1.51zm-9.77 1c-2.3 0.193-3.38 2.44-3.24 4.47 0.087 1.18 0.698 1.79 1.72 1.71 1.02-0.0852 1.7-0.409 2.27-0.707l0.698-0.369c-0.0284-0.208-0.0506-0.406-0.0648-0.596-0.107-1.48 0.0302-2.9 0.415-4.24l-0.351-0.121c-0.297-0.1-0.727-0.21-1.45-0.15zm-16.1 0.751c-0.451 0.381-0.283 1.55 8e-3 1.88 0.554 0.089 1.06 0.229 2-0.565 0.306-0.147 0.848-2.24 0.286-2.16-0.441-0.0786-1.15 0.0256-1.4 0.279z" 
       fill="#4d9543" style='display:%.status|"block;none;"%' stroke-width=".999"/>
</svg></div>

дальше вставляем в меню или на сцену в виде (object) Связанный объект (Thermostat01...00)

Discuss (0) (4)

Санкт-Петербург, Россия

На форуме: odinvolk