the last weeks i tried out to connect my new smart Watermeter to domoticz and i succeeded.
Some Facts:
Hardware: RasPi 1 Modell B
OS: Raspbian Jessie Lite
domoticz: v3.5877
wM-Bus USB-Stick: iM871A-USB https://wireless-solutions.de/products/ ... apter.html
Watermeter: Sensus iPerl
Two month ago my Watercompany installed a new Watermeter, a Sensus iPerl. This meter has a wireless M-bus (wM-Bus) interface using the open metering system (OMS) standard. The payload is AES encrypted but my Watercompany gave me the key.
I tested several tools, but this one is working and installation is easy.
1. Add dummy hardware and virtual device
You could do it with the Webfrontend (see domoticz wiki) or with the api:
Code: Select all
/json.htm?type=createvirtualsensor&idx=7&sensorname=Water&sensortype=113
/json.htm?type=setused&idx=IDXNUMBER&name=Water&switchtype=2&used=true
2. Clone and Install (part of ecpiww/install.txt)
Code: Select all
//get ecpiww source
$mkdir projects
$cd projects
$git clone https://github.com/ffcrg/ecpiww.git
$cd ecpiww
//for domoticz not rally necessary, but there is the default location for the data log files. copy websource to var/www
$chmod u+x cpwww.sh
$./cpwww.sh
ecpiww/linux/include/energycam/ecpiww.h
Code: Select all
//#define FASTFORWARD 0x18C4
#define FASTFORWARD 0x4CAE // Sensus ManufacturerID
Code: Select all
//ecpiwwMeter[iX].version = 0x01;
ecpiwwMeter[iX].version = 0x68; //maybe different for other devices
Cause the values are given in liters the RFXMeter/Counter Dividers for Water must be '1000'.
Code: Select all
int Log2File(char *DataPath, uint16_t mode, uint16_t meterindex, uint16_t infoflag, float metervalue, ecMBUSData *rfData, uint32_t ident) {
char param[ _MAX_PATH];
char datFile[_MAX_PATH];
FILE *hDatFile;
time_t t;
struct tm curtime;
char command[512];
float liter_f; //define variables for domoticz mod
int liter;
switch(mode) {
case LOGTOCSV : if (strlen(DataPath) == 0) {
sprintf(param, "/var/www/ecpiww/data/ecpiwwM%d.csv", meterindex+1);
} else {
sprintf(param, "%s/ecpiwwM%d.csv", DataPath, meterindex+1);
}
Log2CSVFile(param, metervalue); //log kWh
liter_f = metervalue * 1000; // cubic meter to liter
liter = (int)liter_f; // float to integer; domoticz can't handle floating point values
snprintf(command, sizeof(command), "curl -i -H \"Accept: application/json\" -H \"Content-Type: application/json\" http://localhost/json.htm?type=command\\¶m=udevice\\&idx=IDXNUMBER\\&svalue=%i", liter); // update Meter with the current total usage value
system(command); // replace IDXNUMBER with the IDX of the created virtual meter
return APIOK;
break;
Follow the instructions in ecpiww/install.txt and add a Meter
5. Run ecpiww
Run ecpiww
Code: Select all
sudo ./ecpiww