10_NeuronPin.pm 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. ##############################################
  2. # $Id: 10_NeuronPin.pm 16852 2018-06-11 22:00:38Z klausw $
  3. # todo:
  4. # holen von status nach sets nicht wenn ws verbindung
  5. # ao funktioniert nicht
  6. package main;
  7. use strict;
  8. use warnings;
  9. my %sets = (
  10. 'on' => 1,
  11. 'off' => 0,
  12. );
  13. my %rsets = reverse %sets;
  14. sub NeuronPin_Initialize($) {
  15. my ($hash) = @_;
  16. $hash->{DefFn} = 'NeuronPin_Define';
  17. $hash->{InitFn} = 'NeuronPin_Init';
  18. $hash->{StateFn} = "NeuronPin_State";
  19. $hash->{AttrFn} = 'NeuronPin_Attr';
  20. $hash->{SetFn} = 'NeuronPin_Set';
  21. $hash->{GetFn} = 'NeuronPin_Get';
  22. $hash->{UndefFn} = 'NeuronPin_Undef';
  23. $hash->{AttrList} = 'IODev do_not_notify:0,1 showtime:0,1 '.
  24. 'disable:0,1 disabledForIntervals'.
  25. 'poll_interval:1,2,5,10,20,30 restoreOnStartup:on,off,last '.
  26. 'aomax skipreadings ownsets autoalias '.
  27. $readingFnAttributes;
  28. $hash->{Match} = ".*";
  29. $hash->{ParseFn} = "NeuronPin_Parse";
  30. # $hash->{DbLog_splitFn} = "NeuronPin_DbLog_splitFn";
  31. $hash->{AutoCreate} = {"NeuronPin_.*" => { ATTR => "room:Neuron" } };
  32. $hash->{noAutocreatedFilelog} = 1;
  33. }
  34. sub NeuronPin_Define($$) {
  35. my ($hash, $def) = @_;
  36. my @a = split('[ \t][ \t]*', $def);
  37. # hier fehlt noch Überprüfung der Attribute
  38. $modules{NeuronPin}{defptr}{$a[2]." ".$a[3]} = $hash;
  39. return "$hash->{NAME} Pintype not valid" unless ($a[2] =~ /^(input|relay|ai|ao|led|temp|wd)$/ );
  40. $hash->{DEV} = $a[2];
  41. #return "$hash->{NAME} Circuit Name not valid" unless ($a[3] =~ /^[1-9]_((0[1-9])|[1-9][0-9])$/ );
  42. $hash->{CIRCUIT} = $a[3];
  43. $hash->{STATE} = "defined";
  44. if ($main::init_done) {
  45. eval { NeuronPin_Init( $hash, [ @a[ 2 .. scalar(@a) - 1 ] ] ); };
  46. return NeuronPin_Catch($@) if $@;
  47. }
  48. return undef;
  49. }
  50. sub NeuronPin_Init($$) {
  51. my ( $hash, $args ) = @_;
  52. unless (defined $args && int(@$args) == 2) {
  53. return "Define: Wrong syntax. Usage:\n" .
  54. "define <name> NeuronPin <dev> <circuit>";
  55. }
  56. AssignIoPort($hash);
  57. #$hash->{STATE} = 'Initialized';
  58. if (ReadingsVal($hash->{NAME}, '.conf', '')) {
  59. NeuronPin_CreateSets($hash);
  60. if (AttrVal($hash->{NAME},"restoreOnStartup",'')) {
  61. my $val = ReadingsVal($hash->{NAME},'state','off');
  62. Log3 $hash, 5, "$hash->{TYPE} ($hash->{NAME}): im init restoreOnStartup = $val";
  63. NeuronPin_Set($hash,$hash->{NAME}, (looks_like_number($val) ? dim $val : $val));
  64. }
  65. } else {
  66. return if(IsDisabled($hash->{NAME}));
  67. IOWrite($hash, split " ", $hash->{DEF});
  68. }
  69. $hash->{STATE} = ReadingsVal($hash->{NAME},'state','') if ReadingsVal($hash->{NAME},'state','');
  70. return undef;
  71. }
  72. sub NeuronPin_Catch($) {
  73. my $exception = shift;
  74. if ($exception) {
  75. $exception =~ /^(.*)( at.*FHEM.*)$/;
  76. return $1;
  77. }
  78. return undef;
  79. }
  80. sub NeuronPin_State($$$$) { #reload readings at FHEM start
  81. my ($hash, $tim, $sname, $sval) = @_;
  82. #Log3 $hash, 5, "$hash->{TYPE} ($hash->{NAME}): $sname kann auf $sval wiederhergestellt werden $tim";
  83. if ( $sname ne "STATE" && (my $pval = AttrVal($hash->{NAME},"restoreOnStartup",'')) && $hash->{DEV} =~ /relay|ao/ ) {
  84. if ($sname eq "state") {
  85. if ($pval eq 'on' || $pval eq 'off' || looks_like_number($pval)) {
  86. readingsSingleUpdate($hash, "state", $pval, 1);
  87. Log3 $hash, 5, "$hash->{TYPE} ($hash->{NAME}): $sname wiederhergestellt auf $pval";
  88. } else {
  89. $hash->{READINGS}{$sname}{VAL} = $sval;
  90. $hash->{READINGS}{$sname}{TIME} = $tim;
  91. Log3 $hash, 5, "$hash->{TYPE} ($hash->{NAME}): $sname wiederhergestellt auf $sval";
  92. }
  93. }
  94. }
  95. return;
  96. }
  97. sub NeuronPin_Parse ($$) {
  98. my ( $io_hash, $message) = @_;
  99. my $port = $message->{dev}." ".$message->{circuit};
  100. Log3 (undef, 4, "NeuronPin_Parse von $io_hash->{NAME} empfangen:\n" . encode_json $message);
  101. if (my $hash = $modules{NeuronPin}{defptr}{$port}) {
  102. my $value = $message->{value};
  103. # zusätzliche Daten als Internal
  104. $hash->{RELAY_TYPE} = $message->{relay_type} if $message->{relay_type};
  105. $hash->{TYP} = $message->{typ} if defined $message->{typ};
  106. $hash->{GLOB_DEV_ID} = $message->{glob_dev_id} if defined $message->{glob_dev_id};
  107. $value = $rsets{$value} if ($message->{dev} eq 'input' || $message->{dev} eq 'relay' || $message->{dev} eq 'led');
  108. readingsBeginUpdate($hash);
  109. readingsBulkUpdate($hash,"state",$value);
  110. readingsBulkUpdate($hash,"dim",$value) if $message->{dev} eq 'ao';
  111. # my @readings = ("mode","unit","range","debounce","counter","counter_mode","alias","pwm_freq","pwm_duty","temp","humidity","vdd","vad");
  112. # foreach (@readings){
  113. # if (exists($message->{$_})) {
  114. # readingsBulkUpdate($hash,"Z_".$_,$message->{$_});
  115. # } else {
  116. # readingsDelete($hash, "Z_".$_);
  117. # }
  118. # }
  119. my @skipreadings = split(',', AttrVal($hash->{NAME}, 'skipreadings', "relay_type,typ,dev,circuit,glob_dev_id,value,pending") );
  120. foreach (keys %{$hash->{READINGS}}) {
  121. #next if substr($_,0,2) eq "Z_";
  122. readingsDelete($hash, $_) unless exists($message->{$_}) || $_ eq "state" || $_ eq ".conf" || $_ eq "dim";
  123. }
  124. foreach my $key (keys %$message){
  125. if (ref $message->{$key} eq 'ARRAY') { # alle Arrays überspringen
  126. } elsif (grep( /^$key/, @skipreadings )) { # Wer soll nicht als reading angelegt werden
  127. readingsDelete($hash, $key);
  128. } elsif ($key eq 'alias') { # al_ am Anfang von alias weg
  129. my $alias = (split '_', $message->{$key})[1];
  130. readingsBulkUpdate($hash,$key,$alias);
  131. # autocreate alias attribute
  132. if (AttrVal($hash->{NAME}, 'alias', '?') ne $alias && defined AttrVal($hash->{NAME}, 'autoalias', '')) {
  133. my $msg = CommandAttr(undef, $hash->{NAME} . " alias $alias");
  134. Log3 ($hash, 2, "$hash->{TYPE} ($hash->{NAME}): Error creating alias $msg") if ($msg);
  135. }
  136. }else {
  137. readingsBulkUpdate($hash,$key,$message->{$key});
  138. }
  139. }
  140. delete $message->{value};
  141. readingsBulkUpdateIfChanged($hash,".conf",encode_json $message,0);
  142. readingsEndUpdate($hash,1);
  143. NeuronPin_CreateSets($hash);
  144. if ($hash->{HELPER}{SETREQ} && not $hash->{IODev}->{HELPER}{WESOCKETS}) { # workaround because neuron sends old value after set
  145. RemoveInternalTimer($hash,'NeuronPin_RereadPin');
  146. InternalTimer(gettimeofday() + 1, 'NeuronPin_RereadPin', $hash);
  147. delete $hash->{HELPER}{SETREQ};
  148. }
  149. asyncOutput($hash->{HELPER}{CL}, encode_json $message) if $hash->{HELPER}{CL}; # show conf after get
  150. delete $hash->{HELPER}{CL};
  151. return $hash->{NAME};
  152. } else {
  153. Log3 ($hash, 4, "NeuronPin_Parse von $io_hash->{NAME} nix gefunden...anlegen");
  154. return "UNDEFINED NeuronPin_".$message->{dev}."_".$message->{circuit}." NeuronPin " . $port;
  155. }
  156. }
  157. sub NeuronPin_RereadPin($) {
  158. my ($hash) = @_;
  159. return if(IsDisabled($hash->{NAME}));
  160. IOWrite( $hash, split(" ", $hash->{DEF}) );
  161. }
  162. sub NeuronPin_Attr (@) {
  163. my ($command, $name, $attr, $val) = @_;
  164. my $hash = $defs{$name};
  165. my $msg = '';
  166. if ($command && $command eq "set" && $attr && $attr eq "IODev") {
  167. eval {
  168. if ($main::init_done and (!defined ($hash->{IODev}) or $hash->{IODev}->{NAME} ne $val)) {
  169. main::AssignIoPort($hash,$val);
  170. my @def = split (' ',$hash->{DEF});
  171. NeuronPin_Init($hash,\@def) if (defined ($hash->{IODev}));
  172. }
  173. };
  174. return NeuronPin_Catch($@) if $@;
  175. } elsif ($attr eq 'poll_interval') {
  176. if ( defined($val) ) {
  177. if ( looks_like_number($val) && $val > 0) {
  178. RemoveInternalTimer($hash);
  179. NeuronPin_Poll($hash)
  180. } else {
  181. $msg = "$hash->{TYPE} ($hash->{NAME}): Wrong poll intervall defined. poll_interval must be a number > 0";
  182. }
  183. } else {
  184. RemoveInternalTimer($hash);
  185. }
  186. }
  187. return ($msg) ? $msg : undef;
  188. }
  189. sub NeuronPin_Poll($) {
  190. my ($hash) = @_;
  191. my $name = $hash->{NAME};
  192. NeuronPin_Get($hash, $name, 'refresh');
  193. my $pollInterval = AttrVal($name, 'poll_interval', 0);
  194. InternalTimer(gettimeofday() + ($pollInterval * 60), 'NeuronPin_Poll', $hash, 0) if ($pollInterval > 0);
  195. }
  196. sub NeuronPin_CreateSets($) {
  197. my ($hash) = @_;
  198. my $result;
  199. eval {
  200. $result = JSON->new->utf8(1)->decode(ReadingsVal($hash->{NAME}, '.conf', 'nix'));
  201. };
  202. if ($@) {
  203. Log3 ($hash, 3, "$hash->{TYPE} ($hash->{NAME}) reading .conf is no JSON: $@");
  204. } else {
  205. eval {
  206. delete $hash->{HELPER}{SETS};
  207. foreach my $key (keys %$result){
  208. if (ref $result->{$key} eq 'ARRAY') { # wenn Array dann zur set->Dropdonwmenüerzeugung verwenden
  209. if ( exists($result->{substr($key,0,-1)}) ) { # z.B. zu "modes":["Simple","PWM"] passt "mode":"Simple"
  210. if ($result->{$key} && scalar keys @{$result->{$key}} > 1) { # und mehr als eine Option verfügbar
  211. foreach (@{$result->{$key}}){
  212. $hash->{HELPER}{SETS}{substr($key,0,-1)}{$_} = 1;
  213. }
  214. }
  215. } elsif (exists($result->{(split "_", $key)[0]})) { # z.B. "range_modes":["10.0","1.0"]
  216. if ($result->{$key} && scalar keys @{$result->{$key}} > 1) { # und mehr als eine Option verfügbar
  217. foreach (@{$result->{$key}}){
  218. $hash->{HELPER}{SETS}{(split "_", $key)[0]}{$_} = 1;
  219. }
  220. }
  221. } else {
  222. Log3 ($hash, 5, "NeuronPin_CreateSets unbekanntes Array: $key");
  223. }
  224. }
  225. }
  226. # my @stypes = ("modes","range_modes","counter_modes");
  227. # my @stype = ("mode","range_mode","counter_mode");
  228. # foreach my $i (0 .. $#stypes) {
  229. # if ($result->{$stypes[$i]} && scalar keys @{$result->{$stypes[$i]}} > 1) {
  230. # foreach (@{$result->{$stypes[$i]}}){
  231. # $hash->{HELPER}{SETS}{$stype[$i]}{$_} = 1;
  232. # }
  233. # }
  234. # }
  235. my @freesets = split(';', AttrVal($hash->{NAME}, 'ownsets', "debounce;counter;interval;pwm_freq;pwm_duty:slider,0,0.1,100") );
  236. foreach (@freesets) {
  237. my $args = (defined((split ':', $_)[1]) ? (split ':', $_)[1] : "free");
  238. my $setname = (split ':', $_)[0];
  239. $hash->{HELPER}{SETS}{$setname} = $args if exists($result->{$setname});
  240. #$hash->{HELPER}{SETS}{$_} = "free" if exists($result->{$_});
  241. }
  242. #$hash->{HELPER}{SETS}{pwm_duty} = "slider,0,0.1,100" if exists($result->{pwm_duty});
  243. $hash->{HELPER}{SETS}{alias} = "free";
  244. if ($hash->{DEV} eq 'led' || $hash->{DEV} eq 'relay') {
  245. $hash->{HELPER}{SETS}{on} = "noArg";
  246. $hash->{HELPER}{SETS}{off} = "noArg";
  247. } elsif ($hash->{DEV} eq 'ao') {
  248. $hash->{HELPER}{SETS}{on} = "noArg";
  249. $hash->{HELPER}{SETS}{off} = "noArg";
  250. $hash->{HELPER}{SETS}{dim} = "slider,0,0.1," . AttrVal($hash->{NAME},"aomax",'10');
  251. }
  252. my $str = join(" ", map { "$_".( ref($hash->{HELPER}{SETS}{$_}) eq 'HASH' ?
  253. ':' . join (",", sort keys %{$hash->{HELPER}{SETS}{$_}} ) :
  254. ($hash->{HELPER}{SETS}{$_} eq "free" ? '' : ':'.$hash->{HELPER}{SETS}{$_}))
  255. } keys %{$hash->{HELPER}{SETS}}
  256. );
  257. $hash->{HELPER}{SET} = $str;
  258. };
  259. if ($@) {
  260. Log3 ($hash, 1, "$hash->{TYPE} ($hash->{NAME}) Sortierung fehlgeschlagen:\n$@");
  261. }
  262. }
  263. return undef
  264. }
  265. sub NeuronPin_Set($@) {
  266. my ($hash, @a) = @_;
  267. my $name = $a[0];
  268. my $cmd = $a[1];
  269. my $arg = $a[2];
  270. my @arguments = (split(" ",$hash->{DEF}));
  271. #if(!defined($sets{$cmd})) {
  272. if(!defined($hash->{HELPER}{SETS}{$cmd})) {
  273. if (my $setlist = $hash->{HELPER}{SET}) {
  274. return SetExtensions($hash, $setlist, @a) ;
  275. #return 'Unknown argument ' . $cmd . ', choose one of ' . $setlist;
  276. }
  277. return undef
  278. } elsif ($cmd eq "dim") {
  279. $arguments[2] = $arg;
  280. $hash->{HELPER}{SETREQ} = 1;
  281. } elsif ( $hash->{HELPER}{SETS}{$cmd} eq "noArg") {
  282. $arguments[2] = $sets{$cmd};
  283. if ($hash->{DEV} eq 'ao') {
  284. if ($cmd eq 'on') {
  285. $arguments[2] = AttrVal($hash->{NAME},"aomax",'10');
  286. } elsif ($arguments[2] eq 'off') {
  287. $arguments[2] = "0";
  288. }
  289. }
  290. $hash->{HELPER}{SETREQ} = 1;
  291. } elsif ($cmd eq "alias") {
  292. $arguments[2] = $cmd;
  293. $arguments[3] = "al_".$arg;
  294. } else {
  295. $arguments[2] = $cmd;
  296. $arguments[3] = $arg;
  297. }
  298. #$hash->{HELPER}{SETREQ} = 1;
  299. #my @arguments = (split(" ",$hash->{DEF}),$sets{$cmd});
  300. return if(IsDisabled($hash->{NAME}));
  301. IOWrite($hash, @arguments);
  302. }
  303. sub NeuronPin_Get($@) {
  304. my ($hash, $name, $cmd, @args) = @_;
  305. if ($cmd && $cmd eq "refresh") {
  306. my @arguments = (split " ", $hash->{DEF});
  307. return if(IsDisabled($hash->{NAME}));
  308. IOWrite($hash, @arguments);
  309. } elsif ($cmd && $cmd eq "config") {
  310. my @arguments = (split " ", $hash->{DEF});
  311. $hash->{HELPER}{CL} = $hash->{CL};
  312. return if(IsDisabled($hash->{NAME}));
  313. IOWrite($hash, @arguments);
  314. } else {
  315. return 'Unknown argument ' . $cmd . ', choose one of refresh:noArg config:noArg'
  316. }
  317. }
  318. sub NeuronPin_Undef($$) {
  319. my ($hash, $arg) = @_;
  320. my $def = $hash->{DEF};
  321. RemoveInternalTimer($hash);
  322. delete $modules{NeuronPin}{defptr}{$hash->{DEF}};
  323. return undef;
  324. }
  325. #sub NeuronPin_DbLog_splitFn($) {
  326. # my ($event) = @_;
  327. # Log3 undef, 5, "in DbLog_splitFn empfangen: $event";
  328. # my ($reading, $value, $unit) = "";
  329. # my @parts = split(/ /,$event);
  330. # $reading = shift @parts;
  331. # $reading =~ tr/://d;
  332. # $value = $parts[0];
  333. # $unit = "V" if(lc($reading) =~ m/spannung/);
  334. # return ($reading, $value, $unit);
  335. #}
  336. 1;
  337. =pod
  338. =item device
  339. =item summary Logical Module for subdevices of EVOK driven devices.
  340. =item summary_DE Logisches Modul f&uuml; Subdevices von Ger&auml;ten auf denen EVOK l&auml;uft.
  341. =begin html
  342. <a name="NeuronPin"></a>
  343. <h3>NeuronPin</h3>
  344. <ul>
  345. <a name="NeuronPin"></a>
  346. Logical Module for EVOK driven devices.
  347. Defines will be automatically created by the <a href="#Neuron"> Neuron</a> module.
  348. <br>
  349. <a name="NeuronPinDefine"></a>
  350. <b>Define</b>
  351. <ul>
  352. <code>define <name> NeuronPin &lt;dev&gt; &lt;circuit&gt;</code><br><br>
  353. &lt;dev&gt; is an device type like input, ai (analog input), relay (digital output) etc.<br>
  354. &lt;circuit&gt; ist the number of the device.
  355. <br><br>
  356. Example:
  357. <pre>
  358. define NeuronPin_relay_2_01 NeuronPin relay 2_01
  359. </pre>
  360. </ul>
  361. <a name="NeuronPinSet"></a>
  362. <b>Set</b>
  363. <ul>
  364. <code>set &lt;name&gt; &lt;value&gt;</code>
  365. <br><br>
  366. where <code>value</code> can be e.g.:<br>
  367. <ul><li>for relay
  368. <ul><code>
  369. off<br>
  370. on<br>
  371. </code>
  372. The <a href="#setExtensions"> set extensions</a> are also supported for output devices.<br>
  373. </ul>
  374. </li>
  375. </ul>
  376. Other set values depending on the options of the device function.
  377. Details can be found in the UniPi Evok documentation.
  378. </ul>
  379. <a name="NeuronPinGet"></a>
  380. <b>Get</b>
  381. <ul>
  382. <code>get &lt;name&gt; &lt;value&gt;</code>
  383. <br><br>
  384. where <code>value</code> can be<br>
  385. <ul>
  386. <li>refresh: uptates all readings</li>
  387. <li>config: returns the configuration JSON</li>
  388. </ul>
  389. </ul><br>
  390. <a name="NeuronPinAttr"></a>
  391. <b>Attributes</b>
  392. <ul>
  393. <li>poll_interval<br>
  394. Set the polling interval in minutes to query all readings<br>
  395. Default: -, valid values: decimal number<br><br>
  396. </li>
  397. <li>restoreOnStartup<br>
  398. Restore Readings and sets after reboot<br>
  399. Default: last, valid values: last, on, off, no<br><br>
  400. </li>
  401. <li>aomax<br>
  402. Maximum value for the slider from the analog output ports<br>
  403. Default: 10, valid values: decimal number<br><br>
  404. </li>
  405. <li>skipreadings<br>
  406. Values which will be sent from the Device and which shall not be listed as readings<br>
  407. Default: relay_type,typ,dev,circuit,glob_dev_id,value,pending; valid values: comma separated list<br><br>
  408. </li>
  409. <li>ownsets<br>
  410. Values which will be sent from the Device which can be changed via set. For Values for where the device sends fixed choices, the sets will created automatically<br>
  411. Default: debounce;counter;interval;pwm_freq;pwm_duty:slider,0,0.1,100 valid values: semicolon separated list<br><br>
  412. </li>
  413. <li>autoalias<br>
  414. If set to 1, reading alias will automatically change the attribute "alias"<br>
  415. Default: 0, valid values: 0,1<br><br>
  416. </li>
  417. <li><a href="#IODev">IODev</a></li>
  418. <li><a href="#readingFnAttributes">readingFnAttributes</a></li>
  419. <li><a href="#do_not_notify">do_not_notify</a></li>
  420. <li><a href="#showtime">showtime</a></li>
  421. <li><a href="#disable">disable</a></li>
  422. <li><a href="#disabledForIntervals">disabledForIntervals</a></li>
  423. </ul>
  424. <br>
  425. </ul>
  426. =end html
  427. =begin html_DE
  428. <a name="NeuronPin"></a>
  429. <h3>NeuronPin</h3>
  430. <ul>
  431. <a name="NeuronPin"></a>
  432. Logisches Modul f&uuml; Ger&auml;te auf denen EVOK l&auml;uft.
  433. Diese werden automatisch vom <a href="#Neuron"> Neuron</a> Modul angelegt.
  434. <br>
  435. <a name="NeuronPinDefine"></a>
  436. <b>Define</b>
  437. <ul>
  438. <code>define <name> NeuronPin &lt;dev&gt; &lt;circuit&gt;</code><br><br>
  439. &lt;dev&gt; ist der Typ des Subdevices/Pins z.B. input, ai (analoger Eingang), relay (digitaler Ausgang) etc.<br>
  440. &lt;circuit&gt; ist die Nummer des Subdevices/Pins.
  441. <br><br>
  442. Beispiel:
  443. <pre>
  444. define NeuronPin_relay_2_01 NeuronPin relay 2_01
  445. </pre>
  446. </ul>
  447. <a name="NeuronPinSet"></a>
  448. <b>Set</b>
  449. <ul>
  450. <code>set &lt;name&gt; &lt;value&gt;</code>
  451. <br><br>
  452. where <code>value</code> can be e.g.:<br>
  453. <ul><li>f&uuml;r Subdevice Typ relay
  454. <ul><code>
  455. off<br>
  456. on<br>
  457. </code>
  458. </ul>
  459. <a href="#setExtensions"> set extensions</a> werden f&uuml;r Ausg&auml;nge ebenso unterst&uuml;tzt.<br>
  460. </li>
  461. </ul>
  462. Weitere set values sind abh&auml;ngig von den jeweiligen Subdevice Funktionen.
  463. Details dazu sind in der UniPi Evok Dokumentation zu finden.
  464. </ul>
  465. <a name="NeuronPinGet"></a>
  466. <b>Get</b>
  467. <ul>
  468. <code>get &lt;name&gt; &lt;value&gt;</code>
  469. <br><br>
  470. <code>value</code>:<br>
  471. <ul>
  472. <li>refresh: aktualisiert alle readings</li>
  473. <li>config: gibt das Konfigurations JSON zur&uuml;ck</li>
  474. </ul>
  475. </ul><br>
  476. <a name="NeuronPinAttr"></a>
  477. <b>Attribute</b>
  478. <ul>
  479. <li>poll_interval<br>
  480. Interval in Minuten in dem alle Werte gelesen werden.<br>
  481. Standard: -, g&uuml;ltige Werte: Dezimalzahl<br><br>
  482. </li>
  483. <li>restoreOnStartup<br>
  484. Readings nach Neustart wiederherstellen<br>
  485. Standard: last, g&uuml;ltige Werte: last, on, off<br><br>
  486. </li>
  487. <li>aomax<br>
  488. Maxwert f&uuml;r den Schieberegler beim Analogen Ausgang<br>
  489. Standard: 10, g&uuml;ltige Werte: Dezimalzahl<br><br>
  490. </li>
  491. <li>skipreadings<br>
  492. Werte, die vom Ger&auml;t gesendet, aber nicht als Reading dargestellt werden sollen.<br>
  493. Standard: relay_type,typ,dev,circuit,glob_dev_id,value,pending; g&uuml;ltige Werte: kommaseparierte Liste<br><br>
  494. </li>
  495. <li>ownsets<br>
  496. Werte, die vom Ger&auml;t gesendet, und &uuml;ber set ver&auml;ndert werden k&ouml;nnen. Schickt das Ger&auml;t feste Auswahllisten f&uuml;r einen Wert dann werden die sets automatisch angelegt.<br>
  497. Standard: debounce;counter;interval;pwm_freq;pwm_duty:slider,0,0.1,100; g&uuml;ltige Werte: semikolonseparierte Liste<br><br>
  498. </li>
  499. <li>autoalias<br>
  500. Wenn auf 1 wird das reading alias automatisch als Attribut alias gesetzt.<br>
  501. Standard: 0, g&uuml;ltige Werte: 0,1<br><br>
  502. </li>
  503. <li><a href="#IODev">IODev</a></li>
  504. <li><a href="#readingFnAttributes">readingFnAttributes</a></li>
  505. <li><a href="#do_not_notify">do_not_notify</a></li>
  506. <li><a href="#showtime">showtime</a></li>
  507. <li><a href="#disable">disable</a></li>
  508. <li><a href="#disabledForIntervals">disabledForIntervals</a></li>
  509. </ul>
  510. <br>
  511. </ul>
  512. =end html_DE
  513. =cut