[alexa-fhem | Generell] Alles zu Installation und damit verbundenen Problemen

Begonnen von prodigy7, 09 November 2016, 19:42:01

Vorheriges Thema - Nächstes Thema

BoBo1234





sieht schon besser aus jetzt wird das angezeigt
pi@raspberrypi:~ $ sudo journalctl -u alexa
-- Logs begin at Fr 2017-09-08 21:12:45 CEST, end at Fr 2017-09-08 21:13:53 CEST
Sep 08 21:12:48 raspberrypi systemd[1]: Starting LSB: Start daemon at boot time
Sep 08 21:12:48 raspberrypi su[572]: Successful su for pi by root
Sep 08 21:12:48 raspberrypi su[572]: + ??? root:pi
Sep 08 21:12:48 raspberrypi su[572]: pam_unix(su:session): session opened for us
Sep 08 21:12:49 raspberrypi alexa[541]: SSH is enabled and the default password
Sep 08 21:12:49 raspberrypi alexa[541]: This is a security risk - please login a
Sep 08 21:12:49 raspberrypi alexa[541]: -su: Zeile 0: cd: /home/pi/alexa-fhem/bi
Sep 08 21:12:49 raspberrypi alexa[541]: Alexa starting
Sep 08 21:12:49 raspberrypi alexa[541]: -su: /home/pi/alexa-fhem/log/alexa-2017-
Sep 08 21:12:51 raspberrypi alexa[541]: Alexa is running PID 547
Sep 08 21:12:51 raspberrypi alexa[541]: Can't connect to localhost:7072
Sep 08 21:12:52 raspberrypi alexa[541]: Can't connect to localhost:7072
Sep 08 21:12:52 raspberrypi alexa[541]: Can't connect to localhost:7072
Sep 08 21:12:52 raspberrypi alexa[541]: script done
Sep 08 21:12:52 raspberrypi alexa[541]: script done
Sep 08 21:12:52 raspberrypi systemd[1]: Started LSB: Start daemon at boot time f

[1]+  Angehalten              sudo journalctl -u alexa
pi@raspberrypi:~ $ sudo /etc/init.d/alexa status
Alexa is not running
script done

MadMax-FHEM

#1771
Hast du einen Telnetport auf?

Ansonsten mal die Aufrufe mit Port 7072 im Skript auskommentieren, die sind später wichtig wenn aus fhem heraus (nach)gestartet werden soll...


Gruß, Joachim
FHEM PI3B+ Bullseye: HM-CFG-USB, 40x HM, ZWave-USB, 13x ZWave, EnOcean-PI, 15x EnOcean, HUE/deCONZ, CO2, ESP-Multisensor, Shelly, alexa-fhem, ...
FHEM PI2 Buster: HM-CFG-USB, 25x HM, ZWave-USB, 4x ZWave, EnOcean-PI, 3x EnOcean, Shelly, ha-bridge, ...
FHEM PI3 Buster (Test)

BoBo1234

define FHEM.Alexa.DOIF DOIF ([FHEM.Alexa] eq "start") (set FHEM.Alexa on, {system ("sudo /etc/init.d/alexa start > /dev/null 2>&1 &")})\
DOELSEIF ([FHEM.Alexa] eq "stop") (set FHEM.Alexa on, {system ("sudo /etc/init.d/alexa stop > /dev/null 2>&1 &")})\
DOELSEIF ([FHEM.Alexa] eq "restart") (set FHEM.Alexa on, {system ("sudo /etc/init.d/alexa restart > /dev/null 2>&1 &")})\
DOELSEIF ([FHEM.Alexa] eq "status") (set FHEM.Alexa on, {system ("sudo /etc/init.d/alexa status > /dev/null 2>&1 &")})


was mach ich hier mit habe das nicht ganz verstanden

MadMax-FHEM

Willst du nicht erst mal ein Problem nach dem anderen lösen?

Mit dem DOIF zusammen mit dem entsprechenden Dummy kanst du alexa-fhem von fhem aus (nach)starten und den Status sehen.

Allerdings erst möglich, wenn alexa-fhem von dem init.d Script aus gestartet/gestoppt werden kann...

Gruß, Joachim
FHEM PI3B+ Bullseye: HM-CFG-USB, 40x HM, ZWave-USB, 13x ZWave, EnOcean-PI, 15x EnOcean, HUE/deCONZ, CO2, ESP-Multisensor, Shelly, alexa-fhem, ...
FHEM PI2 Buster: HM-CFG-USB, 25x HM, ZWave-USB, 4x ZWave, EnOcean-PI, 3x EnOcean, Shelly, ha-bridge, ...
FHEM PI3 Buster (Test)

amenomade

Kann man dein jetziges Skript bitte sehen?

Ich kann z.B. sowas nicht verstehen:
ZitatSep 08 21:12:49 raspberrypi alexa[541]: -su: Zeile 0: cd: /home/pi/alexa-fhem/bi
wenn dein Skript korrekt wäre.

Also bitte nochmal: bitte dein Skript posten, so wie es jetzt ist.
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

BoBo1234

                        #!/bin/sh
### BEGIN INIT INFO
# Provides: alexa
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time for alexa
# Description: Enable service provided by daemon.
### END INIT INFO
export PATH=$PATH:/pi/local/bin
export NODE_PATH=$NODE_PATH:/home/pi/alexa-fhem/node_modules
PID=`pidof alexa`
export ALEXAPATH="/home/pi/alexa-fhem/bin/alexa"
export LOGPATH="/home/pi/alexa-fhem/log"
case "$1" in
start)
if ps -p $PID > /dev/null 2>&1; then
        echo "Alexa is already running"
        perl /opt/fhem/fhem.pl 7072 "setreading FHEM.Alexa.Status info Alexa is already running"
        perl /opt/fhem/fhem.pl  7072"set FHEM.Alexa.Status on"
        perl /opt/fhem/fhem.pl  7072"set FHEM.Alexa off"
else
        su - "pi" -c "cd $ALEXAPATH;./bin/alexa > $LOGPATH/alexa-`date +%Y-%m`.log 2>&1 &"
        echo "Alexa starting"
        sleep 2
   $0 status
fi
;;
stop)
if ! ps -p $PID > /dev/null 2>&1; then
        echo "Alexa is not running"
        perl /opt/fhem/fhem.pl  7072"setreading FHEM.Alexa.Status info Alexa is not running"
        perl /opt/fhem/fhem.pl  7072"set FHEM.Alexa.Status off"
        perl /opt/fhem/fhem.pl  7072"set FHEM.Alexa off"
else
        kill $PID
        echo "Alexa closed"
        perl /opt/fhem/fhem.pl  7072"setreading FHEM.Alexa.Status info Alexa closed"
        perl /opt/fhem/fhem.pl  "set FHEM.Alexa.Status off"
        perl /opt/fhem/fhem.pl  "set FHEM.Alexa off"
fi
;;
restart)
if ! ps -p $PID > /dev/null 2>&1; then
        $0 start
else
        $0 stop
        $0 start
fi
;;
status)
if ps -p $PID > /dev/null 2>&1; then
        echo "Alexa is running PID $PID"
        perl /opt/fhem/fhem.pl  7072"setreading FHEM.Alexa.Status info Alexa running as PID $PID"
        perl /opt/fhem/fhem.pl  7072"set FHEM.Alexa.Status on"
        perl /opt/fhem/fhem.pl  7072"set FHEM.Alexa off"
else
        echo "Alexa is not running"
        perl /opt/fhem/fhem.pl  7072"setreading FHEM.Alexa.Status info Alexa is not running"
        perl /opt/fhem/fhem.pl  7072"set FHEM.Alexa.Status off"
        perl /opt/fhem/fhem.pl  7072"set FHEM.Alexa off"
fi
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
echo "script done"
exit 0

BoBo1234

export PATH=$PATH:/pi/local/bin

ist das hier überhaupt richtig bzw was kommt da rein

amenomade

Zitatexport PATH=$PATH:/pi/local/bin
Das ist tatsächlich falsch. Wenn ich richtig verstanden habe, hast Du alexa-fhem - warum auch immer - in /home/pi/alexa-fhem installiert.
Daher export PATH=$PATH:/home/pi/alexa-fhem/bin
Allerdings brauchst m.A. diese Zeile gar nicht. Egal.

Das ist falsch - und übrigens was ich hieroben vermutet habe:
Zitatexport ALEXAPATH="/home/pi/alexa-fhem/bin/alexa"
Korrekt ist
export ALEXAPATH="/home/pi/alexa-fhem" da Du danach von dem Verzeichnis aus ein ./bin/alexa machst ! /home/pi/alexa-fhem/bin/alexa/bin/alexa existiert nicht!

Die Zeilen mit port 7072 kannst Du erstmal doch auskommentieren, wie es dir schon gesagt wurde:
#        perl /opt/fhem/fhem.pl 7072 "setreading FHEM.Alexa.Status info Alexa is already running"
#        perl /opt/fhem/fhem.pl  7072"set FHEM.Alexa.Status on"
#        perl /opt/fhem/fhem.pl  7072"set FHEM.Alexa off"
...
#        perl /opt/fhem/fhem.pl  7072"setreading FHEM.Alexa.Status info Alexa is not running"
#        perl /opt/fhem/fhem.pl  7072"set FHEM.Alexa.Status off"
#        perl /opt/fhem/fhem.pl  7072"set FHEM.Alexa off"


Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

BoBo1234

[18:40, 9.9.2017] +49 1523 4357611: root@raspberrypi:/home/pi# sudo /etc/init.d/alexa status
Alexa is not running
script done
root@raspberrypi:/home/pi# sudo journalctl -u alexa
-- Logs begin at Sa 2017-09-09 18:38:01 CEST, end at Sa 2017-09-09 18:38:45 CEST
Sep 09 18:38:04 raspberrypi systemd[1]: Starting LSB: Start daemon at boot time
Sep 09 18:38:04 raspberrypi su[592]: Successful su for pi by root
Sep 09 18:38:04 raspberrypi su[592]: + ??? root:pi
Sep 09 18:38:04 raspberrypi su[592]: pam_unix(su:session): session opened for us
Sep 09 18:38:05 raspberrypi alexa[564]: SSH is enabled and the default password
Sep 09 18:38:05 raspberrypi alexa[564]: This is a security risk - please login a
Sep 09 18:38:05 raspberrypi alexa[564]: -su: Zeile 0: cd: /home/pi/alexa-fhem/bi
Sep 09 18:38:05 raspberrypi alexa[564]: Alexa starting
Sep 09 18:38:05 raspberrypi alexa[564]: -su: /home/pi/alexa-fhem/log/alexa-2017-
Sep 09 18:38:07 raspberrypi alexa[564]: Alexa is running PID 571
Sep 09 18:38:07 raspberrypi alexa[564]: script done
Sep 09 18:38:07 raspberrypi alexa[564]: script done
Sep 09 18:38:07 raspberrypi systemd[1]: Started LSB: Start daemon at boot time f                       
[18:40, 9.9.2017] +49 1523 4357611: #!/bin/sh
### BEGIN INIT INFO
# Provides: alexa
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time for alexa
# Description: Enable service provided by daemon.
### END INIT INFO
export PATH=$PATH:/home/pi/alexa-fhem/bin
export NODE_PATH=$NODE_PATH:/home/pi/alexa-fhem/node_modules
PID=`pidof alexa`
export ALEXAPATH="/home/pi/alexa-fhem/bin/alexa"
export LOGPATH="/home/pi/alexa-fhem/log"
case "$1" in
start)
if ps -p $PID > /dev/null 2>&1; then
        echo "Alexa is already running"
        perl /opt/fhem/fhem.pl 7072 "setreading FHEM.Alexa.Status info Alexa is already running"
        perl /opt/fhem/fhem.pl  7072"set FHEM.Alexa.Status on"
        perl /opt/fhem/fhem.pl  7072"set FHEM.Alexa off"
else
        su - "pi" -c "cd $ALEXAPATH;./bin/alexa > $LOGPATH/alexa-`date +%Y-%m`.log 2>&1 &"
        echo "Alexa starting"
        sleep 2
   $0 status
fi
;;
stop)
if ! ps -p $PID > /dev/null 2>&1; then
        echo "Alexa is not running"
       # perl /opt/fhem/fhem.pl  7072"setreading FHEM.Alexa.Status info Alexa is not running"
       # perl /opt/fhem/fhem.pl  7072"set FHEM.Alexa.Status off"
        perl /opt/fhem/fhem.pl  7072"set FHEM.Alexa off"
else
        kill $PID
        echo "Alexa closed"
       # perl /opt/fhem/fhem.pl  7072"setreading FHEM.Alexa.Status info Alexa closed"
       # perl /opt/fhem/fhem.pl  "set FHEM.Alexa.Status off"
       # perl /opt/fhem/fhem.pl  "set FHEM.Alexa off"
fi
;;
restart)
if ! ps -p $PID > /dev/null 2>&1; then
        $0 start
else
        $0 stop
        $0 start
fi
;;
status)
if ps -p $PID > /dev/null 2>&1; then
        echo "Alexa is running PID $PID"
       # perl /opt/fhem/fhem.pl  7072"setreading FHEM.Alexa.Status info Alexa running as PID $PID"
       # perl /opt/fhem/fhem.pl  7072"set FHEM.Alexa.Status on"
       # perl /opt/fhem/fhem.pl  7072"set FHEM.Alexa off"
else
        echo "Alexa is not running"
       # perl /opt/fhem/fhem.pl  7072"setreading FHEM.Alexa.Status info Alexa is not running"
       # perl /opt/fhem/fhem.pl  7072"set FHEM.Alexa.Status off"
       # perl /opt/fhem/fhem.pl  7072"set FHEM.Alexa off"
fi
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
echo "script done"
exit 0

MadMax-FHEM

Warum nimmst du denn nicht (endlich) das verlinkte Skript und passt es an!?

Bzw. machst die Änderungen die vorgeschlagen werden!?


export ALEXAPATH="/home/pi/alexa-fhem"
export LOGPATH="/home/pi/alexa-fhem/log"


Und nicht vergessen, das Verzeichnis für das Log auch anzulegen!

Somit sollte ein:

sudo /etc/init.d/alexa start

alexa-fhem starten, sofern ein Ausführen per Console:

cd /home/pi/alexa-fhem
./bin/alexa

ausgeführt als User 'pi' tatsächlich funktioniert.

Evtl. noch wie (mehrfach) vorgeschlagen die Zeilen mit den perl-Aufrufen und Port 7072 auskommentieren...
...das kommt später...

Gruß, Joachim
FHEM PI3B+ Bullseye: HM-CFG-USB, 40x HM, ZWave-USB, 13x ZWave, EnOcean-PI, 15x EnOcean, HUE/deCONZ, CO2, ESP-Multisensor, Shelly, alexa-fhem, ...
FHEM PI2 Buster: HM-CFG-USB, 25x HM, ZWave-USB, 4x ZWave, EnOcean-PI, 3x EnOcean, Shelly, ha-bridge, ...
FHEM PI3 Buster (Test)

amenomade

ZitatBzw. machst die Änderungen die vorgeschlagen werden!?
Das frage ich mich auch! Wenn man solche Antwort wie "und was soll der link bringen ;/" kriegt, und der User nicht macht, was empfohlen wird, geht die Hillfsbereitschaft stark runter. Ich kann schon hartnäckig bei Problembehebung sein, aber sorry, nicht so...
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

MadMax-FHEM

Zitat von: amenomade am 09 September 2017, 20:21:50
Das frage ich mich auch! Wenn man solche Antwort wie "und was soll der link bringen ;/" kriegt, und der User nicht macht, was empfohlen wird, geht die Hillfsbereitschaft stark runter. Ich kann schon hartnäckig bei Problembehebung sein, aber sorry, nicht so...

Und das von dir ;)

Aber langsam ist's schon anstrengend...
...gegen eine Wand laufen tut weniger weh...

Gruß, Joachim
FHEM PI3B+ Bullseye: HM-CFG-USB, 40x HM, ZWave-USB, 13x ZWave, EnOcean-PI, 15x EnOcean, HUE/deCONZ, CO2, ESP-Multisensor, Shelly, alexa-fhem, ...
FHEM PI2 Buster: HM-CFG-USB, 25x HM, ZWave-USB, 4x ZWave, EnOcean-PI, 3x EnOcean, Shelly, ha-bridge, ...
FHEM PI3 Buster (Test)

BoBo1234

ja tut mir leid das ich so unfähig bin ich stehe wie ochs vorm berg und versuche das alles um zu setzen doch mir ist nicht immer klar was ich mit manchen antworten anfangen soll das auskommentiern ist doch hier mit # oder wie geht das ich weiß nicht was das heißt für die installation von alexa fhem habe ich 2 wochen gebraucht als komplett neu einsteiger


pi@raspberrypi:~ $ sudo su
root@raspberrypi:/home/pi# sudo /etc/init.d/alexa status
Alexa is not running
script done
root@raspberrypi:/home/pi# sudo journalctl -u alexa
-- Logs begin at Sa 2017-09-09 21:48:56 CEST, end at Sa 2017-09-09 21:50:19 CEST
Sep 09 21:48:59 raspberrypi systemd[1]: Starting LSB: Start daemon at boot time
Sep 09 21:48:59 raspberrypi su[587]: Successful su for pi by root
Sep 09 21:48:59 raspberrypi su[587]: + ??? root:pi
Sep 09 21:48:59 raspberrypi su[587]: pam_unix(su:session): session opened for us
Sep 09 21:49:00 raspberrypi alexa[560]: SSH is enabled and the default password
Sep 09 21:49:00 raspberrypi alexa[560]: This is a security risk - please login a
Sep 09 21:49:00 raspberrypi alexa[560]: Alexa starting
Sep 09 21:49:00 raspberrypi alexa[560]: -su: /home/pi/alexa-fhem/log/alexa-2017-
Sep 09 21:49:02 raspberrypi alexa[560]: Alexa is running PID 570
Sep 09 21:49:02 raspberrypi alexa[560]: script done
Sep 09 21:49:02 raspberrypi systemd[1]: Started LSB: Start daemon at boot time f
Sep 09 21:49:02 raspberrypi alexa[560]: script done

[1]+  Angehalten              sudo journalctl -u alexa
root@raspberrypi:/home/pi# sudo nano /etc/init.d/alexa
Benutzen Sie ,,fg", um zu nano zurückzukehren.

[2]+  Angehalten              sudo nano /etc/init.d/alexa
root@raspberrypi:/home/pi# sudo /etc/init.d/alexa start

SSH is enabled and the default password for the 'pi' user has not been changed.
This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.

-su: /home/pi/alexa-fhem/log/alexa-2017-09.log: Keine Berechtigung
Alexa starting
Alexa is not running
script done
script done
root@raspberrypi:/home/pi#  sudo nano /etc/init.d/alexa
Benutzen Sie ,,fg", um zu nano zurückzukehren.

[3]+  Angehalten              sudo nano /etc/init.d/alexa
root@raspberrypi:/home/pi#

BoBo1234

und ich habe das verlinkte skript genommen
und der link den ihr mir als erstes verlinkt habt der führtr hier her  tut mir leid fals ich zu doof dazu bin
ich verschwende ja eh nur eure zeit :'(

BoBo1234

und so sieht das skript aus was ich runterladen sollte


#!/bin/sh
### BEGIN INIT INFO
# Provides: alexa
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time for alexa
# Description: Enable service provided by daemon.
### END INIT INFO
export PATH=$PATH:/usr/local/bin
export NODE_PATH=$NODE_PATH:/usr/local/lib/node_modules
PID=`pidof alexa`
export ALEXAPATH="/opt/fhem/alexa-fhem"
export LOGPATH="/opt/fhem/log"
case "$1" in
start)
if ps -p $PID > /dev/null 2>&1; then
        echo "Alexa is already running"
        perl /opt/fhem/fhem.pl 7072 "setreading FHEM.Alexa.Status info Alexa is already running"
        perl /opt/fhem/fhem.pl 7072 "set FHEM.Alexa.Status on"
        perl /opt/fhem/fhem.pl 7072 "set FHEM.Alexa off"
else
        su - "pi" -c "cd $ALEXAPATH;./bin/alexa > $LOGPATH/alexa-`date +%Y-%m`.log 2>&1 &"
        echo "Alexa starting"
        sleep 2
   $0 status
fi
;;
stop)
if ! ps -p $PID > /dev/null 2>&1; then
        echo "Alexa is not running"
        perl /opt/fhem/fhem.pl 7072 "setreading FHEM.Alexa.Status info Alexa is not running"
        perl /opt/fhem/fhem.pl 7072 "set FHEM.Alexa.Status off"
        perl /opt/fhem/fhem.pl 7072 "set FHEM.Alexa off"
else
        kill $PID
        echo "Alexa closed"
        perl /opt/fhem/fhem.pl 7072 "setreading FHEM.Alexa.Status info Alexa closed"
        perl /opt/fhem/fhem.pl 7072 "set FHEM.Alexa.Status off"
        perl /opt/fhem/fhem.pl 7072 "set FHEM.Alexa off"
fi
;;
restart)
if ! ps -p $PID > /dev/null 2>&1; then
        $0 start
else
        $0 stop
        $0 start
fi
;;
status)
if ps -p $PID > /dev/null 2>&1; then
        echo "Alexa is running PID $PID"
        perl /opt/fhem/fhem.pl 7072 "setreading FHEM.Alexa.Status info Alexa running as PID $PID"
        perl /opt/fhem/fhem.pl 7072 "set FHEM.Alexa.Status on"
        perl /opt/fhem/fhem.pl 7072 "set FHEM.Alexa off"
else
        echo "Alexa is not running"
        perl /opt/fhem/fhem.pl 7072 "setreading FHEM.Alexa.Status info Alexa is not running"
        perl /opt/fhem/fhem.pl 7072 "set FHEM.Alexa.Status off"
        perl /opt/fhem/fhem.pl 7072 "set FHEM.Alexa off"
fi
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
echo "script done"
exit 0