Metadata-Version: 2.1
Name: ceems
Version: 0.1.1
Summary: Consolinno Energy Managment System utilizing EEBUS
Home-page: UNKNOWN
Author: Leonhard Heizinger, Andreas Penzkofer
Author-email: l.heizinger@consolinno.de, a.penzkofer@consolinno.de
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE

# cEEMS [cēms] [:speaker:](https://translate.google.com/translate_tts?ie=UTF-8&client=tw-ob&tl=en&q=ceems)

Daemon tool `ceemsd` to answer JSON-RPC requests from the [EEBUS-Daemon](https://gitlab.consolinno-it.de/leafletfirmware/eebus/consolinno-eebus-daemon).

## Technical documentation

The technical documentation is found [here](docu.asciidoc).

## Development installation*

    pip install -e .    

This will install the module `ceemsd` and take the latest version of the code when running.

If this does not work you can try

    pip install -r requirements.txt
    sudo python3 setup.py develop

## Running

Run ceems as sudo as this is required for dbus. Option -d for debugging

    sudo ceemsd -d

## Testing

TODO: Automated Testing

### Energy Guard

Start the IEC services `IEC_server` and `Schedule Manager` from [ffnstb-ie-61850](https://gitlab.consolinno-it.de/leafletfirmware/cls-firmware/fnnstb-iec-61850).

Then write schedule data by starting the client with 

    sudo ./IEC_client --port 4102 --hostname 10.154.22.8 --write all

Request to the Energy Guard with this example

    echo -n '{"jsonrpc": "2.0", "method": "requestPowerLimitationCurve","params":[1,2,3], "id": 1}' | nc localhost 20001

### Energy Broker

Follow instructions in this [README](src/mqqt-sim/README.md) to receive incentive data via MQTT.

Request to the Energy Broker with this example

    echo -n '{"jsonrpc": "2.0", "method": "requestIncentiveTable","params":[null], "id": 1}' | nc localhost 20001

### Manual testing

In /src/ceems/ run
 
    python3 -m unittest test_module.py

To test the mqqt part of the energy broker, in /src/mqqt-sim/ follow the instructions in this [README](src/mqqt-sim/README.md).

### Testing JSONRPC calls manually

    ./src/ceems/test_scripts/request_plim_table.sh
    ./src/ceems/test_scripts/request_incentive_table.sh

