I did it all on my raspi!
First installed wkhtmltopdf via apt-get.
sudo apt-get install wkhtmltopdf
Using wkhtmltoimage raised an error (“QXcbConnection: Could not connect to display Aborted”), to overcame that the installation of xvfb ws needed.
sudo apt-get install xvfb
Now I can use this tool to make images of my local webpage although this system doesn’t have a display. I guess this error was due to that.
Usage from the commandline as user pi
sudo xvfb-run wkhtmltoimage --crop-h 350 --crop-w 350 http://MyRaspi:8080/static/MyWebFile.html /etc/openhab2/html/MyPicture.jpg
In OpenHAB2 I created anc String Item to hold the path to the picture
and on the sitemap I have
Image refresh=60000 item=WeatherPicture
The picture is made via a rule which is triggered on each change of the ObservationTime.
I’m using the postUpdate for the String Item WeatherPicture to raise a refresh of the sitemap, but I’m not sure if that isworking.
Item ObservationTime changed
executeCommandLine(“xvfb-run wkhtmltoimage --crop-h 350 --crop-w 350 http://MyRaspi:8080/static/MyWebFile.html /etc/openhab2/html/MyPicture.jpg”)