Hello,
I am using Domoticz for years now in combination with several extensions like HUE, RFXComm.
Recently I added solar panels and am building a system to track nett energy use. Visualizations through Grafana.
Daily at midnight I calculate my nett energy use (in euro) based on power device (T1+T2-R1-R2) Total consumption - total delivered.
This value can become negative because I deliver more to energy grid than I use from energy grid.
When storing this negative result in a managed counter it stores as zero (unsigned values).
There are some suggestions to use a senso but then the avagare, min and max values become confusing. Plus if I only store one valy just before midnight (23:59) the sensor is using this value for the next hour offsetting the min/max for next day. Based on which value is greater yesterday or taday the actuall correct value is min or max value. So this approach leads to ambiguous results and real value cannot be determined. Plus totals are not calculated.
What I would like to propose is possibility to offset the zero point for a managed counter. Move the zero value up by a certain value so that negative values can be stored. In setting besides divider and counter offset a zero offset value (or max negative value offset) should be introduced.
If this is set to 100 then that would mean that a zero value is stored as 100 in database. 25 stored as 125 and -50 as 50. This would allow a managed counter to store negative values (up to defined max value). Displaying these values need work and also the calculation of consumption would require work. But it would allow using negative values without changing the overall architecture and database schema.
If I missed an other possiblity to allow for negative values in managed counters I would really like to test that. Using sensors is maybe a workaround but does not work properly because the last value is used for next hour.
What also is needed for this approach is the possibility to provide negative values in updateHistory (dzvents calls) to 'manage' the counter.
regards,
Andre
Create possibility to store negative numbers in managed counters
Moderators: leecollings, remb0
- waltervl
- Posts: 5909
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Create possibility to store negative numbers in managed counters
I am not totally into this Energy management topic but perhaps you should use a Dummy P1 Energy Meter to put your combined results in https://www.domoticz.com/wiki/Domoticz_ ... mart_meter
It has seperate values for Usage and Return and shows the result also. Tariff 1 and 2 are day/night tariffs. If you have no separate day/night tariff then you can use only tariff 1.
It has seperate values for Usage and Return and shows the result also. Tariff 1 and 2 are day/night tariffs. If you have no separate day/night tariff then you can use only tariff 1.
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: 3
- Joined: Monday 29 March 2021 10:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Create possibility to store negative numbers in managed counters
What I want to do is keep track of my total consumption. That is total consumed - total delivered + total generated (Solar panels) (always positive)waltervl wrote: ↑Monday 29 March 2021 13:40 I am not totally into this Energy management topic but perhaps you should use a Dummy P1 Energy Meter to put your combined results in https://www.domoticz.com/wiki/Domoticz_ ... mart_meter
It has seperate values for Usage and Return and shows the result also. Tariff 1 and 2 are day/night tariffs. If you have no separate day/night tariff then you can use only tariff 1.
And Netto energy use. Total consumed from grid - total delivered. This can become negative when solar generated is higher than total consumed.
I want to see this in chart against time. Both these counters I also multiply with Energy cost and also store that separately.
These values are forwarded to Grafana (through influx DB) for dashboard charting and analysis.
For this a P1 sensor will not work because data need to separated to be able to provide to Grafana. Having a managed counter with negative values would help a lot for this and then basically I am already done. I have dashboard working for all the above except when the counters get negative and they default to 0. At that point the real benefit of installation is not shown anymore in dashboard.
The beauty with Grafana is that you can just change the timescale and look at different time windows. Last month, last 90 day, last 5 years, etc.
Native support for Grafana would also help

- waltervl
- Posts: 5909
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Create possibility to store negative numbers in managed counters
No problem with the SQLite plugin for Grafana: viewtopic.php?f=21&t=35101
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: 3
- Joined: Monday 29 March 2021 10:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Create possibility to store negative numbers in managed counters
I created an additional P1 Energy meter and stored my values for some time. Today is nice sunny day and the actual usage from grid is below 0. Also these values are stored as zero so this does not seem to be a possible solution. So not the actual negative value.waltervl wrote: ↑Monday 29 March 2021 13:40 I am not totally into this Energy management topic but perhaps you should use a Dummy P1 Energy Meter to put your combined results in https://www.domoticz.com/wiki/Domoticz_ ... mart_meter
It has seperate values for Usage and Return and shows the result also. Tariff 1 and 2 are day/night tariffs. If you have no separate day/night tariff then you can use only tariff 1.
- waltervl
- Posts: 5909
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Create possibility to store negative numbers in managed counters
For P1 Return values are also positive numbers, the device widget will calculate the total sum I believe (like return or consume).
Like for example https://community.homehabit.app/t/how-t ... oticz/1529
Like for example https://community.homehabit.app/t/how-t ... oticz/1529
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
Who is online
Users browsing this forum: No registered users and 1 guest