KAIFA Smart Meter, Meter Extension #1 Cuculus HOWTO:
I want to share my findings integrating the
Meter Extension #1 Cuculus for the KAIFA Smart Meter.
The KAIFA Smart Meter is used in this parts of Austria:
Netz Niederösterreich
Innsbrucker Kommunalbetriebe
Salzburg Netz
TINETZ Tiroler Netze
Vorarlberger Energienetze
I don’t know if the Meter Extension #1 Cuculus is sold by all Providers.
It was alot of hassle to get it running because of no documentation and nearly no help from the manufacturer.
NOTE: Use a fixed IP Address for your device via DHCP Mac Address.
Meter Extension #1 Cuculus
KAIFA Smart Meter
Method #1: HTTP REST API
Use this config and fill in the IP of your Device in the resource URL:
sensor:
- platform: rest
name: Power Meter Load
resource: http://YOUR-DEVICE-IP/api
headers:
content-type: application/json
method: "POST"
payload: '{"cmd": "meter_reading","id": 0}'
unit_of_measurement: 'W'
device_class: 'power'
value_template: "{{ value_json['meter'].0.data.2.entry.0.val }}"
unique_id: 300
- platform: rest
name: Power Meter Consumption
resource: http://YOUR-DEVICE-IP/api
headers:
content-type: application/json
method: "POST"
payload: '{"cmd": "meter_reading","id": 0}'
unit_of_measurement: 'Wh'
device_class: 'energy'
state_class: total_increasing
value_template: "{{ value_json['meter'].0.data.4.entry.0.val }}"
unique_id: 301
Method #2: MQTT
This method is a bit more complicated.
You have to setup a MQTT Broker with SSL/TLS.
I won’t cover a MQTT broker installation here.
But i give a quick overview what the way is:
Install mosquitto.
Create CA Certificate.
Create Server Certificate.
Convert CA Certificate CRT FIle to PEM File as mqtt.pem
Edit your mosquitto.conf file to use SSL on port 8883 and link the Certificates.
Go to http://YOUR-DEVICE-IP in a browser.
click on delete for the file mqtt.pem
choose file mqtt.pem file that you created previosly
click upload
Replace MQTTBROKER-IP/MQTTBROKER-USERNAME/MQTTBROKER-PASSWORD/YOUR-DEVICE-IP in the following curl command and then send it:
curl -i -X POST -d "{\"cmd\":\"mqtt_config\",\"host\":\"mqtts://MQTTBROKER-IP\",\"user\":\"MQTTBROKER-USERNAME\",\"password\":\"MQTTBROKER-PASSWORD\",\"port\":\"8883\"}" YOUR-DEVICE-IP/api
So now MQTT should be running and the device will log into your broker with the topic of your meter number.
If you want to see it you can use MQTT Explorer for example.
Use this config and fill in the Topic number of your Device in the state_topic and json_attributes_topic:
sensor:
- name: Power Meter Load
unit_of_measurement: 'W'
device_class: 'power'
unique_id: 170
state_topic: "1KFM0100123456/MeterReading"
json_attributes_topic: "1KFM0100123456/MeterReading"
value_template: "{{ value_json['meter'].0.data.2.entry.0.val }}"
- name: Power Meter Consumption
unit_of_measurement: 'Wh'
device_class: 'energy'
state_class: total_increasing
unique_id: 171
state_topic: "1KFM0100123456/MeterReading"
json_attributes_topic: "1KFM0100123456/MeterReading"
value_template: "{{ value_json['meter'].0.data.4.entry.0.val }}"
Extra Notes:
REST API is at http://YOUR-DEVICE-IP/api
Known commands:
{"cmd": "meter_reading","id": 0}
{"cmd": "log_get_month","id": 1}
{"cmd": "system_status","id": 123}
{"cmd": "mqtt_config","host": "mqtts://MQTTBROKER-IP","user": "MQTTBROKER-USERNAME","password": "MQTTBROKER-PASSWORD","port": "8883"}
Thats it, hope this helps someone out there.