odinvolk

 
<<< Back

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

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

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

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

<?xml version="1.0" encoding="UTF-8"?>
<svg id="%.object_title%%.linkedRoom%" version="1.1" viewBox="0 0 240 168" width="241" height="169" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs id="defs%.object_id%">
 <symbol id="symbolECO">
  <path id="ecoIMG%.object_id%" d="m31.44 17.98c-2.75 0.232-5.05-0.919-6.34-3.04l0.19 2.3c-7.067 3.541-11.78-0.4465-12.37-5.464-1.31 1.15-3.34 1.9-6.06 2.23 2.936 0.9778 4.663-0.7728 6-1.795l0.923 5.57c-1.822 1.243-3.993 2-6.187 2.192-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 2.034-4.524 6.476-5.609 12.09-4.271l-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-2.492 0.3296-3.722 5.991-0.79 6.47 2.037-0.1877 3.229-5.712 0.79-6.48zm-9.77 1c-2.3 0.193-3.38 2.44-3.24 4.47 0.7499 2.655 2.824 1.896 4.688 0.634-0.3725-1.538-0.3031-3.365 0.3502-4.836-0.6271-0.2724-1.315-0.2426-1.801-0.271zm-14.09 2.066c1.305-1.081 0.415-3.067-1.431-1.968-3.098 2.233-0.248 3.812 1.429 1.965z" stroke-width="0.9" fill="#4d9543"/>
 </symbol>
</defs>
 <rect id='deviceid_%.object_title%' x=".01" y=".01" width="240" height="168" rx="2" ry="2" fill='%.alive|"red;#051f1c"%' onclick="return partLoad(this.href);" fill-opacity='%.status|"1;0.9;"%' stroke="#f00" stroke-linecap="round" stroke-linejoin="round" stroke-width=".1"/>
 <text id="value%.object_id%" x="58" y="82" fill="lime" font-family="FreeSans" font-size="16px" stroke-width="1px" text-anchor="middle">%.value%</text> 
 <text id="relay_status%.object_id%" x="184" y="82" fill="lime" font-family="FreeSans" font-size="16px" stroke-width="1px" text-anchor="middle">%.relay_status|"выкл;вкл"%</text>
 <text id="updatedText%.object_id%" x="120" y="130" fill="lime" font-family="FreeSans" font-size="16px" stroke-width="1px" text-anchor="middle">%.updatedText%</text>
 <text id="object_description%.object_id%" x="120" y="110" fill="lime" font-family="FreeSans" font-size="12px" stroke-width="1px" text-anchor="middle">%.object_description%</text>
 <text id="currentTargetValue%.object_id%" x="116" y="65" fill="#bd0000" font-family="FreeSans" font-size="37px" stroke-width="1px" text-anchor="middle">%.currentTargetValue%</text>
<g id="battModeNormal%.object_id%" onClick='callMethod("%.object_title%.enable"); callMethod("%.object_title%.turnOn");'>
  <title><#LANG_DEVICES_THERMOSTAT_MODE_NORMAL#></title>
 <path id="ac%.object_id%" 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%.object_id%" 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"/>
 <path id="fup%.object_id%" 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"/>
</g>
<g id="battPower%.object_id%" onClick='callMethod("%.object_title%.switchEnable");'>
  <title><#LANG_DEVICES_THERMOSTAT_MODE_OFF#></title>
 <path id="rpower%.object_id%" 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%.object_id%" 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"/>
 <path id="kpower%.object_id%" 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='%.disabled|"#ffcb00;#2091b8;"%' stroke-width="2.5"/>
</g>
<g id="battHistory%.object_id%" onclick="var url=('/pChart/?p[]=%.object_title%'+'.value&p[]=%.object_title%'+'.relay_status&op=log&subop=24h&minimal=1');parent.$.fancybox.open({ src: url, type: 'iframe',iframe:{preload:false} });return false;">
  <title><#LANG_HISTORY#></title>
 <path id="aa%.object_id%" 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%.object_id%" 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"/>
 <path id="kpcart%.object_id%" 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"/>
</g>
<g id="battModEco%.object_id%" onClick='callMethod("%.object_title%.enable"); callMethod("%.object_title%.turnOff");'>
    <title><#LANG_DEVICES_THERMOSTAT_MODE_ECO#></title>
 <path id="d%.object_id%" 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%.object_id%" 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"/>
 <path id="fdown%.object_id%" 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"/>
</g>
<g id="battModEco%.object_id%" onClick='callMethod("%.object_title%.tempUp");'>
  <title>Увеличить целевую температуру</title> 
 <rect id="ae%.object_id%" x="91.2" y=".101" width="57.9" height="32.8" rx="2" ry="2" fill="#2091b8" style="paint-order:normal"/>
 <rect id="fplas%.object_id%" x="94.3" y="3.2" width="51.8" height="26.6" rx="2" ry="2" fill="#051f1c" style="paint-order:normal"/>
 <path id="f%.object_id%" 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"/>
</g>
<g id="battModEco%.object_id%" onClick='callMethod("%.object_title%.tempDown");'>
  <title>Уменьшить целевую температуру</title>
 <rect id="h%.object_id%" x="91.2" y="136" width="57.9" height="32.8" rx="2" ry="2" fill="#2091b8" style="paint-order:normal"/>
 <rect id="fmines%.object_id%" x="94.3" y="139" width="51.8" height="26.6" rx="2" ry="2" fill="#051f1c" style="paint-order:normal"/>
 <path id="x%.object_id%" 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"/>
</g>
 <use id="symboleco%.object_id%" transform="translate(96 70)" width="100%" height="100%" xlink:href="#symbolECO" style='display:%.status|"block;none;"%'/>
</svg>

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

Discuss (0) (6)

See also:
2019-09-15 Шаблон класса / Class Template Димер

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

На форуме: odinvolk