python library which can talk with Voltcraft SEM6000
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Go to file
sqozz 8c372513d8 Merge branch 'master' of ssh:// 4 years ago
collectd collectd: clarify bluepy import 4 years ago
.gitignore Ignore some files in Git 4 years ago Improved handling of unavailable devices 4 years ago Adjust 4 years ago
requirements.txt Add PoC lib 5 years ago Add serial and fw version property 4 years ago

SEM6000 Python Library

SEM6000 is a energy meter and power switch with Bluetooth 4.0.

This library provides a Python module for these devices

Run the example code

$ git clone … sem6000
$ cd sem6000
$ virtualenv -p python3 python3_venv
$ . ./python3_venv/bin/activate
$ pip3 install -r requirements.txt
$ python3

Collectd Plugin

You can find a Plugin for collectd in the collectd subdirectory.

Installation procedure (the target directory may be changed of course):

# mkdir -p /usr/local/lib/collectd/python
# cp collectd/ /usr/local/lib/collectd/python
# cp /usr/local/lib/collectd/python

Add or adjust the configuration for your collectds Python plugin as follows:

<Plugin python>
  ModulePath "/usr/local/share/collectd/python"
  LogTraces true
  Interactive false
  Import "collectd_sem6000"

  <Module collectd_sem6000>
    Address "12:34:56:78:90:ab"
    SocketName "FirstSocket"
    ReadTimeout 30
    SuspendTime 300
  <Module collectd_sem6000>
    Address "ab:cd:ef:13:37:42"
    SocketName "ASecondSocket"
  # ...

ReadTimeout and SuspendTime control whats happening when a device is unavailable. If no value could be retrieved for ReadTimeout seconds, the plugin does not retry for SuspendTime seconds. After that, normal operation is resumed. This procedure ensures that an unreachable device does not block other devices (too often) in the current single-threaded architecture.

If not specified, ReadTimeout is 30 seconds and SuspendTime is 5 minutes.

Make sure that everything listed in requirements.txt is available to the user running collectd.