2 states in 1 button

Dashticz, alternative dashboard based on HTML, CSS, jQuery

Moderators: leecollings, htilburgs, robgeerts

Post Reply
darrepac
Posts: 133
Joined: Tuesday 04 February 2014 21:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Isère, France
Contact:

2 states in 1 button

Post by darrepac »

Hi,

I am just starting to jump into dashticz.
About power consumption button, in standard Domoticz UI you can see 2 information in 1 button: current power consumption and total energy consumed for the day:
2021-10-31 21_56_00-Domoticz.png
2021-10-31 21_56_00-Domoticz.png (5.78 KiB) Viewed 361 times

In dashticz, am I obliged to have 2 buttons or is there a way to also put the 2 information into one?

2021-10-31 21_55_38-magicmirrorpi - TightVNC Viewer.png
2021-10-31 21_55_38-magicmirrorpi - TightVNC Viewer.png (37.7 KiB) Viewed 361 times
Lokonli
Posts: 2291
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: 2 states in 1 button

Post by Lokonli »

darrepac wrote: Sunday 31 October 2021 21:57 Hi,

I am just starting to jump into dashticz.
About power consumption button, in standard Domoticz UI you can see 2 information in 1 button: current power consumption and total energy consumed for the day:
2021-10-31 21_56_00-Domoticz.png


In dashticz, am I obliged to have 2 buttons or is there a way to also put the 2 information into one?


2021-10-31 21_55_38-magicmirrorpi - TightVNC Viewer.png
Yes, you can combine it. Assuming your device is a P1 smart meter, you can try the following block definition:

Code: Select all

blocks['customblock'] = {
  idx: '43_1',
  title:"Actual: <Usage>",
  value: "Today: <NettCounterToday> kWh",
  format:true,
  decimals: 1
}
Instead of 43 use the Domoticz device ID of your own device.

For as well the title field as the value field of a Domoticz block you can indicate to fill in the value of a Domoticz device parameter by using the '<' and '>' symbol.

For a smart meter device you can use the following device parameters:
Usage (=Actual power entering your house)
UsageDeliv (=Actual power leaving your house)
NettUsage (=Usage - UsageDeliv)

CounterToday (=Energy entered your house today)
CounterDelivToday (=Energy left your house today)
NettCounterToday (=CounterToday - CounterDelivToday)

Counter (=Total counter of energy that entered your house)
CounterDeliv (=Total counter of energy that left your house)
NettCounter (=Counter - CounterDeliv)

All parameter names are case sensitive.

For more fancy computations you can create your custom getStatus function in custom.js
See: https://dashticz.readthedocs.io/en/mast ... -idx-block

or: create a dial. See:https://dashticz.readthedocs.io/en/mast ... mart-meter
darrepac
Posts: 133
Joined: Tuesday 04 February 2014 21:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Isère, France
Contact:

Re: 2 states in 1 button

Post by darrepac »

Wow sounds interestings! Many thanks!
darrepac
Posts: 133
Joined: Tuesday 04 February 2014 21:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Isère, France
Contact:

Re: 2 states in 1 button

Post by darrepac »

Note: putting values in title is a nice hack but...you do not have any more the original title in your button. But a nice hack still...

For what concern Dial, I have some issues that I will put in the Dial thread.
Lokonli
Posts: 2291
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: 2 states in 1 button

Post by Lokonli »

darrepac wrote:Note: putting values in title is a nice hack but...you do not have any more the original title in your button. But a nice hack still...

For what concern Dial, I have some issues that I will put in the Dial thread.
You can put any text in the title, including the Domoticz device Name field

Verstuurd vanaf mijn AC2003 met Tapatalk

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest