JSON/API energy counter inconsistancy

Moderator: leecollings

Post Reply
infoed
Posts: 22
Joined: Monday 21 October 2024 14:33
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

JSON/API energy counter inconsistancy

Post by infoed »

Hi, I have 2 energy counters for electra and gas.
Note: these devices are created by AD using the built-in hardware device "P1 Smart Meter with LAN interface"

Using JSONAPI json.htm?type=command&param=graph&sensor=counter&range=year results in 2 json sections:
- result
- resultprev
Each containing the datapoints of all days of current year (result) and past year (resultprev)

The result part of electra device returns : c1, c2, c3, c4, d, p, r1, r2, v1, v2
And resultprev : d, r1,r2, r3,r4

The resultpart of gas device returns: c, d, p,v
And resultprev : d, p, v

In the result section, both GAS and ELECTRA have the same info : counter, date, price , daily usage

In the resultprev section ELECTRA device has date, daily usage. Price is missing
In the resultprev section GAS device has date, PRICE, daily usage

The inconsistency IMO is that in resultprev there is no price for ELECTRA devices but there is for GAS devices.

I would like to have prices in the resultprev section for ELECTRA devices for this built-in hardware device type, too.
Note: I did not test this with a custom sensor, "slimme meter electra". I suspect the same behaviour.
kind regards!
User avatar
waltervl
Posts: 7020
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2026.3
Location: NL
Contact:

Re: JSON/API energy counter inconsistancy

Post by waltervl »

P1 device is a special device. I am surprised there is even a resultprev section as that was never there. Probably made for the new report page for a P1 device in recent Domoticz release.
I would test it too with another custom device.

Please note that the API is created to interact with the user interface, it is build on these API calls. So if your value is not needed in the UI it normally is not added in the API.

You better describe which functionality you would like to add to the UI that needs that value. But perhaps you have switched on price calculation only this year and then there is no price value in the database for previous year?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply