(I know, probably a stupid question, and already given answers, but I cant find…)
I would like to getrive an png-image with an sendHttpGetRequest, convert it to base64 and send it to telegram
....
actions.sendTelegram("Es gibt Probleme mit dem System.")
var String chart = sendHttpGetRequest("http://openhab:8080/rrdchart.png?items=LocalComputer_Swap_Used,LocalComputer_Storage_Used,LocalComputer_Memory_Used&period=D&h=350&w=800")
var String b64img = "data:image/png;base64," + java.util.Base64.encoder.encode(chart.getBytes())
actions.sendTelegramPhoto(base64Image, "Sysparams-Chart")
....
in the error-log I see taht the getBytes() does not work.
so, if I compare my base64 string with those used in several examples, I see there are “special characters” like “+_” or in other words the examples use a Base62-like character-table.
“+” is a valid Base64 character. “" is not though but I often see "” use with base64 encoded stuff as a divider between a custom header/footer. But that’s not occurring here either.
This is all pure Java stuff so at this point I’d search around to see how to do this using Java. What ever you find will apply to your Rule too.