Managed counter how to store values

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
hemant5400z
Posts: 114
Joined: Monday 05 November 2018 17:41
Target OS: Linux
Domoticz version:
Contact:

Managed counter how to store values

Post by hemant5400z »

Hi All

I'm trying to store values van managed counters just to calculate my annual usage based on my contract date.
I have the managed counters setup and they do the calculation however they don't keep the history.

I saw: local function updateHistory(id, date, nValue, sValues)
local url = domoticz.settings['http://192.168.1.7:8080'] ..'/json.htm?type=command&param=udevice&idx=' .. 346 ..
'&nvalue=' .. nValue .. '&svalue=' .. sValues .. ';' .. date
domoticz.openURL(url)
return
end

But not sure how and where this will store the value, in meter_calendar or Multimeter_Calendar or somewhere else?
I have Grafana hooked up to a database copy and can do the calculation there once I have the history available for the managed counters.

Anyone care to guide me? Tried ChatGpt but is floods errors :(

Regards,
Hemant
User avatar
waltervl
Posts: 6683
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Managed counter how to store values

Post by waltervl »

There are scripts on the forum where you can calculate the energy usage based on contract date based on existing data in the Domoticz database.

Edit: example viewtopic.php?t=42454
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
hemant5400z
Posts: 114
Joined: Monday 05 November 2018 17:41
Target OS: Linux
Domoticz version:
Contact:

Re: Managed counter how to store values

Post by hemant5400z »

Thanks does it keep history i’m comparing this in grafana currently

Regards
User avatar
waltervl
Posts: 6683
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Managed counter how to store values

Post by waltervl »

Domoticz keeps daily summary data for all days in the database, check the report button on a counter log page.
You can drill down to any month in the past and see the data per day.

See also wiki page https://wiki.domoticz.com/Managing_Devi ... ice_Report
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
hemant5400z
Posts: 114
Joined: Monday 05 November 2018 17:41
Target OS: Linux
Domoticz version:
Contact:

Re: Managed counter how to store values

Post by hemant5400z »

Thanks,

I dont see any data for my general managed counters. Tried to find it with sql browser innde different tables but dont have any idx entries in calendar tables hence my question how to get them.

The log button says No data to display.

Regards,
User avatar
waltervl
Posts: 6683
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Managed counter how to store values

Post by waltervl »

I dont know how this works with storing history data in a managed counter. Just wanted to tell you it possibly is also not needed if you just want to know the energy used from contract date as that can be calculated with scripting.
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

Who is online

Users browsing this forum: No registered users and 1 guest