Page 1 of 1

gas device date entry

Posted: Thursday 03 September 2026 12:18
by epik77
Hi everyone,
I created a small Python script that retrieves the monthly gas consumption total from the utility company's website and publishes it via MQTT to a gas domoticz device. Everything works fine, except that the monthly total is published 2-3 days later, so I only get the current month's consumption counted.
Is it possible to enter the reference date via MQTT or HTTP API?

Thanks, I'm open to any suggestions :-)

Re: gas device date entry

Posted: Thursday 03 September 2026 20:09
by waltervl
You can use a dummy managed counter, Edit it to gas type and you can add history data on a specific day in the past with a http api calls https://wiki.domoticz.com/Domoticz_API/ ... ed_counter

Re: gas device date entry

Posted: Friday 04 September 2026 16:02
by epik77
I created a managed meter,
I changed the model and chose Gas,
I entered the January 2026 reading using this
Payload: {"command": "udevice", "idx": 2802, "nvalue": 0, "svalue": "6981;0;2026-01-31 00:00:00"}
but the command has no effect.

The device counter is not incremented.

The documentation reports:
/json.htm?type=command&param=udevice&idx=IDX&nvalue=0&svalue=COUNTER;USAGE;DATE


IDX = id of your device (This number can be found in the devices tab in the column "IDX")
COUNTER = total cumulative counter energy (Wh, can be set to -1 if unknown or unused, in that case it won't show on dashboard or in logs)
USAGE = energy usage in Watt-hours (Wh)
DATE = date with %Y-%m-%d format (for instance 2019-09-24) to put data in last week/month/year history log, or "%Y-%m-%d %H:%M:%S" format (for instance 2019-10-03 14:00:00) to put data in last days history log


I set the USAGE value to 0

can you give me some suggestions?

Re: gas device date entry

Posted: Friday 04 September 2026 16:37
by waltervl
Not every functionality of the http API is implemented in MQTT. You first need to try it with an http api call.
And no time in the svalue, only the date.

Re: gas device date entry

Posted: Friday 04 September 2026 18:31
by epik77
I managed to understand the device's logic and modified my script to also calculate the monthly consumption difference by inserting it into the device. Here's the payload string.

Payload: {"command": "udevice", "idx": 2800, "nvalue": 0, "svalue": "7347;12;2026-08-31"

The only problem is that the managed counter device lacks the total and doesn't display the latest measurement, but only that of the current month.

Thank you very much.

Re: gas device date entry

Posted: Saturday 05 September 2026 11:01
by waltervl
For a managed counter you have to do all history calculation and feed it to the Domoticz device.
So for one day it will calculate the daily usage based on the rolling counter values you give. But it will not put it the next day in the history table like a normal gas counter will do.

Re: gas device date entry

Posted: Saturday 05 September 2026 17:55
by epik77
That's exactly the problem. My provider provides me with the reading at the end of the month, and my script updates the managed device. But it will never have any data in the dashboard information :-(
It would be nice to at least see the latest data entered in addition to the total.
After all, other GAS devices do the same thing, so on a managed counter device, I have to decide for myself what to display.

I trust the developers, perhaps in future implementations, will allow them to choose what to display on a managed device.

Re: gas device date entry

Posted: Sunday 06 September 2026 12:30
by waltervl
I see people put that kind of data in a text sensor with a dzvents script. Yo can run that script once a day.
There are loads of examples, search for "updatetext" in the forum.

Re: gas device date entry

Posted: Wednesday 09 September 2026 7:17
by epik77
You're right; while waiting for further developments regarding this device, I'll use this workaround.

Thanks for the help.