diff --git a/README.md b/README.md index 6ce5d38..b45df44 100644 --- a/README.md +++ b/README.md @@ -166,8 +166,8 @@ When built with `MBUSPICO_HTTP_ENABLED` option enabled the following HTTP endpoi | **Method** | **Endpoint URL** | **Description** | | --------------| --------------------- | ------------------ | | GET | / | Return last read meter data in JSON format | -| GET | /update | Reboot device into USB bootloader for a quick and easy update of MBusPico application | -| GET | /reboot | Reboot device | +| GET | /update | Reboot device into USB bootloader for a quick and easy update of MBusPico application (*only available on Raspberry Pico*) | +| GET | /reboot | Reboot device (*only available on Raspberry Pico*) | # Hardware wiring / assembly diff --git a/loxone/README.md b/loxone/README.md index 4e987ae..96df8d8 100644 --- a/loxone/README.md +++ b/loxone/README.md @@ -9,13 +9,51 @@ Visualization in Loxone App: [](app.png?raw=true) -## Loxberry +## Raspberry Pi / Loxberry Since MBusPico v2.0 there is also a Python version available. Including a ready-made Python docker container running MBusPico. This enables the usage of MBusPico application on your RaspberryPi already running [LoxBerry](https://github.com/mschlenstedt/Loxberry). -After installing the [Loxberry Docker Plugin](https://wiki.loxberry.de/plugins/docker/start) you can run the MBusPico docker container with the following settings: +## Enable serial port + +On an generic Raspberry Pi (for example running Raspian) execute `sudo raspi-config` and enable the serial port in +`(3) Interface options` -> `(I6) Serial Port`. Just enable the serial port and do not enable the console on it. +Afterwards reboot the device. + +On a Loxberry this can be done directly in the web UI. From `System settings` select `Loxberry services` and `More options`: -[TODO] +[](loxberry_enable_serialport.png?raw=true) + +Again reboot the device after saving the settings. + +## Loxberry +Install the [Loxberry Docker Plugin](https://wiki.loxberry.de/plugins/docker/start). In the portainer web UI you can create +a MBusPico docker container from `Containers` and hit the `Add container` button. + +Make sure that you set some mandatory options: + +* the `Network mode` must be `host` +* the serial port `device` (in most cases `/dev/ttyS0`) must be mapped to the docker container +* MBusPico options (like at least the decryption key `MBUSPICO_DEVICE_KEY`) can be set via `environment variables` + +## Running manually + +Extract the `python.zip` archive of an MBusPico release and execute it directly with Python: +```sh +cd /path/to/extracted +python3 main.py +``` + +Example docker run call: +```sh +docker run --name MBusPico \ + --network host \ + --device=/dev/ttyS0 \ + -e MBUSPICO_DEVICE_KEY=XXXXXXXXXXXXXXXXXXXX \ + -e MBUSPICO_HTTP_SERVER_PORT=8080 \ + -e MBUSPICO_HTTP_ENABLED=1 \ + -e MBUSPICO_SERIAL_PORT=/dev/ttyS0 \ + ravenworx/mbuspico:latest +``` diff --git a/loxone/loxberry_enable_serialport.png b/loxone/loxberry_enable_serialport.png index f9bc808..b60d5be 100644 Binary files a/loxone/loxberry_enable_serialport.png and b/loxone/loxberry_enable_serialport.png differ diff --git a/python/dist/mbus/devices/kaifa_ma309m_netznoe.py b/python/dist/mbus/devices/kaifa_ma309m_netznoe.py index 29fd217..98b24cb 100644 --- a/python/dist/mbus/devices/kaifa_ma309m_netznoe.py +++ b/python/dist/mbus/devices/kaifa_ma309m_netznoe.py @@ -164,14 +164,14 @@ def parse_data(self,data): currentPosition = _DECODER_START_OFFSET # Offset for start of OBIS decoding, skip header, timestamp and break block while True: - print("currentPosition:", currentPosition) - print("OBIS header type:", plaintext[currentPosition + _OBIS_TYPE_OFFSET]) + #print("currentPosition:", currentPosition) + #print("OBIS header type:", plaintext[currentPosition + _OBIS_TYPE_OFFSET]) if plaintext[currentPosition + _OBIS_TYPE_OFFSET] != _DataType_OctetString: print("Unsupported OBIS header type") return False obisCodeLength = plaintext[currentPosition + _OBIS_LENGTH_OFFSET] - print("OBIS code/header length:", obisCodeLength) + #print("OBIS code/header length:", obisCodeLength) if obisCodeLength != 0x06 and obisCodeLength != 0x0C: print("Unsupported OBIS header length") @@ -197,8 +197,8 @@ def parse_data(self,data): codeType = _CodeType_Unknown - print("obisCode (OBIS_A):", obisCode[_OBIS_A]) - print("currentPosition:", currentPosition) + #print("obisCode (OBIS_A):", obisCode[_OBIS_A]) + #print("currentPosition:", currentPosition) if obisCode[_OBIS_A] == _Medium_Electricity: # Compare C and D against code @@ -291,8 +291,8 @@ def parse_data(self,data): elif codeType == _CodeType_PowerFactor: meter.powerFactor = dataValue elif dataType == _DataType_OctetString: - print("Arrived on OctetString") - print("currentPosition:", currentPosition, "plaintext:", plaintext[currentPosition]) + #print("Arrived on OctetString") + #print("currentPosition:", currentPosition, "plaintext:", plaintext[currentPosition]) dataLength = plaintext[currentPosition] currentPosition += 1 # Advance past string length