Forfatter Emne: PellMon på Raspberry  (Læst 191942 gange)

0 Medlemmer og 1 Gæst læser dette emne.

Offline motoz

  • Top of the pop
  • *****
  • Indlæg: 255
  • Respekt optjent: +18/-0
Sv: PellMon på Raspberry
« Svar #90 Dato: Dec 29, 2014, 07:17 »
Hello Clausj,

There are several ways to extend the functionality of PellMon.
1. Use the build in 'Calculate' plugin. A 'Calculate' script can read/write all parameters and can be set up to execute cyclically.
2. Call the command line utility pellmoncli from a shell script or cron job (or mostly any other language). Pellmoncli can read/write all parameters.
3. Use the DBUS interface. With the DBUS interface you can read and write all parameters and also listen for changes.
4. The web 'api' is not that well thought out for 'external' use but you can eg. read parameter values in json from eg. http://pellmonIP:8081/getparamlist/mode,version,boiler_temp
5. Make a new plugin. The plugin interface gives you access to everything without modifying PellMon code, but the plugin could possibly brake with future versions of PellMon if things you depend on are changed.
6. Modify PellMon directly to do what you want. No limits but upgrading can be lots of work.

Which way is most suitable depends very much on what you want to do. #1 is quick and easy for very simple stuff. #2 is a good way if you are familiar with another language. #3 could be a good way if you happen to know your way around DBUS already. #4 is very limited and likely to change in future versions.

If you end up writing a new plugin, you should start by setting up some kind of development environment, meaning you should be able to run your code without first installing it, and also run it in the foreground (not in daemon mode) so you can see error messages.  You can get by with doing everything on a raspberry over putty, but it's much easier to develop on a linux pc (or a virtual pc with linux). Have you tried running pellmon directly from the source checkout without installing it? The wiki text 'contributing to pellmon' covers some use cases. Basically when you have a new plugin you activate it in the config file and start pellmonsrv in debug mode to be able to see error messages. The most simple way to debug is to add lots of 'print' statements to your code and watch the output.

Bio Comfort 30kW, compressor cleaning, lambda. Termax 25cr boiler. Matene vertical pellet conveyor. PellMon open source pellet logger: https://github.com/motoz/PellMon

Offline Clausj

  • Begynder
  • *
  • Indlæg: 11
  • Respekt optjent: +0/-0
Sv: PellMon på Raspberry
« Svar #91 Dato: Dec 29, 2014, 09:47 »
Hi Motoz,

Thank you for your reply.

I think i will go for the Command line or DBUS solution.
I don't have knowledge about DBUS, but I will do some reading to see if that could be the best solution.

I thought the new plugin was the way to go, but as you say it could cause problems when upgrading Pellmon.

I will do some more investigation and possibly give an update in the forum, when I start to get some Progress on my project.
Mvh. Claus

Scotte brænder med NBE styring V.7 på en Dor 16 kedel.
Vacuum solfanger 30 rørs med 300 l. VVB.

Offline motoz

  • Top of the pop
  • *****
  • Indlæg: 255
  • Respekt optjent: +18/-0
Sv: PellMon på Raspberry
« Svar #92 Dato: Mar 04, 2015, 09:01 »
The 'develop' branch of PellMon now has a completely configurable frontpage where every element (widget) can be freely placed or removed. For instance this config creates a frontpage matching the old hardcoded one:

Kode: [Vælg]
# Select which widgets are displayed on the frontpage
[frontpage_widgets]
row_1 = systemimage,events
row_2 = graph
row_3 = consumption24h,silolevel

Some 'widgets' are build in (systemimage, events, graph) and some are supplied by plugins (silolevel, consumption24h, consumption7d, consumption8w, consumption1y). Since plugins now can supply new 'widgets' the door is open for new and interesting plugins, like for instance solar panel energy monitoring or electricity monitoring. Could be a while before this ends up in 'master', but please go ahead and try the develop version if you are interested.
Bio Comfort 30kW, compressor cleaning, lambda. Termax 25cr boiler. Matene vertical pellet conveyor. PellMon open source pellet logger: https://github.com/motoz/PellMon

Offline khe

  • Begynder
  • *
  • Indlæg: 14
  • Respekt optjent: +1/-0
Sv: PellMon på Raspberry
« Svar #93 Dato: Apr 06, 2015, 15:58 »
Så fik jeg sgisme også klasket en RPi på fyret, efter længe at have ville skifte styringen ud med en nyere, for netop at have muligheden for bla at kunne lave en bedre styring i overgangen mellem sommer og vinter, og få en alarm hvis skidtet af en eller anden årsag skulle dø ud. Jeg er ovenud imponeret over hvad man kan udrette, men det kræver en lille smule nørden i fyrrummet og ved computeren, for at tweake til de man (måske) ønsker - men mulighederne er der! Jeg har den tudse gamle styring med 4 LED segmenter (tror den hedder v1), med en 4.99F chip i, og det hele spillede med det samme, helt uden hokus-pokus.  O0

Jeg er sikker på at der kommer en masse spørgsmål hen ad vejen fra min side, da jeg bestemt er novice inden for Linux, men må så også sige, at jeg er imponeret over den support Motoz giver her på siden, og den hjælp andre brugere herinde giver, for at vi sammen kan få en logger der kan tilpasses os alle  ;D

Til dem der tøver - sæt i gang! Det er slet ikke så svært, og der er masser af hjælp at hente med opsætningen. En RPi, en USB til RS232, og så er man stort set i gang  ;)

/Kristian
1st gen 16KW Scotte med v4.99 chip, 24KW DOR kedel, PellMon logger på RPi

Offline motoz

  • Top of the pop
  • *****
  • Indlæg: 255
  • Respekt optjent: +18/-0
Sv: PellMon på Raspberry
« Svar #94 Dato: Apr 09, 2015, 08:47 »
Great, I'm glad you find it useful! You are the first PellMon user with a 4.x box that I know of so it's nice to know that it works as intended. Just ask if there is anything.
Bio Comfort 30kW, compressor cleaning, lambda. Termax 25cr boiler. Matene vertical pellet conveyor. PellMon open source pellet logger: https://github.com/motoz/PellMon

Offline khe

  • Begynder
  • *
  • Indlæg: 14
  • Respekt optjent: +1/-0
Sv: PellMon på Raspberry
« Svar #95 Dato: Apr 16, 2015, 14:23 »
Great, I'm glad you find it useful! You are the first PellMon user with a 4.x box that I know of so it's nice to know that it works as intended. Just ask if there is anything.

Hi Motoz!

I am really happy with the solution, and it is nice and easy to setup :-)

My box was not prepared for serial interface, so at first I had to insert a MAX232 capable chip, before I could communicate with it - afterwards it was a piece of cake, to install the PellMon/RPi interface  :D

I would really like to change the descriptions/text on the webpages that PellMon uses, but as I'm not the Linux-Superuser (never had used Linux at all before), I can't figure out where the files are placed - can You please help me sort it out??

Thank You, for the great work developing PellMon!  :D

Regards Kristian.
« Senest Redigeret: Apr 16, 2015, 14:25 af khe »
1st gen 16KW Scotte med v4.99 chip, 24KW DOR kedel, PellMon logger på RPi

Offline motoz

  • Top of the pop
  • *****
  • Indlæg: 255
  • Respekt optjent: +18/-0
Sv: PellMon på Raspberry
« Svar #96 Dato: Apr 16, 2015, 18:57 »
Wow, thats a super tidy installation, my own raspberry bows it's head in shame right now where it sits on a shelf half buried in a tangle of cables with the box half open...

All 'parameters' in pellmon are supplied by a 'plugin', of which there are several installed and activated by default. I guess you mean the 'scotte' parameters, they are handled by a plugin called 'ScotteCom'. The names and descriptions for the 'scotte' parameters are all in the file src/Pellmonsrv/plugins/scottecom/descriptions.py in a structure like this:

Kode: [Vælg]
dataDescriptions = { #name, unit, description
    'magazine_content': ('magazine content', 'kg', 'Calculated magazine content'),
    'power': ('power', '%', 'Modulated power level'),
    'power_kW': ('power kW', 'kW', 'Calculated power level'),

where for every parameter you have
    'ID': ('visual name', 'unit', 'longer description text'),

You can edit these (just not the ID, that needs to stay as it is) as you like and then install it as usual then it will be moved into the correct place, or you can edit the installed file directly at /usr/local/lib/Pellmonsrv/plugins/scottecom/descriptions.py (since it is an interpreted language the source files are executable). Of course installing a new version of PellMon will overwrite these changes so you need to keep track of them and redo the changes. (Using the GIT version management system really helps but it can be hard to get started with)

Other parameters comes from other plugins which mostly consists of just a single file called __init__.py, eg the SiloLevel plugin defines a couple of parameters like this in /src/Pellmonsrv/plugins/silolevel/__init__.py:

Kode: [Vælg]
itemList=[{'name':'silo_reset_level',  'longname':'Silo fill up level',
           'type':'R/W',   'unit':'kg'   ,   'value':'0', 'min':'0', 'max':'50000'},
          {'name':'silo_reset_time',   'longname':'Silo fill up time',
           'type':'R/W',   'unit':''    ,   'value':'01/01/14 12:00', 'min':'0', 'max':'-'},
...

itemDescriptions = {'silo_reset_level':     'Silo fill up to this amount',
                    'silo_reset_time' :     'dd/mm/yy hh:mm Automatically set when setting fill up level',
...

The html templates for the webpages are in src/Pellmonweb/html, but the texts defined there are mostly some headlines, and I'm about to move most of that to the plugin system also.

Hope this helps, just ask if you need more pointers / help.

...I suppose PellMon should really have some support for language translations by now, I did not give that much thought when I started as there were only one user then...
« Senest Redigeret: Apr 16, 2015, 18:58 af motoz »
Bio Comfort 30kW, compressor cleaning, lambda. Termax 25cr boiler. Matene vertical pellet conveyor. PellMon open source pellet logger: https://github.com/motoz/PellMon

Offline khe

  • Begynder
  • *
  • Indlæg: 14
  • Respekt optjent: +1/-0
Sv: PellMon på Raspberry
« Svar #97 Dato: Apr 16, 2015, 20:54 »
Thank You very much for Your reply, Motoz.

I will see if I can get the time, to dig into the files in the weekend :-)

/Kristian

1st gen 16KW Scotte med v4.99 chip, 24KW DOR kedel, PellMon logger på RPi

Offline khe

  • Begynder
  • *
  • Indlæg: 14
  • Respekt optjent: +1/-0
Sv: PellMon på Raspberry
« Svar #98 Dato: Okt 15, 2015, 07:58 »
Nogen der vil sende deres opsætning af fungerende SMTP konfiguration til Gmail (uden personlige oplysninger, naturligvis!)???
Jeg har lige siddet og nørdet lidt med det Motoz har nævnt på side 1, men kan ikke rigtigt finde hoved og hale i, hvor jeg skal redigere i filen, og om hvorvidt paranteserne skal slettes, eller ej...

/Kristian.
1st gen 16KW Scotte med v4.99 chip, 24KW DOR kedel, PellMon logger på RPi

Offline motoz

  • Top of the pop
  • *****
  • Indlæg: 255
  • Respekt optjent: +18/-0
Sv: PellMon på Raspberry
« Svar #99 Dato: Okt 15, 2015, 09:22 »
Hello,
check this out: https://github.com/motoz/PellMon/wiki/Gmail-and-PellMon

The stuff on page one was to test out email with a provider that doest not support TLS, and instead used the older SSL method. This is already included in pellmon since a long time and is not needed with GMail anyway. But google does not like TLS anymore either, they want everything to go through their webinterface (to be able to show ads one might presume...), so you probably have to enable TLS in the GMail settings (or 'less secure applications' as they like to call it...)
« Senest Redigeret: Okt 15, 2015, 09:31 af motoz »
Bio Comfort 30kW, compressor cleaning, lambda. Termax 25cr boiler. Matene vertical pellet conveyor. PellMon open source pellet logger: https://github.com/motoz/PellMon

Offline khe

  • Begynder
  • *
  • Indlæg: 14
  • Respekt optjent: +1/-0
Sv: PellMon på Raspberry
« Svar #100 Dato: Okt 15, 2015, 15:05 »
Tnx for Your quick answer, Motoz :-)

I had found that info in the Wiki, but was a bit confused over, where to put the strings???

Is it just anywhere in the pellmonsrv.py???
1st gen 16KW Scotte med v4.99 chip, 24KW DOR kedel, PellMon logger på RPi

Offline motoz

  • Top of the pop
  • *****
  • Indlæg: 255
  • Respekt optjent: +18/-0
Sv: PellMon på Raspberry
« Svar #101 Dato: Okt 15, 2015, 15:53 »
Now I'm confused... If you still mean the stuff on page one in this thread, then yes that would go into pellmonsrv.py, but it is already there since a long time ago.

To activate email notifications you only have to add the settings found in the wiki page to your configuration file at /etc/pellmon/pellmon.conf where pellmon has all of it's settings.

The strings are already there, you just need to find them (look towards the end of the file),
https://github.com/motoz/PellMon/blob/d84ee73b65913e7f954c49d4b633f0044cc6c91f/src/pellmon.conf.in#L243
remove the '#' comment mark from the beginning of the needed strings and change them as in the wiki example, then restart to activate the change. (And also change the 'less secure...' settings in your GMail settings)


« Senest Redigeret: Okt 15, 2015, 15:54 af motoz »
Bio Comfort 30kW, compressor cleaning, lambda. Termax 25cr boiler. Matene vertical pellet conveyor. PellMon open source pellet logger: https://github.com/motoz/PellMon

Offline khe

  • Begynder
  • *
  • Indlæg: 14
  • Respekt optjent: +1/-0
Sv: PellMon på Raspberry
« Svar #102 Dato: Okt 16, 2015, 08:13 »
Ahh :-)

It's working 100% - thanks a lot!  ;)
1st gen 16KW Scotte med v4.99 chip, 24KW DOR kedel, PellMon logger på RPi

Offline khe

  • Begynder
  • *
  • Indlæg: 14
  • Respekt optjent: +1/-0
Sv: PellMon på Raspberry
« Svar #103 Dato: Okt 16, 2015, 08:25 »
Hi Motoz...

For getting an notification on silolevel, this should work, right???

alarm1_item = SiloLevel
alarm1_comparator = <
alarm1_level = 32
alarm1_status = SiloLevel
alarm1_enum = OK|SiloLevel - Refill needed!
1st gen 16KW Scotte med v4.99 chip, 24KW DOR kedel, PellMon logger på RPi

Offline motoz

  • Top of the pop
  • *****
  • Indlæg: 255
  • Respekt optjent: +18/-0
Sv: PellMon på Raspberry
« Svar #104 Dato: Okt 16, 2015, 09:29 »
Not quite, you need to use the 'id' of the parameter you compare with, not the label. In this case 'silo_level'.
Every parameter has an 'id', and optionally a label and a description. You can see the 'id' by clicking on the parameter in the parameters page, then it opens like this:
Citér
Silo Level
id: silo_level
Remaining amount of pellets in silo

Kode: [Vælg]
alarm1_item = silo_level
alarm1_comparator = <
alarm1_level = 32
alarm1_status = SiloLevel
alarm1_enum = OK|SiloLevel - Refill needed!

The 'alarm1_status' is for creating a new item to holds the status of the comparision. You can use 'SiloLevel' since there is no item with that id already existing, it has to be something unique. You will then get a parameter named 'SiloLevel' that reads '0' when the comparition is false and '1' when the comparition is true.

Note that if you have a new enough version of pellmon you can also set the alarm on the remaining days instead of the remaining amount of pellet.



The calculation is based on the current consumption, such that when there is less than about a month left it's calculated from last weeks mean consumption, when there is more than that it is calculated from last moths consumption weighted according to a 'standard' monthly distribution of pellet consumption over a year, and finally if you have been using PellMon for over a year it then replays last years consumption forward in time to find out when the hopper becomes empty. The last one gives a very accurate estimate even when filling up a big silo for the whole year.

You also get a silo level graph covering the 'future':
« Senest Redigeret: Okt 16, 2015, 09:35 af motoz »
Bio Comfort 30kW, compressor cleaning, lambda. Termax 25cr boiler. Matene vertical pellet conveyor. PellMon open source pellet logger: https://github.com/motoz/PellMon