52_I2C_HDC1008.pm 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693
  1. # Modul für I2C Temperatur- und Feuchtigkeitssensor HDC1008
  2. # Autor : Karsten Grüttner (schlawiano) bis 2016, Änderungen ab 2018: Gernot Hillier (yoda_gh)
  3. # $Id: 52_I2C_HDC1008.pm 16756 2018-05-18 19:15:41Z yoda_gh $
  4. # Technische Dokumention für den Sensor befindet sich http://www.ti.com/lit/ds/symlink/hdc1008.pdf
  5. package main;
  6. use strict;
  7. use warnings;
  8. # Konfigurationsparameter Temperatur, Lesedauer in Microsekunden und Konfigurationscode als Word (Bit 10)
  9. my %I2C_HDC1008_tempParams =
  10. (
  11. '11Bit' => {delay => 3650, code => 1 << 10 },
  12. '14Bit' => {delay => 6350, code => 0 }
  13. );
  14. # Konfigurationsparameter Feuchtigkeit, Lesedauer in Microsekunden und Konfigurationscode als Word (Bit 9:8)
  15. my %I2C_HDC1008_humParams = #
  16. (
  17. '8Bit' => {delay => 2500, code => 1 << 9 },
  18. '11Bit' => {delay => 3850, code => 1 << 8 } ,
  19. '14Bit' => {delay => 6500, code => 0 }
  20. );
  21. # Konfigurationsparameter Heizelement, Konfigurationscode als Word (Bit 13 )
  22. my %I2C_HDC1008_validsHeater =
  23. (
  24. 'off' => 0, # 0
  25. 'on' => 1 << 13 # 1
  26. );
  27. sub I2C_HDC1008_Initialize($) {
  28. my ($hash) = @_;
  29. $hash->{DefFn} = 'I2C_HDC1008_Define';
  30. $hash->{UndefFn} = 'I2C_HDC1008_Undef';
  31. $hash->{SetFn} = 'I2C_HDC1008_Set';
  32. $hash->{AttrFn} = 'I2C_HDC1008_Attr';
  33. $hash->{ReadFn} = 'I2C_HDC1008_Read';
  34. $hash->{I2CRecFn} = 'I2C_HDC1008_I2CRec';
  35. $hash->{AttrList} =
  36. "interval ".
  37. "IODev ".
  38. "Resolution_Temperature:11Bit,14Bit ". # als Dropdown
  39. "Resolution_Humidity:8Bit,11Bit,14Bit ". # als Dropdown
  40. "roundTemperatureDecimal ".
  41. "roundHumidityDecimal ".
  42. $readingFnAttributes;
  43. }
  44. sub I2C_HDC1008_Define($$) {
  45. my ($hash, $def) = @_;
  46. my @a = split('[ \t][ \t]*', $def);
  47. $hash->{MODUL_STATE} = "defined";
  48. $hash->{RESOLUTION_TEMPERATURE} = '14Bit';
  49. $hash->{RESOLUTION_HUMIDITY} = '14Bit';
  50. $hash->{HEATER} = 'off';
  51. $hash->{INTERVAL} = 0;
  52. $hash->{DEVICE_STATE} = 'UNKNOWN';
  53. if ($main::init_done) {
  54. eval { I2C_HDC1008_Init( $hash, [ @a[ 2 .. scalar(@a) - 1 ] ] ); };
  55. return I2C_HDC1008_Catch($@) if $@;
  56. }
  57. else
  58. {
  59. Log3 $hash, 5, "[$hash->{NAME}] I2C_HDC1008_Define main::init_done was false";
  60. }
  61. return undef;
  62. }
  63. sub I2C_HDC1008_Init($$) {
  64. my ( $hash, $args ) = @_;
  65. my $name = $hash->{NAME};
  66. if (defined $args && int(@$args) > 1)
  67. {
  68. return "Define: Wrong syntax. Usage:\n" .
  69. "define <name> I2C_HDC1008 [<i2caddress>]";
  70. }
  71. if (defined (my $address = shift @$args))
  72. {
  73. $address = $address =~ /^0.*$/ ? oct($address) : $address;
  74. if ($address < 64 && $address > 67) # nur 0x40 bis 0x43 erlaubt
  75. {
  76. Log3 $hash, 5, "[$name] I2C Address not valid for HDC1008";
  77. return "$name I2C Address not valid for HDC1008";
  78. }
  79. else
  80. {
  81. $hash->{I2C_Address} = $address;
  82. }
  83. }
  84. else
  85. {
  86. $hash->{I2C_Address} = oct('0x40');
  87. Log3 $name, 5, "[$name] I2C_HDC1008_Init default-I2C-addresse 0x40 used";
  88. }
  89. my $msg = '';
  90. $msg = CommandAttr(undef, $name . ' interval 5');
  91. if ($msg) {
  92. Log3 $hash, 5, "[$name] I2C_HDC1008_Init interval:".$msg;
  93. return $msg;
  94. }
  95. AssignIoPort($hash);
  96. if (defined AttrVal($hash->{NAME}, "IODev", undef))
  97. {
  98. $hash->{MODUL_STATE} = 'Initialized';
  99. $hash->{DEVICE_STATE} = 'READY';
  100. }
  101. else
  102. {
  103. $hash->{MODUL_STATE} = "Error: Missing Attr 'IODev'";
  104. }
  105. return undef;
  106. }
  107. sub I2C_HDC1008_Catch($) {
  108. my $exception = shift;
  109. if ($exception) {
  110. $exception =~ /^(.*)( at.*FHEM.*)$/;
  111. return $1;
  112. }
  113. return undef;
  114. }
  115. sub I2C_HDC1008_I2CRec ($$) {
  116. my ($hash, $clientmsg) = @_;
  117. my $name = $hash->{NAME};
  118. my $phash = $hash->{IODev};
  119. my $pname = $phash->{NAME};
  120. while ( my ( $k, $v ) = each %$clientmsg )
  121. {
  122. #erzeugen von Internals fuer alle Keys in $clientmsg die mit dem physical Namen beginnen
  123. my $upper_k = uc $k;
  124. $hash->{$upper_k} = $v if $k =~ /^$pname/ ;
  125. }
  126. if ($clientmsg->{direction} && $clientmsg->{$pname . "_SENDSTAT"}) {
  127. my $sendstat = $clientmsg->{$pname . "_SENDSTAT"};
  128. Log3 $hash, 5, "[$name] I2C_HDC1008_I2CRec $clientmsg->{direction} $sendstat ";
  129. if ( $clientmsg->{$pname . "_SENDSTAT"} eq "Ok") {
  130. if ( $clientmsg->{direction} eq "i2cwrite" ) {
  131. if ($hash->{DEVICE_STATE} eq 'READY') {
  132. $hash->{DEVICE_STATE} = 'CONFIGURING';
  133. } elsif($hash->{DEVICE_STATE} eq 'CONFIGURING') {
  134. $hash->{DEVICE_STATE} = 'MEASURING';
  135. }
  136. }
  137. if ( $clientmsg->{direction} eq "i2cread" && defined($clientmsg->{received}) )
  138. {
  139. Log3 $hash, 5, "[$name] I2C_HDC1008_I2CRec received: $clientmsg->{type} $clientmsg->{received}";
  140. I2C_HDC1008_GetTemp ($hash, $clientmsg->{received}) if $clientmsg->{nbyte} == 4;
  141. I2C_HDC1008_GetHum ($hash, $clientmsg->{received}) if $clientmsg->{nbyte} == 4;
  142. }
  143. }
  144. }
  145. }
  146. sub I2C_HDC1008_GetTemp ($$)
  147. {
  148. my ($hash, $rawdata) = @_;
  149. my $name = $hash->{NAME};
  150. my @raw = split(" ",$rawdata);
  151. my $tempWord = ($raw[0] << 8 | $raw[1]);
  152. if ( ($tempWord & 0x3) != 0 ) {
  153. Log3 $hash, 4, "[$name] I2C_HDC1008_I2CRec invalid temperature raw value: $tempWord";
  154. return undef;
  155. }
  156. my $temperature = (($tempWord /65536.0)*165.0)-40.0;
  157. Log3 $hash, 5, "[$name] I2C_HDC1008_I2CRec calced Temperatur: $temperature";
  158. $temperature = sprintf( '%.' . AttrVal($hash->{NAME}, 'roundTemperatureDecimal', 1) . 'f', $temperature );
  159. readingsSingleUpdate($hash, "temperature", $temperature, 0);
  160. }
  161. sub I2C_HDC1008_GetHum ($$)
  162. {
  163. my ($hash, $rawdata) = @_;
  164. my $name = $hash->{NAME};
  165. my @raw = split(" ",$rawdata);
  166. my $humWord = ($raw[2] << 8 | $raw[3]);
  167. if ( ($humWord & 0x3) != 0) {
  168. Log3 $hash, 4, "[$name] I2C_HDC1008_I2CRec invalid humidity raw value: $humWord";
  169. return undef;
  170. }
  171. my $humidity = ($humWord /65536.0)*100.0;
  172. Log3 $hash, 5, "[$name] I2C_HDC1008_I2CRec calced humidity: $humidity";
  173. my $temperature = ReadingsVal($hash->{NAME} ,"temperature","0");
  174. $humidity = sprintf( '%.' . AttrVal($hash->{NAME}, 'roundHumidityDecimal', 1) . 'f', $humidity );
  175. readingsBeginUpdate($hash);
  176. readingsBulkUpdate($hash, 'humidity', $humidity);
  177. readingsBulkUpdate($hash, 'temperature', $temperature);
  178. readingsBulkUpdate(
  179. $hash,
  180. 'state',
  181. 'T: ' . $temperature . ' H: ' . $humidity
  182. );
  183. readingsEndUpdate($hash, 1);
  184. }
  185. sub I2C_HDC1008_Undef($$)
  186. {
  187. my ($hash, $name) = @_;
  188. if ( defined (AttrVal($hash->{NAME}, "interval", undef)) )
  189. {
  190. RemoveInternalTimer($hash);
  191. }
  192. return undef;
  193. }
  194. sub I2C_HDC1008_Reset($)
  195. {
  196. my ($hash) = @_;
  197. my $name = $hash->{NAME};
  198. if ($hash->{MODUL_STATE} ne 'Initialized') { return "Error MODULE_STATE in $name is not 'Initialized' " };
  199. return "$name: no IO device defined" unless ($hash->{IODev});
  200. my $Param = 1 << 15; # Bit 15 für Reset
  201. my $low_byte = $Param & 0xff;
  202. my $high_byte = ($Param & 0xff00) >> 8;
  203. my $iodev = $hash->{IODev};
  204. my $i2caddress = $hash->{I2C_Address};
  205. CallFn($iodev->{NAME}, "I2CWrtFn", $iodev, {
  206. direction => "i2cwrite",
  207. i2caddress => $i2caddress,
  208. reg => 2,
  209. data => $high_byte. " ".$low_byte
  210. });
  211. RemoveInternalTimer($hash);
  212. $hash->{DEVICE_STATE} ='READY';
  213. InternalTimer(gettimeofday() + 15.0/1000, 'I2C_HDC1008_Poll', $hash, 0); # Sensor braucht bis 15 ms bis er bereit ist
  214. }
  215. # Funktion holt die Werte vom Sensor via I2C
  216. # asynchrones Lesen, über Status-Wechsel in $hash->{DEVICE_STATE} und Rückgabe der notwendigen Dauer des aktuellen Schritts in Sekunden,
  217. # die dann an den Timer gegeben wird. Der schaut nach Ablauf der Zeit hier wieder vorbei und weiß als nächstes zu tun ist,
  218. # andere Prozesse werden dabei nicht mehr blockiert.
  219. sub I2C_HDC1008_UpdateValues($)
  220. {
  221. my ($hash) = @_;
  222. my $name = $hash->{NAME};
  223. if ($hash->{MODUL_STATE} ne 'Initialized') { return "Error MODULE_STATE in $name is not 'Initialized' " };
  224. return "$name: no IO device defined" unless ($hash->{IODev});
  225. Log3 $name, 5, "[$name] I2C_HDC1008_UpdateValues starts with state: $hash->{DEVICE_STATE}";
  226. # baue Konfigurationsparameter zusammen
  227. my $modeReading = 1 << 12; # lies beides gleichzeitig
  228. my $resTempIndex = $hash->{RESOLUTION_TEMPERATURE};
  229. my $resHumIndex = $hash->{RESOLUTION_HUMIDITY};
  230. my $heaterIndex = $hash->{HEATER};
  231. my $resTempParam = $I2C_HDC1008_tempParams{$resTempIndex}{code};
  232. my $resHumParam = $I2C_HDC1008_humParams{$resHumIndex}{code};
  233. my $heaterParam = $I2C_HDC1008_validsHeater{$heaterIndex};
  234. my $iodev = $hash->{IODev};
  235. my $i2caddress = $hash->{I2C_Address};
  236. if ($hash->{DEVICE_STATE} eq 'READY')
  237. {
  238. my $Param = $modeReading | $resTempParam | $resHumParam | $heaterParam;
  239. # schicke Konfiguration zum HDC1008-Sensor
  240. # --------------------------------------------------------
  241. my $low_byte = $Param & 0xff;
  242. my $high_byte = ($Param & 0xff00) >> 8;
  243. CallFn($iodev->{NAME}, "I2CWrtFn", $iodev, {
  244. direction => "i2cwrite",
  245. i2caddress => $i2caddress,
  246. reg => 2,
  247. data => $high_byte. " ".$low_byte # Leider fehlt es hier an Doku. Laut Quellcode (00_RPII2C.pm, ab Zeile 369), werden die dezimale Zahlen durch Leerzeichen getrennt, binär gewandelt und zum I2C-Bus geschickt
  248. });
  249. return 15.0/1000; # Sensor braucht bis 15 ms bis er bereit ist
  250. }
  251. elsif($hash->{DEVICE_STATE} eq 'CONFIGURING')
  252. {
  253. # HDC1008-Sensor soll messen
  254. # --------------------------------------------------------
  255. CallFn($iodev->{NAME}, "I2CWrtFn", $iodev, {
  256. direction => "i2cwrite",
  257. i2caddress => $i2caddress,
  258. data => (0)
  259. });
  260. my $tempWait = $I2C_HDC1008_tempParams{$resTempIndex}{delay} +
  261. $I2C_HDC1008_humParams{$resTempIndex}{delay}; # in ns
  262. return $tempWait/1000000.0;
  263. }
  264. elsif($hash->{DEVICE_STATE} eq 'MEASURING')
  265. {
  266. # Werte vom HDC1008-Sensor lesen
  267. # --------------------------------------------------------
  268. CallFn($iodev->{NAME}, "I2CWrtFn", $iodev, { # Leider fehlt es hier an Doku. daher hier der Hinweis bei erfolgreichem Lesen wird die Funktion in $hash->{I2CRecFn} aufgerufen
  269. direction => "i2cread",
  270. i2caddress => $i2caddress,
  271. nbyte => 4
  272. });
  273. # fertig
  274. $hash->{DEVICE_STATE} = 'READY';
  275. my $pollInterval = AttrVal($hash->{NAME}, 'interval', 0);
  276. return $pollInterval * 60; # Pollintervall in Minuten
  277. }
  278. else
  279. {
  280. Log3 $name, 5, "[$name] I2C_HDC1008_UpdateValues wtf... whats wrong !!!!!!!!!!!!!!";
  281. $hash->{DEVICE_STATE} = 'READY';
  282. my $pollInterval = AttrVal($hash->{NAME}, 'interval', 0);
  283. return $pollInterval * 60; # Pollintervall in Minuten
  284. }
  285. }
  286. # set wenn Befehl gesetzt wurde und nicht '?' ist,
  287. # dann führe Befehl aus und gib den Status zurück
  288. # ansonsten gib alle Befehle und deren Optionen zurück
  289. sub I2C_HDC1008_Set($@) {
  290. my ($hash, @param) = @_;
  291. return '"set HDC1008" needs at least one argument' if (int(@param) < 2);
  292. my $name = shift @param;
  293. my $cmd = shift @param;
  294. my $val = join("", @param);
  295. if (defined $cmd && $cmd ne '?') # falls set mit Kommand aufgerufen wurde
  296. {
  297. if ($cmd eq 'Heater')
  298. {
  299. if ( defined($I2C_HDC1008_validsHeater{$val}) )
  300. {
  301. $hash->{HEATER} = $val;
  302. return undef;
  303. }
  304. else
  305. {
  306. return "Invalid value for setting 'Heater'";
  307. }
  308. }
  309. elsif ($cmd eq 'Update')
  310. {
  311. RemoveInternalTimer($hash);
  312. $hash->{DEVICE_STATE} ='READY';
  313. I2C_HDC1008_Poll($hash);
  314. return undef;
  315. }
  316. elsif ($cmd eq 'Reset')
  317. {
  318. I2C_HDC1008_Reset($hash);
  319. return undef;
  320. }
  321. # Debug("Set HDC1008 $cmd");
  322. return -1;
  323. }
  324. else # Ansonsten Rückgabe was an set - Optionen möglich ist
  325. {
  326. return "Update:noArg Heater:off,on Reset:noArg ";
  327. }
  328. }
  329. sub I2C_HDC1008_CheckState
  330. {
  331. my ($hash) = @_;
  332. if ($hash->{MODUL_STATE} ne 'Initialized')
  333. {
  334. my @def = split (' ',$hash->{DEF});
  335. I2C_HDC1008_Init($hash,\@def) if (defined ($hash->{IODev}));
  336. }
  337. }
  338. sub I2C_HDC1008_Poll
  339. {
  340. my ($hash) = @_;
  341. I2C_HDC1008_CheckState($hash);
  342. my $name = $hash->{NAME};
  343. my $delay = I2C_HDC1008_UpdateValues($hash);
  344. # TODO Catch ohne eval?! Das bringt wohl nix, fraglich ist, ob wir hier ein Catch brauchen?
  345. my $ret = I2C_HDC1008_Catch($@) if $@;
  346. if ($delay > 0)
  347. {
  348. Log3 $hash, 5, "[$name] I2C_HDC1008_Poll call InternalTimer with $delay seconds";
  349. InternalTimer(gettimeofday() + $delay, 'I2C_HDC1008_Poll', $hash, 0);
  350. }
  351. else
  352. {
  353. Log3 $name, 5, "[$name] I2C_HDC1008_Poll dont call InternalTimer, nothing todo";
  354. }
  355. return;
  356. }
  357. sub I2C_HDC1008_Attr(@)
  358. {
  359. my ($command, $name, $attr, $val) = @_;
  360. my $hash = $defs{$name};
  361. my $msg = '';
  362. if ($attr eq 'interval')
  363. {
  364. if ( defined($val) )
  365. {
  366. if ( looks_like_number($val) && $val > 0)
  367. {
  368. RemoveInternalTimer($hash);
  369. $hash->{DEVICE_STATE} = 'READY';
  370. InternalTimer(1, 'I2C_HDC1008_Poll', $hash, 0);
  371. $hash->{INTERVAL} = $val;
  372. Log3 $hash, 5, "[$hash->{NAME}] I2C_HDC1008_Attr call InternalTimer with new value $val ";
  373. } else
  374. {
  375. $msg .= "$hash->{NAME}: Wrong poll intervall defined. interval must be a number > 0";
  376. Log3 $hash, 5, "[$hash->{NAME}] I2C_HDC1008_Attr Wrong poll intervall defined. interval must be a number > 0";
  377. $hash->{INTERVAL} = 0;
  378. }
  379. }
  380. else
  381. { #wird auch aufgerufen wenn $val leer ist, aber der attribut wert wird auf 1 gesetzt
  382. RemoveInternalTimer($hash);
  383. $hash->{INTERVAL} = 0;
  384. }
  385. }
  386. elsif ($attr eq 'Resolution_Temperature')
  387. {
  388. if (!defined($val))
  389. {
  390. $hash->{RESOLUTION_TEMPERATURE} = '14Bit';
  391. }
  392. elsif ( defined($I2C_HDC1008_tempParams{$val}{code}) )
  393. {
  394. $hash->{RESOLUTION_TEMPERATURE} = $val;
  395. }
  396. else
  397. {
  398. $msg .= "invalid value for attribute $attr";
  399. }
  400. }
  401. elsif ($attr eq 'Resolution_Humidity')
  402. {
  403. if (!defined($val))
  404. {
  405. $hash->{RESOLUTION_HUMIDITY} = '14Bit';
  406. }
  407. elsif ( defined($I2C_HDC1008_humParams{$val}{code}) )
  408. {
  409. $hash->{RESOLUTION_HUMIDITY} = $val;
  410. }
  411. else
  412. {
  413. $msg .= "invalid value for attribute $attr";
  414. }
  415. }
  416. elsif ($command && $command eq "set" && $attr && $attr eq "IODev")
  417. {
  418. if ($main::init_done and (!defined ($hash->{IODev}) or $hash->{IODev}->{NAME} ne $val))
  419. {
  420. main::AssignIoPort($hash,$val);
  421. my @def = split (' ',$hash->{DEF});
  422. I2C_HDC1008_Init($hash,\@def) if (defined ($hash->{IODev}));
  423. }
  424. }
  425. elsif ( ($attr eq 'roundTemperatureDecimal') || ($attr eq 'roundHumidityDecimal'))
  426. {
  427. if (!defined($val))
  428. {
  429. return undef;
  430. }
  431. elsif (!(looks_like_number($val) && ($val>=0 )))
  432. {
  433. $msg .= "$attr must be a number >= 0"
  434. }
  435. }
  436. return ($msg) ? $msg : undef;
  437. }
  438. 1;
  439. =pod
  440. =item device
  441. =item summary read Texas Instruments HDC1008/1080 temp/humidity sensor via I2C bus
  442. =item summary_DE Texas Instruments HDC1008/1080 Temp./Feuchte-Sensor über I2C auslesen
  443. =begin html
  444. <a name="I2C_HDC1008"></a>
  445. <h3>I2C_HDC1008</h3>
  446. <ul>
  447. <a name="I2C_HDC1008"></a>
  448. Provides an interface to the I2C_HDC1008 I2C Humidity sensor from <a href=" http://www.ti.com">Texas Instruments</a>.
  449. The I2C messages are send through an I2C interface module like <a href="#RPII2C">RPII2C</a>, <a href="#FRM">FRM</a>
  450. or <a href="#NetzerI2C">NetzerI2C</a> so this device must be defined first.<br>
  451. <b>attribute IODev must be set</b><br>
  452. <a name="I2C_HDC1008Define"></a><br>
  453. <b>Define</b>
  454. <ul>
  455. <code>define &lt;name&gt; I2C_HDC1008 [&lt;I2C Address&gt;]</code><br>
  456. where <code>&lt;I2C Address&gt;</code> is an 2 digit hexadecimal value<br>
  457. </ul>
  458. <a name="I2C_HDC1008Set"></a>
  459. <b>Set</b>
  460. <ul>
  461. <code>set &lt;name&gt; Update</code><br>
  462. Reads the current temperature and humidity values from sensor.<br><br>
  463. <code>set &lt;name&gt; Reset</code><br>
  464. Resets the sensor
  465. <code>set &lt;name&gt; Heater {on|off}</code><br>
  466. turns the sensor heater on or off
  467. </ul>
  468. <a name="I2C_HDC1008Attr"></a>
  469. <b>Attributes</b>
  470. <ul>
  471. <li>interval<br>
  472. Set the polling interval in minutes to query data from sensor<br>
  473. Default: 5, valid values: 1,2,5,10,20,30<br><br>
  474. </li>
  475. <li>Resolution_Temperature<br>
  476. resolution for measurement temperature.<br>
  477. Standard: 14Bit, valid values: 11Bit, 14Bit<br><br>
  478. </li>
  479. <li>Resolution_Humidity<br>
  480. resolution for measurement humidity.<br>
  481. Standard: 14Bit, valid values: 8Bit, 11Bit, 14Bit<br><br>
  482. </li>
  483. <li>roundHumidityDecimal<br>
  484. Number of decimal places for humidity value<br>
  485. Default: 1, valid values: 0 1 2,...<br><br>
  486. </li>
  487. <li>roundTemperatureDecimal<br>
  488. Number of decimal places for temperature value<br>
  489. Default: 1, valid values: 0,1,2,...<br><br>
  490. </li>
  491. <li><a href="#IODev">IODev</a></li>
  492. </ul><br>
  493. </ul>
  494. =end html
  495. =begin html_DE
  496. <a name="I2C_HDC1008"></a>
  497. <h3>I2C_HDC1008</h3>
  498. <ul>
  499. <a name="I2C_HDC1008"></a>
  500. Erm&ouml;glicht die Verwendung eines I2C_HDC1008 I2C Feuchtesensors von <a href=" http://www.ti.com">Texas Instruments</a>.
  501. I2C-Botschaften werden &uuml;ber ein I2C Interface Modul wie beispielsweise das <a href="#RPII2C">RPII2C</a>, <a href="#FRM">FRM</a>
  502. oder <a href="#NetzerI2C">NetzerI2C</a> gesendet. Daher muss dieses vorher definiert werden.<br>
  503. <b>Das Attribut IODev muss definiert sein.</b><br>
  504. <a name="I2C_HDC1008Define"></a><br>
  505. <b>Define</b>
  506. <ul>
  507. <code>define &lt;name&gt; I2C_HDC1008 [&lt;I2C Address&gt;]</code><br>
  508. Der Wert <code>&lt;I2C Address&gt;</code> ist ein zweistelliger Hex-Wert<br>
  509. </ul>
  510. <a name="I2C_HDC1008Set"></a>
  511. <b>Set</b>
  512. <ul>
  513. <code>set &lt;name&gt; Update</code><br>
  514. Aktuelle Temperatur und Feuchte Werte vom Sensor lesen.<br><br>
  515. <code>set &lt;name&gt; Reset</code><br>
  516. Setzt den Sensor zur&uuml;ck
  517. <code>set &lt;name&gt; Heater {on|off}</code><br>
  518. Schaltet das Heizelement des Sensors an oder aus
  519. </ul>
  520. <a name="I2C_HDC1008Attr"></a>
  521. <b>Attribute</b>
  522. <ul>
  523. <li>interval<br>
  524. Aktualisierungsintervall aller Werte in Minuten.<br>
  525. Standard: 5, g&uuml;ltige Werte: 1,2,5,10,20,30<br><br>
  526. </li>
  527. <li>Resolution_Temperature<br>
  528. Genauigkeit mit der die Temperatur gemessen werden soll.<br>
  529. Standard: 14Bit, g&uuml;ltige Werte: 11Bit, 14Bit<br><br>
  530. </li>
  531. <li>Resolution_Humidity<br>
  532. Genauigkeit mit der die Feuchtigkeit gemessen werden soll.<br>
  533. Standard: 14Bit, g&uuml;ltige Werte: 8Bit, 11Bit, 14Bit<br><br>
  534. </li>
  535. <li>roundHumidityDecimal<br>
  536. Anzahl Dezimalstellen f&uuml;r den Feuchtewert<br>
  537. Standard: 1, g&uuml;ltige Werte: 0 1 2<br><br>
  538. </li>
  539. <li>roundTemperatureDecimal<br>
  540. Anzahl Dezimalstellen f&uuml;r den Temperaturwert<br>
  541. Standard: 1, g&uuml;ltige Werte: 0,1,2<br><br>
  542. </li>
  543. <li><a href="#IODev">IODev</a></li>
  544. </ul><br>
  545. </ul>
  546. =end html
  547. =cut