Advertisement
Guest User

98_ModubusDHW300

a guest
May 29th, 2020
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.04 KB | None | 0 0
  1. ##################################################################
  2. #
  3. # $Id: 98_ModbusDHW300.pm 15385 2020-05-07 11:11:11Z Olu $
  4. #
  5. # Fhem Modul für die Abfrage/Steuerung von Warmwasser-Wärmepumpen Baureihe DHW 300.
  6. # Verwendet Modbus.pm als Basismodul für die eigentliche Implementation des Protokolls.
  7. #
  8. # Siehe 98_ModbusAttr.pm für ausführlichere Infos zur Verwendung des Moduls 98_Modbus.pm
  9. #
  10. ##################################################################
  11. #
  12. # This file is part of fhem.
  13. #
  14. # Fhem is free software: you can redistribute it and/or modify
  15. # it under the terms of the GNU General Public License as published by
  16. # the Free Software Foundation, either version 2 of the License, or
  17. # (at your option) any later version.
  18. #
  19. # Fhem is distributed in the hope that it will be useful,
  20. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. # GNU General Public License for more details.
  23. #
  24. # You should have received a copy of the GNU General Public License
  25. # along with fhem. If not, see <http://www.gnu.org/licenses/>.
  26. #
  27. ##############################################################################
  28. # Changelog
  29. # 2020-05-07 initial release, forked from 98_ModbusDHW300
  30. #
  31. ##############################################################################
  32.  
  33. package main;
  34. use strict;
  35. use warnings;
  36. sub ModbusDHW300_Initialize($);
  37.  
  38. my %DHW300ParseInfo = (
  39. # Warmwasser
  40. 'h14' => { reading => 'WW_Solltemperatur_C',
  41. name => 'Solltemperatur',
  42. # hint => '25...85',
  43. min => 25,
  44. max => 85,
  45. },
  46. 'h15' => { reading => 'WW_Absenktemperatur_C',
  47. name => 'Absenktemperatur',
  48. # hint => '15...40',
  49. min => 15,
  50. max => 40,
  51. },
  52. 'h16' => { reading => 'WW_Hysterese_K',
  53. name => 'Hysterese',
  54. # hint => '2...10',
  55. min => 2,
  56. max => 10,
  57. },
  58. 'h17' => { reading => 'WW_Modus',
  59. name => 'Modus',
  60. map => '0:ECO, 1:AUTO',
  61. },
  62. 'h18' => { reading => 'WW_Verzoegerung_h',
  63. name => 'Verzoegerung',
  64. # hint => '2...16',
  65. min => 2,
  66. max => 16,
  67. },
  68. 'h19' => { reading => 'WW_Boost_Dauer_h',
  69. name => 'Boost_Dauer',
  70. # hint => '1...8',
  71. min => 1,
  72. max => 8,
  73. },
  74. 'h20' => { reading => 'WW_Boost_Solltemp_C',
  75. name => 'Boost_Solltemp',
  76. # hint => '25...85',
  77. min => 25,
  78. max => 85,
  79. },
  80. # Betriebsstatus
  81. 'i8' => { reading => 'Speichertemperatur_oben_C',
  82. name => 'Speichertemperatur_oben',
  83. },
  84. 'i9' => { reading => 'Speichertemperatur_unten_C',
  85. name => 'Speichertemperatur_unten',
  86. },
  87. 'i10' => { reading => 'Lufteintritt_C',
  88. name => 'Lufteintritt',
  89. },
  90. 'i11' => { reading => 'Kollektrortemperatur_C',
  91. name => 'Kollektrortemperatur',
  92. },
  93. 'i12' => { reading => 'Sollwert_aktuell_C',
  94. name => 'Sollwert_aktuell',
  95. },
  96. 'i13' => { reading => 'Abtaufuehler_C',
  97. name => 'Abtaufuehler',
  98. },
  99. 'i14' => { reading => 'Ventilator',
  100. name => 'Ventilator',
  101. map => '0:AUS, 1:EIN',
  102. },
  103. 'i15' => { reading => 'Verdichter',
  104. name => 'Verdichter',
  105. map => '0:AUS, 1:EIN',
  106. },
  107. 'i16' => { reading => 'Elektroheizung',
  108. name => 'Elektroheizung',
  109. map => '0:AUS, 1:EIN',
  110. },
  111. 'i17' => { reading => 'Solar-/Ladepumpe',
  112. name => 'Solar-/Ladepumpe',
  113. map => '0:AUS, 1:EIN',
  114. },
  115. 'i18' => { reading => 'Leistung_W',
  116. name => 'Leistung',
  117. },
  118. 'i19' => { reading => 'Betriebsart',
  119. name => 'Betriebsart_Statuswert',
  120. map => '0:AUS, 1:EIN, 2:Abtauen, 3:Thermische_Desinfektion, 4:Elektroheizung, 5:Waermerzeuger2, 6:Lueftung, 7:Sensor_Fehler, 8:Idle, 9:Meldungen, 10:Frostschutz',
  121. },
  122. 'i20' => { reading => 'Meldungen',
  123. name => 'Meldungen_Stoerwert',
  124. map => '0:keine_Meldung, 1:Hochdruckpressostat, 2:Einsatzgrenze_oben_ueberschritten, 3:Einsatzgrenze_unten_ueberschritten, 4:Fuehlerfehler_R3, 5:Fuehlerfehler_R5, 6:Fuehlerfehler_R10, 7:Fuehlerfehler_R13',
  125. },
  126. # Laufzeiten
  127. 'i21' => { reading => 'Laufzeit_Geraet_h',
  128. name => 'Laufzeit_Geraet',
  129. },
  130. 'i22' => { reading => 'Laufzeit_Ventilator_h',
  131. name => 'Laufzeit_Ventilator',
  132. },
  133. 'i23' => { reading => 'Laufzeit_Verdichter_h',
  134. name => 'Laufzeit_Verdichter',
  135. },
  136. 'i24' => { reading => 'Laufzeit_Elektroheizung_h',
  137. name => 'Laufzeit_Elektroheizung',
  138. },
  139. );
  140.  
  141. my %DHW300DeviceInfo = (
  142. "timing" => {
  143. timeout => 3, # value seconds timeout when waiting for a response
  144. commDelay => 1, # value seconds minimal delay between two communications e.g. a read a the next write,
  145. # can be overwritten with attribute commDelay if added to AttrList in _Initialize below
  146. sendDelay => 1, # value seconds minimal delay between two sends, can be overwritten with the attribute
  147. # sendDelay if added to AttrList in _Initialize function below
  148. },
  149. "i" => { # details for "input registers" if the device offers them
  150. read => 4, # use function code 4 to read discrete inputs. They can not be written by definition.
  151. defLen => 1, # default length (number of registers) per value ((e.g. 2 for a float of 4 bytes that spans 2 registers)
  152. # can be overwritten in parseInfo per reading by specifying the key "len"
  153. # combine => 10, # allow combined read of up to 10 adjacent registers during getUpdate
  154. combine => 1, # no combined read (read more than one registers with one read command) during getUpdate
  155. # defFormat => "%.1f", # default format string to use after reading a value in sprintf
  156. # can be overwritten in parseInfo per reading by specifying the key "format"
  157. defUnpack => "s>", # default pack / unpack code to convert raw values, e.g. "n" for a 16 bit integer oder
  158. # "f>" for a big endian float IEEE 754 floating-point numbers
  159. # can be overwritten in parseInfo per reading by specifying the key "unpack"
  160. defPoll => 1, # All defined Input Registers should be polled by default unless specified otherwise in parseInfo or by attributes
  161. defShowGet => 1, # default für showget Key in parseInfo
  162. },
  163. "h" => { # details for "holding registers" if the device offers them
  164. read => 3, # use function code 3 to read holding registers.
  165. write => 6, # use function code 6 to write holding registers (alternative could be 16)
  166. defLen => 1, # default length (number of registers) per value (e.g. 2 for a float of 4 bytes that spans 2 registers)
  167. # can be overwritten in parseInfo per reading by specifying the key "len"
  168. combine => 1, # allow combined read of up to 10 adjacent registers during getUpdate
  169. # defFormat => "%.1f", # default format string to use after reading a value in sprintf
  170. defUnpack => "s>", # default pack / unpack code to convert raw values, e.g. "n" for a 16 bit integer oder
  171. # "f>" for a big endian float IEEE 754 floating-point numbers
  172. # can be overwritten in parseInfo per reading by specifying the key "unpack"
  173. defPoll => 1, # All defined Input Registers should be polled by default unless specified otherwise in parseInfo or by attributes
  174. defShowGet => 1, # default für showget Key in parseInfo
  175. defSet => 1
  176. },
  177. );
  178.  
  179.  
  180.  
  181. #####################################
  182. sub ModbusDHW300_Initialize($) {
  183. my ($hash) = @_;
  184.  
  185. require "$attr{global}{modpath}/FHEM/98_Modbus.pm";
  186. $hash->{parseInfo} = \%DHW300ParseInfo; # defines registers, inputs, coils etc. for this Modbus Device
  187. $hash->{deviceInfo} = \%DHW300DeviceInfo; # defines properties of the device like defaults and supported function codes
  188.  
  189. ModbusLD_Initialize($hash); # Generic function of the Modbus module does the rest
  190.  
  191. $hash->{AttrList} .= ' '.$hash->{ObjAttrList}.' '.$hash->{DevAttrList}.' poll-.* polldelay-.*';
  192. }
  193.  
  194. 1;
  195.  
  196. =pod
  197. =item summary Module to work with hot water heat pump of type DHW300
  198. =item summary_DE Modul für Warmwasser-Wärmepumpen der Baureihe DHW300.
  199. =begin html
  200.  
  201. <a name="ModbusDHW300"></a>
  202. <h3>ModbusDHW300</h3>
  203. <ul>
  204. ModbusDHW300 uses the low level Modbus module to provide a way to communicate with the hot water heat pump of type DHW3000.
  205. It defines the modbus registers for different values and reads them in a defined interval.
  206. <br /><br />
  207.  
  208. <b>Prerequisites</b>
  209. <ul>
  210. <b>to be done</b>
  211. </ul><br />
  212.  
  213. <b>Hardware Connection</b>
  214. <ul>
  215. <b>to be done</b>
  216. </ul><br />
  217.  
  218. <b>Special meanings with Readings and the Heating Management System</b>
  219. <ul>
  220. <b>to be done</b>
  221. </ul><br />
  222.  
  223. <a name="ModbusDHW300Define"></a>
  224. <b>Define</b>
  225. <ul>
  226. <code>define &lt;name&gt; ModbusDHW300 &lt;ID&gt; &lt;Interval&gt;</code><br /><br />
  227. The module connects to the DHW300 with the Modbus Id &lt;ID&gt; through an already defined Modbus device and actively requests data from the system every &lt;Interval&gt; seconds.<br /><br />
  228. Example:<br>
  229. <code>define DHW300 ModbusDHW300 2 60</code>
  230. </ul><br />
  231.  
  232. <a name="ModbusDHW300Set"></a>
  233. <b>Set-Commands</b>
  234. <ul>
  235. The following set options are available:
  236. <ul>
  237. <b>to be done</b>
  238. </ul><br />
  239. All other Readings (along with their Meanings) which can only be read:<br />
  240. <ul>
  241. <b>to be done</b>
  242. </ul>
  243. </ul><br />
  244.  
  245. <a name="ModbusDHW300Get"></a>
  246. <b>Get-Commands</b>
  247. <ul>
  248. All readings are also available as Get commands. Internally a Get command triggers the corresponding request to the device and then interprets the data and returns the correct field value. This is a good way for getting a new current value from the Heating Management System.
  249. </ul><br />
  250.  
  251. <a name="ModbusDHW300attr"></a>
  252. <b>Attribute</b>
  253. <ul>
  254. Only centralized Attributes are in use. Especially:
  255. <ul>
  256. <li><a href="#readingFnAttributes">readingFnAttributes</a></li>
  257. </ul>
  258. </ul><br />
  259. </ul>
  260.  
  261. =end html
  262.  
  263. =begin html_DE
  264.  
  265. <a name="ModbusDHW300"></a>
  266. <h3>ModbusDHW300</h3>
  267. <ul>
  268. ModbusDHW300 verwendet das Modul Modbus für die Kommunikation mit der Dimplex Warmwasser-Wärmepumpe DHW300.
  269. Hier wurden die wichtigsten Werte definiert und werden im angegebenen Intervall abgefragt und aktualisiert.
  270. <br /><br />
  271.  
  272. <b>Vorraussetzungen</b>
  273. <ul>
  274. Dieses Modul benötigt das Basismodul <a href="#Modbus">Modbus</a> für die Kommunikation, welches wiederum das Perl-Modul Device::SerialPort oder Win32::SerialPort benötigt.
  275. </ul><br />
  276.  
  277. <b>Physikalische Verbindung zur Heizungssteuerung</b>
  278. <ul>
  279. machen wir noch
  280. </ul><br />
  281.  
  282. <b>Besonderheiten der Readings und des Reglers</b>
  283. <ul>
  284. machen wir noch
  285. </ul><br />
  286.  
  287. <a name="ModbusDHW300Define"></a>
  288. <b>Define</b>
  289. <ul>
  290. <code>define &lt;name&gt; ModbusDHW300 &lt;ID&gt; &lt;Interval&gt;</code><br /><br />
  291. Das Modul verbindet sich zur DHW300 Warmwasser-Wärmepumpe mit der angegebenen Modbus Id &lt;ID&gt; über ein bereits fertig definiertes Modbus-Device und fragt die gewünschten Werte im Abstand von &lt;Interval&gt; Sekunden ab.<br /><br />
  292. Beispiel:<br>
  293. <code>define DHW300 ModbusDHW300 2 60</code>
  294. </ul><br />
  295.  
  296. <a name="ModbusDHW300Set"></a>
  297. <b>Set-Kommandos</b>
  298. <ul>
  299. Die folgenden Werte können gesetzt werden:
  300. <ul>
  301. machen wir noch
  302. </ul><br />
  303.  
  304. <a name="ModbusDHW300Get"></a>
  305. <b>Get-Kommandos</b>
  306. <ul>
  307. Alle Readings sind auch als get-Kommando verfügbar. Intern führt ein get einen Request an die Steuerung aus, und aktualisiert den entsprechenden Readings-Wert (und gibt ihn als Ergebnis des Aufrufs zurück). Damit kann man eine zusätzliche Aktualisierung des Wertes erzwingen.
  308. </ul><br />
  309.  
  310. <a name="ModbusDHW300attr"></a>
  311. <b>Attribute</b>
  312. <ul>
  313. Nur zentral definierte Attribute werden untstützt. Im speziellen:
  314. <ul>
  315. <li><a href="#readingFnAttributes">readingFnAttributes</a></li>
  316. </ul>
  317. </ul><br />
  318. </ul>
  319.  
  320. =end html_DE
  321. =cut
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement