Dashticz - Function - Trigger action on specific value

Dashticz, alternative dashboard based on HTML, CSS, jQuery

Moderators: leecollings, htilburgs, robgeerts

robgeerts
Posts: 1273
Joined: Saturday 24 January 2015 22:12
Target OS: NAS (Synology & others)
Domoticz version: 3.7067
Location: NL
Contact:

Dashticz - Function - Trigger action on specific value

Post by robgeerts »

Just like the function to take action on change of a value I now have extended functionality (in beta) to do something with a block when it has a specific value.
Example, add a red background to a switch when energy usage reaches a limit.

In this example I'm using a device with IDX 150_1
In custom.js add:

Code: Select all

function getStatus_150_1(idx,value,device){
	if(parseFloat(device['Usage'])>1500){
		$('div.block_150_1').addClass('warning');
	}
	else {
		$('div.block_150_1').removeClass('warning');
	}
}
And in custom.css add:

Code: Select all

.warning {
    background: rgba(199,44,44,0.3) !important;
    background-clip: padding-box;
}
User avatar
mvveelen
Posts: 687
Joined: Friday 31 October 2014 10:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: Dashticz - [BETA] - Function - Do something at a specific value

Post by mvveelen »

Going to try this tomorrow evening. Nice work Rob!

Couldn't resist. Have to change the .css I think, but this is just a first try :)
Attachments
Schermafbeelding 2017-05-21 om 23.02.01.png
Schermafbeelding 2017-05-21 om 23.02.01.png (138.59 KiB) Viewed 4838 times
RPi3b+/RFXCOM rfxtrx433E/Shelly/Xiaomi Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
User avatar
mongoose
Posts: 42
Joined: Friday 22 November 2013 10:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Dashticz - [BETA] - Function - Do something at a specific value

Post by mongoose »

Awesome, this is what I have wanted, can't wait to play around with it. For water tank level, or mm rain ☔
robgeerts
Posts: 1273
Joined: Saturday 24 January 2015 22:12
Target OS: NAS (Synology & others)
Domoticz version: 3.7067
Location: NL
Contact:

Re: Dashticz - [BETA] - Function - Do something at a specific value

Post by robgeerts »

If anybody has cool scripts, please share :)
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Dashticz - [BETA] - Function - Do something at a specific value

Post by EdwinK »

We'll see what users come up with.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
robgeerts
Posts: 1273
Joined: Saturday 24 January 2015 22:12
Target OS: NAS (Synology & others)
Domoticz version: 3.7067
Location: NL
Contact:

Re: Dashticz - [BETA] - Function - Do something at a specific value

Post by robgeerts »

Image
(Just a demonstration, in the live version it turns blue when expected rain is more then 5 mm and temperature inside is higher then 23 degrees.

custom.js

Code: Select all

function getStatus_145(idx,value,device){
	if(parseFloat(device['Data'])>23){
		$('div.block_145').addClass('warning');
	}
	else {
		$('div.block_145').removeClass('warning');
	}
}

function getStatus_286(idx,value,device){
	if(parseFloat(device['Data'])>4){
		$('div.block_286').addClass('warningblue');
	}
	else {
		$('div.block_145').removeClass('warningblue');
	}
}
custom.css

Code: Select all

.warning {
	background: rgba(199,44,44,0.3) !important;
    background-clip: padding-box;
}

.warningblue {
	background: rgba(45,119,204,0.3) !important;
    background-clip: padding-box;
}
User avatar
htilburgs
Posts: 464
Joined: Tuesday 03 November 2015 11:01
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Dashticz - [BETA] - Function - Do something at a specific value

Post by htilburgs »

And for those who like a blinking version ;-)

Code: Select all

.warning {
	background: rgba(199,44,44,0.3) !important;
    background-clip: padding-box;
	-webkit-animation: BLINK-ANIMATION 1s infinite;
	-moz-animation: BLINK-ANIMATION 1s infinite;
	-o-animation: BLINK-ANIMATION 1s infinite;
	animation: BLINK-ANIMATION 1s infinite;
}

@-webkit-keyframes BLINK-ANIMATION {
0%, 49% {
    background-color: rgba(255,0,0,0.5);
    border: 3px solid red;
}
50%, 100% {
    background-color: red;
    border: 3px solid rgba(255,0,0.0.5);
}
}
Hardware:
RPi3 - Aeon Labs Z-Stick GEN5 - Fibaro Dimmer 2 - Fibaro Roller Shutter 2 - Fibaro Smoke Sensor - Yeelight RGBW Led bulb - Yeelight Smart LED Light Strip - Neo Coolcam PIR Motion Sensor - Neo Coolcam PowerPlug - Nest Thermostat v3
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Dashticz - [BETA] - Function - Do something at a specific value

Post by EdwinK »

Great thanks.

And now, instead of doing something I'm again playing with Dashticz. Using outside temp for now, as I don't have an inside thermostat. Is it possible to use the 'currentweather_big' as alert?
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Dashticz - [BETA] - Function - Do something at a specific value

Post by EdwinK »

htilburgs wrote:And for those who like a blinking version ;-)
The jumping of the text, is that intentionally?
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
User avatar
htilburgs
Posts: 464
Joined: Tuesday 03 November 2015 11:01
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Dashticz - [BETA] - Function - Do something at a specific value

Post by htilburgs »

No, not intentionally, I've to take a look at that, but something came up. Later on this day...
Hardware:
RPi3 - Aeon Labs Z-Stick GEN5 - Fibaro Dimmer 2 - Fibaro Roller Shutter 2 - Fibaro Smoke Sensor - Yeelight RGBW Led bulb - Yeelight Smart LED Light Strip - Neo Coolcam PIR Motion Sensor - Neo Coolcam PowerPlug - Nest Thermostat v3
robgeerts
Posts: 1273
Joined: Saturday 24 January 2015 22:12
Target OS: NAS (Synology & others)
Domoticz version: 3.7067
Location: NL
Contact:

Re: Dashticz - [BETA] - Function - Do something at a specific value

Post by robgeerts »

Had it too, fixed it with:

Code: Select all

.warning {
	background: rgba(199,44,44,0.3) !important;
	background-clip: padding-box;
	border: 7px solid rgba(255,255,255,0);
	-webkit-animation: BLINK-ANIMATION 1s infinite;
	-moz-animation: BLINK-ANIMATION 1s infinite;
	-o-animation: BLINK-ANIMATION 1s infinite;
	animation: BLINK-ANIMATION 1s infinite;
}

@-webkit-keyframes BLINK-ANIMATION {
	0%, 49% {
		background-color: rgba(199,44,44,0.3);
		background-clip: padding-box;
		border: 7px solid rgba(255,255,255,0);
	}
	50%, 100% {
		background-color: rgba(199,44,44,0.7);
		background-clip: padding-box;
		border: 7px solid rgba(255,255,255,0);
	}
}
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Dashticz - [BETA] - Function - Do something at a specific value

Post by EdwinK »

You two are great people. Thanks. Going to play with this some more.

Now, who do I blame when I don't get my work done today
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
robgeerts
Posts: 1273
Joined: Saturday 24 January 2015 22:12
Target OS: NAS (Synology & others)
Domoticz version: 3.7067
Location: NL
Contact:

Re: Dashticz - [BETA] - Function - Do something at a specific value

Post by robgeerts »

And a blue version:

Code: Select all

.warningblue {
	background: rgba(45,119,204,0.3) !important;
    background-clip: padding-box;
	border: 7px solid rgba(255,255,255,0);
	-webkit-animation: BLINK-ANIMATION-BLUE 1s infinite;
	-moz-animation: BLINK-ANIMATION-BLUE 1s infinite;
	-o-animation: BLINK-ANIMATION-BLUE 1s infinite;
	animation: BLINK-ANIMATION-BLUE 1s infinite;
}

@-webkit-keyframes BLINK-ANIMATION-BLUE {
	0%, 49% {
		background-color: rgba(45,119,204,0.3);
		background-clip: padding-box;
		border: 7px solid rgba(255,255,255,0);
	}
	50%, 100% {
		background-color: rgba(45,119,204,0.7);
		background-clip: padding-box;
		border: 7px solid rgba(255,255,255,0);
	}
}
robgeerts
Posts: 1273
Joined: Saturday 24 January 2015 22:12
Target OS: NAS (Synology & others)
Domoticz version: 3.7067
Location: NL
Contact:

Re: Dashticz - [BETA] - Function - Do something at a specific value

Post by robgeerts »

Orange version:

Code: Select all

.warningorange {
	background: rgba(204,129,44,0.30) !important;
	background-clip: padding-box;
	border: 7px solid rgba(255,255,255,0);
	-webkit-animation: BLINK-ANIMATION 1s infinite;
	-moz-animation: BLINK-ANIMATION 1s infinite;
	-o-animation: BLINK-ANIMATION 1s infinite;
	animation: BLINK-ANIMATION 1s infinite;
}

@-webkit-keyframes BLINK-ANIMATION {
	0%, 49% {
		background-color: rgba(204,129,44,0.3);
		background-clip: padding-box;
		border: 7px solid rgba(255,255,255,0);
	}
	50%, 100% {
		background-color: rgba(204,129,44,0.7);
		background-clip: padding-box;
		border: 7px solid rgba(255,255,255,0);
	}
}
robgeerts
Posts: 1273
Joined: Saturday 24 January 2015 22:12
Target OS: NAS (Synology & others)
Domoticz version: 3.7067
Location: NL
Contact:

Re: Dashticz - [BETA] - Function - Do something at a specific value

Post by robgeerts »

I did this to have different colors, depending on the temperature of my living room:

Code: Select all

function getStatus_145(idx,value,device){
	if(parseFloat(device['Data'])>23){
		$('div.block_145').removeClass('warning').addClass('warningorange');
	}
	else if(parseFloat(device['Data'])>25){
		$('div.block_145').removeClass('warningorange').addClass('warning');
	}
	else {
		$('div.block_145').removeClass('warning').removeClass('warningorange');
	}
}
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Dashticz - [BETA] - Function - Do something at a specific value

Post by EdwinK »

Ze blinking buttons.. Oooo.. ze blinking buttons
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
User avatar
htilburgs
Posts: 464
Joined: Tuesday 03 November 2015 11:01
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Dashticz - [BETA] - Function - Do something at a specific value

Post by htilburgs »

LOL :D
Hardware:
RPi3 - Aeon Labs Z-Stick GEN5 - Fibaro Dimmer 2 - Fibaro Roller Shutter 2 - Fibaro Smoke Sensor - Yeelight RGBW Led bulb - Yeelight Smart LED Light Strip - Neo Coolcam PIR Motion Sensor - Neo Coolcam PowerPlug - Nest Thermostat v3
User avatar
htilburgs
Posts: 464
Joined: Tuesday 03 November 2015 11:01
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Dashticz - [BETA] - Function - Do something at a specific value

Post by htilburgs »

EdKo66 wrote:You two are great people. Thanks. Going to play with this some more.
Now, who do I blame when I don't get my work done today
Thnx... And updated the wiki too....
Hardware:
RPi3 - Aeon Labs Z-Stick GEN5 - Fibaro Dimmer 2 - Fibaro Roller Shutter 2 - Fibaro Smoke Sensor - Yeelight RGBW Led bulb - Yeelight Smart LED Light Strip - Neo Coolcam PIR Motion Sensor - Neo Coolcam PowerPlug - Nest Thermostat v3
mikeoo
Posts: 110
Joined: Sunday 22 March 2015 7:35
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Holland
Contact:

Re: Dashticz - [BETA] - Function - Do something at a specific value

Post by mikeoo »

And how to find/know what you need to use if you want something else like a switch of a doorsensor.
For temps you use Data -

if(parseFloat(device['Data'])>23){

Usage for reaching a limit
if(parseFloat(device['Usage'])

Love this option again :D but missing some info to use it for other parts.
robgeerts
Posts: 1273
Joined: Saturday 24 January 2015 22:12
Target OS: NAS (Synology & others)
Domoticz version: 3.7067
Location: NL
Contact:

Re: Dashticz - [BETA] - Function - Do something at a specific value

Post by robgeerts »

It's not the same for all devices.
You can search the output (http://DOMOTICZ_URL:8080/json.htm?type=devices&filter=all&used=true&order=Name) for attributes you could use.
For example, you could use for switch:

Code: Select all

function getStatus_145(idx,value,device){
   if(device['Data']=="On"){
      $('div.block_145').addClass('warning');
   }
   else {
      $('div.block_145').removeClass('warning');
   }
}
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest