S0 Power meter readout using raspberry pi zero

Tags: #<Tag:0x00007f6179876748> #<Tag:0x00007f6179876658> #<Tag:0x00007f6179876450>

Last week I have installed a 3 phase kWh meter with an S0 pulse output.
I am using a raspberry pi zero to connect the GPIO to the S0 of the meter.
The connections are as follow:
The S0 port is connected to pin 1 (3V3) and pin 16 (GPIO23) of the raspberry.
On the raspberry is raspbian-jessie installed.
With the following python code I do the readout:

import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)

counter = 0
while True:
    GPIO.wait_for_edge(23, GPIO.RISING)
    counter += 1
    print "Counter is now", counter/800.0, "kWh"
    GPIO.wait_for_edge(23, GPIO.FALLING)

GPIO.cleanup()

This code I got from here
The output looks like this:

Counter is now 1.2125 kWh
Counter is now 1.21375 kWh
Counter is now 1.215 kWh
Counter is now 1.21625 kWh
Counter is now 1.2175 kWh
Counter is now 1.21875 kWh
Counter is now 1.22 kWh
Counter is now 1.22125 kWh
Counter is now 1.2225 kWh
Counter is now 1.22375 kWh
Counter is now 1.225 kWh
Counter is now 1.22625 kWh
Counter is now 1.2275 kWh

I have openhab 1.8.2 running on my synology.
Now my question is how to get this output of the python program into openhab.
I want to be able to visualize the power consumption in Openhab realtime by using the persistence binding and storing the data in a mysql database on my Synology.

Persistence is already working for temperature visualization, so is mysql.