Screenshot of Dashboard headless mode

@Colin No, looks like that scrot is a very simple program.

@craigcurtin I will have a look. Zerotier sounds interesting. My first idea was exactly what you are suggesting, but I discard this idea because I didn't want another “system” involved.

Do I miss something for the execution node?
With the terminal Xterm or with run I can take a screenshot but if I use the same command in NR it is not working?! :thinking:

This is the short flow of taking a image with imagemagick:
[{"id":"1c7c43e8.c230ac","type":"exec","z":"7dea4bf.d0795b4","command":"import -window root /home/pi/screen1.png","addpay":false,"append":"","useSpawn":"true","timer":"20","oldrc":false,"name":"imagemagick","x":440,"y":1980,"wires":[,,]},{"id":"4a738cd2.76da04","type":"inject","z":"7dea4bf.d0795b4","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":1980,"wires":[["1c7c43e8.c230ac"]]}]

How are you starting Node-RED ? If you're running it as a service it may not have a screen session.

@dceejay, I am running NR as a service :thinking:

So you’ll need to tell your capture program to capture the screen of the user that is running the browser

@dceejay I have only one user :thinking: I have no idea how to specify the user in the capture programs :worried:

I guess I am too stupid for getting this to run. :weary:
I get this error message: import-im6.q16: unable to open X server `' @ error/import.c/ImportImageCommand/360.

So basically I have two exec node: one with: export DISPLAY=:0 and one with import /home/pi/screen1.png

It works all in ssh but not in node red.

I do not think it is valid to expot the display from within NR

You need to treat the machine as if it does have a monitor, so makes sure a graphical desktop is installed, then check out a Google search for Kiosk Mode Raspberry pi - this will do the autostart and definition of a graphical desktop which should get you most of the way .

I do not get your reluctance to get another system involved - another PI is not going to cost much and as it will be on a central site you will have access to it for control etc.

I think what you are trying to do at the moment is a little above your Linux knowledge and hence i would simplify it to start with

Craig

Instead of puppeteer, did you try chrome in headless mode?

@stefanp I think the problem is that it is not obvious how to achieve what you want. Are you sure that writing a report to a file and sending that off via Telegram and then have some post processing at the other end would not be a better way to solve the problem?

2 Likes

I agree with Colin, take the data you use to populate the dashboard and build a kinda HTML or TEXT report and send that to telegram. No puppeteer, no headless etc.

If you particularly like the dashboard you could construct a JSON string with all the data you need to regenerate it (not the layout, just the values), including chart data as the chart can be asked to output its current data, send that via Telegram, and at the other end feed that data into node red running another copy of the dashboard. Then you would have a display that automatically updates each time a new telegram is received.

Thanks all of you to support me!

So it took me some time to figure out how I can take a screenshot of the dashboard and send it via Telegram. Thanks to manly Colin, dceejay and Craigs suggestions and some searching in the internet I put the puzzle together and now it works :smiley:

If I wanna use scrot I have to put the display number in front, thats it : DISPLAY=:0 scrot
Thanks to dceejay and Colin to get me into that :+1:

I am starting now the chromium browser in kiosk mode and the dashboard is loaded automatically.
Thanks to Craig :+1:

2 Likes

Could you share the solution on json?

Hey Alexalburca,

it is just that line you have to put in the exec node!

I appreciate your attention in answering me, but as I am a beginner I do not quite understand what to do, the inbound and outbound flows to route the url dynamically. I want to route the print through a telegram robot.

If you can share the piece of your node I would appreciate it very much.

If you can not without problems I will continue studying.

tks

@alexalburca: The best thing would be to open a new topic where you explain in detail your problem.
In this topic I explained you how to take a screenshot of the node red dashboard.
For sending the screenshot: I just used the node-red-contrib-chatbot to send that screenshot via telegram.