Ring Video Doorbell

Begonnen von blueberry63, 23 August 2017, 11:06:28

Vorheriges Thema - Nächstes Thema

GreenFHEMfan

Danke für deine Antwort pflock_y,

es ist zum k.... - es gibt soviel Varianten hier wie man es hinbekommen kann. Jeder hat sich seine eigene Variante gebaut.
Leider funktioniert deine Variante bei mir auch nicht. Warum gibt es nicht eine einheitliche Methode ?

Wenn man die Vorlagen
https://github.com/budachst/ring-fhem/blob/master/run_ring
oder
https://github.com/tchellomello/python-ring-doorbell/pull/108
geht es nicht - oder irgendeine Kleinigkeit fehlt!

Jeder hat sich seine eigene ring.py gebaut bzw. abgeändert - die run_ring bzw. run_ring.sh gibt es auch in unterschiedlichen Varianten ...

Sorry, ich weiß, dass es Arbeit macht einen genaue Ablaufbeschreibung zu bauen. Ich will eigentlich auch nicht beschweren.
Aus mir spricht nur reine Verzweiflung...

:-[
Rasp 3B+,4 / CUL /  Duofernstick / SIGNALduino (nanocul CC1101 optiboot) / mqtt

Otto123

Zitat von: mnennstiel am 28 Mai 2020, 11:02:19
... Ich habe vorher mit dem Befehl "echo "alias python=/usr/local/bin/python3.8" >> ~/.bashrc" und "source ~/.bashrc" Python 3.8 als Standard für den Befehl "python" definiert!
Hallo Maik,

für welchen User?

Also Deine Frage war crontab, die wurde beantwortet.
Wenn Deine run_ring nicht solo läuft, läuft sie auch nicht in crontab.

Also poste beides und ev. sieht jemand was. Nur schimpfen und sagen geht nicht - hilft niemanden.

Gruß Otto
Viele Grüße aus Leipzig  ⇉  nächster Stammtisch an der Lindennaundorfer Mühle
RaspberryPi B B+ B2 B3 B3+ ZeroW,HMLAN,HMUART,Homematic,Fritz!Box 7590,WRT3200ACS-OpenWrt,Sonos,VU+,Arduino nano,ESP8266,MQTT,Zigbee,deconz

GreenFHEMfan

Zitat von: Otto123 am 28 Mai 2020, 21:16:07
Hallo Maik,

für welchen User?

Also Deine Frage war crontab, die wurde beantwortet.
Wenn Deine run_ring nicht solo läuft, läuft sie auch nicht in crontab.

Also poste beides und ev. sieht jemand was. Nur schimpfen und sagen geht nicht - hilft niemanden.

Gruß Otto

Sorry kann ich dir nicht sagen für welchen User - bin da einer Beschreibung im Netz gefolgt.

Ich habe jetzt schon soviel Änderungen vorgenommen, das ich erstmal einige rückgängig machen musste, um auf irgendeine Variante aufzubauen. Und um dir auch eine klare Aussage zu machen Otto.

run_ring:

#!/bin/bash
#run_ring.sh
#make sure the process is always running.

process=/opt/fhem/bin//ring.py

if ps ax | grep -v grep | grep $process > /dev/null
then
    echo "Process $process is still running."
    exit
else
    nohup bash -c "python $process" >/dev/null &
    echo "Process $process started."
fi

exit


crontab -e unter /etc

# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#

@reboot fhem /opt/fhem/bin/run-ring
@hourly fhem /opt/fhem/bin/run-ring
#
Rasp 3B+,4 / CUL /  Duofernstick / SIGNALduino (nanocul CC1101 optiboot) / mqtt

Otto123

#333
der hier ist schon mal falsch: process=/opt/fhem/bin//ring.py

Und mit standard - python läuft doch das aktuelle Script nicht mehr?

Mit crontab -e kann man die (user) crontab bearbeiten
Mit crontab -l anzeigen

Gruß Otto
Viele Grüße aus Leipzig  ⇉  nächster Stammtisch an der Lindennaundorfer Mühle
RaspberryPi B B+ B2 B3 B3+ ZeroW,HMLAN,HMUART,Homematic,Fritz!Box 7590,WRT3200ACS-OpenWrt,Sonos,VU+,Arduino nano,ESP8266,MQTT,Zigbee,deconz

GreenFHEMfan

#334
OK sorry - habe ich jetzt beim Umschreiben falsch geschrieben. Wollte nämlich deine Variante unter /home/pi versuchen.

So - geändert - funktioniert aber nicht!




Wenn ich unter /opt/fhem/bin python ring.py eingebe bekommt der Dummy unter fhem Signale rein - die Log Datei wird auch beschrieben!

Um Python 3.8 zu installieren von ich folgender Anleitung gefolgt: https://installvirtual.com/how-to-install-python-3-8-on-raspberry-pi-raspbian/
Rasp 3B+,4 / CUL /  Duofernstick / SIGNALduino (nanocul CC1101 optiboot) / mqtt

Otto123

#335
Was funktioniert nicht? die run-ring ausführen? Was kommt als Ausgabe?
Was hat das fhem da zu suchen? ???

Zitat@hourly fhem /opt/fhem/bin/run-ring

ZitatWenn ich unter /opt/fhem/bin python ring.py eingebe
Und wieder die Frage: welcher user?
Viele Grüße aus Leipzig  ⇉  nächster Stammtisch an der Lindennaundorfer Mühle
RaspberryPi B B+ B2 B3 B3+ ZeroW,HMLAN,HMUART,Homematic,Fritz!Box 7590,WRT3200ACS-OpenWrt,Sonos,VU+,Arduino nano,ESP8266,MQTT,Zigbee,deconz

GreenFHEMfan

#336
folgendes kommt:




ok den user fhem habe ich jetzt aus der crontab entfernt - ändert aber nix an dem Resultat. Hatte ich vorher schon weggelassen o.E.




ich habe keinen bestimmten User eingetragen - ich denke es ist alles unter user:pi


pi@Raspberry-PI3B-plus:/opt/fhem/bin $ ls -la
insgesamt 68
drwxrwxrwx  2 fhem dialout  4096 Mai 28 21:40 .
drwxr-xr-x 18 fhem dialout  4096 Mai 28 11:25 ..
-rwxrwxrwx  1 fhem dialout 34299 Mai 28 22:04 ring.log
-rwxrwxrwx  1 fhem dialout 10187 Mai 28 12:08 ring.py
-rw-r--r--  1 pi   pi        966 Mai 28 21:11 ring_token.cache
-rwxrwxrwx  1 fhem dialout   311 Mai 28 21:40 run_ring
Rasp 3B+,4 / CUL /  Duofernstick / SIGNALduino (nanocul CC1101 optiboot) / mqtt

Otto123

Und was sagt
ps -aux|grep ring
und keine Bilder :( lässt sich die Ausgabe nicht als Text kopieren?
Viele Grüße aus Leipzig  ⇉  nächster Stammtisch an der Lindennaundorfer Mühle
RaspberryPi B B+ B2 B3 B3+ ZeroW,HMLAN,HMUART,Homematic,Fritz!Box 7590,WRT3200ACS-OpenWrt,Sonos,VU+,Arduino nano,ESP8266,MQTT,Zigbee,deconz

GreenFHEMfan

#338
pi@Raspberry-PI3B-plus:~ $ ps -aux|grep ring
pi        1577  0.0  0.0   4368   572 pts/1    S+   22:06   0:00 grep --color=auto ring

Was bedeutet das?
Rasp 3B+,4 / CUL /  Duofernstick / SIGNALduino (nanocul CC1101 optiboot) / mqtt

Otto123

ich meine der Prozess läuft nicht :(
Obwohl laut Bild da steht er hat ihn gestartet. Hat er ihn wieder beendet?

Was ist wenn Du in gleicher Situation das eingibst?
bash -c "python /opt/fhem/bin/ring.py"
Viele Grüße aus Leipzig  ⇉  nächster Stammtisch an der Lindennaundorfer Mühle
RaspberryPi B B+ B2 B3 B3+ ZeroW,HMLAN,HMUART,Homematic,Fritz!Box 7590,WRT3200ACS-OpenWrt,Sonos,VU+,Arduino nano,ESP8266,MQTT,Zigbee,deconz

GreenFHEMfan

Zitat von: Otto123 am 28 Mai 2020, 22:30:16
ich meine der Prozess läuft nicht :(
Obwohl laut Bild da steht er hat ihn gestartet. Hat er ihn wieder beendet?

Was ist wenn Du in gleicher Situation das eingibst?
bash -c "python /opt/fhem/bin/ring.py"

Nun kommt das:

pi@Raspberry-PI3B-plus:/opt/fhem/bin $ bash -c "python /opt/fhem/bin/ring.py"
Traceback (most recent call last):
  File "/opt/fhem/bin/ring.py", line 10, in <module>
    from pathlib import Path
ImportError: No module named pathlib
Rasp 3B+,4 / CUL /  Duofernstick / SIGNALduino (nanocul CC1101 optiboot) / mqtt

Otto123

Und jetzt sind wir wieder bei meiner Frage #331.
Du hast für irgendwen die ~/.bashrc" Python 3.8 als Standard definiert. Gilt genau für diesen User.

Würd ich nie machen, mach den Aufruf am Besten mit absoluten Pfaden zu Deiner python 3.8 Installation.
Viele Grüße aus Leipzig  ⇉  nächster Stammtisch an der Lindennaundorfer Mühle
RaspberryPi B B+ B2 B3 B3+ ZeroW,HMLAN,HMUART,Homematic,Fritz!Box 7590,WRT3200ACS-OpenWrt,Sonos,VU+,Arduino nano,ESP8266,MQTT,Zigbee,deconz

GreenFHEMfan

#342
OK - wie kann ich das wieder rückgängig machen? Ich war beim Standartfestsetzen als User PI !

habe jetzt mal deinen Befehl mit 3.8 gestartet und dann auch mal die Doorbell-Klingel gedrückt.


pi@Raspberry-PI3B-plus:/opt/fhem/bin $ bash -c "python3.8 /opt/fhem/bin/ring.py"
2020-05-28 22:40:11,882 - fhem_ring - INFO - Found 1 devices.
2020-05-28 22:40:11,887 - fhem_ring - INFO - Updating device data for device 'FrontDoor' in FHEM...
2020-05-28 22:40:11,890 - fhem_ring - INFO - Polling for events.
2020-05-28 22:40:12,493 - fhem_ring - INFO - Updating device data for device 'FrontDoor' in FHEM...
2020-05-28 22:40:12,630 - fhem_ring - INFO - No connection to ring API, continueing...
2020-05-28 22:40:12,631 - fhem_ring - INFO - Snapshot: False
2020-05-28 22:40:48,561 - fhem_ring - INFO - Updating device data for device 'FrontDoor' in FHEM...
2020-05-28 22:40:48,564 - fhem_ring - INFO - Alert detected at 'FrontDoor'.
2020-05-28 22:42:13,034 - fhem_ring - INFO - Updating device data for device 'FrontDoor' in FHEM...
2020-05-28 22:42:13,178 - fhem_ring - INFO - No connection to ring API, continueing...
2020-05-28 22:42:13,180 - fhem_ring - INFO - Snapshot: False
2020-05-28 22:44:13,655 - fhem_ring - INFO - Updating device data for device 'FrontDoor' in FHEM...
2020-05-28 22:44:13,792 - fhem_ring - INFO - No connection to ring API, continueing...
2020-05-28 22:44:13,793 - fhem_ring - INFO - Snapshot: False
2020-05-28 22:46:14,247 - fhem_ring - INFO - Updating device data for device 'FrontDoor' in FHEM...
2020-05-28 22:46:14,404 - fhem_ring - INFO - No connection to ring API, continueing...
2020-05-28 22:46:14,406 - fhem_ring - INFO - Snapshot: False
Rasp 3B+,4 / CUL /  Duofernstick / SIGNALduino (nanocul CC1101 optiboot) / mqtt

Otto123

Rückgängig? Ist doch egal, ist jetzt so für user pi. Stört doch erstmal nicht.
Jetzt (er)setzt Du diesen Befehl in deine run-ring ;)
Dann probierst Du die run-ring. Aber wirklich so
/opt/fhem/bin/run-ring

Wen die geht, machst Du crontab.
crontab -e dann macht er den editor auf und Du fügst die zwei Zeilen ein:
@reboot /opt/fhem/bin/run-ring
@hourly /opt/fhem/bin/run-ring



Wie gesagt ich halte die verquickung von user fhem (inklusive dem Ordner /opt/fhem/bin) für unnötig.
Viele Grüße aus Leipzig  ⇉  nächster Stammtisch an der Lindennaundorfer Mühle
RaspberryPi B B+ B2 B3 B3+ ZeroW,HMLAN,HMUART,Homematic,Fritz!Box 7590,WRT3200ACS-OpenWrt,Sonos,VU+,Arduino nano,ESP8266,MQTT,Zigbee,deconz

GreenFHEMfan

#344
Ouuuh  -  Otto ein fataler Schreibfehler

Zitat
/opt/fhem/bin/run-ring

müßte

/opt/fhem/bin/run_ring

heißen, und im crontab -e den ich unter /etc im Editor öffne muss auch

@reboot /opt/fhem/bin/run_ring
@hourly /opt/fhem/bin/run_ring

stehen!!!!

:o




Wenn ich /opt/fhem/bin/run_ring eingebe kommt:


pi@Raspberry-PI3B-plus:~ $ /opt/fhem/bin/run_ring
Process /opt/fhem/bin/ring.py started.
pi@Raspberry-PI3B-plus:~ $ nohup: leite Standardfehlerausgabe auf Standardausgabe um


Aber der crontab -e unter /etc scheint trotzdem nicht zu laufen!


# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --repo$
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --repo$
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --repo$
#

@reboot /opt/fhem/bin/run_ring
@hourly /opt/fhem/bin/run_ring
#






pi@Raspberry-PI3B-plus:~ $ crontab -l
no crontab for pi


kann aber mit 'cd /etc' und 'sudo nano crontab -e" den crontab oben bearbeiten


... ich gehe jetzt erstmal schlafen - Gute Nacht!
Rasp 3B+,4 / CUL /  Duofernstick / SIGNALduino (nanocul CC1101 optiboot) / mqtt