Page 1 of 1
update historic data via api
Posted: Wednesday 04 June 2025 22:20
by JanJaap
I had a problem with the plugin for one of my solarpanels. I have the data from the app and now want to load that via the json api as per instructions here:
https://wiki.domoticz.com/Domoticz_API/ ... ed_counter
So I compile the following URL:
http://<my ip>:8080/json.htm?type=command¶m=udevice&idx=490&nvalue=0&svalue=5349003;26900;2025-05-22
Response in the browser:

- Schermafbeelding 2025-06-04 221836.png (2.78 KiB) Viewed 696 times
However no data added for May 22:

- Schermafbeelding 2025-06-04 221931.png (44.31 KiB) Viewed 696 times
What am I doing wrong? Tried for different date's, same result
Re: update historic data via api
Posted: Wednesday 04 June 2025 22:55
by waltervl
Is there already data for the 25th? Because then you will get 2 database entries for the same date in the meter_calendar table and that cause trouble. It will not over write the data it will add an entry and probably just use the first one it will find (the old one)
Re: update historic data via api
Posted: Saturday 14 June 2025 21:54
by JanJaap
ok, so I deleted the 0 data via the json api successfully. Shows now the following on:
http://<my iP>:8080/json.htm?type=command¶m=graph&sensor=counter&idx=490&range=2025-05-17T2025-05-25

- Schermafbeelding 2025-06-14 215204.png (19.23 KiB) Viewed 608 times
but when trying to update a value for the 18th using:
http://<my ip>:8080/json.htm?type=command¶m=udevice&idx=490&nvalue=0&svalue=5247603;17600;2025-05-18
and reply:

- Schermafbeelding 2025-06-14 215347.png (1.94 KiB) Viewed 608 times
Then there is no change still. Not in the graph, not in the API. Any idea's?
Re: update historic data via api
Posted: Saturday 14 June 2025 22:15
by jvdz
http://<my ip>:8080/json.htm?type=command¶m=udevice&idx=490&nvalue=0&svalue=5247603;17600;2025-05-18
This is just updating that actual sValue of the device with (probably) invalid data, but not as you expect do an update for a certain date in the history.
Re: update historic data via api
Posted: Saturday 14 June 2025 22:27
by JanJaap
Wel it is listed as the option to update the device history on the wiki. So I would expect updating the svalue to be reflected in the graph?
Additionally, I'd expect a NOK on invalid data (but maybe that's just me being optimistic

)
Re: update historic data via api
Posted: Saturday 14 June 2025 22:39
by jvdz
JanJaap wrote: ↑Saturday 14 June 2025 22:27
Wel it is listed as the option to update the device history on the wiki. So I would expect updating the svalue to be reflected in the graph?
You're right ..... I see it now too and learned something today. Sorry about that.
Re: update historic data via api
Posted: Saturday 14 June 2025 22:42
by JanJaap
OK I ran some test with bogus data: Still getting the same, nice 'ok' reply so guess that does not give much guidance......
Re: update historic data via api
Posted: Saturday 14 June 2025 23:36
by waltervl
Check the database values. I think update here means adding a row for that date as I explained before. So not overwriting the existing value. At least that is what happens on my counter device that I maintain this way.
Re: update historic data via api
Posted: Saturday 14 June 2025 23:53
by JanJaap
That's just what i did: delete the old values first, check (on te api) there's no value and the try to onsert e new one. Still, no success. Can you share you're method?
Re: update historic data via api
Posted: Sunday 15 June 2025 0:36
by waltervl
I use the same method as you for a kwh General Instant and counter device::
Code: Select all
http://MY-IP:8080/json.htm?type=command¶m=udevice&idx=407&nvalue=0&svalue=187721000;-368000;2025-05-31
The value will always be added to the end of the table so it depends of the sorting you use when you see it.
Re: update historic data via api
Posted: Sunday 15 June 2025 8:12
by Kedi
My solution is add the missing or change wrong data in the right table with 'phpliteadmin.php' manually, and that did always work so far.
You have to install the php file which you will find here:
https://www.phpliteadmin.org/download/
On some distributions you can just install it.