@oliverio Ein altes Android Tablet, welches Android 4.4.2 als höchste Version bekommen hat, habe ich, bis auf eine Flot-Grafik, manuell per Node-Red gefüllt. Die Flot-Grafik lasse ich jetzt minütlich unter /dev/shm im RAM ablegen, und kann da auch prima per Node-Red dran und ans Tablet ausliefern.
Der Javascript-Adapter hat alle Parameter mit Fragezeichen? als fehlerhaft markiert. Daher habe ich alle Fragezeichen entfernt. Der Parameter quality wird nicht mehr unterstützt. Bei path muss der Dateiname mit rein, sonst gibt es eine Fehlermeldung, welche danach aussieht, dass der Ordner als Ziel genutzt wird. Ein paar Semikolon und Kommas musste ich auch noch korrigieren,
Bei der Installation musste ich chromium noch manuell nachinstallieren.
peter@iob:~$ sudo apt install chromium -y
In der Instanz noch Externen Browser anhaken und den Pfad angeben.
/usr/bin/chromium
Mein aktuelles Skript:
Spoiler
function Temptendenz(){
sendTo('puppeteer.0', 'screenshot', { url: 'http://192.168.2.24:8082/vis-2/?tendenz#startseite',
ioBrokerOptions: {
/**
* Define a filename for the ioBroker storage e.g. test.png
*/
storagePath: 'tendenz.png',
},
/**
* Define at most one wait option
* You can also look for other waitOptions currently supported by Puppeteer API
* see e.g. https://puppeteer.github.io/puppeteer/docs/puppeteer.page.waitforfilechooser
*/
waitOption: {
/**
* Define a Timeout in ms
*/
waitForTimeout: 5000,
/**
* Wait for a given id/tag/etc to be occured
*/
waitForSelector: 'w000680',
},
/**
* Optionally, specify the viewport manually, see https://pptr.dev/api/puppeteer.viewport
*/
viewportOptions: {
width: 800,
height: 600
},
/**
* The file path to save the image to. The screenshot type will be inferred
* from file extension. If path is a relative path, then it is resolved
* relative to current working directory. If no path is provided, the image
* won't be saved to the disk.
*/
path: '/dev/shm/tendenz.png',
/**
* When true, takes a screenshot of the full page.
* @defaultValue false
*/
fullPage: false,
/**
* An object which specifies the clipping region of the page.
*/
clip: {
x: 0,
y: 0,
width: 223,
height: 47
},
/**
* Quality of the image, between 0-100. Not applicable to `png` images.
*/
// quality: 100,
/**
* Hides default white background and allows capturing screenshots with transparency.
* @defaultValue false
*/
omitBackground: true,
/**
* Encoding of the image.
* @defaultValue 'binary'
*/
encoding: 'binary', //'base64' | 'binary',
/**
* If you need a screenshot bigger than the Viewport
* @defaultValue true
*/
captureBeyondViewport: false,
}, obj => {
if (obj.error) {
log(`Error taking screenshot: ${obj.error.message}`, 'error');
} else {
// the binary representation of the image is contained in `obj.result`
log(`Successfully took screenshot: ${obj.result}`);
}
});
}
//'*/30 * * * * *'
schedule("* * * * *", function(){
Temptendenz();
});
Temptendenz();