[vz-dev] cost wird auf 0 gesetzt

Andreas Goetz cpuidle at gmail.com
Thu Aug 21 16:01:25 CEST 2014


Kennst Du https://github.com/volkszaehler/volkszaehler.org/issues/121 ?


2014-08-21 15:58 GMT+02:00 Jakob Hirsch <jh at plonk.de>:

> Andreas Goetz, 2014-08-21 13:20:
> > Jakob:
> >
> > 1) im json Output oder in der Datenbank?
>
> Beides.
>
> > 2) was erwartest Du- den alten (Zahlen)Wert oder "leer"?
>
> Äh, also cost ist der Preis pro Einheit, bei Power € pro Wh (k.A. warum
> hier nicht der quasi-Standard kWh genommen wurde). Zumindest wird's ja
> im Frontend so verwendet.
>
> > 3) welcher Kontext- entity?
>
> Hm?
>
> Hier mal ein Beispiel:
>
> 1) Neuer channel anlegen:
> > curl -s '
> http://localhost/vz/middleware.php/channel.json?operation=add&type=power&resolution=1000&title=Test
> '
> ->  ac6e83a0-2920-11e4-b652-419929a59594
>
> 2) Anschauen:
> > curl -s '
> http://localhost/vz/middleware.php/channel/ac6e83a0-2920-11e4-b652-419929a59594.json'
> | json_pp
> > {
> >    "version" : "0.3",
> >    "entity" : {
> >       "title" : "Test",
> >       "resolution" : 1000,
> >       "uuid" : "ac6e83a0-2920-11e4-b652-419929a59594",
> >       "type" : "power"
> >    }
> > }
>
> 3) cost setzen
> >  curl -s '
> http://localhost/vz/middleware.php/channel/ac6e83a0-2920-11e4-b652-419929a59594.json?operation=edit&cost=0.0002'
> | json_pp
> > {
> >    "version" : "0.3",
> >    "entity" : {
> >       "resolution" : 1000,
> >       "title" : "Test",
> >       "uuid" : "ac6e83a0-2920-11e4-b652-419929a59594",
> >       "type" : "power",
> >       "cost" : 0
> >    }
> > }
>
> 4) anschauen
> > curl -s '
> http://localhost/vz/middleware.php/channel/ac6e83a0-2920-11e4-b652-419929a59594.json'
> | json_pp
> > {
> >    "entity" : {
> >       "cost" : 0,
> >       "type" : "power",
> >       "title" : "Test",
> >       "resolution" : 1000,
> >       "uuid" : "ac6e83a0-2920-11e4-b652-419929a59594"
> >    },
> >    "version" : "0.3"
> > }
> In  der DB steht jetzt merkwürdigerweise "0,0002" (also lokales Format)
> statt "0.0002".
>
> 5) nochmal cost setzen
> >  curl -s '
> http://localhost/vz/middleware.php/channel/ac6e83a0-2920-11e4-b652-419929a59594.json?operation=edit&cost=0.0002'
> | json_pp
> > {
> >    "version" : "0.3",
> >    "entity" : {
> >       "resolution" : 1000,
> >       "type" : "power",
> >       "cost" : 0.0002,
> >       "title" : "Test",
> >       "uuid" : "ac6e83a0-2920-11e4-b652-419929a59594"
> >    }
> > }
> cost ist jetzt korrekt!
>
> 6) nochmal anschauen
> >  curl -s '
> http://localhost/vz/middleware.php/channel/ac6e83a0-2920-11e4-b652-419929a59594.json'
> | json_pp
> > {
> >    "version" : "0.3",
> >    "entity" : {
> >       "title" : "Test",
> >       "uuid" : "ac6e83a0-2920-11e4-b652-419929a59594",
> >       "resolution" : 1000,
> >       "type" : "power",
> >       "cost" : 0.0002
> >    }
> > }
> -> sieht gut aus!
>
> 7) Wert einfügen
> > curl -s -X POST '
> http://localhost/vz/middleware.php/data/ac6e83a0-2920-11e4-b652-419929a59594.json?value=1.250000
> '
>
> 8) anschauen
> > {
> >    "version" : "0.3",
> >    "entity" : {
> >       "cost" : 0,
> >       "uuid" : "ac6e83a0-2920-11e4-b652-419929a59594",
> >       "title" : "Test",
> >       "resolution" : 1000,
> >       "type" : "power"
> >    }
> > }
> -> cost ist jetzt 0, in der DB steht auch "0" drin.
>
> Ich kann jetzt cost wieder setzen, aber nach dem nächsten POST/add wird
> es wieder auf "0" gesetzt.
>
> > Tatsächlich ist die Sache ziemlich frickelig und jetzt schon x-mal
> > überarbeitet :(
>
> Hm, ok, aber bei einem data-POST sollten doch keine
> channel-Eigenschaften geändert werden, oder?
>
>
>
> Gruß
> Jakob
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://demo.volkszaehler.org/pipermail/volkszaehler-dev/attachments/20140821/85117d6d/attachment-0001.html>


More information about the volkszaehler-dev mailing list