Dashticz P1 Smart Meter: Last 7 days cumulative usage graph

Dashticz, alternative dashboard based on HTML, CSS, jQuery

Moderators: leecollings, htilburgs, robgeerts

Post Reply
User avatar
Antoinne
Posts: 14
Joined: Monday 30 March 2020 17:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Dashticz P1 Smart Meter: Last 7 days cumulative usage graph

Post by Antoinne »

I recently started my own Dashticz deployment and I really love the flexibility it offers compared with standard Domoticz. There is however one thing I haven’t figured out. How to recreate the “Last 7 days” cumulative usage graph (as shown in the image below) of P1 Smart Meter? I really would like to have an additional graph to the one I already have of P1 usage. But can someone provide an example on how to recreate this specific (original) Domoticz graph? Any help/tips would be much appreciated ;-)
Dagelijks cumalatief - Capture.PNG
Dagelijks cumalatief - Capture.PNG (103.01 KiB) Viewed 1591 times
Tnx,

Antoinne
User avatar
clinkadink
Posts: 417
Joined: Tuesday 31 December 2019 1:15
Target OS: Linux
Domoticz version: 2020.2
Location: Swindon, UK
Contact:

Re: Dashticz P1 Smart Meter: Last 7 days cumulative usage graph

Post by clinkadink »

What have you tried so far? If the Domoticz can report on it, the data is available. The above graph is a line graph, with filled with an opaque colour.

Something like this ...

Code: Select all

blocks['cumalatief'] = {	
  title: 'P Elektriciteitsmeter',
  devices: [idx],  // <---- idx of your P1 device
  graph: 'line',
  borderColors:['rgba(83, 51, 198, 1)'],
  datasetColors: ['rgba(83, 51, 198, 0.33)'],
  legend: true
}
And add to your column like this ...

Code: Select all

columns[1] = {}
columns[1]['width'] = 12;
columns[1]['blocks'] = [ 'cumalatief']
P1 meters typically have multiple datasets, or sub-devices. If you don't want all datasets shown in the graph, use the graphTypes parameter. More info here: https://dashticz.readthedocs.io/en/beta ... raphs.html
"UI is the saddle, the stirrups, & the reins. UX is the feeling you get being able to ride the horse."
User avatar
Antoinne
Posts: 14
Joined: Monday 30 March 2020 17:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Dashticz P1 Smart Meter: Last 7 days cumulative usage graph

Post by Antoinne »

This helped me a lot. Thanks!

I'm still a bit confused though. I have been working on my dashticz project for 3 weeks now, using a lot of different devices. But the P1 output and graphs still puzzle me. Based on different examples I found in the wiki and on this forum, I have made two graphs (for gas and elektra) I like. See example for elektra below (not finished yet).
Spoiler: show
blocks['graph_8'] = {
title: 'Stroomverbruik',
devices: [8],
graph: ['bar'],
height: '295px',
custom : {
"maand": {
range: 'month',
filter: '1 months',
data: {
staaf: 'd.v_8+d.v2_8',
}
},
"vandaag": {
range: 'day',
filter: '24 hours',
data: {
staaf: 'd.v_8+d.v2_8',
}
},
"week": {
range: 'day',
filter: '168 hours',
data: {
staaf: 'd.v_8+d.v2_8',
}
},
"jaar": {
range: 'year',
filter: '12 months',
data: {
staaf: 'd.v_8+d.v2_8',
}
}
},
legend: true,
datasetColors:['blue']
}
What confuses me is the output on the today ("vandaag") screen in the example you gave. I would expect it to show only the last 24 hours, but it shows a week. Why?

But as said, with the example you gave me, I can continue my learning exeperience ;-)

Antoinne
User avatar
clinkadink
Posts: 417
Joined: Tuesday 31 December 2019 1:15
Target OS: Linux
Domoticz version: 2020.2
Location: Swindon, UK
Contact:

Re: Dashticz P1 Smart Meter: Last 7 days cumulative usage graph

Post by clinkadink »

The example block that I gave did not contain any custom data. Therefore, it will automatically create the default 3 range buttons; last day, week and month. You can set which range is used when the graph is loaded, by updating this is your config.sys.

Code: Select all

config['standard_graph'] = 'day'; 
More info here: https://dashticz.readthedocs.io/en/beta ... raphs.html

If you need anything else, just ask ;)
"UI is the saddle, the stirrups, & the reins. UX is the feeling you get being able to ride the horse."
Lokonli
Posts: 2262
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Dashticz P1 Smart Meter: Last 7 days cumulative usage graph

Post by Lokonli »

config.sys => CONFIG.js
Lokonli
Posts: 2262
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Dashticz P1 Smart Meter: Last 7 days cumulative usage graph

Post by Lokonli »

MS-DOS experience? ;)
User avatar
Antoinne
Posts: 14
Joined: Monday 30 March 2020 17:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Dashticz P1 Smart Meter: Last 7 days cumulative usage graph

Post by Antoinne »

Maybe it is because I am running Dashticz V3.4.3 Beta, but my default buttons are last hours, today and last month. I also got confused because the available (or shown?) data of the P1 meter changes. Anyhow, I have learned a lot on P1 meters and making graphs in Dashticz today ;)

The next challenge will be incorporating information from the JSON Buienradar offers. I already have some 20 Buienradar API-devices running on Domoticz/Dashticz, but now I need to figure out how to incorporate data that is only available through JSON on Buienradar. I still have a lot to learn to become a true power user in Domoticz/Dashticz ;-)

Once I have finished my designs, I will post them on the "show your design" post :D

Tnx,

Antoinne
User avatar
Antoinne
Posts: 14
Joined: Monday 30 March 2020 17:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Dashticz P1 Smart Meter: Last 7 days cumulative usage graph

Post by Antoinne »

Lokonli wrote: Thursday 16 April 2020 23:42 MS-DOS experience? ;)
I'll DOS you all. I still write batchfiles in my sleep ;-)
User avatar
clinkadink
Posts: 417
Joined: Tuesday 31 December 2019 1:15
Target OS: Linux
Domoticz version: 2020.2
Location: Swindon, UK
Contact:

Re: Dashticz P1 Smart Meter: Last 7 days cumulative usage graph

Post by clinkadink »

Lokonli wrote: Thursday 16 April 2020 23:42 MS-DOS experience? ;)
:lol: What was I thinking. I haven't used config.sys (or autoexec.bat) since the '90s!!
"UI is the saddle, the stirrups, & the reins. UX is the feeling you get being able to ride the horse."
User avatar
clinkadink
Posts: 417
Joined: Tuesday 31 December 2019 1:15
Target OS: Linux
Domoticz version: 2020.2
Location: Swindon, UK
Contact:

Re: Dashticz P1 Smart Meter: Last 7 days cumulative usage graph

Post by clinkadink »

Antoinne wrote: Friday 17 April 2020 0:24 Maybe it is because I am running Dashticz V3.4.3 Beta, but my default buttons are last hours, today and last month.
No, this is correct for the master and the beta. These will only change if you specify custom data in your block.
Antoinne wrote: Friday 17 April 2020 0:24 I also got confused because the available (or shown?) data of the P1 meter changes.
This is because P1 meters have multiple datasets. This can be demonstrated by using my example block above, i.e. without any custom data, and with legend set to true. The legend will then show each of your datasets and their key names, e.g. v2, v_2, etc. If you only want to display data for v2 (for example), then add this to your block:

Code: Select all

graphTypes: ['v2'],
You can view the raw data being returned for 'counter' devices using this url (replace everything between and including the square brackets):

Code: Select all

http://[DOMOTICZ_IP_AND_PORT]/json.htm?type=graph&sensor=counter&idx=[IDX]&range=day
You can view information about the device itself by using this url:

Code: Select all

[code]http://[DOMOTICZ_IP_AND_PORT]/json.htm?type=devices&rid=[IDX]
Antoinne wrote: Friday 17 April 2020 0:24 The next challenge will be incorporating information from the JSON Buienradar offers. I already have some 20 Buienradar API-devices running on Domoticz/Dashticz, but now I need to figure out how to incorporate data that is only available through JSON on Buienradar.
Sorry, I cannot help you with this, I do not use Bienradar. Instead, I use Rainviewer. https://www.rainviewer.com/api.html
I host it locally, then embed it using the url in a frame in Dashticz. It is similar to Bienradar, except is available for any where in the world, the user has full controls, allowing them to zoom out and into another country. It updates every second in 10 minutes increments. It can also be styled/themed like Google Maps styling.

Image
"UI is the saddle, the stirrups, & the reins. UX is the feeling you get being able to ride the horse."
User avatar
Antoinne
Posts: 14
Joined: Monday 30 March 2020 17:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Dashticz P1 Smart Meter: Last 7 days cumulative usage graph

Post by Antoinne »

Tnx again. That rainviewer look really nice. Maybe that is something I will use too. I also noticed that the documentation on graphs is now much more elaborate compared to the last time I looked at it. This really helps.

There is however still one thing I don't get. It is probably something really simple that I either forgot or did not implement correctly. But when I create the simple graph with the example you gave, it does not show the default 3 ranges last day, week and month. I get buttons with last hours, today and last month. And when I look at the output of the today button it show the last week instead of 24 hours?!?
buttons - Capture.PNG
buttons - Capture.PNG (194.87 KiB) Viewed 1480 times
I can not figure out how to correct this. The weird thing is, I really prefer the weekly view. And it must be a mild form of autism, but I can't stand the fact that the text on the standard button is incorrect with tho output I get ;-)

Any tips on how to fix this?
Lokonli
Posts: 2262
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Dashticz P1 Smart Meter: Last 7 days cumulative usage graph

Post by Lokonli »

The 'today' button shows the data it receives from Domoticz defined as 'today'. There is a setting somewhere in Domitcz where you define how many days will be shown on the day graph.
In Dashticz the graph data is fully customizable. The documentation of the beta branch (not the master version!) contains quite some examples.
With the custom graphs you can filter the data, select data elements, custom computations, set button text, etc.
Probably people here are willing to help as well.

Sent from my SM-A320FL using Tapatalk

User avatar
Antoinne
Posts: 14
Joined: Monday 30 March 2020 17:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Dashticz P1 Smart Meter: Last 7 days cumulative usage graph

Post by Antoinne »

Tnx, I did not think of that setting. I only looked at it when I installed Domoticz 2 years ago ;-)
User avatar
clinkadink
Posts: 417
Joined: Tuesday 31 December 2019 1:15
Target OS: Linux
Domoticz version: 2020.2
Location: Swindon, UK
Contact:

Re: Dashticz P1 Smart Meter: Last 7 days cumulative usage graph

Post by clinkadink »

Apologies, that is correct, last hours, today and last month.

Second example below if you want to give it a spin ...

Code: Select all

blocks['cumalatief'] = {	
  title: 'P Elektriciteitsmeter',
  devices: [8], 
  graph: 'line',
  graphTypes: ['eu_8'],
  borderColors:['rgba(83, 51, 198, 1)'],
  datasetColors: ['rgba(83, 51, 198, 0.33)'],
  lineFill: [true],
  buttonsText: ['Today', 'Week', 'Month'],
  maxTicksLimit: 14,
  zoom: 'x',
  debugButton: true,
  legend: {
    'Cumalatief' : 'eu_8'
  }
}
"UI is the saddle, the stirrups, & the reins. UX is the feeling you get being able to ride the horse."
User avatar
Antoinne
Posts: 14
Joined: Monday 30 March 2020 17:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Dashticz P1 Smart Meter: Last 7 days cumulative usage graph

Post by Antoinne »

As expected, resetting the Domoticz defined 'today' setting created another steep learning curve today (and tonight). More work to do on my graphs. Really love the "debugButton: true" option ;-)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest