Page 1 of 1

Query P1 database with JSON

Posted: Saturday 24 January 2026 9:58
by Gingerpale
Hi,
My current energy script filters the P1 meter log database per year and searches for specific dates in that year.
[url]http://<IPaddr>:<Port>/json.htm?type=command&param=graph&sensor=counter&idx=12345&range=year&year=2026[/url]
It returns the whole year, but filtering for 2026-01-01 it returns:

Code: Select all

{
			"c" : "6409.15",
			"d" : "2026-01-01",
			"p" : "11.8244",
			"v" : "9.91"
		},
So this works but queries a large JSON response.

Since I am only looking for data at one specific date (day of the year), I thought I could also do:
[url]http://<IPaddr>:<Port>/json.htm?type=command&param=graph&sensor=counter&idx=12345&range=2026-01-01T2026-01-01[/url]
However, in this case not all data is present, I get (only showing "result" section below), so "c" and "p" are missing:

Code: Select all

	"result" : 
	[
		{
			"d" : "2026-01-01",
			"v" : "9.91"
		},
		{
			"d" : "2026-01-01",
			"v" : "20.11"
		}
	],
What thinking error do I make?
Ultimately I want to fetch the data of the P1 meter for one specific day of the year (e.g. contract start date).

Any idea's?

Re: Query P1 database with JSON

Posted: Saturday 24 January 2026 12:06
by waltervl
What if you range from the contract date till today? You also only see the d and v value?

Re: Query P1 database with JSON

Posted: Saturday 24 January 2026 13:27
by gizmocuz
Another option, use the web gui. Click on your P1 meter, at the top click 'Report', then click on the right month to see a report by day
You ask for yearly data, so you get a year.. you can also query for the last month, has less values

Re: Query P1 database with JSON

Posted: Saturday 24 January 2026 14:47
by Gingerpale
@ waltervl If I range from contract date start till today it also only gives the d and v values back.
@gizmocuz I use this in a Dzvents script to calculate something like total counter = today counter - start counter, so using &range=year is nice as it gives values per day. As my script fetches quite a lot of JSON data every time and I had the issue with the callback function in other post, I figured it would be good to query for less JSON data or for exactly the data I need without fetching all the other useless data and searching through it.
Range felt like a good option but strangely enough it only fetches part of the data I need, actually I need the "c" which it doesn't fetch.
So I just wondered if I made a mistake or anything?