Har du lyst til at støtte Stoker Pro? Læs mere her: Støt Stoker Pro Forum

Raspberry Pi

Spørgsmål vedr. Woody samt det tilbehør der laves til Woody pillefyret
Besvar
sandr
Stoker I
Stoker I
Indlæg: 16
Tilmeldt: 26 jul 2012 21:53

Raspberry Pi

Indlæg af sandr » 25 feb 2013 17:18

Hi Anders "motoz"
I'm trying to get your code working, but so far without any success.
Maybe I'm doing something wrong.
Installed the files index.html & parameters.html in /var/www, and index.html & jquery-1.4.2.min.js in /var/www/media.
Installed the rest of the files from github under /home/pi/pellmon. changed owner to pi:pi on all files under ~pi/pellmon.

Ran the command: pellmonsrv.py start

Got these lines in pellmon.log:
2013-02-25 17:11:59,268 - INFO - Chip version: 6.78
2013-02-25 17:12:05,557 - INFO - loglevel: info
2013-02-25 17:12:07,793 - INFO - serial port ok
2013-02-25 17:12:07,890 - INFO - Chip version: 6.78
2013-02-25 17:12:08,106 - INFO - starting pelletMonitor
2013-02-25 17:12:08,196 - INFO - created signalhandler
2013-02-25 17:12:08,202 - INFO - started timer

So it seems like the program is communicating with my pellet-controller.

But then I'm stock !!

According to the READ.ME file is the rrd-database file supposed to be created automatically, but I do not get this file in the path sepcified.

Any hints how to continue?

BR
Steen


Brugeravatar
motoz
Stoker IV
Stoker IV
Indlæg: 124
Tilmeldt: 14 feb 2013 08:06
Mit fyr: BioComfort 30kW + termax 25cr
Geografisk sted: Ostrobothnia
Modtaget likes: 11 gange
Kontakt:

Raspberry Pi

Indlæg af motoz » 25 feb 2013 17:47

Hello, nice that are trying it out.
Just copy the whole thing to /home/pi/pellmon and start the communication daemon with ./pellmonsrv.py start (as you already did)
Then you start the webserver from the same place by running ./pellmonwebb.py
The webserver does not run as a daemon (yet...) so it won't return to the prompt. You can stop it with ctrl-C.
The webpages are served on port 8081 by default (you can change that in pellmon.conf), so go to http://ip-of-your-raspberrypi:8081 with your browser, or http://localhost:8081 if you are running the browser on your raspberry.
Or you can use the command line client by running ./pellmoncli.py
You get a prompt:
>
Then you can use tab completion to find out what you can do
eg:
>g [tab]
prints:
>get
then:
>get [tab][tab]
lists all parameters
>get version
should return your chip version when it works...
>quit
will quit...

Oh, just noticed I have removed the code that creates the RRD database if it does not exist already, by mistake. Consider yourself to be the first to report a bug for pellMon! Thanks!


/AN
PellMon open source pellet logger at https://github.com/motoz/PellMon

Brugeravatar
motoz
Stoker IV
Stoker IV
Indlæg: 124
Tilmeldt: 14 feb 2013 08:06
Mit fyr: BioComfort 30kW + termax 25cr
Geografisk sted: Ostrobothnia
Modtaget likes: 11 gange
Kontakt:

Raspberry Pi

Indlæg af motoz » 25 feb 2013 18:03

PellMon open source pellet logger at https://github.com/motoz/PellMon

sandr
Stoker I
Stoker I
Indlæg: 16
Tilmeldt: 26 jul 2012 21:53

Raspberry Pi

Indlæg af sandr » 25 feb 2013 18:28

Hi Anders.
One step forward :-)

Now I got the RRD-database.

And the pellmoncli.py program is not less than genius !!

But I still have some trouble with the web-part.
I'm getting this error in my browser-window:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 656, in respond
response.body = self.handler()
File "/usr/lib/python2.7/dist-packages/cherrypy/lib/encoding.py", line 188, in __call__
self.body = self.oldhandler(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/cherrypy/_cpdispatch.py", line 34, in __call__
return self.callable(*self.args, **self.kwargs)
File "./pellmonwebb.py", line 206, in index
tmpl = lookup.get_template("index.html")
File "/usr/lib/python2.7/dist-packages/mako/lookup.py", line 239, in get_template
"Cant locate template for uri %r" % uri)
TopLevelLookupException: Cant locate template for uri 'index.html'

And I get this error on my RPI:

ACCEPT: text/html, application/xhtml+xml, */*
USER-AGENT: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
ACCEPT-LANGUAGE: da-DK
ACCEPT-ENCODING: gzip, deflate
[25/Feb/2013:18:26:15] HTTP Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 656, in re spond
response.body = self.handler()
File "/usr/lib/python2.7/dist-packages/cherrypy/lib/encoding.py", line 188, in __call__
self.body = self.oldhandler(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/cherrypy/_cpdispatch.py", line 34, in __ call__
return self.callable(*self.args, **self.kwargs)
File "./pellmonwebb.py", line 206, in index
tmpl = lookup.get_template("index.html")
File "/usr/lib/python2.7/dist-packages/mako/lookup.py", line 239, in get_templa te
"Cant locate template for uri %r" % uri)
TopLevelLookupException: Cant locate template for uri 'index.html'

192.168.0.197 - - [25/Feb/2013:18:26:15] "GET / HTTP/1.1" 500 1528 "" "Mozilla/5. 0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"


BR
Steen

Brugeravatar
motoz
Stoker IV
Stoker IV
Indlæg: 124
Tilmeldt: 14 feb 2013 08:06
Mit fyr: BioComfort 30kW + termax 25cr
Geografisk sted: Ostrobothnia
Modtaget likes: 11 gange
Kontakt:

Raspberry Pi

Indlæg af motoz » 25 feb 2013 18:32

Do you have the index.html file in "/home/pi/pellmon/html/" ?
And, check that you installed python-cherrypy3, and not python-cherrypy by mistake,
Python-cherrypy is an older version of the cherrypy webframework, I have not used that and it will probably not work.

Edit: Just checked, I get the exact same error msg by removing the pellmon/html folder, so that is probably it. The html and media folders should be in the pellmon folder, with their contents.
PellMon open source pellet logger at https://github.com/motoz/PellMon


sandr
Stoker I
Stoker I
Indlæg: 16
Tilmeldt: 26 jul 2012 21:53

Raspberry Pi

Indlæg af sandr » 25 feb 2013 19:12

Hi again.

Yeps, got the python-cherrypy3 installed.

The mistake was, that index.html was not under ~pi/pellmon/html/ but under ~pi/pellmon/

I think the serverpart, and specially the client is excellent, but I don't really understand why you'r running a python webserver. Why not use nginx or apache on the Rasperry Pi, and then use some javascript-code & html5 to let the browser parse and create the graphs from rrd-data? Then RPI do not use a lot of power creating the graphs.
And it's possible to zoom-in etc on the browser.
Have a look here: http://thule.mine.nu/html/about.html

peterfarsinsen
Stoker V
Stoker V
Indlæg: 167
Tilmeldt: 30 jan 2012 21:22
Mit fyr: Woody 10kw
Areal: 165
Brændsel: Træpiller
Fremviser gerne i postnummer: 9280
Årligt forbrug: ~6 ton
Geografisk sted: Sejlflod, Nordjylland

Raspberry Pi

Indlæg af peterfarsinsen » 25 feb 2013 19:32

Nice to see that work is progressing on your app!

The sequential parameter loading is a bit clunky, but it's nice not to have to 'get' the current value manually :) Maybe the web server could send back parameters in bulk?

I'm a huge fan of interactive graphs too and just found this: http://javascriptrrd.sourceforge.net/ Looks pretty nice imho. I'll have a look at implementing it if I find the time this week.
Woody 10Kw, BS20, etc., etc.
http://peterfarsinsen.stokerlog.dk

Brugeravatar
motoz
Stoker IV
Stoker IV
Indlæg: 124
Tilmeldt: 14 feb 2013 08:06
Mit fyr: BioComfort 30kW + termax 25cr
Geografisk sted: Ostrobothnia
Modtaget likes: 11 gange
Kontakt:

Raspberry Pi

Indlæg af motoz » 25 feb 2013 19:49

Nice that you got it working.

There is just one explanation to why I used a python webserver, and that is because I have been meaning to learn python for several years but have not found enough inspiration to start. You really need to have a goal you want to achieve, to be able to learn the tool. So this project is my goal to be able to learn a new very useful tool, which is python. And you need to have a server side programming language anyway, so why not python? By the way, you can run a cherrypy webapp on top of eg. apache just fine, it's just that it doesn't require apache to work so in a way it's much easier to get started.

Client side rendering of the graph is on my "list", rrdtool is just a natural way to get started with almost zero effort. I have checked out "Flot" a bit, that seems to fit quite nicely. If you are interested I will most definitely accept patches!

peterfarsinsen: Nice find, I didn't know about that. Clunky... icon_cheesygrin.gif well, I guess you found out already that this is very much "my-first-javascript". Anyway, I thought that it verified nicely that the daemon works as intended, you can feed it with hundreds of read requests and it serializes them and responds correctly to each request when the data is ready.
PellMon open source pellet logger at https://github.com/motoz/PellMon

sandr
Stoker I
Stoker I
Indlæg: 16
Tilmeldt: 26 jul 2012 21:53

Raspberry Pi

Indlæg af sandr » 26 feb 2013 12:31

I have very limited knowledge of python, so I need some help.
I would like to see my flow and my boiler return temperature on the graphs as well.
I can see, that the Z060000 dataset is defined, but it seems like it is not used by pellmonsrv, since I'm not able to get these values from pellmoncli.py
How do I include these values?

BR
Steen

sandr
Stoker I
Stoker I
Indlæg: 16
Tilmeldt: 26 jul 2012 21:53

Raspberry Pi

Indlæg af sandr » 26 feb 2013 14:13

Ok managed to include flow, boiler_temp_return & feeder_capacity in the data collection by adding these 3 lines to pellmonsrv.py:
'boiler_temp_return': { ('6.03','zzzz') : data (FrameZ06, 0, 0) },
'flow': { ('6.03','zzzz') : data (FrameZ06, 4, 0) },
'feeder_capacity': { ('0000','zzzz') : data (FrameZ00, 12, 0) },

BR
Steen


Besvar