Hi,
I had a similar “problem” for the OpenWeatherMap current condition icon. I use a JavaScript rule (with helper libraries) ..
/**
* Save/ persist current condition weather icon to file ...
* The icon is available as item of type Image.
* The Image type is a RawType item with according methods to read the data.
* package: org.openhab.core.library.types;
* link: https://github.com/openhab/openhab-core/blob/master/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/RawType.java
*
*/
JSRule({
name: "save current condition weather icon to filesystem",
description: "persists the OpenWeatherMap current condition icon image to the local filesystem",
triggers: [
UpdatedEventTrigger("OpenWeatherMap_Current_Condition_Icon")
],
execute: function( module, input) {
logInfo( me + " triggered ");
var FileUtils = Java.type("org.apache.commons.io.FileUtils");
var outFilePath = OPENHAB_CONF + "/icons/classic/" + "currentweatherconditionicon.png";
var outFile = FileUtils.getFile(outFilePath);
if (isUninitialized("OpenWeatherMap_Current_Condition_Icon")) {
logInfo( me + " --- item " + "OpenWeatherMap_Current_Condition_Icon" + " not initialized");
return;
}
var imageBytes = getItem("OpenWeatherMap_Current_Condition_Icon").state.getBytes();
FileUtils.writeByteArrayToFile(outFile, imageBytes);
}
});
Alexander