Domoticz virtual sensor: how to set initial value

194 Views Asked by At

I have a device that reads the P1 port of a smart meter. I have created a virtual sensor for the smart meter and, through a simple shell script, I can set the meter readings in Domoticz. This works well.

However, for the devices (both electricity and gas), I get a large peak of consumption on the first period. That is because the virtual sensor is initialized with the values of 0 for all the counters. This gives a peak that makes the graphs unusable.

Is there a way to initialize the meter reading on a non-zero value?

1

There are 1 best solutions below

0
On BEST ANSWER

Domoticz uses an sqlite3 database. With sqlite3 domoticz.db '.dump' > domo.dump, you can get a complete dump of the database. Searching for the index of the meter, I found the initial value (for the gas meter:)

 INSERT INTO Meter VALUES(1093,0,0,'2022-03-24 18:00:00');

Removing that row from the Meter table did the trick.