gas device date entry

Subforum for general discussions. Do not dump your questions/problems here, but try to find the subforum where it belongs!

Moderators: leecollings, remb0

Post Reply
epik77
Posts: 17
Joined: Thursday 26 March 2026 10:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

gas device date entry

Post 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 :-)
User avatar
waltervl
Posts: 7002
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2026.3
Location: NL
Contact:

Re: gas device date entry

Post 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
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
epik77
Posts: 17
Joined: Thursday 26 March 2026 10:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: gas device date entry

Post 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?
User avatar
waltervl
Posts: 7002
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2026.3
Location: NL
Contact:

Re: gas device date entry

Post 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.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
epik77
Posts: 17
Joined: Thursday 26 March 2026 10:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: gas device date entry

Post 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.
Attachments
device.png
device.png (10.13 KiB) Viewed 255 times
User avatar
waltervl
Posts: 7002
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2026.3
Location: NL
Contact:

Re: gas device date entry

Post 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.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
epik77
Posts: 17
Joined: Thursday 26 March 2026 10:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: gas device date entry

Post 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.
User avatar
waltervl
Posts: 7002
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2026.3
Location: NL
Contact:

Re: gas device date entry

Post 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.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
epik77
Posts: 17
Joined: Thursday 26 March 2026 10:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: gas device date entry

Post by epik77 »

You're right; while waiting for further developments regarding this device, I'll use this workaround.

Thanks for the help.
Post Reply