Kindle Display: Unterschied zwischen den Versionen

Aus FHEMWiki
Zeile 23: Zeile 23:
For example, you can set XYZ at the place where the first temperature should be shown and ABC for the first humidity value.<br>
For example, you can set XYZ at the place where the first temperature should be shown and ABC for the first humidity value.<br>
If you want to edit the template you can use the free software [www.inkscape.org/de/ Inkscape]. For more information about generating SVGs for fhem please refer to this article [http://www.fhemwiki.de/wiki/Icons Icons]. Most important information is to save the SVG as a "normal SVG" and not as an inkscape SVG.<br>
If you want to edit the template you can use the free software [www.inkscape.org/de/ Inkscape]. For more information about generating SVGs for fhem please refer to this article [http://www.fhemwiki.de/wiki/Icons Icons]. Most important information is to save the SVG as a "normal SVG" and not as an inkscape SVG.<br>
For the Kindle Paperwhite the resolution of the SVG must be 758 x 1024 for the Kindle 4 version use 600x800. This is mandatory. Wrong scaled images won't be displayed on the Kindle.<br> Copy the Kindle_Template.svg to <nowiki>/opt/fhem/www/images/</nowiki>.
For the Kindle Paperwhite the resolution of the SVG must be 758 x 1024 for the Kindle 4 version use 600x800. This is mandatory. Wrong scaled images won't be displayed on the Kindle.<br> Copy the Kindle_Template.svg to <nowiki>/opt/fhem/www/images/</nowiki>.<br><br>
Download and install the [http://forum.fhem.de/index.php/topic,21821.msg200310.html#msg200310 FileReplacer.pm from fhem Forums], save it to /opt/fhem/FHEM and load the module. You can also restart fhem instead.<br><br>
All we're doing now is to using the FileReplacer module to read the SVG template, replace a search pattern with our data and saving it.<br>
:<code>define kindledisplay FileReplacer /opt/fhem/www/images/template1.svg /opt/fhem/www/images/status1.svg 60</code>
:<code>attr kindledisplay DoPNG 1</code>
:<code>attr kindledisplay UTF8-Encode 1</code>
:<code>attr kindledisplay room Display</code>
 
DoPNG enabled the generation from SVG to PNG. UTF8-Encode is needed to support special characters.<br>
Now just create your mappings:
:<code>attr kindledisplay Regex1 XYZ </code>
:<code>attr kindledisplay Expr1 sprintf("%.1f", ReadingsVal("Sensor1", "Temp1", 0)) </code>
:<code>attr kindledisplay Regex2 ABC </code>
:<code>attr kindledisplay Expr2 sprintf("%.1f", ReadingsVal("Sensor1", "Hum1", 0)) </code>
And so on... :) The FileReplacer will replace the pattern XYZ with the ReadingsVal from Sensor1.<br>
Now check if the PNG is created [http://your-fhem-ip:8083/fhem/www/images/status1.png http://your-fhem-ip:8083/fhem/www/images/KindleDisplay.png]. If so, be happy, the first part is done!


==Modifying the Kindle==
==Modifying the Kindle==

Version vom 24. September 2014, 06:39 Uhr

NOTE: This Article is not yet finished! This note will be removed once i think it's okay ;)
As long as I'm working on it, this information will be shown.


This article shows how to configure a Amazon Kindle eBook-Reader as a information display for fhem. Use this manual at your own risk. Jailbreaking a Kindle is quite easy but there is no guarantee for breaking the system.

All of the information shown below is collected from the fhem-forum fhem-Forum. Many thanks to everybody who participated on the development of this information to get it done.Special thanks to "alex" and "stefan" from the board. Further information is from the mobileread board.

Hardware requirements

Kindle Touch / Paperwhite / Paperwhite 2

You can use Kindle Touch / Paperwhite / Paperwhite 2 without any limitations.

Kindle 4

For setting this up on the Kindle 4 (with the 5-way button) you need some more configuration work but it's also working. Addidional tasks for this version are shown down below.

Prerequisites

fhem and server configuration

Server configuration

Not sure if still needed, but just for in case it is, install imagemagick on your linux system.

apt-get install imagemagick

That's it :)

fhem configuration

First you need a svg-template. You can find one in the first posting on the fhem-Forum thread. In the template just replace the data with some placeholder you like. Later this placeholder is found via a regular expression and replaced by your data.
For example, you can set XYZ at the place where the first temperature should be shown and ABC for the first humidity value.
If you want to edit the template you can use the free software [www.inkscape.org/de/ Inkscape]. For more information about generating SVGs for fhem please refer to this article Icons. Most important information is to save the SVG as a "normal SVG" and not as an inkscape SVG.
For the Kindle Paperwhite the resolution of the SVG must be 758 x 1024 for the Kindle 4 version use 600x800. This is mandatory. Wrong scaled images won't be displayed on the Kindle.
Copy the Kindle_Template.svg to /opt/fhem/www/images/.

Download and install the FileReplacer.pm from fhem Forums, save it to /opt/fhem/FHEM and load the module. You can also restart fhem instead.

All we're doing now is to using the FileReplacer module to read the SVG template, replace a search pattern with our data and saving it.

define kindledisplay FileReplacer /opt/fhem/www/images/template1.svg /opt/fhem/www/images/status1.svg 60
attr kindledisplay DoPNG 1
attr kindledisplay UTF8-Encode 1
attr kindledisplay room Display

DoPNG enabled the generation from SVG to PNG. UTF8-Encode is needed to support special characters.
Now just create your mappings:

attr kindledisplay Regex1 XYZ
attr kindledisplay Expr1 sprintf("%.1f", ReadingsVal("Sensor1", "Temp1", 0))
attr kindledisplay Regex2 ABC
attr kindledisplay Expr2 sprintf("%.1f", ReadingsVal("Sensor1", "Hum1", 0))

And so on... :) The FileReplacer will replace the pattern XYZ with the ReadingsVal from Sensor1.
Now check if the PNG is created http://your-fhem-ip:8083/fhem/www/images/KindleDisplay.png. If so, be happy, the first part is done!

Modifying the Kindle

To prevent from error messages like "your Kindle is no longer registered as a test Kindle..." please make sure your Kindle is connected to a valid Amazon Account.
We need to download some software to install it on the Kindle.
Please download it from Mobileread Forums


Always use the newest version and look for one who fits to your Kindle (e.G. K4).

Jailbreaking the Kindle

Don't worry. This sounds more hard and dangerous than it is in fact. It's just a few steps to have full access to your Kindle.

Installing additional software

Kindle 4 additional tasks

coming soon :)