Development of the BERadio RFM-to-MQTT gateway software

Hey,

i would like to use the LinkIt Smart 7688 Duo as gateway and data forwarder to let data converge from the radio to the MQTT bus. I am currently running a recent version of LEDE on it.

I installed python-pip, but the installation of BERadio does not work.
This is the Stacktrace:

root@LEDE:/# pip install -v --index-url=https://packages.hiveeyes.org/hiveeyes/python/eggs/ beradio
Collecting beradio
  1 location(s) to search for versions of beradio:
  * https://packages.hiveeyes.org/hiveeyes/python/eggs/beradio/
  Getting page https://packages.hiveeyes.org/hiveeyes/python/eggs/beradio/
  Looking up "https://packages.hiveeyes.org/hiveeyes/python/eggs/beradio/" in the cache
  No cache entry available
  Starting new HTTPS connection (1): packages.hiveeyes.org
  "GET /hiveeyes/python/eggs/beradio/ HTTP/1.1" 200 None
  Updating cache with response from "https://packages.hiveeyes.org/hiveeyes/python/eggs/beradio/"
  Analyzing links from page https://packages.hiveeyes.org/hiveeyes/python/eggs/beradio/
    Skipping link https://packages.hiveeyes.org/hiveeyes/python/eggs/ (from https://packages.hiveeyes.org/hiveeyes/python/eggs/beradio/); not a file
    Found link https://packages.hiveeyes.org/hiveeyes/python/eggs/beradio/beradio-0.4.4.tar.gz (from https://packages.hiveeyes.org/hiveeyes/python/eggs/beradio/), version: 0.4.4
    Found link https://packages.hiveeyes.org/hiveeyes/python/eggs/beradio/beradio-0.5.0.tar.gz (from https://packages.hiveeyes.org/hiveeyes/python/eggs/beradio/), version: 0.5.0
    Found link https://packages.hiveeyes.org/hiveeyes/python/eggs/beradio/beradio-0.6.0.tar.gz (from https://packages.hiveeyes.org/hiveeyes/python/eggs/beradio/), version: 0.6.0
    Found link https://packages.hiveeyes.org/hiveeyes/python/eggs/beradio/beradio-0.7.0.tar.gz (from https://packages.hiveeyes.org/hiveeyes/python/eggs/beradio/), version: 0.7.0
    Found link https://packages.hiveeyes.org/hiveeyes/python/eggs/beradio/beradio-0.8.0.tar.gz (from https://packages.hiveeyes.org/hiveeyes/python/eggs/beradio/), version: 0.8.0
  Using version 0.8.0 (newest of versions: 0.4.4, 0.5.0, 0.6.0, 0.7.0, 0.8.0)
  Looking up "https://packages.hiveeyes.org/hiveeyes/python/eggs/beradio/beradio-0.8.0.tar.gz" in the cache
  Current age based on date: 67
  "GET /hiveeyes/python/eggs/beradio/beradio-0.8.0.tar.gz HTTP/1.1" 304 0
  Using cached https://packages.hiveeyes.org/hiveeyes/python/eggs/beradio/beradio-0.8.0.tar.gz
  Downloading from URL https://packages.hiveeyes.org/hiveeyes/python/eggs/beradio/beradio-0.8.0.tar.gz (from https://packages.hiveeyes.org/hiveeyes/python/eggs/beradio/)
  Running setup.py (path:/tmp/pip-build-1gZhDi/beradio/setup.py) egg_info for package beradio
    Running command python setup.py egg_info
    /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'entry_points'
      warnings.warn(msg)
    /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'include_package_data'
      warnings.warn(msg)
    /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
      warnings.warn(msg)
    /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'zip_safe'
      warnings.warn(msg)
    /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'test_suite'
      warnings.warn(msg)
    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: -c --help [cmd1 cmd2 ...]
       or: -c --help-commands
       or: -c cmd --help

    error: invalid command 'egg_info'
Cleaning up...
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-1gZhDi/beradio/
Exception information:
Traceback (most recent call last):
  File "/tmp/pip-build-R0GTLf/pip/pip/basecommand.py", line 215, in main
  File "/tmp/pip-build-R0GTLf/pip/pip/commands/install.py", line 324, in run
  File "/tmp/pip-build-R0GTLf/pip/pip/req/req_set.py", line 380, in prepare_files
  File "/tmp/pip-build-R0GTLf/pip/pip/req/req_set.py", line 634, in _prepare_file
  File "/tmp/pip-build-R0GTLf/pip/pip/req/req_set.py", line 129, in prep_for_dist
  File "/tmp/pip-build-R0GTLf/pip/pip/req/req_install.py", line 439, in run_egg_info
  File "/tmp/pip-build-R0GTLf/pip/pip/utils/__init__.py", line 707, in call_subprocess
InstallationError: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-1gZhDi/beradio/

@Andreas do you have Ideas, why i get this error?

thanks a bunch. See you

1 Like

Hi there,

thanks for reporting this! We just updated the setup documentation:

Please try:

pip install --extra-index-url=https://packages.hiveeyes.org/hiveeyes/python/eggs/ beradio

Hopefully, everything will be fine with that.

Cheers,
Andreas.

Hey,

thanks for your help, but it didn’t fix the problem. Same output.

I see, it’s this error:

error: invalid command 'egg_info'

This will fix it:

pip install --upgrade setuptools

See also:

Thanks, this worked! Now, the installation shows further progress, but still croaks when cleaning up:

Cleaning up...
  Removing source in /tmp/pip-build-RAOI9B/beradio
  Removing source in /tmp/pip-build-RAOI9B/json-store
Exception:
Traceback (most recent call last):
  File "/tmp/pip-build-R0GTLf/pip/pip/basecommand.py", line 215, in main
  File "/tmp/pip-build-R0GTLf/pip/pip/commands/install.py", line 342, in run
  File "/tmp/pip-build-R0GTLf/pip/pip/req/req_set.py", line 784, in install
  File "/tmp/pip-build-R0GTLf/pip/pip/req/req_install.py", line 851, in install
  File "/tmp/pip-build-R0GTLf/pip/pip/req/req_install.py", line 1064, in move_wheel_files
  File "/tmp/pip-build-R0GTLf/pip/pip/wheel.py", line 247, in move_wheel_files
  File "/tmp/pip-build-R0GTLf/pip/pip/locations.py", line 140, in distutils_scheme
  File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 321, in __init__
    _Distribution.__init__(self, attrs)
  File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
    self.finalize_options()
  File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 387, in finalize_options
    ep.require(installer=self.fetch_build_egg)
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2324, in require
    items = working_set.resolve(reqs, env, installer, extras=self.extras)
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 862, in resolve
    new_requirements = dist.requires(req.extras)[::-1]
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2568, in requires
    dm = self._dep_map
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2815, in _dep_map
    self.__dep_map = self._compute_dependencies()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2824, in _compute_dependencies
    for req in self._parsed_pkg_info.get_all('Requires-Dist') or []:
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2806, in _parsed_pkg_info
    metadata = self.get_metadata(self.PKG_INFO)
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1468, in get_metadata
    value = self._get(self._fn(self.egg_info, name))
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1577, in _get
    with open(path, 'rb') as stream:
IOError: [Errno 2] No such file or directory: '/usr/lib/python2.7/site-packages/appdirs-1.4.3.dist-info/METADATA'

Thanks! We tried to address the problem of “appdirs==1.4.3” being already installed on the LEDE system per:

It looks like it is working now:

root@LEDE:~# beradio --version
beradio 0.8.1

root@LEDE:~# beradio info
--------------------------------------------------
                  beradio 0.8.1
--------------------------------------------------
config file: /root/.local/share/beradio/config.json
network_id:  755af7af-66aa-44f8-9b78-5dc6c2dd5670
gateway_id:  siss4

Yes, that looks good. Thanks @Andreas for hands on support.

by the way: Wenn ich

pip install -v --index-url=https://packages.hiveeyes.org/hiveeyes/python/eggs/ beradio

probiere, dann beschwert er sich, daß er das cert nicht prüfen kann:

connection error: [Errno 1] _ssl.c:510: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

Der unsichere Weg ist, die url per http anzusprechen, dann warnt pip:

http://packages.hiveeyes.org/hiveeyes/python/eggs/beradio/ uses an insecure transport scheme (http). Consider using https if packages.hiveeyes.org has it available

Mit openssl s_client -connect packages.hiveeyes.org:443 -showcerts kann man das cert beurteilen, und mit

openssl s_client -connect packages.hiveeyes.org:443 -showcerts </dev/null 2>/dev/null|openssl x509 -outform PEM >packages-he.pem

lokal ablegen. Mittels folgendem

pip install -v --cert packages-he.pem --index-url=http://packages.hiveeyes.org/hiveeyes/python/eggs/ beradio

kommt er aber bei mir auch nur bis

connection error: hostname 'packages.hiveeyes.org' doesn't match u'pulp.cicer.de'

Hmmm… ẁget und lokales install haben es dann gelöst ;)

3 posts were merged into an existing topic: Probleme mit SNI und Python 2.7.6

Ältere Python Versionen < 2.7.9 haben die SNI Erweiterung für SSL leider noch nicht an Bord. Um dies nachzuholen, tippt man:

pip install requests pyOpenSSL idna

Klappt es damit vielleicht auch bei Dir?

Update: für requests 2.2.1 (py2.7.6) wurde noch gebraucht:

pip install ndg-httpsclient pyasn1

P.S.: Bei der globalen Installation von Python Modulen ist Vorsicht geboten: Der pip Installer überschreibt ggf. Python Module, die bereits durch das Betriebssystem installiert wurden. Das Paketframework der Linux Distribution bekommt davon jedoch nichts mit, was zu Problemen führen kann.
Auf Nummer sicher geht man, wenn man sich vom Betriebssystem per virtualenv isoliert, wie unter Probleme mit SNI und Python 2.7.6 beschrieben wird.

Ja, das ist halt immer toll mit venv, da kann man das alles machen…

Da hier appdirs v 1.4.3 ist, geht es ‘nativ’ nicht, wenn Du
appdirs==1.4.0 im Paket festnagelst. Wie wäre es mit einem ‘mindestens 1.4.0’ ?

Auch das haben wir bereits adressiert:

Hattest Du Dir das 0.8.0er Release per wget besorgt? Falls ja, dann versuche es doch mal mit der Version 0.8.1.

genau: der Ziepfad von wget war ein anderer, die schon geholte 0.8.1 war unausgepackt - der Versuch davor war tatsäch leider die 0.8.0…

Mit 0.8.1 installiert der tarball!

Exzellent!

Nachdem Du Deine beradio/config.json angepasst hast (network_id: testdrive), um ohne Authentifizierung Nachrichten auf den Bus publizieren zu können …

$ beradio info
--------------------------------------------------
                  beradio 0.8.1
--------------------------------------------------
config file: /Users/amo/Library/Application Support/beradio/config.json
network_id:  testdrive
gateway_id:  area-42

… kannst Du das ganze im Trockendock testen:

beradio forward --source='data://d1:#i999e1:_2:h11:hli488ei572ee1:tli2163ei1925ei1092ei1354ee1:wi10677ee' --target='mqtt://swarm.hiveeyes.org'

Das Datenfeld, das als “#i999e” kodiert ist, beschreibt dabei die Node ID. Die kannst Du ggf. ebenfalls ad hoc ändern.

So kannst Du sehen, was auf dem Bus ankommt:

$ mosquitto_sub -h swarm.hiveeyes.org -t 'hiveeyes/testdrive/#' -v

hiveeyes/testdrive/tug22/999/wght1 106.77
hiveeyes/testdrive/tug22/999/hum1 4.88
hiveeyes/testdrive/tug22/999/hum2 5.72
hiveeyes/testdrive/tug22/999/temp1 21.63
hiveeyes/testdrive/tug22/999/temp2 19.25
hiveeyes/testdrive/tug22/999/temp3 10.92
hiveeyes/testdrive/tug22/999/temp4 13.54
hiveeyes/testdrive/tug22/999/message-json {"wght1": 106.77, "hum1": 4.88, "hum2": 5.72, "temp1": 21.63, "temp2": 19.25, "temp3": 10.92, "temp4": 13.54, "time": 1491179577482038016}
hiveeyes/testdrive/tug22/999/message-beradio d1:#i999e1:_2:h11:hli488ei572ee1:tli2163ei1925ei1092ei1354ee1:wi10677ee

… und im Dashboard:
https://swarm.hiveeyes.org/grafana/dashboard/db/hiveeyes-testdrive-automatic

Mit der Version 0.9.0 ist nun auch MQTT Authentifizierung möglich:
https://hiveeyes.org/docs/beradio/handbook.html#quickstart

1 Like

Hi there,

we just released BERadio 0.12.3 on PyPI, so it can be easily installed using

pip install beradio --upgrade

Also, it finally features a working blueprint for running it as a system service on OpenWrt/LEDE, see beradio.init. You will find appropriate installation instructions inside this file.

For further instructions, please have a look at the updated section at LinkIt Smart 7688 Duo as RFM95 to Wifi-BERadio gateway.

@einsiedlerkrebs is currently using this release of BERadio after he rigged up his telemetry setup again the other day, enjoy berlin-wedding-42-pirate.

Cheers!

Preview: A reassembling decoder for BERadio messages

Hi there,

we just pushed some features for completing the BERadio gateway functionality as a counterpart of the BERadio C++ encoder library: Enjoy the BERadioMessageDecoder — BERadio 0.12.3 documentation, it includes some doctests to both proof and document its functionality at the same time.

By now, it’s only a working prototype, thus it is not integrated into the runtime machinery of BERadio yet. We would love to hear any thoughts, questions or criticisms. Thanks.

Cheers and have a good summer!