- Based on dustmeter.
The setup will present a BACNET device with a collection of AnalogInputObjects. The AnalogInputObjects are the readout of various remote meters.
- A thermorasp that runs the server.py
- A pumpstation that runs the daemon
- A DYLOS DC1700 air quality monitor connected to a USR-TCP232-302 on TCP server mode listening at 8888 port
- python 3.4 or newer
- bacpypes 0.16
- PyQt5
pip3 install bacpypes==0.16
apt-get install python3-pyqt5
python3.4 main.py
Please make sure previous seesion of main.py have exited and relased the network port.
The configuration file is called server.cfg. It contains multiple [sections] of key = value pairs. Lines can be comments by prepending a #.
The server section is the main configuration section. It has the following configuration keys:
ip
: IP address Stringport
: IntegerobjectName
: StringvendorIdentifier
: IntegervendorName
: Stringlocation
: StringmodelName
: Stringdescription
: Stringdustmeters
: Optional, list of space seperated section namesthermorasps
: Optional, list of space seperated section namespumpstations
: Optional, list of space seperated section names
The last three keys dustmeters
, thermorasps
and pumpstations
have the value section names seperated by spaces.
Each of those section name corresponds to a configuration section of a meter to monitor.
All meter configuration sections have the following optional keys:
description
: StringdeviceType
: StringupdateInterval
: Integerresolution
: Float
A section that has been given in the value of the dustmeters key can have the following keys:
host
: String, defaults tolocalhost
port
: Integer, defaults to8888
name
: String, defaults todustMeter
default_dust
: Defaults to0
reconnect
: Bool, defaults toTrue
A section that has been given in the value of the thermorasps key can have the following keys:
host
: String, defaults tolocalhost
port
: Integer, defaults to50007
name
: String, defaults toThermoRasp
A section that has been given in the value of the pumpstations key can have the following keys:
host
: String, defaults tolocalhost
port
: Integer, defaults to63432
name
: String, defaults toPumpstation
reconnect
: Bool, defaults toFalse
To add support for another type of meter, create a new module with a new class, which inherits from meter_base.MeterBase
.
The module must be imported in the main.py
file and must be added as a value together with the configuration key it shall use to the METERS
map in main.py
.
The module needs to have a function called getMeters
, that takes a map of configuration values, which was read from the configuration file, and returns a list of new meter objects.
The new class must implement start
and join
methods, which have the functionality of those of threading.Thread
.
In addition the class has a stop
method, which gets called when monitoring is supposed to be stopped, and a getPresentValue
method to retrieve the current value.