Function toFullString() from ECMA 5.1 in ECMA11

Hi,

To send a photo from openhab to telegram i have to convert my image-item to “FullString”
In ECMA 5.1 i could do this with the function toFullString()
But i don’t know how to do this in ECMA 11…

Does anybody know what i can use in ECMA11 ?

This is my old code:

telegramAction.sendTelegramPhoto(camPic.state.toFullString(), "Printer is finished");

What’s camPic? Assuming it’s a variable, how did it get populated?

What did you attempt in ECMA11?

I can’t really say given the lack of context posted, but assuming that camPic is a Java openHAB Item Object I would imagine the following would work:

var camPic = items.getItem('CamPic');
telegram...camPic.rawState.toFullString()...

I think you have an Item instance from the openhab-js library. So the item is wrapped to simplify the methods. I would guess that you should use state() now.

toString() and toFullString() are not the same (e.g. see DateTimeType (openHAB Core 4.2.0-SNAPSHOT API)). So OP will need to call toFullString() on the rawState since state() only returns the toString().

Ah, yes you are right. It is not the same. :grinning:

Thx Rich, you are right, i had to use rawState instead of state.

Now it is working again :grinning:

Here is my working code:

var telegramAction = actions.get("telegram","telegram:telegramBot:XXXXXXXX");
var camPic;

camPic = items.getItem('Cam3DPrinter_Image');
telegramAction.sendTelegramPhoto(camPic.rawState.toFullString(), 'New Test');