Coder Social home page Coder Social logo

vscp-python-sensor-bme280's Introduction

vscp-python-sensor-bme280

bme280

VSCP interface to BME280 barometric sensor

Reports the temperature, pressure, sealevel pressure, humidity and dewpoint for a BME280 sensor and temperature, pressure, sea level pressure for a BMP280 sensor. The appropriate VSCP events are sent to a MQTT broker of choice.

Typically the scripts is used in a cron job to deliver the events on timed intervals.

Install

Prerequisites

The code here is dependent on the VSCP helper library. Therefore you have to install this package first. It is available for Debian type systems including Raspberry Pi. Check and download the latest version here

For convenience this is how the current version is installed on a Raaspberry Pi

wget https://github.com/grodansparadis/vscp-helper-lib/releases/download/v14.0.2/libvscphelper14_14.0.2-1_armhf.deb

wget https://github.com/grodansparadis/vscp-helper-lib/releases/download/v14.0.2/libvscphelper14-dev_14.0.2-1_armhf.deb

sudo dpkg -i ./libvscphelper14_14.0.2-1_armhf.deb
sudo dpkg -i ./libvscphelper14-dev_14.0.2-1_armhf.deb

Note that there may be [later versions available)(https://github.com/grodansparadis/vscp-helper-lib/releases) then the one downloaded above. You should always install the latest version.

It is recommended to install in a virtual environment in your current project:

git clone https://github.com/grodansparadis/vscp-python-sensor-bme680.git
cd vscp-python-sensor-bme680
python3 -m venv .env
source .env/bin/activate

You may need to install Python venv with

apt install python3-venv

if it's not installed.

Configparser

Configparser can be found on PyPi and is documented https://docs.python.org/3/library/configparser.html. Install with

pip3 install configparser

Install the smbus module

pip3 install smbus

Install VSCP modules

pyvscphelper is not needed if only MQTT should be used. You can install the modules from PyPi

pip3 install pyvscp
pip3 install pyvscphelper

If you need them on more places either go for a global install or use a virtual environment and install all the modules in it.

Install MQTT module

For MQTT functionality Paho MQTT module is needed. You can install the modules from PyPi

pip3 install paho-mqtt

Configure

You setup the code by either editing the scripts or create a configuration file with the settings. In the scripts all relevant values can be found in the beginning of the file along with documentation.

The settings are named the same in the config file as in the script itself so the documentation for the configuration file is valid also for directly adding the scripts.

To get help you can issue

mqtt-bme280.py --help

on the command line after the module is installed.

The recommended way to configure the scripts is to use a configuration file and store this file in a safe location as it contains usernames and password and in that way can protect this sensitive information. The syntax to instruct the script to read a configuration file is

mqtt-bme680.py --configure path-to-config-file

So

mqtt-bme680.py --configure /etc/vscp/bme680-config.ini

will read the configuration from /etc/vscp/bme680-config.ini

vscp-python-sensor-bme280's People

Contributors

grodansparadis avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.