Bar charts of energy consumption

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Daro1003
Posts: 181
Joined: Monday 14 November 2022 12:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Poland
Contact:

Bar charts of energy consumption

Post by Daro1003 »

I connected the energy meter structure to ESP + PZEM from Tasmota and it shows nicely the daily, monthly and annual energy consumption.
The problem is that in the monthly consumption chart I have a solid line.

I saw someone on the Internet post a bar chart from a given month where consumption was shown in bars for each day.
The question is how to create such a chart in domoticz?
Do you need Grafana for this or can it be set somehow in Domoticz?

Topic with pictures:
https://www.elektroda.pl/rtvforum/topic ... l#20767204
User avatar
waltervl
Posts: 5843
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Bar charts of energy consumption

Post by waltervl »

What type of device is your Domoticz device that has these values?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Daro1003
Posts: 181
Joined: Monday 14 November 2022 12:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Poland
Contact:

Re: Bar charts of energy consumption

Post by Daro1003 »

It is "custom sensor"
I would like to get total energy in the bars.
Attachments
Tasmota22.jpg
Tasmota22.jpg (42.01 KiB) Viewed 3336 times
custom senso1r.jpg
custom senso1r.jpg (19.17 KiB) Viewed 3339 times
willemd
Posts: 642
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: Bar charts of energy consumption

Post by willemd »

General, custom sensors are stored in the percentage and percentage_calendar tables and therefore you get lines and daily min,max and avg values.

If you use a counter device (stored in the meter and meter_calendar tables), you will get the bars. You will get bars of the daily increase of the counter.
Daro1003
Posts: 181
Joined: Monday 14 November 2022 12:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Poland
Contact:

Re: Bar charts of energy consumption

Post by Daro1003 »

How and where to change it?
Sensors and data are downloaded automatically by Tasmoticz and everything is added automatically. Is it possible to change this sensor?
User avatar
waltervl
Posts: 5843
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Bar charts of energy consumption

Post by waltervl »

That you should ask in Tasmota forum. How does Tasmota create the Domoticz device? Is it with MQTT Auto discover?

Edit: I read now you use the Tasmoticz Plugin. Please discuss this with the author. https://github.com/joba-1/Tasmoticz
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Daro1003
Posts: 181
Joined: Monday 14 November 2022 12:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Poland
Contact:

Re: Bar charts of energy consumption

Post by Daro1003 »

If I complete the Configure MQTT data in Tasmota and provide the IP and Domoticz port there, the sensors automatically appear in Domoticz. So it's Tasmoticz's fault?
User avatar
waltervl
Posts: 5843
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Bar charts of energy consumption

Post by waltervl »

Daro1003 wrote: Friday 13 October 2023 21:07 If I complete the Configure MQTT data in Tasmota and provide the IP and Domoticz port there, the sensors automatically appear in Domoticz. So it's Tasmoticz's fault?
Yes.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Daro1003
Posts: 181
Joined: Monday 14 November 2022 12:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Poland
Contact:

Re: Bar charts of energy consumption

Post by Daro1003 »

So write a message to user Joba-1 with this problem? Or maybe a plugin update?

Is there any Tasmota forum?
User avatar
waltervl
Posts: 5843
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Bar charts of energy consumption

Post by waltervl »

I think the best thing is to make a new issue on the GitHub repository https://github.com/joba-1/Tasmoticz/issues with reference to this forum topic.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Daro1003
Posts: 181
Joined: Monday 14 November 2022 12:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Poland
Contact:

Re: Bar charts of energy consumption

Post by Daro1003 »

Thanks for the link, I added a description of the problem with a link to this topic. I wonder if anything will be done about it.
willemd
Posts: 642
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: Bar charts of energy consumption

Post by willemd »

Daro1003 wrote: Friday 13 October 2023 18:48 How and where to change it?
Sensors and data are downloaded automatically by Tasmoticz and everything is added automatically. Is it possible to change this sensor?
If you cannot change those created by Tasmoticz, you could create an additional device, type counter, and each time the Tasmoticz device changes you then also change this extra device using a dzvents script.
Daro1003
Posts: 181
Joined: Monday 14 November 2022 12:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Poland
Contact:

Re: Bar charts of energy consumption

Post by Daro1003 »

Unfortunately, I'm bad at writing scripts.
willemd
Posts: 642
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: Bar charts of energy consumption

Post by willemd »

Daro1003 wrote: Saturday 14 October 2023 22:15 Unfortunately, I'm bad at writing scripts.
This will be one of the easiest. Use one device as trigger, take the value from that device, and then update the other.
User avatar
waltervl
Posts: 5843
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Bar charts of energy consumption

Post by waltervl »

Better to have it fixed in the plugin. Should be not so difficult.
In tasmota.py this section should be changed I think.

Code: Select all

        'zählerstand_total':    {'Name':'Total Usage',  'Unit':'KWh',   'DomoType': 'Custom'},
        'zählerstand_tarif_1':    {'Name':'Tarif1 Usage',  'Unit':'KWh',   'DomoType': 'Custom'},
        'zählerstand_tarif_2':    {'Name':'Tarif2 Usage',  'Unit':'KWh',   'DomoType': 'Custom'},
Last edited by waltervl on Sunday 15 October 2023 21:52, edited 1 time in total.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
hjheins
Posts: 1
Joined: Sunday 15 October 2023 21:04
Target OS: Linux
Domoticz version:
Contact:

Re: Bar charts of energy consumption

Post by hjheins »

Hi just chiming in.
I also use this device, and had the same issues.
The solution indeed is a small script that you attach to a dummy device.
I basically hacked up a more complex script from SunnyBoy, and only made the bit referring to my Dummymeter device working.
See the attached file as for some reason the forum seems to interpret it all as external links in a code block.

Hendrik-Jan
Attachments
Dummymeter.txt
(4.81 KiB) Downloaded 62 times
User avatar
waltervl
Posts: 5843
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Bar charts of energy consumption

Post by waltervl »

The real solution would be to use an energy counter device instead of a custom sensor. You also would get better reports.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
joba1
Posts: 19
Joined: Saturday 03 March 2018 16:39
Target OS: Linux
Domoticz version: V2024.7
Location: DE
Contact:

Re: Bar charts of energy consumption

Post by joba1 »

Hi,

I'm willing to try your suggestion and you seem to know which type of device is needed.
Can you elaborate in terms of https://www.domoticz.com/wiki/Developin ... vice_Types which type would do what you want?
There are different flavors of counters with and without TypeName and even a kWh type.
User avatar
waltervl
Posts: 5843
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Bar charts of energy consumption

Post by waltervl »

Yes, kWh would be the correct device

It needs 2 values to update, svalue=POWER;ENERGY
POWER = current power (W)
ENERGY = Integer, total cumulative energy in Watt-hours (Wh)

So from the screenshot above
Power = 2+2+33=37 W
Energy = Energy Total = 21.224*1000 W
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
joba1
Posts: 19
Joined: Saturday 03 March 2018 16:39
Target OS: Linux
Domoticz version: V2024.7
Location: DE
Contact:

Re: Bar charts of energy consumption

Post by joba1 »

I just created a pull request on my repo that should do what you want.

You can download/clone the test version plugin from the corresponding branch https://github.com/joba-1/Tasmoticz/tre ... s-counters

I tested, that the devices have a counter type and show correct values, but please check if the diagrams look as expected (I never used them before so I don't know what to expect)

You need to delete the old devices or the plugin won't recreate the new ones.
Better save a backup of the database before deleting them. I try to make a script to save the history from the old device to the new one.
So maybe the history can be restored later.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest