Dashticz - v3.4.3 beta
Moderators: leecollings, htilburgs, robgeerts
-
- Posts: 2260
- Joined: Monday 29 August 2016 22:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Dashticz - v3.4.3 beta
Dashticz v3.4.3 beta is small update containing:
* The new calender module. See:
https://www.domoticz.com/forum/viewtopi ... 67&t=32132
* Bug fixes
* Improved error reporting
The main reason for adding this is that the interface to the functions in custom.js changed.
So if you see the next message:
Then please check that function in custom.js, especially line 41.
Examples for the new getStatus function can be found here:
https://dashticz.readthedocs.io/en/beta ... -idx-block
I'll add a few more examples coming days.
* The new calender module. See:
https://www.domoticz.com/forum/viewtopi ... 67&t=32132
* Bug fixes
* Improved error reporting
The main reason for adding this is that the interface to the functions in custom.js changed.
So if you see the next message:
Then please check that function in custom.js, especially line 41.
Examples for the new getStatus function can be found here:
https://dashticz.readthedocs.io/en/beta ... -idx-block
I'll add a few more examples coming days.
- EdwinK
- Posts: 1820
- Joined: Sunday 22 January 2017 21:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Rhoon
- Contact:
Re: Dashticz - v3.4.3 beta
Guess I'm going to wait. Don't know what to do.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
-
- Posts: 47
- Joined: Wednesday 09 August 2017 23:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Dashticz - v3.4.3 beta
I have 2 question about the getStatus function
I'm on 3.4.2 right now and have the following fuction:
2. The setTimeout function doesn’t work. It is executed one time on refresh of the page but the class is not applied. How is this fixable as it checks if the device isn’t updated in time? (before it worked only after a refresh of the page, but in this case that was not a big problem)
I'm on 3.4.2 right now and have the following fuction:
- Spoiler: show
2. The setTimeout function doesn’t work. It is executed one time on refresh of the page but the class is not applied. How is this fixable as it checks if the device isn’t updated in time? (before it worked only after a refresh of the page, but in this case that was not a big problem)
-
- Posts: 2260
- Joined: Monday 29 August 2016 22:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Dashticz - v3.4.3 beta
The afterupdate parameter is not applicable anymore. You can indeed remove it.
The removeClass part also is not needed. Only addClass is used. Maybe setClass would be a better name.
You cannot use block.addClass in the setTimeout function.
(getStatus already returned. Changes in block are not seen anymore)
To be honest, I did not think of this use case, but I expect the following will work.
The removeClass part also is not needed. Only addClass is used. Maybe setClass would be a better name.
You cannot use block.addClass in the setTimeout function.
(getStatus already returned. Changes in block are not seen anymore)
To be honest, I did not think of this use case, but I expect the following will work.
Code: Select all
setTimeout(function(){
if(moment(device['LastUpdate']).unix()<(moment().unix()-(4200))){
Dashticz.setBlock('241', {
addClass:'update_timeout'
});
console.log('Timeout Grondvochtigheidsensor:');
}
else {
Dashticz.setBlock('241', {
addClass:''
});
console.log('Grondvochtigheidsensor is actief');
}
},1000);
- EdwinK
- Posts: 1820
- Joined: Sunday 22 January 2017 21:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Rhoon
- Contact:
Re: Dashticz - v3.4.3 beta
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
-
- Posts: 47
- Joined: Wednesday 09 August 2017 23:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Dashticz - v3.4.3 beta
Thank you Lokonli.Lokonli wrote: ↑Saturday 11 April 2020 22:40 The afterupdate parameter is not applicable anymore. You can indeed remove it.
The removeClass part also is not needed. Only addClass is used. Maybe setClass would be a better name.
You cannot use block.addClass in the setTimeout function.
(getStatus already returned. Changes in block are not seen anymore)
To be honest, I did not think of this use case, but I expect the following will work.
- Spoiler: show
I'm on 3.4.3 now, but your solution does not work.
In de console, the message 'Timeout Grondvochtigheidsensor' is displayed, but the class in not applied.
For now, I did change it to:
- Spoiler: show
For this purpuse not a problem, but maybe for other devices not suitable.
-
- Posts: 2260
- Joined: Monday 29 August 2016 22:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Dashticz - v3.4.3 beta
I think you want to apply the 'update_timeout' class after 70 minutes without device update?
getStatus_241 will only be called after an update of device 241, so that's not a good place to set the class.
You could use the afterGetDevices function in custom.js for this, because this function will be called after every update.
If you change it as follow it should work:
Also update to latest beta ...
getStatus_241 will only be called after an update of device 241, so that's not a good place to set the class.
You could use the afterGetDevices function in custom.js for this, because this function will be called after every update.
If you change it as follow it should work:
Code: Select all
function afterGetDevices() {
var device = Domoticz.getAllDevices()['241'];
if (moment(device['LastUpdate']).unix() < (moment().unix() - (4200))) { //(70 min)
Dashticz.setBlock('241', {
addClass: 'update_timeout'
});
} else {
Dashticz.setBlock('241', {
addClass: ''
});
}
}
-
- Posts: 47
- Joined: Wednesday 09 August 2017 23:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Dashticz - v3.4.3 beta
I updated the file dashtics.js and tried your sugestion.Lokonli wrote: ↑Sunday 12 April 2020 20:11 I think you want to apply the 'update_timeout' class after 70 minutes without device update?
getStatus_241 will only be called after an update of device 241, so that's not a good place to set the class.
You could use the afterGetDevices function in custom.js for this, because this function will be called after every update.
If you change it as follow it should work:Also update to latest beta ...
- Spoiler: show
The fuction gets indeed called a lot of times now, I did a console.log in the if-part.
But still the class is not applied.
So, the function works, but the addClass does not
-
- Posts: 2260
- Joined: Monday 29 August 2016 22:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Dashticz - v3.4.3 beta
How did you define your block?
And your css class?
Sent from my SM-A320FL using Tapatalk
And your css class?
Sent from my SM-A320FL using Tapatalk
-
- Posts: 2260
- Joined: Monday 29 August 2016 22:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Dashticz - v3.4.3 beta
Try this:
Code: Select all
function getStatus_407(block) {
var value = block.device.Level;
if (value == 1) {
block.addClass = 'alertnormal';
} else if (value == 2) {
block.addClass = 'alertlight';
} else if (value == 3) {
block.addClass = 'alertmedium';
} else {
block.addClass = 'alerthigh';
}
}
function getStatus_408(block) {
var value = block.device.Level;
if (value == 1) {
block.addClass = 'alertnormal';
} else if (value == 2) {
block.addClass = 'alertlight';
} else if (value == 3) {
block.addClass = 'alertmedium';
} else {
block.addClass = 'alerthigh';
}
}
- EdwinK
- Posts: 1820
- Joined: Sunday 22 January 2017 21:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Rhoon
- Contact:
Re: Dashticz - v3.4.3 beta
Thanks, This seems to work
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
-
- Posts: 2260
- Joined: Monday 29 August 2016 22:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Dashticz - v3.4.3 beta
As a result of the setBlock call, the block will be refreshed. As a result of the refresh, the getStatus function will be called again. Since you set addClass in the getStatus function as well, it will overwrite the addClass value set by the setBlock function.
So probably you have to add some checks on the LastUpdate value in the getStatus function, and only modify addClass if needed.
-
- Posts: 47
- Joined: Wednesday 09 August 2017 23:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Dashticz - v3.4.3 beta
Wow, of course, that makes sense!Lokonli wrote: ↑Monday 13 April 2020 22:47 As a result of the setBlock call, the block will be refreshed. As a result of the refresh, the getStatus function will be called again. Since you set addClass in the getStatus function as well, it will overwrite the addClass value set by the setBlock function.
So probably you have to add some checks on the LastUpdate value in the getStatus function, and only modify addClass if needed.
Thank you Lokonli for your time and suggestions, really appreciate it.
I changed the code a bit and this way it works as intended.
For your information, and maybe for others with the same problem, this is how:
- Spoiler: show
Who is online
Users browsing this forum: No registered users and 1 guest