MaxvandeLaar / homey-webos-plus

Improved LG WebOS integration for Homey
GNU General Public License v3.0
27 stars 11 forks source link

Sand message #5

Closed johngrinders closed 4 years ago

johngrinders commented 4 years ago

Hey. Everything works great. There are no errors, no problems, everything is perfect. Thanks for the app. One small question: two more lines appeared in the message sending, as I understand it, to send an image, I just can’t figure out how to use it. I would be grateful for an example of use. Thanks!!! 2E12A3D6-6A77-4E5C-881C-DEE5FDDBA4E1

MaxvandeLaar commented 4 years ago

EDIT: !!! Only for v1.0.0 ignore this if you are running v1.1.0 !!

Hi @johngrinders,

Glad to head everything is working out great for you. I do admit, this feature is sadly not as straightforward as I would have liked and I'll make sure the README will include some general examples. I made a quick example flow (the flow labels are in Dutch but you'll probably work it out 😉) https://homey.app/f/UKYLO1 (Sadly the UI of the flow sharing isn't that great)

So to walk you through it a bit... The first text field is obviously the message field. The second and third field are both required for the icon.

The second field tells the TV what type of image you are sending to it. So if you have an example.png image, the field should be png etc. for jpg...

The third field is a base64 representation of the image. To convert an image to base64 you can use any image to base64 convertor online (I use https://www.base64-image.de) and copy the string. The string will look something like this:

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAIqADAAQAAAABAAAAIgAAAAACeqFUAAADpklEQVRYCcVYS24UQQztniRK4CgsWLCOhITIWZJbhHCK5C7AAoltJOAsiImmZwY/v3r1cfWkAwviKO362X5+5aruZBxMbm9vb6CfS66urq7Hu7u7691u9+HNl0/PguP+3fthHMePx4j++uvn4dW3eSDjMA57+4GG7O0XLWhKGAndvJjmnYPJEPx8ezE4EHTWZ2lldOTR5AV+CAoaYtkM+72NmXaJ9hjWGFc0z+mIdgXIKed7BtrA5ANrC7i23cTpOwLFPAaQACEQQ7VOQDhcnsyYmWNU2UNT2pRBDKYyQamdlycrqRaIwXk4W/kcqV/5FmhxrceBc9CQfn0LLKNKSOJWdkB+a2t8z2sGmF2bUbUtToEhyhSkdiJsidG+Rs6Q34zAoZLEtNoJy3JNRZ9Kgnoba+RBpybahb72vzAUkDpDqTB63F2NbRog1tHWhLhdNzLgW+JYmCGL2eqoIA0+WkamY/Ydz3SEYpWjUBMYVtJwqaDQM9LXROsvEDYgNsSBbA2VGIkZxwusK5KM8gAyxsnP6L87NdtTUQabuTbHmJG5S0t0+UPLsibQB6sHawy3MQd3dY1sjJ59Lla5UYYIoDG0wk2rqfnlxTTNx61Z2W7gRmKN2HOTji8Rm70cV9mg2dUAxuxXy9UmP7B4XE6MBFxhqUbKqVm6OeMedww9HrebXdVbgyNUTo1Rb/zp+KkNDUHmBOPd3MbYU4T2hcHTFogxkvwoSHGsANJtuCVGYKXgsFQbGvKyPr4o1ocTBooLaWlzsgyu5hkryyMQhi/Pace4uUbWCUhZolaERkMdcc7iK25eyLAOOQC2p267MbspnxpcaHQVDeev8MM11MFxpDWjbSIT5jMQbM2L9H1h53Ycy7sCZu5LEWzOzzY05rr1YOcwA3ErJwMB8a3BNVu+0FrEGQUJo1V9QvyGsuF0qri+YiDM854Co3TVvvQMSHnXtAyIDeHoGUJQm9XxdoaqrbN48oHQasvf9IuAyIh9s+oe4fDTn9yaKrAB0ticF81BQ5q3b701EXF0FvdYp0eagQ7XmKoH2oE03yOokfzSi6FD35HWNWDzQu9LGUDAgnXXDZ8B1fdIoDZSGRnp5iOuGNqL15CnmsJlCmGN2DPXSJdxyj4Z0kxZo6e2NFccfAb/4eMZx1eOxDM0BOMaQ19tzWPs36U7vmv9ORHjRBx/y8ACxqZGLn6c579BlxmIyCLyhchh+uL7uYf0/cD/SML8f+1eXl7e/AGKkeCEuESxxwAAAABJRU5ErkJggg==

Now it's important to strip everything before (and including) the first comma (data:image/*;base64,). So the example string will look like this:

iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAA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s+oe4fDTn9yaKrAB0ticF81BQ5q3b701EXF0FvdYp0eagQ7XmKoH2oE03yOokfzSi6FD35HWNWDzQu9LGUDAgnXXDZ8B1fdIoDZSGRnp5iOuGNqL15CnmsJlCmGN2DPXSJdxyj4Z0kxZo6e2NFccfAb/4eMZx1eOxDM0BOMaQ19tzWPs36U7vmv9ORHjRBx/y8ACxqZGLn6c579BlxmIyCLyhchh+uL7uYf0/cD/SML8f+1eXl7e/AGKkeCEuESxxwAAAABJRU5ErkJggg==

Or if you are on MacOS (no clue for other OS) just run base64 /path/to/image.png and you will get the base64 string without the data:image/*;base64, part.

I hope this makes a bit more sense for you, let me know if it works for you.

EDIT: !!! Only for v1.0.0 ignore this if you are running v1.1.0 !!

MaxvandeLaar commented 4 years ago

@johngrinders,

So when writing the explanation above, I really started to dislike how it works. Therefor, I decided to rewrite it a bit resulting in a new version of the app. It now allows for urls to image as well.

See v1.1.0

johngrinders commented 4 years ago

Installed version 1.1.0, everything works perfectly. There is a proposal to make it possible to add an image from the Gallery application, as for example this can be implemented in sending a push message with an image. There is another question regarding image size. as I understand it, in a message it is displayed with dimensions of about 300 ns and 300 pixels, and you can’t do it again?

MaxvandeLaar commented 4 years ago

Hi @johngrinders, I was definitely not aware of any Gallery app (I will look into this), can you please create a new issue for both questions as they don't seem to relate to the current one. Furthermore, I do not understand what you want to achieve or mean with the second question.