Reading SML meters with optical reading head

Many "modern" meters have an optical interface, i.e. an infrared diode, with which some current meter values are output in SML format. The cFos Charging Manager supports these meters and the connection of an optical reading head. Optical read heads are available in two variants: With 3.3V TTL level or with USB connection. You can connect a TTL read head to the cFos Power Brain controller, and one with a USB interface to the Raspberry PI or Windows.

To read a meter that speaks SML using an optical reading head, you need a reading head with TTL level for the cFos Power Brain. This is wired as follows: For controllers with Hardware Revission 1.1 (Rev. C) and 2.0 (Rev. F):

GND - Pin 10
TxD - Pin 11 - here RxD of the reader is connected
RxD - Pin 12 - here TxD of the reader is connected
Vcc - Pin 15

Then set up a meter of the type "SML Meter" in the cFos Charging Manager. Enter COM2,9600,8,N,1 as the address.
If you are using the cFos Charging Manager under Windows or Raspberry, you need an optical reading head with USB interface. Set up type "SML Meter" as the meter and set the address to COMx,9600,8,N,1, where COMx is the COM port under which the USB reader reports (similar to Modbus adapters).

Enable counter with blink code

In the basic state, the "modern measuring devices" installed in meter cabinets only supply the kWh via optical interface. In order to receive timely performance values, they must be enabled with a PIN. You can obtain the PIN from your metering point operator or network operator. If you have the PIN, you can unlock the meter with a torch: Flash the optical interface once. The meter will then carry out a display test and "PIN" and 4 zeros will appear in the display. Now you can increase the first 0 by pulses of approx. 1 sec. Now you can increase the first 0 by pulses of approx. 1 sec. until you have entered the first digit of the pin. Then wait until the cursor jumps to the 2nd zero and increase this digit accordingly by flashing pulses. After you have entered all 4 digits of the PIN, the counter is enabled for 120 seconds. In this state, brief flashing causes the display to change to different representations. One of them is "PIN on". Now light up for approx. 5sec until "PIN off" appears. You have now permanently enabled the transmission of active power via the optical interface. Please note that this also allows anyone with a torch to read the various values of the meter. Unfortunately, the active power is often only transmitted as a total value. The cFos Charging Manager then calculates the corresponding current values for the phases. Since this is subject to a certain degree of inaccuracy, you should therefore plan or set a certain reserve for load management tasks.

Read out the meter with Tasmota

Tasmota is an operating system for Espressif ESP processors. You can connect the Hichi IR optical reading head to an ESP module running Tasmota. Tasmota then provides a web server from which the cFos Charging Manager can then read in the meter data determined via the reading head. Here are Andreas H.'s instructions on how to configure Tasmota accordingly:

After integration into the WLAN, the read head is to be described with the corresponding script according to the existing meter.
Web interface (IP read head) -> Consoles -> Edit Script (store script)
Important: Activate "Script enable" and save
With the existing meter definition "Tasmota_Smartmeter_http.json" a Logarex meter model LK13BE with SML is read out.
The matching script:

>D
>B
->sensor53 r
>M 1
+1,3,s,16,9600,LK13BE,1,10,2F3F210D0A,063035310D0A
1,77070100010800ff@1000,Gesamt kWh bezogen,kWh,Power_total_in,1
1,77070100020800ff@1000,Gesamt kWh geliefert,kWh,Power_total_out,1
1,77070100100700ff@1,Verbrauch aktuell,W,Power_curr,0
1,77070100240700ff@1,Power L1,W,Power_L1_curr,0
1,77070100380700ff@1,Power L2,W,Power_L2_curr,0
1,770701004C0700ff@1,Power L3,W,Power_L3_curr,0
1,77070100200700ff@1,Voltage L1,V,Volt_L1_curr,1
1,77070100340700ff@1,Voltage L2,V,Volt_L2_curr,1
1,77070100480700ff@1,Voltage L3,V,Volt_L3_curr,1
1,770701001f0700ff@1,Amperage L1,A,Amperage_L1_curr,2
1,77070100330700ff@1,Amperage L2,A,Amperage_L2_curr,2
1,77070100470700ff@1,Amperage L3,A,Amperage_L3_curr,2
1,770701000e0700ff@1,Frequency,Hz,HZ,2
1,77070100510704ff@1,Phaseangle I-L1/U-L1,deg,phase_angle_p1,1
1,7707010051070fff@1,Phaseangle I-L2/I-L2,deg,phase_angle_p2,1
1,7707010051071aff@1,Phaseangle I-L3/I-L3,deg,phase_angle_p3,1
1,77070100510701ff@1,Phase angle U-L2/U-L1,deg,phase_angle_l2_l1,1
1,77070100510702ff@1,Phase angle U-L3/U-L1,deg,phase_angle_l3_l1,1

If a meter other than the one mentioned in the example is used, Tasmota must be put into operation with the script matching the existing meter.
Suitable Tasmota scripts for the most common models can be found on the internet.
Afterwards, the output can be tested with the link http://ip_lesekopf/cm?cmnd=status%2010. The feedback should then look something like this.
The feedback should then look something like this (example: Logarex LK13BE)

{
"StatusSNS":{
"Time":"2022-09-24T10:16:32",
"LK13BE":{
"Power_total_in":108.9,
"Power_total_out":0.0,
"Power_curr":4294,
"Power_L1_curr":1390,
"Power_L2_curr":1453,
"Power_L3_curr":1450,
"Volt_L1_curr":235.0,
"Volt_L2_curr":232.9,
"Volt_L3_curr":234.2,
"Amperage_L1_curr":5.96,
"Amperage_L2_curr":6.33,
"Amperage_L3_curr":6.25,
"HZ":50.00,
"phase_angle_p1":353.1,
"phase_angle_p2":351.6,
"phase_angle_p3":353.2,
"phase_angle_l2_l1":120.1,
"phase_angle_l3_l1":241.0
}
}
}

Accordingly, the entries in the meter definition (JSON) must then be adapted individually and uploaded to the cFos WB.

For this feedback, a user-defined counter can then be created in the cFos Charging Manager using a JSON definition. For the above example, here is the download on the page of the devices supported by the cFos Charging Manager. In the cFos Charging Manager, you then enter a counter of the type "HTTP Input" with the address of your Tasmota.