update historic data via api
Moderators: leecollings, remb0
Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.
Use the following template when posting here:
Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....
If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly
If you are replying, please do not quote images/code from the first post
Please mark your topic as Solved when the problem is solved.
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.
Use the following template when posting here:
Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....
If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly
If you are replying, please do not quote images/code from the first post
Please mark your topic as Solved when the problem is solved.
-
- Posts: 215
- Joined: Thursday 12 October 2017 20:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Dev
- Location: the Netherlands
- Contact:
update historic data via api
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: However no data added for May 22: What am I doing wrong? Tried for different date's, same result
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: However no data added for May 22: What am I doing wrong? Tried for different date's, same result
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
- waltervl
- Posts: 5842
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: update historic data via api
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)
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 215
- Joined: Thursday 12 October 2017 20:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Dev
- Location: the Netherlands
- Contact:
Re: update historic data via api
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 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: Then there is no change still. Not in the graph, not in the API. Any idea's?
http://<my iP>:8080/json.htm?type=command¶m=graph&sensor=counter&idx=490&range=2025-05-17T2025-05-25 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: Then there is no change still. Not in the graph, not in the API. Any idea's?
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
- jvdz
- Posts: 2328
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: update historic data via api
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.http://<my ip>:8080/json.htm?type=command¶m=udevice&idx=490&nvalue=0&svalue=5247603;17600;2025-05-18
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- Posts: 215
- Joined: Thursday 12 October 2017 20:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Dev
- Location: the Netherlands
- Contact:
Re: update historic data via api
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
)
Additionally, I'd expect a NOK on invalid data (but maybe that's just me being optimistic

RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
- jvdz
- Posts: 2328
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: update historic data via api
You're right ..... I see it now too and learned something today. Sorry about that.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- Posts: 215
- Joined: Thursday 12 October 2017 20:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Dev
- Location: the Netherlands
- Contact:
Re: update historic data via api
OK I ran some test with bogus data: Still getting the same, nice 'ok' reply so guess that does not give much guidance......
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
- waltervl
- Posts: 5842
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: update historic data via api
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.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 215
- Joined: Thursday 12 October 2017 20:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Dev
- Location: the Netherlands
- Contact:
Re: update historic data via api
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?
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
- waltervl
- Posts: 5842
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: update historic data via api
I use the same method as you for a kwh General Instant and counter device::
The value will always be added to the end of the table so it depends of the sorting you use when you see it.
Code: Select all
http://MY-IP:8080/json.htm?type=command¶m=udevice&idx=407&nvalue=0&svalue=187721000;-368000;2025-05-31
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 575
- Joined: Monday 20 March 2023 14:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Somewhere in NL
- Contact:
Re: update historic data via api
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.
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.
Logic will get you from A to B. Imagination will take you everywhere.
Who is online
Users browsing this forum: No registered users and 1 guest