Page 1 of 1

show managed counter in dashticz

Posted: Monday 21 December 2020 12:20
by jsmit
Hi,

I have in domoticz an managed couter to show my total delivery of my sun panels.
But i don't no how to show this one in dashticz.
In dashticz it shows on (as an switch).

var p1_zonnepanelen_totaal = 441;

blocks[p1_zonnepanelen_totaal] = {}
blocks[p1_zonnepanelen_totaal]['title'] = 'Totaal';
blocks[p1_zonnepanelen_totaal]['width'] = 4;
blocks[p1_zonnepanelen_totaal]['unit'] = 'kWh'
blocks[p1_zonnepanelen_totaal]['icon'] = 'fas fa-sun';
blocks[p1_zonnepanelen_totaal]['last_update'] = false;

Can anyone point me in the rigth direction?

Jacco

Re: show managed counter in dashticz

Posted: Monday 21 December 2020 16:40
by Lokonli
jsmit wrote: Monday 21 December 2020 12:20 Hi,

I have in domoticz an managed couter to show my total delivery of my sun panels.
But i don't no how to show this one in dashticz.
In dashticz it shows on (as an switch).

var p1_zonnepanelen_totaal = 441;

blocks[p1_zonnepanelen_totaal] = {}
blocks[p1_zonnepanelen_totaal]['title'] = 'Totaal';
blocks[p1_zonnepanelen_totaal]['width'] = 4;
blocks[p1_zonnepanelen_totaal]['unit'] = 'kWh'
blocks[p1_zonnepanelen_totaal]['icon'] = 'fas fa-sun';
blocks[p1_zonnepanelen_totaal]['last_update'] = false;

Can anyone point me in the rigth direction?

Jacco
How did you add this block to a column?
Any code in custom.js?

Can you post the output of:

Code: Select all

http://domoticz ip:port/json.htm?type=devices&rid=441

Re: show managed counter in dashticz

Posted: Monday 21 December 2020 16:55
by jsmit
Lokonli,

Thanks for your reply.

I didn't change anything in custom.js

//add custom javascript in here
function afterGetDevices(){

}

function getExtendedBlockTypes(blocktypes){
//blocktypes.Type['Lighting 2'] = { icon: 'fa fa-lightbulb-o', title: '<Name>', value: 'ds' }
return blocktypes;
}


Here is the output:
{
"ActTime" : 1608565734,
"AstrTwilightEnd" : "18:35",
"AstrTwilightStart" : "06:41",
"CivTwilightEnd" : "17:08",
"CivTwilightStart" : "08:08",
"DayLength" : "07:37",
"NautTwilightEnd" : "17:53",
"NautTwilightStart" : "07:23",
"ServerTime" : "2020-12-21 16:48:54",
"SunAtSouth" : "12:38",
"Sunrise" : "08:49",
"Sunset" : "16:27",
"app_version" : "2020.2 (build 12496)",
"result" :
[
{
"AddjMulti" : 1.0,
"AddjMulti2" : 1.0,
"AddjValue" : 0.0,
"AddjValue2" : 0.0,
"BatteryLevel" : 255,
"Counter" : "3.829 kWh",
"CustomImage" : 0,
"Data" : "3.829 kWh",
"Description" : "",
"Favorite" : 0,
"HardwareID" : 20,
"HardwareName" : "Zonnepanelen",
"HardwareType" : "Dummy (Does nothing, use for virtual switches only)",
"HardwareTypeVal" : 15,
"HaveTimeout" : false,
"ID" : "82441",
"LastUpdate" : "2020-12-21 16:48:03",
"Name" : "Zonnepanelen totaal",
"Notifications" : "false",
"PlanID" : "5",
"PlanIDs" :
[
5
],
"Protected" : false,
"ShowNotifications" : false,
"SignalLevel" : "-",
"SubType" : "Managed Counter",
"SwitchTypeVal" : 4,
"Timers" : "false",
"Type" : "General",
"TypeImg" : "counter",
"Unit" : 1,
"Used" : 1,
"ValueQuantity" : "",
"ValueUnits" : "",
"XOffset" : "0",
"YOffset" : "0",
"idx" : "441"
}
],
"status" : "OK",
"title" : "Devices"
}

Re: show managed counter in dashticz

Posted: Monday 21 December 2020 17:17
by Lokonli
You are the first one that is using a Managed Counter.

It's not supported yet by Dashticz: I will add it.

Re: show managed counter in dashticz

Posted: Monday 21 December 2020 17:21
by jsmit
Oke, that's why i can't found it.

I can change the title of the device when i change custom.js
function getStatus_441(block) {
var usage = block.device.Usage;
var device = block.device;
block.title = device['Data']
}
But i want to change the status ofcourse.

Thanks for adding.

Jacco

Re: show managed counter in dashticz

Posted: Monday 21 December 2020 18:15
by Lokonli
jsmit wrote: Monday 21 December 2020 17:21 Oke, that's why i can't found it.

I can change the title of the device when i change custom.js
function getStatus_441(block) {
var usage = block.device.Usage;
var device = block.device;
block.title = device['Data']
}
But i want to change the status ofcourse.

Thanks for adding.

Jacco
Managed Counter added to latest beta.

Update with 'git pull'

Re: show managed counter in dashticz

Posted: Monday 21 December 2020 19:05
by jsmit
Lokonli,

Thanks for the quick update.
Works perfect.

Jacco