Page 1 of 1
Combine 2 different idx devices in 1 block
Posted: Wednesday 23 December 2020 9:30
by cornesch
Hello Everyone,
Is it possible to display 2 separate devices in 1 block in Dashticz?
I mean a humidity meter and air quality meter.
I would like to see this: (55% / 471ppm)
Re: Combine 2 different idx devices in 1 block
Posted: Wednesday 23 December 2020 10:15
by Lokonli
You can create a dummy text device in Domoticz, and with some Domoticz scripting fill it with the data from the humidity and air quality sensors.
or, do it in Dashticz, but that will require some coding as well:
1) Add the device that changes most often to Dashticz
If this is the humidity meter, then I expect it's a TempHum sensor. You probably need subdevice 2:
So assume your temp device is 100, air quality 200.
In CONFIG.js:
Code: Select all
columns[1] = {
blocks: [ '100_2']
}
2) Add the following to custom.js:
Code: Select all
function getStatus_100_2(block) {
var humDevice = block.device;
var airDevice = Domoticz.getAllDevices()[200];
console.log(humDevice);
console.log(airDevice);
block.value = humDevice.Humidity + ' / ' + airDevice.Data
}
The two console statements will help in the debugging. Open DevTools (F12), then on the console tab you should see the device info printed, when the device gets updated. If it's working you can remove the console statements of course.
Re: Combine 2 different idx devices in 1 block
Posted: Thursday 24 December 2020 10:58
by cornesch
Thanks for the tips @lokonli !
I finally solved it like below to get it working:
Code: Select all
function getStatus_235(block) {
var airDevice = Domoticz.getAllDevices()[235];
var humDevice = Domoticz.getAllDevices()[234];
block.value = humDevice.Humidity + ' % ';
block.title = airDevice.Data
}