[vz-dev] Volkszaehler with 1-wire counter (progress report)

Steffen Vogel info at steffenvogel.de
Mon Sep 19 15:59:30 CEST 2011


Hi Willy,

Am Montag, den 19.09.2011, 00:03 +0200 schrieb Willy Verbiest:
> The volkszaehler demo database is now running on my embedded PC
> (ALIX.1D).

Nice :) You might want to add your experiences to our benchmark site:
http://wiki.volkszaehler.org/development/benchmark

> I'm thinking to do the following:
> Define a cron job to run a PHP script every minute
> The PHP script will read the sensor table (1-wire temperature, 1-wire
> counter).

I would try to ommit direct access to the DB because it could create
inconsistency.

Try to use the API request:
http://localhost/volkszaehler.org/middlware.php/entity.json
This gets all public Channels (requires property &public=1)

> Going in a loop through all the sensors.
> For each sensor:
> Start a c program with parameters and get the results of one reading
> by the standard out or some other OS mechanism.
I suggest using http://digitemp.com or http://owfs.org which implement
this c program.

> Store the current time, the current value and the previous value in
> the sensor table.

Use the API ;)

> If it is set in the table then the sensor value will also be send to
> the volkszaehler database with a HTTP request.

> The 1-Wire counter is a read only 32 bit counter to get the number of
> pulses I have to take the previous counter value and the current and
> make the difference.

I would not store the last absolute value in the entity table because it
would require direct DB access. Here is a 2 smarter ways to do this:

1. Store the absolute value in a local text file and read it with PHP.

2. Every Channel has properties (title, description, resolution etc..)
which a stored in the 'properties' table and referenced with the
'entity' table.
Setting these properties is quite easy:

http://localhost/volkszaehler.org/channel/<uuid>.json?opeartion=edit&counter=1234123
(assuming 'counter' is the property)

Getting the properties is also easy:
http://localhost/volkszaehler.org/channel/<uuid>.json

The list of properties is here:
https://github.com/volkszaehler/volkszaehler.org/blob/master/lib/Definition/PropertyDefinition.json

Not every channel can has every property.
The mapping of allowed and required properties is here:
https://github.com/volkszaehler/volkszaehler.org/blob/master/lib/Definition/EntityDefinition.json

> You wrote:
> “Hint: you need to create your meter with &resolution=1000 (which
> stand for 1000 impulses/kWh = 1 Impulse/Wh)”
> 
> The meter from MBW Electronic gives 800 pulses for 1 kWh
> Is this a problem?
> Do I have to do some recalculations?

No, just use '&resolution=800'.

Good luck :)



You said that you wrote your own C program to read the counter?
Do you want to release it? Propably we could integrate it directly in
vzlogger?

gretings

Steffen

-- 
Steffen Vogel
Robensstraße 69
52070 Aachen

Handy: +49 176 96978528
Mail: info at steffenvogel.de
Web: http://www.steffenvogel.de
Jabber: stv0g at jabber.ccc.de
ICQ: 236033
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part
URL: <http://volkszaehler.org/pipermail/volkszaehler-dev/attachments/20110919/628a19cb/attachment.pgp>


More information about the volkszaehler-dev mailing list