@ -5,8 +5,13 @@ First of all you need is a eHZ (Elektronischer Haushaltszähler) and an IrDA USB
I used several information from the openHAB community, mainly from [this topic](https://community.openhab.org/t/using-a-power-meter-sml-with-openhab/21923/1).
You need to get, modify and compile [libsml](https://github.com/dailab/libsml) from Github liked described [here](https://community.openhab.org/t/using-a-power-meter-sml-with-openhab/21923/1). I included my version of sml_server.c here as it differs a bit.
You need to get, modify and compile [libsml](https://github.com/volkszaehler/libsml) (the [old libsml](https://github.com/dailab/libsml) is dead!) from Github liked described [here](https://community.openhab.org/t/using-a-power-meter-sml-with-openhab/21923/1) and in my comment about the new repository [further down in the thread](https://community.openhab.org/t/using-a-power-meter-sml-with-openhab/21923/12). But I included my version of sml_server.c (pulled and edited 2018/01/19) here as it differs a bit.
* **sml.items**: Put this file into your */etc/openhab2/items*.
If you like to have a fixed device name (e.g. */dev/sml0* instead of */dev/ttyUSB0*) which cannot change (it may if you plug in another USB device), please use the *50-sml.rules* file and modify it. To find our the serial and maybe also different manufacturer of our device use the following command to display USB device properties:
```
lsusb -v
```
* **50-sml.rules**: Put this file into your */etc/udev/rules.d* directory and modify it for your specific setup.
* **sml.items**: Put this file into your */etc/openhab2/items* directory.
* **sml.rules**: Put this file into your */etc/openhab2/rules* directory and modify it for your specific setup. In my case the compiled sml_server is in */home/openhabian/src/libsml/examples*. You also might need to adjust the device name, in my case it is: */dev/ttyUSB0*
* **sml_server.c**: Put this file into the *libsml* subdirectory *src/libsml/examples* and compile *libsml* with this file, not the original one.
Time cron "0,30 */1 * * * ?" // this one cycles every 30 seconds. depends on your needs
then
// getting the payload of the meter
var String meter_payload = executeCommandLine("/home/openhabian/src/libsml/examples/sml_server /dev/ttyUSB0", 5000) // note the argument /dev/ttyUSB0 - your meter-device-id goes here
var String meter_payload = executeCommandLine("/home/openhabian/volkszaehler/libsml/examples/sml_server /dev/ttyUSB0", 5000) // note the argument /dev/ttyUSB0 or /dev/sml0 - your meter-device-id goes here
// splitting the payload - first in lines, then getting counterStr and consumptionStr with delimiter "#"