hobbyquaker / lgtv2mqtt

Interface between LG WebOS Smart TVs and MQTT :tv:
MIT License
106 stars 33 forks source link

Use icons in Toast #7

Open linkasum opened 6 years ago

linkasum commented 6 years ago

Hello! I would like to know if you can send a picture of the message via toast. The module in the openhab message when inserting a message inserts its logo. Thanks in advance

hobbyquaker commented 6 years ago

I must admit - I don't know. Is it perhaps possible to just add the html <img src="..."> tag to the message? Will try out on ocassion.

linkasum commented 6 years ago

I'm not a programmer, but I started looking for information and found this, maybe it will help you

https://community.openhab.org/t/connect-sdk-binding-for-lg-webos-tvs/4726/220

hobbyquaker commented 6 years ago

just found that

    public  void showToast(String message, String iconData, String iconExtension, ResponseListener<Object> listener)
    {
        JSONObject payload = new JSONObject();

        try {
            payload.put("message", message);

            if (iconData != null)
            {
                payload.put("iconData", iconData);
                payload.put("iconExtension", iconExtension);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }

        sendToast(payload, listener);
    }

So it is possible by adding iconData and iconExtension attributes to the payload. Question is how we get the image. We could send it e.g. base64 encoded via an MQTT message - or we could define an image folder in lgtv2mqtt options where files reside that can be used. Will put that on my todo, nice feature, wasn't aware that this is possible :)

Edit: just read your link and saw that we can simply supply an URL where the image can be loaded. Do you have a Webserver where you can put the images or do we need to integrate a simple webserver in lgtv2mqtt?

linkasum commented 6 years ago

I understand what I'm talking about, but I can not help you, only if I'm a beta tester