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
Brugeravatar
motoz
Stoker IV
Stoker IV
Indlæg: 105
Tilmeldt: 14 feb 2013 08:06
Mit fyr: BioComfort 30kW + termax 25cr
Geografisk sted: Ostrobothnia
Modtaget likes: 1 gang
Kontakt:

Raspberry Pi

Indlægaf motoz » 21 nov 2013 08:37

I didn't design pellmoncli.py to be used as a python module, only directly run as a program. If you look at the source you notice that the dbus connection stuff happens in the if __main__: clause, meaning it gets called only when run as a main program, not when importing it. Changed like this it should work also as a module:


# Connect to pellmonsrv on the dbus system bus
d = Gio.bus_get_sync(Gio.BusType.SYSTEM, None)
notify = Gio.DBusProxy.new_sync(d, 0, None, 'org.pellmon.int', '/org/pellmon/int', 'org.pellmon.int', None)

if __name__ == "__main__":


If you don't need any of the additional stuff pellmonsrv does (like data logging, email, settings/alarm monitoring) you could communicate directly with the burner from your own python program, skipping the server and dbus entirely. In the 'develop' branch I have made that a lot easier by breaking out the burner communication in its own python module 'Scotteprotocol'. After installing pellmon from develop you can just

import Scotteprotocol
p = Scotteprotocol.Protocol('/dev/ttyUSB0', 'auto')
print p.getItem('boiler_return_temp')
p.setItem('max_power', '75')

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


Juel
Stoker V
Stoker V
Indlæg: 195
Tilmeldt: 16 mar 2011 21:49
Mit fyr: Scotte m. woody chip.
Areal: 160
Brændsel: Træpiller
Fremviser gerne i postnummer: 4250
Geografisk sted: Omkring 4250 Fuglebjerg

Raspberry Pi

Indlægaf Juel » 21 nov 2013 09:13

Arhhh ok, I'm new to python, so it takes a Little while to see through codes and functions :)
Cool both ways looks good, i'll try them later today, and see what will Work best with my solution :)

Thanks Again for your help, this is gonna be great :D

Juel
Stoker V
Stoker V
Indlæg: 195
Tilmeldt: 16 mar 2011 21:49
Mit fyr: Scotte m. woody chip.
Areal: 160
Brændsel: Træpiller
Fremviser gerne i postnummer: 4250
Geografisk sted: Omkring 4250 Fuglebjerg

Raspberry Pi

Indlægaf Juel » 21 nov 2013 22:57

Hi :)

I can make some of it Work..

I can get and set, and I can turn the burner off, but i cant turn it on Again :/

p.setItem('burner_off', '0') <-- turns it off
p.setItem('burner_off', '1') <--- does nothing
p.setItem('burner_on', '0') <--- does nothing
p.setItem('burner_on', '1') <--- does nothing

How do I turn the burner on Again?

And another thing, if i run the scrip to fast after last execution i get this:

Exception in thread Thread-1 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
File "/usr/local/etc/pelletsystem/src/protocol.py", line 184, in run
File "/usr/lib/python2.7/Queue.py", line 168, in get
File "/usr/lib/python2.7/threading.py", line 237, in wait
<type 'exceptions.TypeError'>: 'NoneType' object is not callable

Is that some thread I have to close?

Juel
Stoker V
Stoker V
Indlæg: 195
Tilmeldt: 16 mar 2011 21:49
Mit fyr: Scotte m. woody chip.
Areal: 160
Brændsel: Træpiller
Fremviser gerne i postnummer: 4250
Geografisk sted: Omkring 4250 Fuglebjerg

Raspberry Pi

Indlægaf Juel » 21 nov 2013 23:28

Hehe :D It was an error 40 ;D I cant turn the burner on when it's boiler temp = my set temp ;)

p.setItem('burner_on', '0000') Works :)

But i still get the

Exception in thread Thread-1 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
File "/usr/local/etc/pelletsystem/src/protocol.py", line 184, in run
File "/usr/lib/python2.7/Queue.py", line 168, in get
File "/usr/lib/python2.7/threading.py", line 237, in wait
<type 'exceptions.TypeError'>: 'NoneType' object is not callable

Alot :/

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

Raspberry Pi

Indlægaf motoz » 22 nov 2013 19:34

Are you sure you get the error when you run the script again, and not from the 'old' script that just ended? I think it might relate to the protocol thread being set to 'daemonic' meaning that it should just be shut down when the main thread ends, the cleaner way would be to have the main thread send a 'quit' signal to it and then join it. Anyway I can't reproduce it with a simple test, but I think I have seen a similar error when breaking out of pellmonsrv with crtl-c. But that was from the 'unclean' shutdown, starting it again has always worked. If you could post a script that reproduces the error on startup it would be great.

And btw, your project sounds great! Hopefully you can share some code someday!

And btw2 did you notice the plugin framework I started in the develop branch? If you use the server it might possibly be useful for your project. The scotte communication is now an optional plugin, and there is a prototype for a raspberry gpio plugin. For now it only implements a counter on an input pin and calculates power and feeder_time from that. The idea is to extend that to whatever could be useful, onewire support is one thing and maybe a separate plugin for some kind of programmable automations / alarms.
PellMon open source pellet logger at https://github.com/motoz/PellMon


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

Raspberry Pi

Indlægaf motoz » 05 dec 2013 09:18

What will be the best way to make custom alarms? should I just dive into learning python?

PellMon now has a plugin called 'CustomAlarms'. When the plugin is enabled in the config file you can add as many alarms as you want for any data value. Initial values for the alarms are set in the config file, and they can be changed from the 'parameters' page in the webinterface and in the command line interface. When the alarm state is changed an event is added to the log, and if configured for alarms an email is also sent.
Billede

Next I'm thinking of adding a plugin that does some kind of easily configurable calculations and actions. Any ideas for what should be possible to do with it?
PellMon open source pellet logger at https://github.com/motoz/PellMon

Juel
Stoker V
Stoker V
Indlæg: 195
Tilmeldt: 16 mar 2011 21:49
Mit fyr: Scotte m. woody chip.
Areal: 160
Brændsel: Træpiller
Fremviser gerne i postnummer: 4250
Geografisk sted: Omkring 4250 Fuglebjerg

Raspberry Pi

Indlægaf Juel » 05 dec 2013 09:45

Hi :)

Sorry for my late reply, i havent had any time for my project :( But the other day I layed out the wires in the house, so im getting there :)
Im using the python module 'Scotteprotocol' to communicate with the pelletburner, and it Works.

WOW that new plugin sounds nice! im going to install that, hopefully today :) Ihave also been thinking about the calculation part, I was looking into make a outside temp to pelletuse calculation :) Something like the average temp for one day and connect it to that days pelletuse :)

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

Raspberry Pi

Indlægaf motoz » 09 dec 2013 10:24

Hello again, I had some time to kill on a train trip so I hacked up a new plugin: 'Calculate'
This lets you add new data items that executes a simple 'program' to calculate it's value when read. The 'programming language' (so to speak...) is very simple. Any given value is pushed to a last-in-first-out stack, and an operator pops one or several values from the stack and then pushes the result back. The result of the calculation is whatever is left on the stack after the calculation is ready. For instance this:
boiler_temp;GET;2;DIV
will return the boiler temperature divided by two. The 'program' is set in the config file, and can be changed from the web interface and from the command line interface. Supported 'operators': ADD, SUB, MUL, DIV, GET, SET, EXEC, >, <, ==, !=, IF, POP. Some documentation is in the config file.

Hopefully this can be of some use, it was at least fun to make!
PellMon open source pellet logger at https://github.com/motoz/PellMon

Juel
Stoker V
Stoker V
Indlæg: 195
Tilmeldt: 16 mar 2011 21:49
Mit fyr: Scotte m. woody chip.
Areal: 160
Brændsel: Træpiller
Fremviser gerne i postnummer: 4250
Geografisk sted: Omkring 4250 Fuglebjerg

Raspberry Pi

Indlægaf Juel » 09 dec 2013 10:38

Nice :) I have not upgraded my version yet, im still doing some cabeling, so I can move my RPi for the furnace room, to my house. I really hope i can test all your new functions by this week, i cant wait to test everything out :) I still think it would be fun to calculate the pellet use from outside temp :)

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

Raspberry Pi

Indlægaf motoz » 23 dec 2013 08:37

The newest addition to PellMon is a simple plugin that connects to owfs to give read access to an "unlimited" number of onewire devices (eg. temperature sensors). Tested only with the owfs 'fake adapter', since I don't have any onewire hardware (yet).
PellMon open source pellet logger at https://github.com/motoz/PellMon



Tilbage til "Woody Pillefyr"

Hvem er online

Brugere der læser dette forum: Ingen og 0 gæster