<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><title>AW: [vz-users] Cyble Sensor an Raspberry - vzlogger - Problem gelöst</title><style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:inherit;
panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:70.85pt 70.85pt 56.7pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hallo Thomas,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Ich glaube wir haben da ein bisschen aneinander vorbeigeredet…<o:p></o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Mit der „alten“ Schaltung, also GPIO3 mit Pull-Up, Cyble gegen Ground:<o:p></o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>- gab es beim Starten des vzloggers immer einen (Fehl-)Impuls (da der Level des GPIO ja bereits high war?)<o:p></o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>- Hatte ich ein debounce_delay von 700 und je einen Impuls vom Cyble<o:p></o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>- dieser Impuls und auch alle Störimpulse wurden vom vzlogger weiter an die DB geschickt<o:p></o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Mit der jetzigen Schaltung mit GPIO21 mit Pull-Down, Cyble gegen 3,3V:<o:p></o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>- gibt es diesen ersten Impuls beim Starten des vzloggers nicht mehr (was ja richtig ist)<o:p></o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>- hat es mit einem debounce_delay nicht funktioniert, die korrekt kommenden einzelne Impulse wurden im Debug angezeigt, aber nicht an die DB übermittelt (zu kurz?)<o:p></o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>- mit debounce_delay=0 kommen zwei Impulse, davon wird nur einer geloggt <o:p></o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>- Störimpulse treten nicht mehr auf oder werden nicht geloggt.</span><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'><o:p></o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'>[Dec 07 09:48:16][S0] MeterS0:HWIF_GPIO:first poll returned 0<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'>[Dec 07 09:48:16][S0] MeterS0:HWIF_GPIO:first poll returned 1<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'>[Dec 07 09:48:16][S0] MeterS0:HWIF_GPIO:first poll returned 1<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'>[Dec 07 09:48:16][s0] Reading S0 - returning 2 readings (n=1 n_neg = 0)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'>[Dec 07 09:48:16][mtr0] Got 2 new readings from meter:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'>[Dec 07 09:48:16][mtr0] Reading: id=Power/StringIdentifier: value=118.54 ts=1575708496489<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'>[Dec 07 09:48:16][mtr0] Reading: id=Impulse/StringIdentifier: value=1.00 ts=1575708496489<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'>[Dec 07 09:48:16][chn0] Adding reading to queue (value=1.00 ts=1575708496489)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'>[Dec 07 09:48:16][chn0] ==> number of tuples: 1<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:red'><o:p> </o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Wie Du siehst macht es der Vzlogger aus irgendeinem Grund richtig, trotz der 2 geloggten Impulse wird nur einer in die DB geschrieben, d.h. es kommt exakt das richtige an. Drehe ich das debounce_delay soweit auf dass nur ein Impuls „durchkommt“, erfolgt kein Schreibvorgang.<o:p></o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Mein Vzlogger.conf sieht aus wie folgt:<o:p></o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> </span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'>"protocol": "s0",<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> "enabled": true,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> "skip": false,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> "allowskip": false,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> "interval": -1,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> "aggtime": -1,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> "aggfixedinterval": false,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> "gpio": 21,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> "gpio_dir": -1,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> "configureGPIO": true,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> </span><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'>"send_zero": false,<o:p></o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> "debounce_delay": 0,<o:p></o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> </span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> "channel": {<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> "identifier": "Impulse”<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> [ … ]<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Nach meinem Verständnis macht configureGPIO folgendes:<o:p></o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>- den GPIO exportieren<o:p></o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>- ihn auf Eingang setzen<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>- das Edge auf Rising<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>- active_low auf 0<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> if (_configureGPIO) {<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> fd = ::open("/sys/class/gpio/export",O_WRONLY);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> if (fd<0) throw vz::VZException("open export failed");<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> name.clear();<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> name.append(std::to_string(_gpiopin));<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> name.append("\n");<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> res=write(fd,name.c_str(), name.length()+1); // is the trailing zero really needed?<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> if ((name.length()+1)!=res) throw vz::VZException("export failed");<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> ::close(fd);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> } else return false; // doesn't exist and we shall not configure<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> if (_configureGPIO) {<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> name.clear();<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> name.append("/sys/class/gpio/gpio");<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> name.append(std::to_string(_gpiopin));<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> name.append("/direction");<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> fd = ::open(name.c_str(), O_WRONLY);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> if (fd<0) throw vz::VZException("open direction failed");<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> res=::write(fd,"in\n",3);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> if (3!=res) throw vz::VZException("set direction failed");<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> if (::close(fd)<0) throw vz::VZException("set direction failed");<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> name.clear();<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> name.append("/sys/class/gpio/gpio");<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> name.append(std::to_string(_gpiopin));<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> name.append("/edge");<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> fd = ::open(name.c_str(), O_WRONLY);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> if (fd<0) throw vz::VZException("open edge failed");<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> res=::write(fd,"rising\n",7);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> if (7!=res) throw vz::VZException("set edge failed");<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> if (::close(fd)<0) throw vz::VZException("set edge failed");<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> name.clear();<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> name.append("/sys/class/gpio/gpio");<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> name.append(std::to_string(_gpiopin));<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> name.append("/active_low");<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> fd = ::open(name.c_str(), O_WRONLY);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> if (fd<0) throw vz::VZException("open active_low failed");<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> res=::write(fd,"0\n",2);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> if (2!=res) throw vz::VZException("set active_low failed");<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> if (::close(fd)<0) throw vz::VZException("set active_low failed");<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#984807;mso-style-textfill-fill-color:#984807;mso-style-textfill-fill-alpha:100.0%'> }<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Es mag sein dass der Pull-Down anderswo gesetzt wird, ich überblicke ja nicht den ganzen Code. Mit „gpio –g mode 21 down“ im rc.local funktioniert es auf jeden Fall für mich.<o:p></o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Ich schicke Dir gerne das Datenblatt des Cyble, dazu bräuchte ich allerdings Deine Email-Adresse, die Datei ist zu gross für die Liste.<o:p></o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Gruss,<o:p></o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Alex<o:p></o:p></span></p><p class=MsoNormal><span lang=DE style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> volkszaehler-users [mailto:volkszaehler-users-bounces@demo.volkszaehler.org] <b>On Behalf Of </b>Thomas Höpfner<br><b>Sent:</b> Saturday, December 07, 2019 6:49 AM<br><b>To:</b> volkszaehler.org - users; 'volkszaehler.org - users'<br><b>Subject:</b> Re: [vz-users] Cyble Sensor an Raspberry - vzlogger - Problem gelöst<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt;font-family:"Tahoma","sans-serif"'>Hallo Alex<o:p></o:p></span></p><p style='margin:0in;margin-bottom:.0001pt;min-height: 11pt'><span style='font-size:11.0pt;font-family:"Tahoma","sans-serif"'><o:p> </o:p></span></p><blockquote style='border:none;border-left:solid #325FBA 1.5pt;padding:0in 0in 0in 4.0pt;margin-left:3.75pt;margin-right:3.75pt;margin-bottom:12.0pt'><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>mein Problem hat sich in der Zwischenzeit gelöst…</span><o:p></o:p></p></div></div></blockquote><p style='margin:0in;margin-bottom:.0001pt'>Noch nicht ganz.<o:p></o:p></p><blockquote style='border:none;border-left:solid #325FBA 1.5pt;padding:0in 0in 0in 4.0pt;margin-left:3.75pt;margin-top:12.0pt;margin-right:3.75pt;margin-bottom:12.0pt'><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Ich habe es nun mal mit einem “normalen” GPIO mit internen Pull-Down-Widerstand versucht, also so wie Du. Allerdings musste ich letzteren softwaremässig einschalten, mit „gpio -g mode 21 down“ im rc.local. Das Programm „gpio“ ist Teil des nachladbaren Paketes „wiringpi“. Ohne das hat es nicht funktioniert, im Sourcecode des vzloggers habe ich auch nicht sehen können, dass „configureGPIO“ den internen Pull-Down konfiguriert. Es kann aber sein, dass er bei manchen GPIOs standardmässig aktiviert ist.</span><o:p></o:p></p></div></div></blockquote><p style='margin:0in;margin-bottom:.0001pt'>Ich habe den PullDown nicht extra aktiviert, sondern in der vzlogger.conf mit :<o:p></o:p></p><div><p class=MsoNormal> "protocol": "s0",<o:p></o:p></p></div><div><p class=MsoNormal> "gpio": 23,<o:p></o:p></p></div><div><p class=MsoNormal> "gpio_dir": -1,<o:p></o:p></p></div><div><p class=MsoNormal> "configureGPIO": <strong>true</strong>,<o:p></o:p></p></div><div><p class=MsoNormal> "send_zero": false,<o:p></o:p></p></div><div><p class=MsoNormal> "debounce_delay": 0<o:p></o:p></p></div><p style='margin:0in;margin-bottom:.0001pt'><o:p> </o:p></p><p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt;font-family:"Tahoma","sans-serif"'>eingeschaltet. Den Code habe ich mir nicht angeschaut, davon habe ich keine Ahnung, deshalb vermute ich. Das auf den Pi ein Pull Widerstand standardmäßig aktiviert ist, widerspricht meinen Erfahrungen.</span><o:p></o:p></p><blockquote style='border:none;border-left:solid #325FBA 1.5pt;padding:0in 0in 0in 4.0pt;margin-left:3.75pt;margin-top:12.0pt;margin-right:3.75pt;margin-bottom:12.0pt'><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Nun habe ich keine Fehlimpulse mehr. Allerdings bin ich mir nicht sicher, ob das an der Schaltung liegt, und/oder an einem nun komplett anderen Verhalten des vzloggers. </span><o:p></o:p></p></div></div></blockquote><p style='margin:0in;margin-bottom:.0001pt'>Ich denke das Ergebnis zählt.<o:p></o:p></p><blockquote style='border:none;border-left:solid #325FBA 1.5pt;padding:0in 0in 0in 4.0pt;margin-left:3.75pt;margin-top:12.0pt;margin-right:3.75pt;margin-bottom:12.0pt'><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Ursprünglich (also in der Schaltung mit dem Pull-Up und einem bis auf die Unterbrechungen ja dauerhaft hohen Pegel am GPIO) hatte ich ein debounce_delay von 700 eingestellt, obwohl der Cyble ja ein elektronischer Kontakt ist. Wurde hier in dieser Liste mal von einem anderen Benutzer des Cyble so als notwendig dokumentiert.</span><o:p></o:p></p></div></div></blockquote><p style='margin:0in;margin-bottom:.0001pt'>Nach deiner Beschreibung hat der Ausgang keine vorgaben für die Polarität. Das funktioniert eigentlich nur mit einen mechanischen Kontakt. Die billigste und kleinste Lösung ist ein Reedkondakt(Relais), und die Prellen immer (davon habe ich Ahnung). "Elektronisch" ist Vermutlich die Erkennung des Verbrauchs und Erzeugung des Impulses. <o:p></o:p></p><blockquote style='border:none;border-left:solid #325FBA 1.5pt;padding:0in 0in 0in 4.0pt;margin-left:3.75pt;margin-top:12.0pt;margin-right:3.75pt;margin-bottom:12.0pt'><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Die Impulse vom Cyble kamen regelmässig (das war nie das Problem) und der vzlogger hat jede „1“ auch an die Datenbank geschickt. Jetzt, mit 3,3V gegen GPIO mit Pull-Down ist letzterer ja, solange kein Impuls eintrifft, auf GND. Damit fiel schonmal der eine (logisch ja falsche) einmalige „Einschaltimpuls“ beim Starten des vzloggers weg. Soweit gut.</span><o:p></o:p></p></div></div></blockquote><p style='margin:0in;margin-bottom:.0001pt'>Ich denke dieses "falsche" verhalten ist den Programmieren bewusst und sie reagieren nur auf Flanken nach den Einschalten.<o:p></o:p></p><blockquote style='border:none;border-left:solid #325FBA 1.5pt;padding:0in 0in 0in 4.0pt;margin-left:3.75pt;margin-top:12.0pt;margin-right:3.75pt;margin-bottom:12.0pt'><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Allerdings hat der vzlogger nun auch die regelmässig und richtig kommenden „1“en des Cyble zwar im Debug angezeigt, aber nicht mehr an die DB geschickt. Ich habe dann mal testweise das debounce_delay auf 0 gesetzt. Nun sah man plötzlich nicht nur einen Impuls vom Sensor, sondern jedesmal 2, zeitgleich. Das war wohl mal der Grund für das debounce_delay.</span><o:p></o:p></p></div></div></blockquote><p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt;font-family:"Tahoma","sans-serif"'>Diesen Verhalten solltest du noch Nachgehen. </span><o:p></o:p></p><blockquote style='border:none;border-left:solid #325FBA 1.5pt;padding:0in 0in 0in 4.0pt;margin-left:3.75pt;margin-top:12.0pt;margin-right:3.75pt;margin-bottom:12.0pt'><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Der Vzlogger aber hat daraus Power und Impulse gemacht, also wie bei einem E-Zähler, und (entsprechend meiner Config) natürlich nur den Impuls (einen!) geloggt und auch per curl auch an die DB gesendet. Entweder haben Entwickler des Cyble und Programmierer des vzloggers mehr gemein als man denkt – oder vielleicht ist genau dieses Verhalten für das Protokoll als Standard definiert. </span><o:p></o:p></p></div></div></blockquote><p style='margin:0in;margin-bottom:.0001pt'><span style='font-family:"inherit","serif"'>Der vzlogger ist ausschließlich für die Erfassung und Übertragung an die Middleware zuständig. Die Auswertung-Interpretation erfolg im Frontend. Ob Strom, Gas, Wasser oder sonst etwas ist egal. "S0" bedeutet digitale Impulse für verbrauchte Menge/Arbeit. Aus Arbeit und Zeit wird die Leistung errechnet. Das ist Physik, die haben wir alle gemeinsam.</span><o:p></o:p></p><blockquote style='border:none;border-left:solid #325FBA 1.5pt;padding:0in 0in 0in 4.0pt;margin-left:3.75pt;margin-top:12.0pt;margin-right:3.75pt;margin-bottom:12.0pt'><div><div><p><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Auf jeden Fall funktioniert es so.</span><o:p></o:p></p></div></div></blockquote><p style='margin:0in;margin-bottom:.0001pt'>Wenn der 1. Impulse fehlt funktioniert es noch nicht richtig.<o:p></o:p></p><blockquote style='border:none;border-left:solid #325FBA 1.5pt;padding:0in 0in 0in 4.0pt;margin-left:3.75pt;margin-top:12.0pt;margin-right:3.75pt;margin-bottom:12.0pt'><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Es scheint dass der Vzlogger eine Impulsmindestlänge für analoge Impulsgeber (Reed) und bei digitalen einen zweifachen Impuls vorraussetzt. </span><o:p></o:p></p></div></div></blockquote><p style='margin:0in;margin-bottom:.0001pt'>Der Pi kann nur digital, und ja: "debounce_delay".<o:p></o:p></p><blockquote style='border:none;border-left:solid #325FBA 1.5pt;padding:0in 0in 0in 4.0pt;margin-left:3.75pt;margin-top:12.0pt;margin-right:3.75pt;margin-bottom:12.0pt'><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Und vielleicht siebt genau das die eventuell ja noch vorhandenen Störimpulse aus, die diese Vorgaben nicht erfüllen…</span><o:p></o:p></p></div></div></blockquote><p style='margin:0in;margin-bottom:.0001pt'>Eher nicht, ich vermute das "debounce_delay" noch nicht passt.<o:p></o:p></p><p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt;font-family:"Tahoma","sans-serif"'>Ohne Angaben zum Impulse im Datenblatt deines Cyble, oder eine Auswertung mit Oszi, hilft nur experimentieren mit der delayzeit. 0 ist definitiv zu wenig, dein jetziger Wert scheinbar zu hoch. </span><o:p></o:p></p><p style='margin:0in;margin-bottom:.0001pt'><o:p> </o:p></p><p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt;font-family:"Tahoma","sans-serif"'>Viel Spaß beim experimentieren.</span><o:p></o:p></p><p style='margin:0in;margin-bottom:.0001pt'><o:p> </o:p></p><p style='margin:0in;margin-bottom:.0001pt'><span style='font-size:11.0pt;font-family:"Tahoma","sans-serif"'>Thomas</span><o:p></o:p></p><p style='margin:0in;margin-bottom:.0001pt'><o:p> </o:p></p><p style='margin:0in;margin-bottom:.0001pt'><o:p> </o:p></p></div></body></html>