Page 1 of 1

Custom graph title with net usage

Posted: Sunday 19 April 2020 21:10
by rolands
Hello,

I am new to Dashticz and creating my custom dash bit by bit. There is a lot possible and documented, very cool.
Now I have a graph that displayes my P1 smart meter electricity. However, the title seems to display the used electricity and not the net used electricity. There is not calculated with the returned power from my solar panels.

Is it possible to have a custom title that, for example, displays the used power, returned power end net power for the current day?

I did try some things with the "customHeader", but i don't get it working. Maybe someone here with an example?

I currently use this:

Code: Select all

blocks[p1_grafiek_elektra] = {
	title: 'Elektriciteit',
    graph: ['line','bar','bar'],
    custom : {
        "last hours": {
            range: 'day',
            filter: '4 hours',
            data: {
                nett: 'd.v+d.v2-d.r1-d.r2',
                usage: 'd.v+d.v2',
                generation: '-d.r1-d.r2'
            }
        },
        "last day": {
            range: 'day',
            filter: '24 hours',
            data: {
                nett: 'd.v+d.v2-d.r1-d.r2',
                usage: 'd.v+d.v2',
                generation: '-d.r1-d.r2'
            }
        },
        "last 2 weeks": {
            range: 'month',
            filter: '14 days',
            data: {
                nett: 'd.v+d.v2-d.r1-d.r2',
                usage: 'd.v+d.v2',
                generation: '-d.r1-d.r2'
            }
        },
        "last 6 months": {
            range: 'year',
            filter: '6 months',
            data: {
                nett: 'd.v+d.v2-d.r1-d.r2',
                usage: 'd.v+d.v2',
                generation: '-d.r1-d.r2'
            }
        }
    },
    legend: false,
    datasetColors:['blue','red','yellow']
}
Any help is appriciated.

Regards,
Roland

Re: Custom graph title with net usage

Posted: Monday 20 April 2020 12:05
by clinkadink
Hi Roland,

Which Dashticz version are you running; Master or latest Beta?

I note you don't have the devices parameter in your graph block. E.g.

Code: Select all

devices: [123],
The default value displayed in the header is taken from the device data provided by Domoticz. You can see what is being returned/used using this link. Obviously update the url accordingly removing the square brackets.

http://[domoticz_ip_and_port]/json.htm?type=devices&rid=[idx]

If you need further help, adding this to your graph block, and providing the output, will allow me to support further.

Code: Select all

debugButton: true,
More info on debugButton here: https://www.domoticz.com/forum/viewtopi ... on#p237106

Cheers ;)

Re: Custom graph title with net usage

Posted: Monday 20 April 2020 21:05
by rolands
Hello, thank you for your reply.

clinkadink wrote: Monday 20 April 2020 12:05 Which Dashticz version are you running; Master or latest Beta?
I use the latest master version, 3.3.3.1., this is because this was the default with the installer, but i am willing to change to beta if needed.
clinkadink wrote: Monday 20 April 2020 12:05 I note you don't have the devices parameter in your graph block. E.g.

Code: Select all

devices: [123],
I am not sure, i just found some examples that i used. There is a VAR defened with:
var p1_grafiek_elektra = 'graph_1';
When i add the devices parameter in the graph block, there is no difference.
clinkadink wrote: Monday 20 April 2020 12:05 The default value displayed in the header is taken from the device data provided by Domoticz. You can see what is being returned/used using this link. Obviously update the url accordingly removing the square brackets.

http://[domoticz_ip_and_port]/json.htm?type=devices&rid=[idx]
It seems that the values used are the from the counter today value from the device. I already have the values in the graph, so maybe i can use the values from there, somehow with this:

nett: 'd.v+d.v2-d.r1-d.r2',
usage: 'd.v+d.v2',
generation: '-d.r1-d.r2'

I can fiddle arround, but i am not sure how i can modify the output in the title.

The debugbutton don't seem to work, maybe thats for the beta version?

The output for the device info from domoticz:
Spoiler: show
{
"ActTime" : 1587408620,
"AstrTwilightEnd" : "22:58",
"AstrTwilightStart" : "04:16",
"CivTwilightEnd" : "21:20",
"CivTwilightStart" : "05:54",
"DayLength" : "14:13",
"NautTwilightEnd" : "22:05",
"NautTwilightStart" : "05:09",
"ServerTime" : "2020-04-20 20:50:20",
"SunAtSouth" : "13:37",
"Sunrise" : "06:30",
"Sunset" : "20:43",
"app_version" : "2020.1",
"result" :
[
{
"AddjMulti" : 1.0,
"AddjMulti2" : 1.0,
"AddjValue" : 0.0,
"AddjValue2" : 0.0,
"BatteryLevel" : 255,
"Counter" : "11678.153",
"CounterDeliv" : "4589.816",
"CounterDelivToday" : "10.351 kWh",
"CounterToday" : "3.393 kWh",
"CustomImage" : 0,
"Data" : "7274440;4403713;1360153;3229663;598;0",
"Description" : "",
"Favorite" : 1,
"HardwareID" : 2,
"HardwareName" : "EnergieMeterP1",
"HardwareType" : "P1 Smart Meter USB",
"HardwareTypeVal" : 4,
"HaveTimeout" : false,
"ID" : "0001",
"LastUpdate" : "2020-04-20 20:50:16",
"Name" : "Power",
"Notifications" : "false",
"PlanID" : "0",
"PlanIDs" :
[
0
],
"Protected" : false,
"ShowNotifications" : true,
"SignalLevel" : "-",
"SubType" : "Energy",
"SwitchTypeVal" : 0,
"Timers" : "false",
"Type" : "P1 Smart Meter",
"TypeImg" : "counter",
"Unit" : 1,
"Usage" : "598 Watt",
"UsageDeliv" : "0 Watt",
"Used" : 1,
"XOffset" : "0",
"YOffset" : "0",
"idx" : "1"
}
],
"status" : "OK",
"title" : "Devices"
}
I would like to use the CounterDelivToday as my generated power, countertoday as my consumption and then calculate the difference as my net delivered/generated power in the title:

"CounterDelivToday" : "10.351 kWh",
"CounterToday" : "3.393 kWh",

Any suggestion how to do this with the current graph?

Thanks,
Roland

Re: Custom graph title with net usage

Posted: Sunday 26 April 2020 17:38
by clinkadink
Currently, the displays the default data reported by the device. Many devices collect multiple data, like yours (above). There is currently no method to access this data within the header. I have logged this as a new feature request and let you know how I get on.
https://www.domoticz.com/forum/viewtopi ... 78&t=32374

Re: Custom graph title with net usage

Posted: Monday 04 May 2020 15:22
by dorenberg
Same here. Also very interested in this.