Dashticz - Function - Trigger action on specific value

Dashticz, alternative dashboard based on HTML, CSS, jQuery

Moderators: leecollings, htilburgs, robgeerts

jake
Posts: 742
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

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

Post by jake »

htilburgs wrote: Thnx... And updated the wiki too....
I would like to propose a litte change in the Wiki regarding the change of color, based on value xyz:

- Start with the paragraph about finding the right variable for monitoring, so before explaining what to add to custom.js (common practice for manuals, since people try to follow the manual line by line and won't recognize the next paragraph while they get stuck in the paragraph before)
- Don't use the example json command for all devices, but start with the one for the specific device, since that is what the user is after in the first place:

Code: Select all

/json.htm?type=devices&rid=IDX
and point for all other json command to the Domoticz wiki: http://www.domoticz.com/wiki/Domoticz_A ... rtain_type
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 »

htilburgs wrote:
I also noticed a minor in .trashcan. After height the : is missing. (I know, I'm a nitpicker ;-))
Hahaha, added the : after height :D
RPi3b+/RFXCOM rfxtrx433E/Shelly/Xiaomi Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
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 »

jake wrote:
htilburgs wrote: Thnx... And updated the wiki too....
I would like to propose a litte change in the Wiki regarding the change of color, based on value xyz:

- Start with the paragraph about finding the right variable for monitoring, so before explaining what to add to custom.js (common practice for manuals, since people try to follow the manual line by line and won't recognize the next paragraph while they get stuck in the paragraph before)
- Don't use the example json command for all devices, but start with the one for the specific device, since that is what the user is after in the first place:

Code: Select all

/json.htm?type=devices&rid=IDX
and point for all other json command to the Domoticz wiki: http://www.domoticz.com/wiki/Domoticz_A ... rtain_type
I understand what you mean. Take a look at it tomorow...
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 »

jake wrote:
htilburgs wrote: Thnx... And updated the wiki too....
I would like to propose a litte change in the Wiki regarding the change of color, based on value xyz:

- Start with the paragraph about finding the right variable for monitoring, so before explaining what to add to custom.js (common practice for manuals, since people try to follow the manual line by line and won't recognize the next paragraph while they get stuck in the paragraph before)
- Don't use the example json command for all devices, but start with the one for the specific device, since that is what the user is after in the first place:

Code: Select all

/json.htm?type=devices&rid=IDX
and point for all other json command to the Domoticz wiki: http://www.domoticz.com/wiki/Domoticz_A ... rtain_type
Finaly found some time and changed the Wiki. Thanks for your possitive reply.
Btw, when you've an account, you can edit the wiki yourself....;-)
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 - Function - Trigger action on specific value

Post by EdwinK »

Why wouldn't this work?

Code: Select all

// temp

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

Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
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 - Function - Trigger action on specific value

Post by mvveelen »

EdKo66 wrote:Why wouldn't this work?

Code: Select all

// temp

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

Change Data to Temp :)
RPi3b+/RFXCOM rfxtrx433E/Shelly/Xiaomi Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
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 - Function - Trigger action on specific value

Post by EdwinK »

mvveelen wrote:
EdKo66 wrote:Why wouldn't this work?

Change Data to Temp :)
Of course... Thanks ;)
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
User avatar
gielie
Posts: 290
Joined: Tuesday 12 January 2016 11:40
Target OS: Raspberry Pi / ODroid
Domoticz version: latest β
Location: The Netherlands (Alkmaar)
Contact:

Re: Dashticz - Function - Trigger action on specific value

Post by gielie »

I have tried this one, but it doesnt work, can someone tell me why and give me a solution.

Code: Select all


// temp

function getStatus_304(idx,value,device){
   if(parseFloat(device['Temp'])>20){
      $('div.block_304').removeClass('warningred').removeClass('warningorange').addClass('warning');
   }
   else if(parseFloat(device['Temp'])>22){
      $('div.block_304').removeClass('warning').removeClass('warningred').addClass('warningorange');
   } 
   else if(parseFloat(device['Temp'])>24){
      $('div.block_304').removeClass('warningorange').removeClass('warning').addClass('warningred');
   }
   else {
      $('div.block_304').removeClass('warning').removeClass('warningorange').removeClass('warningred');
   }
}

- Aeon Labs USB Stick met Z-wave plus
- Aeotec MultiSensor 6
- FIBARO FGS223
- FIBARO FGWPE Wall Plug
- Neo CoolCam Power plug
- Popp Smoke Detector
- Toon
- Kodi Media Server
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 - Function - Trigger action on specific value

Post by htilburgs »

gielie wrote:I have tried this one, but it doesnt work, can someone tell me why and give me a solution.

Code: Select all


// temp

function getStatus_304(idx,value,device){
   if(parseFloat(device['Temp'])>20){
      $('div.block_304').removeClass('warningred').removeClass('warningorange').addClass('warning');
   }
   else if(parseFloat(device['Temp'])>22){
      $('div.block_304').removeClass('warning').removeClass('warningred').addClass('warningorange');
   } 
   else if(parseFloat(device['Temp'])>24){
      $('div.block_304').removeClass('warningorange').removeClass('warning').addClass('warningred');
   }
   else {
      $('div.block_304').removeClass('warning').removeClass('warningorange').removeClass('warningred');
   }
}

I think there are two errors:
- the device['Temp'] and should be device['Data']
- Start with the highest and work down to the lowest temperature

Code: Select all

function getStatus_304(idx,value,device){
   if(parseFloat(device['Data'])>24){
      $('div.block_304').removeClass('warning').removeClass('warningorange').addClass('warningred');
   }
   else if(parseFloat(device['Data'])>22){
      $('div.block_304').removeClass('warning').removeClass('warningred').addClass('warningorange');
   } 
   else if(parseFloat(device['Data'])>20){
      $('div.block_304').removeClass('warningorange').removeClass('warningred').addClass('warning');
   }
   else {
      $('div.block_304').removeClass('warning').removeClass('warningorange').removeClass('warningred');
   }
}
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 - Function - Trigger action on specific value

Post by EdwinK »

Don't know why it wouldn't work for you. You did put it in custom.js?
I have the problem because it is a sensor with a '_1' in it.

Mmm. Yesterday I was told to change it from 'Data' to 'Temp'.
Even rain isn't flashing anymore :(
Last edited by EdwinK on Friday 09 June 2017 13:09, edited 1 time in total.
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 - Function - Trigger action on specific value

Post by htilburgs »

EdKo66 wrote:Don't know why it wouldn't work for you. You did put it in custom.js?
I have the problem because it is a sensor with a '_1' in it.

Mmm. Yesterday I was told to change it from 'Data' to 'Temp'.
That can be, but it's not right...;-)
When you check your device with http://domoticz_url:port/json.htm?type=devices&rid=304, you wil see there is no parameter Temp. What you find is Data. So it should be Data. :idea:

Furthermore, you started with the lowest values. In that case the formule won't work. Work down from high to low.
Example in you're case when it is 22,5 degree the warningorange AND warningred are true. Which one should be picked?? :?:
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 - Function - Trigger action on specific value

Post by EdwinK »

htilburgs wrote:
EdKo66 wrote:Don't know why it wouldn't work for you. You did put it in custom.js?
I have the problem because it is a sensor with a '_1' in it.

Mmm. Yesterday I was told to change it from 'Data' to 'Temp'.
That can be, but it's not right...;-)
When you check your device with http://domoticz_url:port/json.htm?type=devices&rid=304, you wil see there is no parameter Temp. What you find is Data. So it should be Data.
but... there is a Temp parameter. Are so I think.

Code: Select all

"result" : [
      {
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "BatteryLevel" : 100,
         "CustomImage" : 0,
         "Data" : "18.1 C, 0 %",
         "Description" : "",
         "DewPoint" : "18.10",
         "Favorite" : 1,
         "HardwareID" : 13,
         "HardwareName" : "RFXcom",
         "HardwareType" : "RFXCOM - RFXtrx433 USB 433.92MHz Transceiver",
         "HardwareTypeVal" : 1,
         "HaveTimeout" : false,
         "Humidity" : 0,
         "HumidityStatus" : "Dry",
         "ID" : "1001",
         "LastUpdate" : "2017-06-09 13:10:33",
         "Name" : "Buiten temp",
         "Notifications" : "false",
         "PlanID" : "0",
         "PlanIDs" : [ 0 ],
         "Protected" : false,
         "ShowNotifications" : true,
         "SignalLevel" : 6,
         "SubType" : "Rubicson/IW008T/TX95",
[b]         "Temp" : 18.100000000000001,
[/b]        
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 - Function - Trigger action on specific value

Post by htilburgs »

Ok, that differs from mine. Use this code in config.js and it should work.

Code: Select all

function getStatus_304(idx,value,device){
   if(parseFloat(device['Temp'])>24){
      $('div.block_304').removeClass('warning').removeClass('warningorange').addClass('warningred');
   }
   else if(parseFloat(device['Temp'])>22){
      $('div.block_304').removeClass('warning').removeClass('warningred').addClass('warningorange');
   } 
   else if(parseFloat(device['Temp])>20){
      $('div.block_304').removeClass('warningorange').removeClass('warningred').addClass('warning');
   }
   else {
      $('div.block_304').removeClass('warning').removeClass('warningorange').removeClass('warningred');
   }
}
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 - Function - Trigger action on specific value

Post by EdwinK »

Put this in, but for now it will not be working because of the multi-sensor thing even if the humidity doesn't really work
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 - Function - Trigger action on specific value

Post by EdwinK »

htilburgs wrote:Ok, that differs from mine. Use this code in config.js and it should work.
Shouldn't it be in custom.js?
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 - Function - Trigger action on specific value

Post by htilburgs »

Sorry, it should be config.js. My mistake...
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 - Function - Trigger action on specific value

Post by EdwinK »

*flashing buttoons*
*flashing buttoons*
Screen Shot 2017-06-09 at 14.03.31.png (108.15 KiB) Viewed 3226 times
Yes... It works. Had fixed a little typo (You forgot the closing ' ).
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 - Function - Trigger action on specific value

Post by htilburgs »

Ok, happy and sorry.... Probably a Cut & Paste error.
Nice to hear it works!!
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
gielie
Posts: 290
Joined: Tuesday 12 January 2016 11:40
Target OS: Raspberry Pi / ODroid
Domoticz version: latest β
Location: The Netherlands (Alkmaar)
Contact:

Re: Dashticz - Function - Trigger action on specific value

Post by gielie »

Yes the code works, tanks. And like Ed told, the last Temp misses a '
- Aeon Labs USB Stick met Z-wave plus
- Aeotec MultiSensor 6
- FIBARO FGS223
- FIBARO FGWPE Wall Plug
- Neo CoolCam Power plug
- Popp Smoke Detector
- Toon
- Kodi Media Server
lukev
Posts: 66
Joined: Friday 21 October 2016 10:42
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Dashticz - Function - Trigger action on specific value

Post by lukev »

Any method to extract temp from tem/hum sensor?
My data reads this:

Code: Select all

Data	"27.8 C, 47 %"
so the tigger doesn't work...
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests