Page 2 of 2
Re: Electricity consumption & cost per day, month and year
Posted: Friday 21 June 2024 15:37
by McMelloW
mojso wrote: Friday 21 June 2024 13:17
I made a change in the script, in line 150, 158, 167
if you plan to update domoticz immediately, you can do it before or after,
I have last beta update of Domoticz
Thanks a lot It works OK now.
Missing 5 days - Electricity consumption & cost per day, month and year
Posted: Friday 21 June 2024 20:09
by McMelloW
These 2 lines (179-180) in the source code
Code: Select all
dz.log('daysCounterMonth: ' .. daysCounterMonth, dz.LOG_DEBUG)
dz.log('daysCounterYear: ' .. daysCounterYear, dz.LOG_DEBUG)
Showing these results in the domoticz log
Code: Select all
2024-06-21 19:39:00.579 Status: dzVents: Debug: ElecConsCost: daysCounterMonth: 16
2024-06-21 19:39:00.579 Status: dzVents: Debug: ElecConsCost: daysCounterYear: 168
Today it is day 173 of 2024 and day 21 of June so I miss 5 days of the year and of the month. The date on my Raspberry Pi is the actual date & time. It is also synchronized with ntp
Does somebody has an explanation for this difference.
Re: Electricity consumption & cost per day, month and year
Posted: Friday 21 June 2024 20:29
by waltervl
It seems to count the number of entries in the database. So probably Domoticz did not register your energy every day.
Do you see gaps in the graphs of your original energy devices?
Re: Electricity consumption & cost per day, month and year
Posted: Friday 21 June 2024 23:38
by McMelloW
waltervl wrote: Friday 21 June 2024 20:29
It seems to count the number of entries in the database. So probably Domoticz did not register your energy every day.
Do you see gaps in the graphs of your original energy devices?
Yes there are gaps in these devices. I had to go back 5 days after an updatebeta. This causes the gaps in the database.
The energy data consumed and delivered is registered by my energy provider as I can see.
I had the impression the days and month were just counted by de calendar. But it is not.
Re: Electricity consumption & cost per day, month and year
Posted: Saturday 04 October 2025 9:56
by hyeronimo
Hi, I am using this script to display daily and cumulative electricty cost in my dashticz dashboard. Recently I have moved to latest beta and new hardware, and now the script is not working any more. I have changed v into v1, bit that does not seem to help.
The log error:
Code: Select all
2025-10-04 09:52:00.247 Error: Error opening url: http://127.0.0.1:8080/json.htm?type=graph&sensor=counter&range=year&idx=249
2025-10-04 09:52:00.319 Error: dzVents: ElectricityConsumptionAndCost: HTTP/1.1 response: 404 ==>> Not Found
249 is the P1_DSMR.
Also I do not know how I can use the calculated cost from the energy dashboard. For the script I created several dummy devices for the output, so i can use the data where I want.
Re: Electricity consumption & cost per day, month and year
Posted: Saturday 04 October 2025 10:05
by waltervl
Your script makes use of a Domoticz API call and those have been changed. See this wiki page how to fix this
https://wiki.domoticz.com/Domoticz_API/ ... and_newer)
Re: Electricity consumption & cost per day, month and year
Posted: Saturday 04 October 2025 10:28
by hyeronimo
Thanks Walter, I will go from there!
Re: Electricity consumption & cost per day, month and year
Posted: Saturday 04 October 2025 10:49
by hyeronimo
Working again! For those who want the updated script: