Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support s0 on raspberry pi GPIOs #110

Closed
r00t- opened this issue Jan 13, 2015 · 19 comments
Closed

support s0 on raspberry pi GPIOs #110

r00t- opened this issue Jan 13, 2015 · 19 comments

Comments

@r00t-
Copy link
Contributor

r00t- commented Jan 13, 2015

WIP here: https://github.com/r00t-/vzlogger/tree/raspis0
see also: "request for comments: s0 meter, supporting different interfaces" #85

@mbehr1
Copy link
Contributor

mbehr1 commented Feb 23, 2015

pls take a look at https://github.com/mbehr1/vzlogger/tree/s0_gpio as well. Was tested already ok by Udo. Quite a simple change to enable gpio support. But needs external configuration of gpio ports before start of vzlogger.

@r00t-
Copy link
Contributor Author

r00t- commented Feb 24, 2015

department of redundancy department?

@mbehr1
Copy link
Contributor

mbehr1 commented Feb 24, 2015

Yes, I agree.

I’d prefer a more complete solution as well.
(There’ve been some questions/discussions on the mailing list and there was no answer/reply/comment from your side.)

Basically I thought that the current meterS0 code would already work with gpios. During test I noticed that gpios need blocking reads so I quickly changed it…

Waiting for your changes for review.

Am 24.02.2015 um 10:24 schrieb r00t- notifications@github.com:

department of redundancy department?

personally i much prefer having the config self-contained, instead of relying on external scripts
my code has some other fixes too, like not consume two pulses per reading
plus the WIP on #85 #85, will try to push that for review sometime soon

Reply to this email directly or view it on GitHub #110 (comment).

Gruß
Matthias

@gitka
Copy link
Contributor

gitka commented Mar 6, 2015

Tried to test S0-support on Udos Addon-board from https://github.com/mbehr1/vzlogger/tree/s0_gpio for local HTTP-support, but don't get a result or error-message.
[mtr1] Meter configured, enabled.
[chn2] New channel initialized (uuid=...f95918 api=NULL id=Impulse)
local http-output:
{ "version": "0.4.0", "generator": "vzlogger", "data": [ { "uuid": "7836dd20-00d5-11e0-bab1-856ed5f95918", "last": 0, "interval": -1, "protocol": "s0" } ] }
Gruß
Karlheinz

@mbehr1
Copy link
Contributor

mbehr1 commented Mar 6, 2015

Ist das mit vollem Loglevel?

Conf Datei?

Gruß
Matthias

Sent from a mobile device.

Am 06.03.2015 um 08:57 schrieb Karlheinz notifications@github.com:

Tried to test S0-support on Udos Addon-board from https://github.com/mbehr1/vzlogger/tree/s0_gpio for local HTTP-support, but don't get a result or error-message.
[mtr1] Meter configured, enabled.
[chn2] New channel initialized (uuid=...f95918 api=NULL id=Impulse)
local http-output:
{ "version": "0.4.0", "generator": "vzlogger", "data": [ { "uuid": "7836dd20-00d5-11e0-bab1-856ed5f95918", "last": 0, "interval": -1, "protocol": "s0" } ] }
Gruß
Karlheinz


Reply to this email directly or view it on GitHub.

@gitka
Copy link
Contributor

gitka commented Mar 7, 2015

Hi,

Ist das mit vollem Loglevel?
das war nur auszugsweise bei verbosity=10
Mit 15 u. ausgeschaltetem ersten Meter (d0), sieht das so aus:
[Mar 07 18:24:08] Opened logfile /home/pi/vzlogger.log
[Mar 07 18:24:08][] ===> Start meters
[Mar 07 18:24:08][mtr0] Meter for protocol 'd0' is disabled. Skipping.
[Mar 07 18:24:08][mtr1] Meter connection established
[Mar 07 18:24:08][mtr1] Meter thread started
[Mar 07 18:24:08][mtr1] Meter is opened. Starting channels.
[Mar 07 18:24:08][http] Starting local interface HTTPd on port 8080
[Mar 07 18:24:08][] Startup done.
[Mar 07 18:24:08][mtr1] Number of readers: 2
[Mar 07 18:24:08][mtr1] Config.daemon: 0
[Mar 07 18:24:08][mtr1] Config.local: 1
[Mar 07 18:24:08][mtr1] Got 0 new readings from meter:
"Got 0 new readings" ... innerhalb einer Minute 35 MB logfile
Conf Datei?
Auszug vzlogger.conf:
... "enabled" : true , // true, Beginn S0 Impulse
"skip": false,
"protocol" : "s0",
"aggtime": 60, // aggregate all signals for x seconds.
"device": "sys/class/gpio/gpio17/value",
"resolution": 2000,
"channel": {
"api" : "NULL" ,
"uuid" : "7836dd20-00d5-11e0-bab1-856ed5f95918",
"identifier" : "Impulse", /* Impulszähler */
"aggmode": "SUM",
} ...

/etc/rclocal :
echo 17 > /sys/class/gpio/export && echo "rising" >
/sys/class/gpio/gpio17/edge

Gruß
Karlheinz

@mbehr1
Copy link
Contributor

mbehr1 commented Mar 7, 2015

Innerhalb einer Min. 35MB?

Was steht denn da drin? Kannst du kurzen Auszug schicken?

Am 07.03.2015 um 18:44 schrieb Karlheinz notifications@github.com:

Hi,

Ist das mit vollem Loglevel?
das war nur auszugsweise bei verbosity=10
Mit 15 u. ausgeschaltetem ersten Meter (d0), sieht das so aus:
[Mar 07 18:24:08] Opened logfile /home/pi/vzlogger.log
[Mar 07 18:24:08][] ===> Start meters
[Mar 07 18:24:08][mtr0] Meter for protocol 'd0' is disabled. Skipping.
[Mar 07 18:24:08][mtr1] Meter connection established
[Mar 07 18:24:08][mtr1] Meter thread started
[Mar 07 18:24:08][mtr1] Meter is opened. Starting channels.
[Mar 07 18:24:08][http] Starting local interface HTTPd on port 8080
[Mar 07 18:24:08][] Startup done.
[Mar 07 18:24:08][mtr1] Number of readers: 2
[Mar 07 18:24:08][mtr1] Config.daemon: 0
[Mar 07 18:24:08][mtr1] Config.local: 1
[Mar 07 18:24:08][mtr1] Got 0 new readings from meter:
"Got 0 new readings" ... innerhalb einer Minute 35 MB logfile
Conf Datei?
Auszug vzlogger.conf:
... "enabled" : true , // true, Beginn S0 Impulse
"skip": false,
"protocol" : "s0",
"aggtime": 60, // aggregate all signals for x seconds.
"device": "sys/class/gpio/gpio17/value",
"resolution": 2000,
"channel": {
"api" : "NULL" ,
"uuid" : "7836dd20-00d5-11e0-bab1-856ed5f95918",
"identifier" : "Impulse", /* Impulszähler */
"aggmode": "SUM",
} ...

/etc/rclocal :
echo 17 > /sys/class/gpio/export && echo "rising" >
/sys/class/gpio/gpio17/edge

Gruß
Karlheinz

Reply to this email directly or view it on GitHub #110 (comment).

Gruß

Matthias Behr

@gitka
Copy link
Contributor

gitka commented Mar 7, 2015

Innerhalb einer Min. 35MB?

Was steht denn da drin? Kannst du kurzen Auszug schicken?

wie gesagt, ständig diese Zeile:
[Mar 07 18:24:08][mtr1] Got 0 new readings from meter:

Wie kann ich prüfen, ob die Impulse wirklich auf GIO17/value ankommen?

@mbehr1
Copy link
Contributor

mbehr1 commented Mar 7, 2015

"device": "sys/class/gpio/gpio17/value“,

da fehlt ein „/„ -> „/sys/class/gpio/…“

Am 07.03.2015 um 20:32 schrieb Karlheinz notifications@github.com:

Innerhalb einer Min. 35MB?

Was steht denn da drin? Kannst du kurzen Auszug schicken?

wie gesagt, ständig diese Zeile:
[Mar 07 18:24:08][mtr1] Got 0 new readings from meter:

Wie kann ich prüfen, ob die Impulse wirklich auf GIO17/value ankommen?

Reply to this email directly or view it on GitHub #110 (comment).

Gruß

Matthias

@andig
Copy link
Contributor

andig commented Mar 8, 2015

Moin,

Ist es evtl sinnvoll eine regex zur Prüfung des Devices einzubauen die bei Bedarf zumindest eine Warnung ausgibt?

Viele Grüße, Andreas

Am 07.03.2015 um 22:19 schrieb Matthias Behr notifications@github.com:

"device": "sys/class/gpio/gpio17/value“,

da fehlt ein „/„ -> „/sys/class/gpio/…“

Am 07.03.2015 um 20:32 schrieb Karlheinz notifications@github.com:

Innerhalb einer Min. 35MB?

Was steht denn da drin? Kannst du kurzen Auszug schicken?

wie gesagt, ständig diese Zeile:
[Mar 07 18:24:08][mtr1] Got 0 new readings from meter:

Wie kann ich prüfen, ob die Impulse wirklich auf GIO17/value ankommen?

Reply to this email directly or view it on GitHub #110 (comment).

Gruß

Matthias


Reply to this email directly or view it on GitHub.

@mbehr1
Copy link
Contributor

mbehr1 commented Mar 8, 2015

Ja, macht Sinn. Kann ich hinzufügen. Allerdings soll der Code eigentlich eh nicht aufgenommen werden. Ich warte noch auf die eigentliche Lösung von r00t- mit generischem Ansatz.

Am 08.03.2015 um 05:04 schrieb andig notifications@github.com:

Moin,

Ist es evtl sinnvoll eine regex zur Prüfung des Devices einzubauen die bei Bedarf zumindest eine Warnung ausgibt?

Viele Grüße, Andreas

Am 07.03.2015 um 22:19 schrieb Matthias Behr notifications@github.com:

"device": "sys/class/gpio/gpio17/value“,

da fehlt ein „/„ -> „/sys/class/gpio/…“

Am 07.03.2015 um 20:32 schrieb Karlheinz notifications@github.com:

Innerhalb einer Min. 35MB?

Was steht denn da drin? Kannst du kurzen Auszug schicken?

wie gesagt, ständig diese Zeile:
[Mar 07 18:24:08][mtr1] Got 0 new readings from meter:

Wie kann ich prüfen, ob die Impulse wirklich auf GIO17/value ankommen?

Reply to this email directly or view it on GitHub #110 (comment).

Gruß

Matthias


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub #110 (comment).

Gruß

Matthias Behr

@gitka
Copy link
Contributor

gitka commented Mar 8, 2015

Ja, macht Sinn. Kann ich hinzufügen. Allerdings soll der Code
eigentlich eh nicht aufgenommen werden. Ich warte noch auf die
eigentliche Lösung von r00t- mit generischem Ansatz.

Ja, eine Prüfung auf Vorhandensein des files/port wäre hilfreich. Ich
frag mich nur, wie generisch die Lösung von root aussieht?

Anscheinend ist in meinen Einstellungen noch etwas falsch - ich erhalte
noch kein reading.
[chn2] Buffer dump (size=0): {}

In der Kombination
"daemon":false
"local":"enabled":false

sollte vzlogger im Vordergrund laufen. Hier erhalte ich folgende Meldung:
[Mar 08 13:49:55][chn2] Start logging thread for NULL-api. Running as
daemon: no
terminate called after throwing an instance of 'vz::OptionNotFoundException'
what(): Option 'middleware' not found
[Mar 08 13:49:55][mtr1] Got 0 new readings from meter:
Aborted

OK- Es läuft nur dann ohne Fehler, wenn für "middleware" etwas
eingetragen ist - auch wenn "api"=NULL

Trotzdem noch keine readings

@r00t-
Copy link
Contributor Author

r00t- commented Mar 8, 2015

i suggest to keep the structure part in the other thread:

sorry for the delay, pushed my unfinished work here:
https://github.com/r00t-/vzlogger/tree/bases0

please have a look, comment, use, or discard...
-- #85 (comment)

(please note that the code in my raspis0 branch is still working as-is,
and probably more complete than mbehr1's)

@mbehr1
Copy link
Contributor

mbehr1 commented Mar 8, 2015

Eine Prüfung auf Existenz des Files gibt es eigentlich schon:
if (fd < 0) {
print(log_error, "open(%s): %s", "", _device.c_str(), strerror(errno));
return ERR;
}

bekommst du die Warnung? (mit dem alten „sys/…“)?

Wie konfigurierst du den Pin bevor du vzlogger startest?

@Udo: kannst du die Settings noch mal schicken?

Am 08.03.2015 um 13:58 schrieb Karlheinz notifications@github.com:

Ja, macht Sinn. Kann ich hinzufügen. Allerdings soll der Code
eigentlich eh nicht aufgenommen werden. Ich warte noch auf die
eigentliche Lösung von r00t- mit generischem Ansatz.

Ja, eine Prüfung auf Vorhandensein des files/port wäre hilfreich. Ich
frag mich nur, wie generisch die Lösung von root aussieht?

Anscheinend ist in meinen Einstellungen noch etwas falsch - ich erhalte
noch kein reading.
[chn2] Buffer dump (size=0): {}

In der Kombination
"daemon":false
"local":"enabled":false

sollte vzlogger im Vordergrund laufen. Hier erhalte ich folgende Meldung:
[Mar 08 13:49:55][chn2] Start logging thread for NULL-api. Running as
daemon: no
terminate called after throwing an instance of 'vz::OptionNotFoundException'
what(): Option 'middleware' not found
[Mar 08 13:49:55][mtr1] Got 0 new readings from meter:
Aborted

OK- Es läuft nur dann ohne Fehler, wenn für "middleware" etwas
eingetragen ist - auch wenn "api"=NULL

Trotzdem noch keine readings

Reply to this email directly or view it on GitHub #110 (comment).

Gruß

Matthias

@gitka
Copy link
Contributor

gitka commented Mar 16, 2015

Eine Prüfung auf Existenz des Files gibt es eigentlich schon:
if (fd < 0) {
print(log_error, "open(%s): %s", "", _device.c_str(), strerror(errno));
return ERR;
}

bekommst du die Warnung? (mit dem alten „sys/…“)?

Nein, leider keine Warnung.
Wie konfigurierst du den Pin bevor du vzlogger startest?
s. s0vz https://github.com/w3llschmidt/s0vz: /etc/rclocal :
echo 17 > /sys/class/gpio/export && echo "rising" >
/sys/class/gpio/gpio17/edge

In welchem Zweig wird nun weiterentwickelt - mbehr oder root?

@UdoSchake
Copy link

die '/etc/vzlogger_gpio.conf' sollte folgendes beinhalten:
"meters": [{
"enabled": true, // disabled meters will be ignored
"skip": false, // if enabled, errors when opening meter will lead to meter being ignored
"protocol": "s0",
"mode": "gpio",
"aggtime": 5, // aggregate all signals and give one update to middleware every 5 seconds
"aggfixedinterval": true, // round all timestamps to middleware to nearest aggtime
"device": "/sys/class/gpio/gpio4/value",
"channel": {
"api": "volkszaehler", // default middleware api: volkszaehler.org
"identifier": "Impulse", // s0 meter knows "Impulse" and "Power"
"uuid": "deine UUID",
"middleware": "http://127.0.0.1/middleware.php",
"aggmode": "SUM" // add all s0 intervals in the aggregation
}
},

und die '/etc/rc.local' für den dazu gehörigen GPIO-Pin:
echo 4 > /sys/class/gpio/export && echo "rising" > /sys/class/gpio/gpio4/edge

Gruß
Udo

@r00t-
Copy link
Contributor Author

r00t- commented May 16, 2015

gpio is generic and not raspi specific, meter should be named accordingly.
https://www.kernel.org/doc/Documentation/gpio/sysfs.txt

@mbehr1
Copy link
Contributor

mbehr1 commented Jun 6, 2015

see #169 with a solution for this topic.

@mbehr1
Copy link
Contributor

mbehr1 commented Jul 12, 2015

can we close this issue?

@andig andig closed this as completed Jul 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants