Kindle als Fhem-Display

Begonnen von alexmetz, 25 März 2014, 22:59:15

Vorheriges Thema - Nächstes Thema

marboj

#675
So, nach 3 Tagen "basteln" läuft der Kindle als Display grundsätzlich. Es ist ein PW1.

Folgende Frage ist noch offen:

- Wie bekomme ich nun das Batterie-Reading in mein FHEM?

Habe das angelegt:

define kindleweb HTTPSRV kindle /opt/fhem/kindle Kindle Web
attr kindleweb userattr readings
attr kindleweb readings KindleBatt



und die config.sh erweitert:

#
# show battery level?
BATTDISP=0

#
# sleep extra for 30 seconds to give the kindle time to update his battery status
EXTRASLEEP=1

#
# add Batt level to URI as query string
DO_QUERYSTRING=1
QUERYSTRING=KindleBatt


Folgende Probleme habe ich noch:

- mein FHEM hatte ich Passwortgeschützt. Leider klappt der Aufruf der Statusseite nicht mit dem hier schon mehrfach genannten Aufruf, den Benutznamen und das passwort in die URL einzubauen. Bei deaktiviertem USER/PASSWORT klappt es einwandfrei.

- Der PW1 aktualisiert am Ladegerät, allerdings nicht im Akkbetrieb. Bei Akku holt er genau eine Aktualisierung. Die verschiedenen Werte für RTC (0,1,2) hab ich alle ausprobiert, auch die angepasste utils.sh.

Muss außer dem WIKI noch etwas gemacht werden? Habe die aktuellsten Pakete installiert:
-linkss0.25N , python0.15N, onlinescreensaver v0.3, KUAL 2.7

Hier meine Config zum OSS:

#############################################################################
### ONLINE-SCREENSAVER CONFIGURATION SETTINGS
#############################################################################

# Interval in MINUTES in which to update the screensaver by default. This
# setting will only be used if no schedule (see below) fits. Note that if the
# update fails, the script is not updating again until INTERVAL minutes have
# passed again. So chose a good compromise between updating often (to make
# sure you always have the latest image) and rarely (to not waste battery).
DEFAULTINTERVAL=300

# Schedule for updating the screensaver. Use checkschedule.sh to check whether
# the format is correctly understood.
#
# The format is a space separated list of settings for different times of day:
#       SCHEDULE="setting1 setting2 setting3 etc"
# where each setting is of the format
#       STARTHOUR:STARTMINUTE-ENDHOUR:ENDMINUTE=INTERVAL
# where
#       STARTHOUR:STARTMINUTE is the time this setting starts taking effect
#       ENDHOUR:ENDMINUTE is the time this setting stops being active
#       INTERVAL is the interval in MINUTES in which to update the screensaver
#
# Time values must be in 24 hour format and not wrap over midnight.
# EXAMPLE: "00:00-06:00=480 06:00-18:00=15 18:00-24:00=30"
#          -> Between midnight and 6am, update every 4 hours
#          -> Between 6am and 6pm (18 o'clock), update every 15 minutes
#          -> Between 6pm and midnight, update every 30 minutes
#
# Use the checkschedule.sh script to verify that the setting is correct and
# which would be the active interval.
SCHEDULE="00:00-06:00=30 06:00-22:00=3 22:00-24:00=10"

# URL of screensaver image. This really must be in the EXACT resolution of
# your Kindle's screen (e.g. 600x800 or 758x1024) and really must be PNG.
#IMAGE_URI="http://enter.the.domain/here/and/the/path/to/the/image.png"
IMAGE_URI="http://192.168.0.110:8083/fhem/www/images/status.png"

# folder that holds the screensavers
SCREENSAVERFOLDER=/mnt/us/linkss/screensavers/

# In which file to store the downloaded image. Make sure this is a valid
# screensaver file. E.g. check the current screensaver folder to see what
# the first filename is, then just use this. THIS FILE WILL BE OVERWRITTEN!
SCREENSAVERFILE=$SCREENSAVERFOLDER/bg_ss00.png

# Whether to create log output (1) or not (0).
LOGGING=1

# Where to log to - either /dev/stderr for console output, or an absolute
# file path (beware that this may grow large over time!)
LOGFILE=/dev/stderr
#LOGFILE=/tmp/onlinescreensaver.log

# whether to disable WiFi after the script has finished (if WiFi was off
# when the script started, it will always turn it off)
DISABLE_WIFI=1

# Domain to ping to test network connectivity. Default should work, but in
# case some firewall blocks access, try a popular local website.
TEST_DOMAIN="www.google.com"

# How long (in seconds) to wait for an internet connection to be established
# (if you experience frequent timeouts when waking up from sleep, try to
# increase this value)
NETWORK_TIMEOUT=30



#############################################################################
# Advanced
#############################################################################

# the real-time clock to use (0, 1 or 2)
RTC=0
#RTC2=0

# the temporary file to download the screensaver image to
TMPFILE=/tmp/tmp.onlinescreensaver.png


Vielleicht hat noch jemand die entscheidenden Tips...

Viele Grüße
Marco

meine FHEM-Konfiguration: Raspberry Pi4, BT-Dongle, CUL868, CeeBee II

andi11

vorausgesetzt du hast das Reading erfolgreich in kindleweb dann so:

attr FREPLACER_Kindle_Wohnzimmer Rep37Reading kindleweb:KindleBatt
attr FREPLACER_Kindle_Wohnzimmer Rep37Regex KindleBatt

Und da wo es im SVG angezeigt werden soll den Text KindleBatt einfügen.

marboj

#677
Durch manuelles Aufrufen des Webservers wurde das Reading einmal angelegt, allerdings aktualisiert es sich nicht.

Die Attribute anlegen und das SVG anpassen kommen als nächstes.
meine FHEM-Konfiguration: Raspberry Pi4, BT-Dongle, CUL868, CeeBee II

andi11

rufst du das erzeugte Bild auch über diesen HTTP Server ab? Deine Defintion im Kindle sieht für mich ehr so als als wäre es die Standart FHEMWEB Instanz?

marboj

Guten Morgen,

verstehe ich deine Rückfrage richtig, dass der Webserver auf das Verzeichnis zeigen muss, imdem das Status.svg liegt? Das stand nirgendwo.

Ich passe den Pfad mal an auf den Pfad, in dem das Bild liegt...
meine FHEM-Konfiguration: Raspberry Pi4, BT-Dongle, CUL868, CeeBee II

andi11

nicht ganz. Der Kindle öffnet ja nicht dass SVG sondenr das erzeugte Bild.
Der Kindle muss dieses Bild nicht über die Standart Instanz von FHEM öffnen, sondern über den erzeugten HTTPSRV

define HTTPSRV_Kindle_Wohnzimmer HTTPSRV kindle_wohnzimmer /opt/fhem/www/images/ Kindle Wohnzimmer

Link zum öffnen ist dann in meinem Fall
https://hcs:8083/fhem/kindle_wohnzimmer/status1.png

marboj

ok. Also wird das erzeugte Status-Bild quasi "durch" den neuen Webserver aufgerufen und beim Aufruf wird das Query mitgegeben.

Habe jetzt die URL in der config.sh entsprechend angepasst:

IMAGE_URI="http://000.000.000.000:8083/fhem/kindle/status.png"

und das Device auf den Ordner verlinkt, wo die PNG-Datei liegt.

defmod kindleweb HTTPSRV kindle /opt/fhem/www/images/ Kindle Web
attr kindleweb userattr readings
attr kindleweb readings KindleBatt


Trotzdem wird das Reading nicht erzeugt...
meine FHEM-Konfiguration: Raspberry Pi4, BT-Dongle, CUL868, CeeBee II

andi11

was steht denn im eventCount vom Server? Erhöht sich der Wert mit jeder Abfrage? Nicht dass der Kindle auf anderem Weg anfrägt

marboj

Tatsächlich steht nix im eventcounter. Wenn ich die URL manuell aufrufe :http:/000.000.0000.000:8083/fhem/kindle/status1.svg?KindleBatt=50, wird das Reading geschrieben und der Counter hochgezählt.

Muss die URL in der config.sh noch erweitert werden oder reichen die Parameter:

BATTDISP=0
# sleep extra for 30 seconds to give the kindle time to update his battery status
EXTRASLEEP=1
#
# add Batt level to URI as query string
DO_QUERYSTRING=1
QUERYSTRING=KindleBatt


meine FHEM-Konfiguration: Raspberry Pi4, BT-Dongle, CUL868, CeeBee II

andi11

Zitat von: marboj am 01 März 2023, 17:32:27
http:/000.000.0000.000:8083/fhem/kindle/status1.svg?KindleBatt=50
entfernst du hier deine lokale IP, weil du Sicherheitsbedenken hast, oder soll die tatsächlich der Kindle aufrufen? Es müsste ein png o.ä. sein, kein svg.

marboj

Hast Recht, muss ich nicht entfernen.   :)

Der Kindle ruft natürlich das png auf, aber mit dem geposteten Aufruf wird der Counter auch erhöht...
meine FHEM-Konfiguration: Raspberry Pi4, BT-Dongle, CUL868, CeeBee II

andi11

QUERYSTRING=KindleBatt
woher hast du diese Zeile in deiner config.sh?

Gerne auch Abschnitt im WIKI oder ähnliches verlinken, ist schon einige Jahre her dass ich das eingerichtet habe  :)

marboj

meine FHEM-Konfiguration: Raspberry Pi4, BT-Dongle, CUL868, CeeBee II

marboj

Habe noch das hier gefunden: https://forum.fhem.de/index.php/topic,32847.msg252321.html#msg252321

und meine URL erweitert : IMAGE_URI="http://192.168.0.110:8083/fhem/kindle/status.png?KindleBatt=$BATT"

Jetzt wird das Reading auch gefüllt, allerdings mit Datum und Uhrzeit.

meine FHEM-Konfiguration: Raspberry Pi4, BT-Dongle, CUL868, CeeBee II

andi11

poste mal bitte ein list von allen betroffenen Devices
oder klick jeweils unten auf den praktischen "Copy for forum.fhem.de"

Ich hab meine Config vom Kindle nicht gesichert, und weiß aus dem Stand ehrlich gesagt nichtmal mehr, wie ich drauf zugreifen kann. Läuft einfach stabil...